gpif callback and zlp

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hello,

   

is it possible to send a zero length packet from a gpif callback?

   

i use a slavefifosync like design.

   

I configured the the P to U Channel to CY_U3P_DMA_TYPE_MANUAL

   

I do not use a U to P Channel.

   

I tried it like this:

   

 

   

void CyFxGpifCB (CyU3PGpifEventType event,uint8_t currentState)
{
   if (event == CYU3P_GPIF_EVT_SM_INTERRUPT)
   {
       if (currentState == ZLP)
          {
            CyU3PReturnStatus_t status = CY_U3P_SUCCESS;
            status = CyU3PDmaChannelCommitBuffer (&glChHandleSlFifoPtoU, 0, 0);    // send ZLP
            if (status != CY_U3P_SUCCESS)
              CyU3PDebugPrint (4, "CyU3PDmaChannelCommitBuffer GPIF CB failed, Error code = %x\n", status);
         }
    }
}

void CyFxSlFifoPtoUDmaCallback (CyU3PDmaChannel *chHandle,CyU3PDmaCbType_t  type,
                                CyU3PDmaCBInput_t *input)
{
    CyU3PReturnStatus_t status = CY_U3P_SUCCESS;
    if (type == CY_U3P_DMA_CB_PROD_EVENT)
    {
        if(input->buffer_p.count!=0)
        {
         status = CyU3PDmaChannelCommitBuffer (chHandle, input->buffer_p.count, 0);
        if (status != CY_U3P_SUCCESS)
           CyU3PDebugPrint (4, "CyU3PDmaChannelCommitBuffer DMA CB failed, Error code = %d\n", status);
       
        }
    }
}

   

but i get the error code "CyU3PDmaChannelCommitBuffer GPIF CB failed, Error code = 0x47"

   

Is there some other way ?

   

best regards

   

g.

0 Likes
1 Reply
Anonymous
Not applicable

You can try the following:

   

I think in your current implementation, you are doing the INTR_CPU action when you are in the ZLP state.

   

Instead of that you can directly do COMMIT action when you are in ZLP state. COMMIT action itself commits a ZLP to host PC.

   

Thanks,

   

sai krishna.

0 Likes