📄 dc_struct.c.h
字号:
EP4:in, sigle buffer, interrupt, 16 bytes buffer size
EP5:out,sigle buffer, bulk , 64 bytes buffer size
EP6:in, sigle buffer, bulk, 64 bytes buffer size
EP7:out,double buffer, bulk , 64 bytes buffer size
EP8:in, double buffer, bulk, 64 bytes buffer size
*---------------------------------------*/
//??是否需要配置端点0?
std_endpoint_descriptor StdEp1Desc1362={
7, //bLength
DEVICE, //bDescriptorType
1, //bEndpointAddress--EP1,out
0x01, //bmAttributes----isocronous
SWAP(1023), //wMaxPacketSize,此处需要再斟酌
1 //bInterval
};
std_endpoint_descriptor StdEp2Desc1362={
7, //bLength
DEVICE, //bDescriptorType
2|0x80, //bEndpointAddress--EP2,in
0x01, //bmAttributes---isocronous
SWAP(1023), //wMaxPacketSize,此处需要再斟酌
1 //bInterval
};
std_endpoint_descriptor StdEp3Desc1362={
7, //bLength
DEVICE, //bDescriptorType
3, //bEndpointAddress--EP3,out
0x01, //bmAttributes---interrupt
SWAP(16), //wMaxPacketSize,此处需要再斟酌
0xff //bInterval
};
std_endpoint_descriptor StdEp4Desc1362={
7, //bLength
DEVICE, //bDescriptorType
4|0x80, //bEndpointAddress--EP4,in
0x01, //bmAttributes---interrupt
SWAP(16), //wMaxPacketSize,此处需要再斟酌
0xff //bInterval
};
std_endpoint_descriptor StdEp5Desc1362={
7, //bLength
DEVICE, //bDescriptorType
5, //bEndpointAddress--EP5,out
0x02, //bmAttributes---bulk
SWAP(64), //wMaxPacketSize,此处需要再斟酌
0 //bInterval
};
std_endpoint_descriptor StdEp6Desc1362={
7, //bLength
DEVICE, //bDescriptorType
6|0x80, //bEndpointAddress--EP6,in
0x02, //bmAttributes---bulk
SWAP(64), //wMaxPacketSize,此处需要再斟酌
0 //bInterval
};
std_endpoint_descriptor StdEp7Desc1362={
7, //bLength
DEVICE, //bDescriptorType
7, //bEndpointAddress--EP3,in
0x02, //bmAttributes---interrupt
SWAP(64), //wMaxPacketSize,此处需要再斟酌,对于double buffer,是否*2?
0 //bInterval
};
std_endpoint_descriptor StdEp8Desc1362={
7, //bLength
DEVICE, //bDescriptorType
8|0x80, //bEndpointAddress--EP3,in
0x02, //bmAttributes---interrupt
SWAP(64), //wMaxPacketSize,此处需要再斟酌,对于double buffer,是否*2?
0 //bInterval
};
typedef struct _SETUP_PKG {
USB_Device_Request DeviceRequest;
unsigned short wLength;
unsigned short wCount;
unsigned char *pData;
unsigned char dataBuffer[MAX_CONTROLDATA_SIZE];
} SETUP_PKG;
typedef struct _DATA_INFO {
struct _flags
{
unsigned char bus_reset; //1:总线挂起复位标志
unsigned char resume; //1:indicates that a"resume" state was detected
unsigned char suspend; //挂起改变标志
unsigned char sof; //SOF标志
unsigned char psof; //pseudo SOF标志
unsigned char busstatus; //current bus status
unsigned char setup_packet; //收到setup包
unsigned char remote_wakeup; //远程唤醒标志
unsigned char in_isr; //usb中断服务标志
unsigned char control_state; //控制端点处理状态 0:IDLE 空闲状态
// 1:TRANSMIT 数据发送状态
// 2:RECEIVE 数据接收状态
unsigned char configuration; //配置标志(0:未配置;1:已配置)
unsigned char ep1_rxdone; //端点1收到数据标志
unsigned char ep2_rxdone; //端点2收到数据标志
unsigned char ep3_rxdone; //端点3收到数据标志
unsigned char ep4_rxdone; //端点4收到数据标志
unsigned char ep5_rxdone; //端点5收到数据标志
unsigned char ep6_rxdone; //端点6收到数据标志
unsigned char ep7_rxdone; //端点7收到数据标志
unsigned char ep8_rxdone; //端点8收到数据标志
unsigned char ep1_txbuffull; //端点1发送缓冲区满
unsigned char ep2_txbuffull; //端点2发送缓冲区满
unsigned char ep3_txbuffull; //端点3发送缓冲区满
unsigned char ep4_txbuffull; //端点4发送缓冲区满
unsigned char ep5_txbuffull; //端点5发送缓冲区满
unsigned char ep6_txbuffull; //端点6发送缓冲区满
unsigned char ep7_txbuffull; //端点7发送缓冲区满
unsigned char ep8_txbuffull; //端点8发送缓冲区满
}bits;
unsigned short value;
}INFOFLAGS;
SETUP_PKG SetupPkg;
INFOFLAGS InfoFlags;
/*-------------------------------------------------------------------
/*--------------------------------------------------------------------
static uint8 bStdDescriptor[DEVICE_DES_LEN]= {
// std_device descriptor
DEVICE_DES_LEN, // bLength
DEVICE, // bDescriptorType
0, 1, // bcdUSB (USB Spec 1.1)
0xff, // bDeviceClass (0xFF = Vendor Specific)
0xff, // bDeviceSubClass
0xff, // bDeviceProtocol
EP0MaxSize, // bMaxPacketSize0
// 0x04, 0x5E,
// 0x23, 0x01, // idVendor: 0123
// 0x67, 0x45, // idProduct: 4567
#if 0
0x5E, 0x04, // idVendor
0xCE, 0x00, // idProduct
#endif
//#if FINAL_TI_NUMBERS_TO_USE
0x51, 0x04, // idVendor TI USB PRODUCT CODES 0451, BBBB
0xBB, 0xBB, // idProduct
//#endif
// 0x1C, 0x00, // idProduct
// 0x00, 0x1C,
0, 0, // bcdDevice
0, // iManufacturer - index of Manf String Descriptor
0, // iProduct - index of Product String Descriptor
0, // iSerialNumber - Index of Serial Number String
1 // bNumConfigurations
// std_config descriptor
9, // bLength
CONFIGURATION, // bDescriptorType
CONFIG_DES_LEN%256,
CONFIG_DES_LEN/256, // wTotalLength
1, // bNumInterfaces
1, // bConfigurationValue
0, // iConfiguration
0x40, // bmAttributes (self powered)
32, // MaxPower (x2 mA)
// std_interface descriptor
9, // bLength
INTERFACE, // bDescriptorType
0, // bInterfaceNumber
0, // bAlternateSetting
2, // bNumEndpoints (number endpoints used, excluding EP0)
0xff, // bInterfaceClass
0xff, // bInterfaceSubClass
0xff, // bInterfaceProtocol
0, // ilInterface (Index of this interface string desc.)
// endpoint2 - In
7, // bLength
ENDPOINT, // bDescriptorType
0x80|IN_EP_NUM, // bEndpointAddress (EP 2, IN)
2, // bmAttributes (0010 = Bulk)
EPMaxSize, 0, // wMaxPacketSize
0, // bInterval (ignored for Bulk)
// endpoint3 - Out
7, // bLength
ENDPOINT, // bDescriptorType
OUT_EP_NUM, // bEndpointAddress (EP 3, Out)
2, // bmAttributes (0010 = Bulk)
EPMaxSize, 0, // wMaxPacketSize
0, // bInterval (ignored for Bulk)
};
------------------------------------------------------------------
------------------------------------------------------------------*/
#endif _DC_STRUCT_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -