Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Unable to render {include} The included page could not be found.
Unable to render {include} The included page could not be found.

NetDev_Tx()

The next function in the device API structure is the transmit/Tx() function.

Files

Every device driver’s net_dev.c

Prototype

 

static void NetDev_Tx (NET_IF *p_if,

CPU_INT08U *p_data,

CPU_INT16U size,

NET_ERR *p_err);

Note that since every device driver’s Tx() function is accessed only by function pointer via the device driver’s API structure, it doesn’t need to be globally available and should therefore be declared as ‘static’.

Arguments

p_if

Pointer to the interface to start a network device.

p_data

Pointer to address of the data to transmit.

size

Size of the data to transmit.

p_err

Pointer to variable that will receive the return error code from this function.

Returned Value

None.

Required Configuration

None.

Notes / Warnings

The transmit function should perform the following actions:

  1. For SPI wireless device, get the access to the SPI bus by performing the following operation:

a. Acquire the SPI lock by calling p_dev_bsp->SPI_Lock().

b. Enable the chip select by calling p_dev_bsp->SPI_ChipSelEn().

c. Configure the SPI controller for the wireless device by calling p_dev_bsp->SPI_SetCfg().

  1. Write data to the device by calling p_dev_bsp->SPI_WrRd() and by using the network buffer passed as argument and by using a global buffer to read data.
  2. The driver should then take all necessary steps to initiate transmission of the data.
  3. Set perr to NET_DEV_ERR_NONE and return from the transmit function.
  • No labels