usb_prop.c 提供了Device_Property, Device_Table & USER_STANDARD_REQUEST 结构描述,这3个东东定义于usb_core.c。
在ST的例子中,USER_STANDARD_REQUESTS里面的成员全部定义为了空函数,DEVICE_PROP的成员有具体的定义,详细的解读会再以后给出。
DEVICE Device_Table =
{
EP_NUM, // defined in usb_conf.h EP_NUM=2 代表USB应用使用的端点数量
1 // 代表USB应用使用的配置数量
};
DEVICE_PROP Device_Property = //这些函数具体的描述在后面
{
Joystick_init, //USB IP的初始化
Joystick_Reset,
Joystick_Status_In, //回调函数,进入某个阶段状态结束时调用,用于执行类或应用相关的过程,本例中为空函数
Joystick_Status_Out, //回调函数,退出某个阶段状态结束时调用,本例中为空函数
Joystick_Data_Setup, //回调函数,
Joystick_NoData_Setup, //回调函数
Joystick_Get_Interface_Setting, //回调函数,检测收到的设置接口的标准请求
Joystick_GetDeviceDescriptor, //内核获取设备描述符
Joystick_GetConfigDescriptor, //内核获取配置描述符
Joystick_GetStringDescriptor, //内核获取字符串描述符
0,
0x40 /*MAX PACKET SIZE*/
};
//下面的ONE_DESCRIPTOR 即指向usb_desc.c中定义的各种描述符
ONE_DESCRIPTOR Device_Descriptor = //设备描述符
{
(u8*)Joystick_DeviceDescriptor, //描述符均在usb_desc中定义
JOYSTICK_SIZ_DEVICE_DESC
};
ONE_DESCRIPTOR Config_Descriptor = //配置描述符
{
(u8*)Joystick_ConfigDescriptor,
JOYSTICK_SIZ_CONFIG_DESC
};
ONE_DESCRIPTOR Joystick_Report_Descriptor = //报告描述符
{
(u8 *)Joystick_ReportDescriptor,
JOYSTICK_SIZ_REPORT_DESC
};
ONE_DESCRIPTOR Mouse_Hid_Descriptor = //HID描述符
{
(u8*)Joystick_ConfigDescriptor + JOYSTICK_OFF_HID_DESC,
JOYSTICK_SIZ_HID_DESC
};
ONE_DESCRIPTOR String_Descriptor[4] = //字符串描述符 defined in usb_desc.c
{
{(u8*)Joystick_StringLangID, JOYSTICK_SIZ_STRING_LANGID},
{(u8*)Joystick_StringVendor, JOYSTICK_SIZ_STRING_VENDOR},
{(u8*)Joystick_StringProduct, JOYSTICK_SIZ_STRING_PRODUCT},
{(u8*)Joystick_StringSerial, JOYSTICK_SIZ_STRING_SERIAL}
};
用户413685 2012-6-14 11:40