audio_endpoint_data, hid_endpoint_data suggestion

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

audio_endpoint_data, hid_endpoint_data suggestion

583 Views
johnstrohm
Contributor III

In the 5.0 Beta stack, the usb_audio device class defines an audio_endpoint_data structure as part of the audio_device_struct, and the usb_hid class defines a hid_endpoint structure as part of the hid_device_struct.

Down inside them we find audio_endpoint_struct and hid_endpoint_struct definitions.  Currently, part of these structs are guarded by conditional compilation on whether queuing is enabled for the device class.

Upon inspection of the device class driver code, it in fact appears that the entirety of the audio_endpoint_data and hid_endpoint_data are actually only used if queuing is enabled.  To reduce memory usage, and code, for non-queuing apps, all of the *_endpoint_data stuff should probably be guarded on the queuing.

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

384 Views
jeremyzhou
NXP Employee
NXP Employee

Hi John,

Thank you very much for your focus on Freescale Kinetis product. I'd glad to provide service for you.

Firstly, I appreciate your suggestion a lot, and I was wondering if you could share the more information about it, such as the specific codes.

Then I can report this to USB AE team for checking.

Thanks for your cooperation in advance.
Have a great day,
Ping

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

0 Kudos

384 Views
johnstrohm
Contributor III

In c:/Freescale_BM_USB_Stack_v5.0/Src/usb_core/device/sources/classes/audio/usb_audio.c:

Lines 107-144, 174-211, and 1803-1839 are the places where audio_endpoint_data is used.  Observe that it is ONLY used inside code that is guarded with #if AUDIO_IMPLEMENT_QUEUING/#endif pairs.  Lines 325-331 are where it is set.  (I reported the use of HID_IMPLEMENT_QUEUING in those lines, instead of AUDIO_IMPLEMENT_QUEUING, in a separate topic.)


That the data is used ONLY inside those guards indicates that all of the code that sets the data can also be guarded, and also the lines that declare that data, in usb_audio.h, at lines 133-150 and line 179.

In c:/Freescale_BM_USB_Stack_v5.0/Src/usb_core/device/sources/classes/hid/usb_hid.c:

Lines 148-168 and 633-656 are the places where hid_endpoint_data is used.  (There is some commented-out code to deallocate the hid_endpoint_data, left over from when it was malloc()'ed.)  Observe that it is ONLY used inside code that is guarded with #if HID_IMPLEMENT_QUEUING/#endif pairs.  Lines 230-239, 255-264, and 288-296 are where it is set.


That the data is used ONLY inside those guards indicates that all of the code that sets the data can also be guarded, and also the lines that declare that data, in usb_hid.h, at lines 85-101 and line 114.


0 Kudos

384 Views
jeremyzhou
NXP Employee
NXP Employee

Hi John,

Thanks the information you provided and I really appreciate a lot.

Have a great day,
Ping

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

0 Kudos