...
Anchor
Tx()
function.Files
...
Every device driver’s net_dev.c
Anchor
Prototype
...
HTML Table | summary | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
class | Code_Listing | |||||||||
Table Row (tr) | ||||||||||
Table Cell (td) | ||||||||||
| ||||||||||
Anchor | 1109835 | 1109835 | static void NetDev_Tx||||||||
Code Block | ||||||||||
static void NetDev_Tx (NET_IF*pif, Anchor | | 1135880 | 1135880 | CPU_INT08U *p_data,|||||||
Anchor | 1135881 | 1135881 | CPU_INT16U size,||||||||
Anchor | 1135882 | 1135882 | NET_ERR *perr);||||||||
Table Row (tr) |
...
*pif,
CPU_INT08U *p_data,
CPU_INT16U size,
NET_ERR *perr); |
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
static
’.Arguments
pif
Pointer to the interface to start a network device.
...
p_data
anchorPointer to address of the data to transmit.
Anchor
size
Size of the data to transmit.
...
perr
Pointer to variable that will receive the return error code from this function.
...
Returned Value
...
None. 1110516 Anchor
Required Configuration
Anchor
Notes / Warnings
...
The transmit function should perform the following actions:
...
- 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 byp_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 configured.
Anchor 1111286 1111286 - The driver should then take all necessary steps to initiate transmission of the data.
Anchor 1111730 1111730 - Set
perr
toNET_DEV_ERR_NONE
and return from the transmit function.