CSP Interface

File: csp/csp_interface.h

Description: CSP Interface


typedef int (*nexthop_t)(csp_iface_t*, uint16_t, csp_packet_t*, int)

Interface Tx function.


struct csp_iface_s

This struct is referenced in documentation. Update doc when you change this.

uint16_t addr

Host address on this subnet

uint32_t autherr

Authentication errors (packets)

void *driver_data

Driver data, only known/used by the driver layer, e.g. device/channel references.

uint32_t drop

Dropped packets

uint32_t frame

Frame format errors (packets)

void *interface_data

Interface data, only known/used by the interface layer, e.g. state information.

uint32_t irq


uint8_t is_default

Set default IF flag (CSP supports multiple defaults)

const char *name

Name, max compare length is #CSP_IFLIST_NAME_MAX

uint16_t netmask

Subnet mask

struct csp_iface_s *next
nexthop_t nexthop

Next hop (Tx) function

uint32_t rx

Successfully received packets

uint32_t rx_error

Receive errors, e.g. too large message

uint32_t rxbytes

Received bytes

uint32_t tx

Successfully transmitted packets

uint32_t tx_error

Transmit errors (packets)

uint32_t txbytes

Transmitted bytes

Interface Functions

void csp_qfifo_write(csp_packet_t *packet, csp_iface_t *iface, void *pxTaskWoken)

Inputs a new packet into the system.

This function can be called from interface drivers (ISR) or tasks, to route and accept packets.


EXTREMELY IMPORTANT: pxTaskWoken must ALWAYS be NULL if called from task, and ALWAYS be NON NULL if called from ISR. If this condition is met, this call is completely thread-safe

This function is fire and forget, it returns void, meaning that the packet will always be either accepted or dropped, so the memory will always be freed.

  • packet – A pointer to the incoming packet

  • iface – A pointer to the incoming interface TX function.

  • pxTaskWoken – Valid reference if called from ISR, otherwise NULL!