Posix ETH driver

File: csp/drivers/eth_linux.h

Description: Posix ETH driver

Note

Using this driver require user elevation. Guideline for doing this is given at run-time

Interface Functions

int csp_eth_init(const char *device, const char *ifname, int mtu, unsigned int node_id, _Bool promisc, csp_iface_t **return_iface)
[source]

Open RAW socket and add CSP interface.

Parameters:
  • device – network interface name (Linux device).

  • ifname – ifname CSP interface name.

  • mtu – MTU for the transmitted ethernet frames.

  • node_id – CSP address of the interface.

  • promisc – if true, receive all CAN frames. If false a filter is set before forwarding packets to the router

  • return_iface – the added interface.

Returns:

#CSP_ERR_NONE on success, otherwise an error code.

int csp_eth_tx_frame(csp_iface_t *iface, csp_eth_header_t *eth_frame)
[source]

Transmit an CSP ethernet frame

Parameters:
  • iface – Ethernet interface to use.

  • eth_frame – The CSP ethernet frame to transmit.

Returns:

#CSP_ERR_NONE on success, otherwise an error code.

void *csp_eth_rx_loop(void *param)
[source]

Posix ethernet RX thread

Parameters:
  • param – Ethernet CSP interface to use.

Returns:

NULL