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_Rx (NET_IF *pifp_if, Anchor |
---|
| 113587711514191135877 |
---|
| 1151419 |
---|
| CPU_INT08U **p_data, Anchor |
---|
| 113587811514201135878 |
---|
| 1151420 |
---|
| CPU_INT16U *p_size, Anchor |
---|
| 113587911514211135879 |
---|
| 1151421 |
---|
| NET_ERR *perrp_err); |
|
|
Note that since every device driver’s Rx() 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 Anchor |
---|
| 114927111516741149271 |
---|
| 1151674 |
---|
|
Pointer to the interface to receive data from a network device.
p_data
Anchor |
---|
| 114927411516821149274 |
---|
| 1151682 |
---|
|
Pointer to return the address of the received data.
p_size
Anchor |
---|
| 114927711516901149277 |
---|
| 1151690 |
---|
|
Pointer to return the size of the received data.
perr p_err Anchor |
---|
| 114928011516981149280 |
---|
| 1151698 |
---|
|
Pointer to variable that will receive the return error code from this function.
...
Notes / Warnings
Anchor |
---|
| 109116311345611091163 |
---|
| 1134561 |
---|
|
The receive function should perform the following actions:
- 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(). Anchor |
---|
| 109117011345581091170 |
---|
| 1134558 |
---|
|
Check for receive errors if applicable. If an error should occur during reception, the driver should set *size to 0 and *p_data to (CPU_INT08U *)0 and return. Additional steps may be necessary depending on the device being serviced.- For Ethernet wireless devices, get the size of the received frame and subtract 4 bytes for the CRC. It it is always recommended that the frame size is checked to ensure that it is greater than 4 bytes before performing the subtraction to ensure that an underflow does not occur. Set *size equal to the adjusted frame size.
Anchor |
---|
| 109118411337781091184 |
---|
| 1133778 |
---|
|
Get a new data buffer area by calling NetBuf_GetDataPtr(). If memory is not available, an error will be returned and the device driver should set *size to 0 and *p_data to (CPU_INT08U *)0. For DMA devices, the current receive descriptor should be marked as available or owned by hardware. The device driver should then return from the receive function. Anchor |
---|
| 109119111338931091191 |
---|
| 1133893 |
---|
|
If an error does not occur while getting a new data area, DMA devices the function should perform the following operations:
Anchor |
---|
| 109119811338941091198 |
---|
| 1133894 |
---|
|
a. Set
*p_data equal to the address of the data area within the descriptor being servicedthe frame type of the data received (NET_IF_WIFI_MGMT_FRAME or NET_IF_WIFI_DATA_PKT) at the beginning of the network buffer.
Anchor |
---|
| 109120511338001091205 |
---|
| 1133800 |
---|
|
b.
Set the The data
area pointer stored within the
receive descriptor device should be transferred to the address of the data
area obtained by calling NetBuf_GetDataPtr(). Anchor |
---|
1091212 | 1091212 | c. Update any descriptor ring pointers if applicable....
section (after the frame type) of the network buffer by calling p_dev_bsp->SPI_WrRd() and by using a global buffer to write data and set *p_data equal to the address of the obtained data area.
- Sidable the device chip select by calling p_dev_bsp->SPI_ChipSelDis() and unlock the SPI bus access by calling p_dev_bsp->SPI_Unlock().
Anchor |
---|
| 109122611345801091226 |
---|
| 1134580 |
---|
|
Set perr p_err to NET_DEV_ERR_NONE and return from the receive function. Otherwise, set perr p_err to an appropriate network device error code.