Suggested mod to USB 5.0 stack

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Suggested mod to USB 5.0 stack

441 Views
johnstrohm
Contributor III

File usb_misc.h contains the following:


#define MAX_EXPECTED_CONTROL_OUT_SIZE   (76 + USB_SETUP_PKT_SIZE)

#if USBCFG_DEV_KHCI || USBCFG_DEV_EHCI

typedef struct usb_dev_data

{

    uint8_t             control_out[96];/* control_out must be 32 byte align,

                                        ** 96 = (((MAX_EXPECTED_CONTROL_OUT_SIZE-1)/32) + 1) * 32

                                        */

} usb_dev_data_t;

The problem is that, if MAX_EXPECTED_CONTROL_OUT_SIZE is increased, array control_out must also be resized.


This is easy enough to fix.  The modified code should be:

#define MAX_EXPECTED_CONTROL_OUT_SIZE   (76 + USB_SETUP_PKT_SIZE)

/* Round up to 32 byte block size

#define ROUNDED_UP_CONTROL_OUT_SIZE ((MAX_EXPECTED_CONTROL_OUT_SIZE+31)/32)

#if USBCFG_DEV_KHCI || USBCFG_DEV_EHCI

typedef struct usb_dev_data

{

    uint8_t             control_out[ROUNDED_UP_CONTROL_OUT_SIZE];/* control_out must be 32 byte align,

} usb_dev_data_t;

#endif

Labels (2)
Tags (2)
0 Kudos
2 Replies

281 Views
Kan_Li
NXP TechSupport
NXP TechSupport

Hi John,

I have reported this to our USB stack team, and they appreciate your suggestion which will be incorporated into next release.


Have a great day,
Kan

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

281 Views
Rick_Li
NXP Employee
NXP Employee

Thank you for the suggestion, we will forward it to our development team!

0 Kudos