This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Can anybody explain the meaning of Free Head, Active Head, Active Tail for RX Buffer Descriptor and FreeHead, Active Tail, NextBDToProcess?

Other Parts Discussed in Thread: TMS570LC4357, HALCOGEN

Hello all,

I am using TMS570LC4357. I tried to implement ethernet communication. For that I'm using HalCoGen Example code.


I tried to analyse the code using the debugger.

Of course I understands how ethernet works. Even I have some questions.

In CCPI RAM of EMAC Module, Tx BD which represents 256 transmit packets and Rx BD which represents 10 receive packets are declared.

And they are accessed via hdif_data[0] structure pointer.


So What are the meaning of the members of txch_t , rxch_t structures?

i.e:

typedef struct

{

emac_tx_bd  *freehead, *activetail, *nextBdToprocess;

 }txch_t;

typedef struct

{

emac_rx_bd  *freehead, *activehead, *activetail;

 }rxh_t;

Please anybody explain, in what meaning they use these member.

For example:

1. txch_t->activehead:  It is the Packet, where the current Trasmission Queue begins, So in this Packet only SOP, PktLen, BufLen are having validity.

2. txch_t->activetail: It is the Packet, which is the last Packet of the current transmission Queue. here, txch_t->activetail->Next (= 0) field has NULL value. If further Packet Queue needs to be added, then that Queue ActiveHead address should be written in txch_t->activetail->Next field, if suppose txch_t->activetail->EOQ is not setted by EMAC module.

Like this way please anybody explain. (Sorry I may suppose be wrong, Because I just understand in this way while analysing the code using debugger.)

If suppose I am wrong, Please correct me.

Thanks in advance.

Regards,

Karthikeyan .K

  • Hello karthikeyan,

    One of our EMAC experts will help you with this.
  • Hi Karthikeyan,

    These structures are defined for easy traversal of Tx and Rx Buffer descriptors. You're right in your assumptions of what they're used for. The comments in the emac.h file make this clear:

    /**
     * Helper struct to hold the data used to operate on a particular
     * receive channel
     */
    typedef struct rxch_struct {
      volatile emac_rx_bd_t *free_head; /*Used to point to the free buffer descriptor which can receive new data.*/
      volatile emac_rx_bd_t *active_head; /*Used to point to the active descriptor in the chain which is receiving.*/
      volatile emac_rx_bd_t *active_tail; /*Used to point to the last descriptor in the chain.*/
    }rxch_t;

    /**
     * Helper struct to hold the data used to operate on a particular
     * transmit channel
     */
    typedef struct txch_struct {
      volatile emac_tx_bd_t *free_head; /*Used to point to the free buffer descriptor which can transmit new data.*/
      volatile emac_tx_bd_t *active_tail; /*Used to point to the last descriptor in the chain.*/
      volatile emac_tx_bd_t *next_bd_to_process; /*Used to point to the next descriptor in the chain to be processed.*/
    }txch_t;

    So these structs don't have any special purpose apart from what is mentioned above. Let me know if you have any more queries.

    Thanks and Regards,

    Chaitanya

  • Hello Karthikeyan,

    If the above answers your query, can you pls verify and close this thread ?