Hello Stack Overflow社区,
当我尝试编译从Freescale MQX获得的USB键盘设备应用程序的示例代码时,我有一个非常奇怪的编译器错误。在usb_descriptor.c中它有:
`usb_language_t g_usb_language[USB_MAX_SUPPORTED_INTERFACES] =
{
{
(uint16_t) 0x0409,
g_string_descriptors,
g_string_desc_size
}
};
/*************************************/
usb_all_languages_t g_languages =
{
g_usb_str_0,
sizeof(g_usb_str_0),
USB_MAX_LANGUAGES_SUPPORTED,
g_usb_language
};`
/ ********* /
uint8_t USB_Desc_Set_Speed
(
uint32_t handle,
uint16_t speed
)
{
descriptor_union_t ptr1, ptr2;
UNUSED_ARGUMENT(handle);'
usb_language_t
,usb_all_languages_t
& descriptor_union_t
在usb_desc.h中定义如下:
typedef struct _usb_language
{
uint16_t language_id;
uint8_t ** lang_desc;
uint8_t * lang_desc_size;
} usb_language_t;
typedef struct _usb_all_languages
{
uint8_t *languages_supported_string;
uint8_t languages_supported_size;
uint8_t languages_number;
/*Allocate Memory In App Layer*/
usb_language_t *usb_language;
} usb_all_languages_t;
typedef union descriptor_union
{
uint32_t word;
uint8_t * bufr;
void* pntr;
device_descriptor_t dvic;
usb_configuration_descriptor_t* cfig;
interface_descriptor_t* intf;
endpoint_descriptor_t* ndpt;
qualifier_descriptor_t* qual;
otg_descriptor_t* otg;
common_descriptor_t* common;
} descriptor_union_t;
然而,即使我在usb_descriptor.c开始时#include "usb_desc.h"
,我收到错误消息
错误[Pe020]:标识符" usb_language_t"未定义
错误[Pe020]:标识符" usb_all_languages_t"未定义
错误[Pe020]:标识符" descriptor_union_t"未定义
有人可以帮我解决这个问题吗?我正在使用IAR进行MQX 4.0.2 RTOS的开发。此外,我正在尝试将USB键盘设备应用程序集成到预先存在的固件中。
提前谢谢!