1 Reply Latest reply on Jan 15, 2013 1:40 AM by rama.sai.krishna.vakkantula

    Is it possible to create dma channel between GPIF socket and Host mode Endpoint Socket?

    taewoong.yang

      I use FX3 DVK on host mode.

         

      When i create a dma channel between GPIF(P port) socket and CPU in MANUAL-IN,

         

      (GPIF socket is Producer, CPU socket is Consumer)

         

      a Callback routine is called.

         

       

         

      but,

         

      When i create a dma channel between GPIF(P port) socket and Host mode Endpoint(U-port) in MANUAL,

         

      (GPIF socket is Producer, Endpoint socket is Consumer)

         

      a Callback routine is not called.

         

       

         

         /* Add the IN endpoint. */
          CyU3PMemSet ((uint8_t *)&epCfg, 0, sizeof(epCfg));
          epCfg.type = CY_U3P_USB_EP_BULK;
          epCfg.mult = 1;
          epCfg.maxPktSize = glMscEpSize;
          epCfg.pollingRate = 0;
          /* Since DMA buffer sizes can only be multiple of 16 bytes and
           * also since this is an interrupt endpoint where the max data
           * packet size is same as the maxPktSize field, the fullPktSize
           * has to be a multiple of 16 bytes. */
          size = ((glMscEpSize + 0x0F) & ~0x0F);
          epCfg.fullPktSize = size;
          epCfg.isStreamMode = CyFalse;
       

         

          /* Add the OUT EP. */
          status = CyU3PUsbHostEpAdd (glMscOutEp, &epCfg);
          if (status != CY_U3P_SUCCESS)
          {
              goto enum_error;
          }

         

          /* Create a DMA channel for OUT EP. */
          CyU3PMemSet ((uint8_t *)&dmaCfg, 0, sizeof(dmaCfg));
          dmaCfg.size = glMscEpSize;
          dmaCfg.count = 2;  // 0;

         

          dmaCfg.prodHeader = 0;
          dmaCfg.prodFooter = 0;
          dmaCfg.consHeader = 0;
          dmaCfg.prodAvailCount = 0;

         

          dmaCfg.dmaMode = CY_U3P_DMA_MODE_BYTE;
          dmaCfg.notification = CY_U3P_DMA_CB_PROD_EVENT | CY_U3P_DMA_CB_CONS_EVENT;

         


          /* Create a DMA channel for OUT EP. */
          //dmaCfg.prodSckId = CY_U3P_CPU_SOCKET_PROD;
          dmaCfg.prodSckId = CY_U3P_PIB_SOCKET_5;
          dmaCfg.consSckId = (CyU3PDmaSocketId_t)(CY_U3P_UIB_SOCKET_CONS_0 + (0x0F & glMscOutEp));
          dmaCfg.cb = CyFxMassOutDmaCallback;

         

          status = CyU3PDmaChannelCreate (&glMscOutCh, CY_U3P_DMA_TYPE_MANUAL, &dmaCfg);
          if (status != CY_U3P_SUCCESS)
          {
              goto app_error;
          }

         

          /* Enable EP transfer. In stream mode, the transfer size should be zero. */
       status = CyU3PUsbHostEpSetXfer (glMscOutEp, CY_U3P_USB_HOST_EPXFER_NORMAL, 0);
       if (status != CY_U3P_SUCCESS)
       {
        goto app_error;
       }

         

          status = CyU3PDmaChannelSetXfer (&glMscOutCh, 0);
       if (status != CY_U3P_SUCCESS)
       {
        CyU3PDebugPrint (4, "[Error] CyU3PDmaChannelSetXfer(glMscOutCh) Failed, Error code = %d\n", status);
        goto app_error;
       }