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.

AM3359 CPDMA TX Function

Hello all,

I am using beaglebone board to make a project to send fragment packet without LWIP. I made a program that just want to send only one fragment packet one time when it is called.

But I met with two problem in this program.

1. It can only send when in debug mode when I carryout the command one by one.But when CPDMA finished sending,It not set the EOQ. And If I run it in auto mode,no packet is sent.

2.When the CPDMA sent the single fragment packet,It only clear the ownership in this buffer discripter.But not set the EOQ. And when the function is called again.I can not send again.

Could any one help me out or is there any guide more detail of sending and receiving ?

Thanks!

 

MY sending program is like this:

//Send Single package to Network

int AM335x_EMAC_send (void *packet, int length)

 {

  volatile struct cpdma_tx_bd *bd_to_send;

  struct txch *txch;

  volatile uint32 cnt = 0xFFFF;

 

 cpswinst *pCpswinst = &cpsw_inst_data[0];

 

 txch = &(pCpswinst->txch);

 bd_to_send = txch->free_head;

 bd_to_send->flags_pktlen = length;

 

 /* Indicate the start of the packet */  

bd_to_send->flags_pktlen |= (CPDMA_BUF_DESC_SOP | CPDMA_BUF_DESC_OWNER | CPDMA_BUF_DESC_EOP);

 

 /* Intialize the buffer pointer and length */

 bd_to_send->bufptr = (unsigned int)packet;

  bd_to_send->bufoff_len = (length) & CPDMA_BD_LEN_MASK;

 CPSWCPDMATxHdrDescPtrWrite(pCpswinst->cpdma_base,  (unsigned int)(bd_to_send), 0);

 /* Make sure that the transmission is over */

  while(((bd_to_send->flags_pktlen & CPDMA_BUF_DESC_OWNER)  == CPDMA_BUF_DESC_OWNER) && ((--cnt) != 0));

 

     /* If CPDMA failed to transmit, give it a chance once more */

     if(0 == cnt) {

        CPSWCPDMATxHdrDescPtrWrite(pCpswinst->cpdma_base,  (uint32)(bd_to_send), 0);

        return;

      }

     bd_to_send->flags_pktlen &= ~(CPDMA_BUF_DESC_SOP);

      bd_to_send->flags_pktlen &= ~(CPDMA_BUF_DESC_EOP);

 

 

      CPSWCPDMATxCPWrite(pCpswinst->cpdma_base, 0, (uint32)bd_to_send);

 

     CPSWCPDMAEndOfIntVectorWrite(pCpswinst->cpdma_base, CPSW_EOI_TX_PULSE);

   return ERR_OK;

 }