Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
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
summary
classCode_Listing
Table Row (tr)
Table Cell (td)
rowspan2

Anchor
1109835
1109835
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);

Table Row (tr)

Anchor
1109840
1109840
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’.

Anchor
1109841
1109841
Arguments

Anchor
1131864
1131864
pif p_if

Anchor
1131865
1131865
Pointer to the interface to start a network device.

...

Anchor
1131904
1131904
Size of the data to transmit.

Anchor
1131891
1131891
perr p_err

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

...

Anchor
1110530
1110530
The transmit function should perform the following actions:

  1. 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. Anchor10912751091275 Non-DMA hardware should Mem_Copy() the data stored within the buffer pointed to by p_data to the device’s internal memory. Anchor10912821091282 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:

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

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

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

  1. Anchor
    1134753
    1134753
    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. Anchor
    1111286
    1111286
    The driver should then take all necessary steps to initiate transmission of the data.
  3. Anchor
    1111730
    1111730
    Set perr to NET_DEV_ERR_NONE and return from the transmit function.