Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor10919181091918 NetDev_Tx() Anchor10912401091240The next function in the device API structure is the transmit/Tx() function.anchor11098311109831

Files

Anchor11098321109832Every device driver’s net_dev.c Anchor11098391109839

Prototype

...

static void NetDev_Tx CPU_INT08U *p_data, CPU_INT16U size, NET_ERR *p_err);
HTML Table
summary
classCode_Listing
Table Row (tr)
Table Cell (td)
rowspan2
Anchor
11098351109835
Code Block
          static void NetDev_Tx (NET_IF
*p_if,
Anchor
11514221151422
Anchor
11514231151423
Anchor
11514241151424
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’static. Anchor11098411109841

Arguments

Anchor11318641131864 p_if Anchor11318651131865pif

Pointer to the interface to start a network device.

Anchor11104861110486p_dataanchor11319021131902

Pointer to address of the data to transmit.

Anchor11104871110487size Anchor11319041131904

Size of the data to transmit.

Anchor11318911131891 p_err Anchor11318921131892perr

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

...

Returned Value

Anchor11070581107058None. Anchor11105161110516

Required Configuration

...

None. Anchor11105181110518

Notes / Warnings

Anchor11105301110530The transmit function should perform the following actions:

...

  1. Anchor11347531134753 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. Anchor11112861111286For 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.
  2. Non-DMA hardware should Mem_Copy() the data stored within the buffer pointed to by p_data to the device’s internal memory.
  3. 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.
  4. The driver should then take all necessary steps to initiate transmission of the data. Anchor11117301111730
  5. Set perr to NET_DEV_ERR_NONE and return from the transmit function.