MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / tivaif_process_transmit

Function tivaif_process_transmit

bsp/tm4c129x/drivers/drv_eth.c:739–786  ·  view source on GitHub ↗

* This function will process all transmit descriptors and free pbufs attached * to any that have been transmitted since we last checked. * * This function is called only from the Ethernet interrupt handler. * * @param netif the lwip network interface structure for this ethernetif * @return None. */

Source from the content-addressed store, hash-verified

737 * @return None.
738 */
739static void
740tivaif_process_transmit(tStellarisIF *pIF)
741{
742 tDescriptorList *pDescList;
743 uint32_t ui32NumDescs;
744
745 /* Get a pointer to the transmit descriptor list. */
746 pDescList = pIF->pTxDescList;
747
748 /* Walk the list until we have checked all descriptors or we reach the
749 * write pointer or find a descriptor that the hardware is still working
750 * on.
751 */
752 for(ui32NumDescs = 0; ui32NumDescs < pDescList->ui32NumDescs; ui32NumDescs++)
753 {
754 /* Has the buffer attached to this descriptor been transmitted? */
755 if(pDescList->pDescriptors[pDescList->ui32Read].Desc.ui32CtrlStatus &
756 DES0_TX_CTRL_OWN)
757 {
758 /* No - we're finished. */
759 break;
760 }
761
762 /* Does this descriptor have a buffer attached to it? */
763 if(pDescList->pDescriptors[pDescList->ui32Read].pBuf)
764 {
765 /* Yes - free it if it's not marked as an intermediate pbuf */
766 if(!((uint32_t)(pDescList->pDescriptors[pDescList->ui32Read].pBuf) & 1))
767 {
768 pbuf_free(pDescList->pDescriptors[pDescList->ui32Read].pBuf);
769 DRIVER_STATS_INC(TXBufFreedCount);
770 }
771 pDescList->pDescriptors[pDescList->ui32Read].pBuf = NULL;
772 }
773 else
774 {
775 /* If the descriptor has no buffer, we are finished. */
776 break;
777 }
778
779 /* Move on to the next descriptor. */
780 pDescList->ui32Read++;
781 if(pDescList->ui32Read == pDescList->ui32NumDescs)
782 {
783 pDescList->ui32Read = 0;
784 }
785 }
786}
787
788/**
789 * This function will process all receive descriptors that contain newly read

Callers 1

tivaif_interruptFunction · 0.85

Calls 1

pbuf_freeFunction · 0.50

Tested by

no test coverage detected