Suggested mod to USB 5.0 stack

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Suggested mod to USB 5.0 stack

927 次查看
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

标签 (2)
标记 (2)
0 项奖励
回复
2 回复数

767 次查看
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 项奖励
回复

767 次查看
Rick_Li
NXP Employee
NXP Employee

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

0 项奖励
回复