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

...

Every device driver’s net_dev.c Anchor11098391109839

Prototype

...

static void NetDev_Tx CPU_INT08U *p_data, CPU_INT16U size, NET_ERR *perr);
HTML Table
summary
classCode_Listing
Table Row (tr)
Table Cell (td)
rowspan2
Anchor
11098351109835
Code Block
          static void NetDev_Tx (NET_IF
*pif,
Anchor
11358801135880
Anchor
11358811135881
Anchor
11358821135882
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’. Anchor11098411109841 Arguments Anchor11318641131864 pif Anchor11318651131865static’.

Arguments

pif

Pointer to the interface to start a network device.

...

1110486p_dataanchor11319021131902

Pointer to address of the data to transmit.

Anchor11104871110487size Anchor11319041131904

Size of the data to transmit.

...

1131891perr Anchor11318921131892

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

...

Returned Value

...

None. Anchor11105161110516

Required Configuration

Anchor11105171110517None. Anchor11105181110518

Notes / Warnings

...

The transmit function should perform the following actions:

...

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