USB DMA Read Endian Select

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

USB DMA Read Endian Select

跳至解决方案
2,987 次查看
amwilhite
Contributor III

Operating in USB Host Mode, I'm using the USB Audio class to read 16-bit, 16kHz PCM audio from a connected microphone.

The algorithm that processes the audio requires that the samples be in big-endian format; however, it appears that all USB data is transferred in little-endian.

I noticed that the USB Device Mode has an Endian Select field to switch between the two types, but I have not been able to find any mechanism for converting from little-endian to big-endian when reading USB audio in host mode.

Can anyone suggest a mechanism to accomplish this?

标签 (1)
0 项奖励
回复
1 解答
2,881 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I checked the USB OS Adapter has the ENDIANNESS definition at <usb_osa.h>:

/*! @brief Define big endian */
#define USB_BIG_ENDIAN (0U)
/*! @brief Define little endian */
#define USB_LITTLE_ENDIAN (1U)

/*! @brief Define current endian */
#define ENDIANNESS USB_LITTLE_ENDIAN

The OS adapter (OSA) is used to wrap the differences between RTOSes and enable a USB stack with the
same code base and behavior.

Note
OSA should not be used in the USB application. Therefore, from the USB application viewpoint, OSA is invisible.

If your application doesn't use RTOS, it need to software convert data from little endian to big endian.

best regards,

Mike

在原帖中查看解决方案

0 项奖励
回复
1 回复
2,882 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

I checked the USB OS Adapter has the ENDIANNESS definition at <usb_osa.h>:

/*! @brief Define big endian */
#define USB_BIG_ENDIAN (0U)
/*! @brief Define little endian */
#define USB_LITTLE_ENDIAN (1U)

/*! @brief Define current endian */
#define ENDIANNESS USB_LITTLE_ENDIAN

The OS adapter (OSA) is used to wrap the differences between RTOSes and enable a USB stack with the
same code base and behavior.

Note
OSA should not be used in the USB application. Therefore, from the USB application viewpoint, OSA is invisible.

If your application doesn't use RTOS, it need to software convert data from little endian to big endian.

best regards,

Mike

0 项奖励
回复