6 Replies Latest reply on Nov 26, 2012 12:58 AM by content.librarian

    Get DMA status,busy or idle

    jia.decun

       Hello everyone 

         

      The issue as follows:

         

      Develop with SDKv1.2. 

         

      I want to transfer data by USB3.0 with DMA mode. I create 3 DMA chanels.and two for data transfer the third for command transfer.

         

      As we know just one DMA channel can work at the same time.But I want to transfer command during data transfer.Data transfer is not continue.So I want to transfer command in data transmission interval. So the DMA for command transfer must be CY_U3P_DMA_TYPE_MANUAL mode .Before command transfer I should check if other two DMA channels are busy or idle.

         

      Is there any function to get the DMA status .Does somebody get me an sample .And does my scheme word?

         

      thanks

         

      ayi 

        • 1. Re: Get DMA status,busy or idle
          content.librarian

          Hi Ayi,

             

          check the function "CyU3PDmaChannelGetStatus" and compare the producer and consumer counts. If they are eqal, no data is in  progress.

             

           

             

          Why are you no using the control channel EP0? There you do not have to check if data is in progress. I think you also do not have to check if any data is in progress while you like to send control transfers. The dma should be connected to different sockets and they are connected to different endpoints. So the endpoint work for user like parallel.

             

          If I may not understand you right then I am sorry, please try a exactlier explanation.

             

          regards,

             

          lumpi

          • 2. Re: Get DMA status,busy or idle
            jia.decun

             Hi lumpi 

               

            Thanks for your replay.

               

            >check the function "CyU3PDmaChannelGetStatus" and compare the producer and consumer counts. If they are >eqal, no data is in  progress.

               

             I know the function "CyU3PDmaChannelGetStatus".But I think there is no "IDLE" with return value .And what the mean "compare the producer and consumer counts"? And how to compare?

               

             

               

             

               

            >Why are you no using the control channel EP0? There you do not have to check if data is in progress. I think you >also do not have to check if any data is in progress while you like to send control transfers. The dma should be >connected to different sockets and they are connected to different endpoints. So the endpoint work for user like >parallel.

               

            I use 3 DMA channel :U1-->P1  P1-->U1 and U2-->P2.And after the channels is created the socket address is fixed . So I think  the endpoint work for user not like parallel. When  the" U1-->P1 "channel is used  I want to send command(the command shouled be send by GPIF to external device :FPGA ,the command is not like the vender request,the command can be understand as data transfer ) by "U2-->P2"channel .I just think of the GPIF interface can't be share.

               

             

               

            Besr regard

               

            ayi

            • 3. Re: Get DMA status,busy or idle
              content.librarian

              Hi Ayi

                 

              >check the function "CyU3PDmaChannelGetStatus" and compare the producer and consumer counts. If they are >eqal, no data is in  progress.

                 

               I know the function "CyU3PDmaChannelGetStatus".But I think there is no "IDLE" with return value .And what the mean "compare the producer and consumer counts"? And how to compare?

                 

               

                 

              If you compare these counts you can see if any data is in progress. If producer count is higher than consumer count, then consumer has data left to transmit. If both counts are the same, then no data is in progress and there is no transmission ongoing.

                 

               

                 

              >Why are you no using the control channel EP0? There you do not have to check if data is in progress. I think you >also do not have to check if any data is in progress while you like to send control transfers. The dma should be >connected to different sockets and they are connected to different endpoints. So the endpoint work for user like >parallel.

                 

              I use 3 DMA channel :U1-->P1  P1-->U1 and U2-->P2.And after the channels is created the socket address is fixed . So I think  the endpoint work for user not like parallel. When  the" U1-->P1 "channel is used  I want to send command(the command shouled be send by GPIF to external device :FPGA ,the command is not like the vender request,the command can be understand as data transfer ) by "U2-->P2"channel .I just think of the GPIF interface can't be share.

                 

              Ok, in this the interface truely can not be shared. You may also can check the DMA callback functions. They notify may be some DMA event you need to do y

                 

               

                 

              regards,

                 

               

                 

              lumpi

              • 4. Re: Get DMA status,busy or idle
                along.bq

                 Can I use uart or i2c  port  to communicate with FPGA? FX3 receive control data from ep0,and translate control data,then communicate with fpga through uart or i2c port?

                • 5. Re: Get DMA status,busy or idle
                  jia.decun

                  Hi cityhunterlyf 

                     

                  I2C should be work .Othe project used before ,But if I use I2C to transfer command the FPGA GPIF  RTL must be rewrite.  

                     

                   

                     

                  regaed

                     

                  ayi

                  • 6. Re: Get DMA status,busy or idle
                    content.librarian

                    Hi cityhunterlyf,

                       

                    you can also use the UART port to communicate with the FPGA. That is a bit faster than the I2C port. It is a pitty that you can not use the really fast SPI port while you are using GPIF II in 32-bit mode.

                       

                    regards,

                       

                    lumpi