Include Page |
---|
| css.uC-TCP-IP Wireless Device Driver APIs.css |
---|
| css.uC-TCP-IP Wireless Device Driver APIs.css |
---|
|
Include Page |
---|
| css.webworks.css |
---|
| css.webworks.css |
---|
|
...
HTML Table |
---|
|
Table Row (tr) |
---|
Table Cell (td) |
---|
| static void NetDev_Tx (NET_IF *pifp_if, Anchor |
---|
| 113588011514221135880 |
---|
| 1151422 |
---|
| CPU_INT08U *p_data, Anchor |
---|
| 113588111514231135881 |
---|
| 1151423 |
---|
| CPU_INT16U size, Anchor |
---|
| 113588211514241135882 |
---|
| 1151424 |
---|
| NET_ERR *perrp_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
pif p_if Pointer to the interface to start a network device.
...
Size of the data to transmit.
perr p_err Pointer to variable that will receive the return error code from this function.
...
The transmit function should perform the following actions:
Anchor |
---|
| 109126811347581091268 |
---|
| 1134758 |
---|
|
For DMA-based hardware, the driver should select the next available transmit descriptor and set the pointer to the data area equal to the address pointer to by p_data. Anchor |
---|
1091275 | 1091275 | Non-DMA hardware should Mem_Copy() the data stored within the buffer pointed to by p_data to the device’s internal memory. Anchor |
---|
1091282 | 1091282 | Once completed, the driver must configure the device with the number of bytes to transmit. This is passed directly by value within the size argument. DMA-based devices generally have a size field within the transmit descriptor. Non-DMA devices generally have a transmit size register that needs to be configuredSPI 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().- 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.
- The driver should then take all necessary steps to initiate transmission of the data.
- Set perr to NET_DEV_ERR_NONE and return from the transmit function.