USBFS_LoadInEP ignores length argument?

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

cross mob
JoBr_1593366
Level 5
Level 5
100 sign-ins 50 questions asked 100 replies posted

When using DMA with Automatic Buffer Management, USBFS_ReadOutEP is only called once to set up the DMA, and the length argument matters:

The allocated buffer size and length parameter must be equal to endpoint maximum packet size.

But with USBFS_LoadInEP, the first call is:

Configure DMA. This is required only once, with parameter pData is not NULL.

Then further calls are

Initiate DMA transaction on demand, with the pData pointer is NULL.

It seems like the length parameter is irrelevant to the first call, so should it just be NULL?  Looking inside USB_LoadInEP16, the length parameter only seems to be used if pData == NULL.  Yet Cypress example code uses the length of the buffer when called the first time...

0 Likes
1 Solution
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hello JoBr_1593366

When using DMA with Automatic Buffer Management, the first time USBFS_LoadInEP() is called, it is used to setup the DMA . When this is done it does not make use of the length parameter passed.

The second time USBFS_LoadInEP() is called, it is used to trigger the the DMA transaction. This time it makes use of the  length parameter.

This has been done so that only one function could be used to perform two tasks.

I tried passing NULL in place of the length parameter, the first time USBFS_LoadInEP() is called and everything seems to be working properly

Best Regards

Ekta

View solution in original post

0 Likes
1 Reply
Ekta_N
Moderator
Moderator
Moderator
750 replies posted First like given 250 solutions authored

Hello JoBr_1593366

When using DMA with Automatic Buffer Management, the first time USBFS_LoadInEP() is called, it is used to setup the DMA . When this is done it does not make use of the length parameter passed.

The second time USBFS_LoadInEP() is called, it is used to trigger the the DMA transaction. This time it makes use of the  length parameter.

This has been done so that only one function could be used to perform two tasks.

I tried passing NULL in place of the length parameter, the first time USBFS_LoadInEP() is called and everything seems to be working properly

Best Regards

Ekta

0 Likes