郁闷呀!!!!!向各位讨教!!! 以下为程序运行出错的代码:
//设备描述符 unsigned char DeviceDescr[] = {0x12, //设备描述符长度,= 12H 0x01, //设备描述符类型,= 01H 0x00, 0x01, //协议版本,= 1.10 0x00, //测试设备类型, = 0DCH 0x00, 0x10, //设备子类,设备协议 0x10, //端点0最大数据包大小,= 10H 0x5e, 0x10, //PHILIPS公司的设备ID 0xff, 0xff, //设备制造商定的产品ID 0x00, 0x01, //设备系列号 0x00, 0x00, 0x00, //索引 0x01, };
unsigned char usb_descr[] = { //配置描述符
sizeof(USB_CONFIGURATION_DESCRIPTOR), //配置描述符长度,= 09H USB_CONFIGURATION_DESCRIPTOR_TYPE, //配置描述符类型,= 02H CONFIG_DESCRIPTOR_LENGTH,0x00, //描述符总长度, = 002EH 1, //只支持1个接口 1, //配置值 0, //字符串描述符指针(无) 0x80, //自供电,不支持远程唤醒 //支持总线供电 0x32, //最大功耗(100mA)
//接口描述符
sizeof(USB_INTERFACE_DESCRIPTOR), //接口描述符长度,= 09H USB_INTERFACE_DESCRIPTOR_TYPE, //接口描述符类型,= 04H 0, //接口数,只有1个 0, //可选配置,只有1个 NUM_ENDPOINTS, //除端点0的端点索引数目,= 04H 0x08, //大容量存储类,= 08H 0x06, //子类代码,= 04H ---------UFI 0x50, //协议代码,= 050H ---------单批量传输协议(Bulk-Only) 0, //字符串描述符索引,为0则未使用字符串描述符
//端点描述符,端点1输入
0x07, //端点描述符长度,= 07H USB_ENDPOINT_DESCRIPTOR_TYPE, //端点描述符类型,= 05H 0x81, //端点1 IN USB_ENDPOINT_TYPE_INTERRUPT, //中断传输, = 03H EP1_PACKET_SIZE,0x00, //端点最大包的大小,= 0010H 10, //传输间隔时间,= 10ms
//端点描述符,端点1输出
0x07, //端点描述符长度,= 07H USB_ENDPOINT_DESCRIPTOR_TYPE, //端点描述符类型,= 05H 0x1, //端点1 OUT USB_ENDPOINT_TYPE_INTERRUPT, //中断传输,= 03H EP1_PACKET_SIZE,0x00, //端点最大包的大小,= 0010H 10, //传输间隔时间,= 10ms
//端点2输入
0x07, //端点描述符长度,= 07H USB_ENDPOINT_DESCRIPTOR_TYPE, //端点描述符类型,= 05H 0x82, //端点2 IN USB_ENDPOINT_TYPE_BULK, //批量传输,= 02H EP2_PACKET_SIZE,0x00, //端点最大包的大小,= 0040H 10, //批量传输时该设备无效
//端点2输出
0x07, //端点描述符长度,= 07H USB_ENDPOINT_DESCRIPTOR_TYPE, //端点描述符类型,= 05H 0x2, //端点2 OUT USB_ENDPOINT_TYPE_BULK, //批量传输,= 02H EP2_PACKET_SIZE,0x00, //端点最大包的大小,= 0040H 10, //批量传输时该设备无效
};
INT8U mbr[512]={ 0x33,0xc0,0x8e,0xc0,0x8e,0xd8,0x8e,0xd0,0xbc,0x00,0x7c,0xfc,0x8b,0xf4,0xbf,0x00,//00000000 0x06,0xb9,0x00,0x01,0xf2,0xa5,0xea,0x44,0x06,0x00,0x00,0x8b,0xd5,0x58,0xb4,0x10,//00000010 0xf6,0xe4,0x05,0xae,0x04,0x8b,0xf0,0x8a,0x74,0x01,0x8b,0x4c,0x02,0xbb,0x00,0x7c,//00000020 0xe8,0x01,0x02,0xcd,0x13,0x72,0x16,0x81,0xbf,0xfe,0x01,0x55,0xaa,0x75,0x0e,0xea,//00000030 0x00,0x7c,0x00,0x00,0x80,0xfa,0x81,0x74,0x02,0xb2,0x80,0x8b,0xea,0xbf,0xbe,0x07,//00000040 0xb9,0x04,0x00,0x32,0xf6,0x8a,0x45,0x04,0x3c,0x00,0x74,0x0b,0x3c,0x05,0x74,0x07,//00000050 0x80,0x3d,0x80,0x74,0x19,0xfe,0xc6,0x83,0xc7,0x10,0xe2,0xe9,0x0a,0xf6,0x74,0x06,//00000060 0xbe,0x9c,0x06,0xeb,0x04,0x90,0xbe,0xb4,0x06,0xe8,0x0e,0x00,0xeb,0xfe,0x8a,0xc6,//00000070 0x04,0x31,0x50,0xbe,0x99,0x06,0xbb,0x1b,0x06,0x53,0xfc,0xac,0x50,0x24,0x7f,0xb4,//00000080 0x0e,0xcd,0x10,0x58,0xa8,0x80,0x74,0xf2,0xc3,0x0d,0x0a,0xa0,0x0d,0x0a,0x4e,0x6f,//00000090 0x20,0x61,0x63,0x74,0x69,0x76,0x65,0x20,0x70,0x61,0x72,0x74,0x69,0x74,0x69,0x6f,//000000a0 0x6e,0x2e,0x2e,0xae,0x0d,0x0a,0x50,0x61,0x72,0x74,0x69,0x74,0x69,0x6f,0x6e,0x20,//000000b0 0x6e,0x6f,0x74,0x20,0x66,0x6f,0x75,0x6e,0x64,0x2e,0x2e,0xae,0x00,0x00,0x00,0x00,//000000c0 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//000000d0 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//000000e0 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//000000f0 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000100 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000110 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000120 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000130 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000140 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000150 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000160 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000170 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000180 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//00000190 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//000001a0 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x01,//000001b0 0x01,0x00,0x06,0x01,0x21,0x60,0x01,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,//000001c0 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//000001d0 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,//000001e0 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x55,0xaa//000001f0 };
当我把mbr[512]不赋初值,或者把mbr[512]数据全改为0X00时,在AXD中跳到DeviceDescr[]地址时能看到DeviceDescr[]数组定义的正确的赋值,当mbr[512]这以上数据时,在AXD中跳到DeviceDescr[]地址时看到的是它前一个数据,地址 跳转不对,而且有的数据还错了!搞了几天都晕了,不知道不什么,请各位高手指点!我用的是ADS2.2 |