📄 usb_data_structures.h
字号:
/*
* File: usb_data_structures.h
* Purpose: USB data structure definitions
*
* Notes:
*/
#ifndef _USB_DATA_STRUCTURES_H
#define _USB_DATA_STRUCTURES_H
#include "common.h"
/********************************************************************/
/* usb data structure definitions */
/* USB host queue head structure */
typedef struct {
uint32 qh_link_ptr;
uint32 ep_char;
uint32 ep_cap;
uint32 curr_qtd;
uint32 next_qtd;
uint32 alt_qtd;
uint32 qtd_token;
uint32 qtd_buf0;
uint32 qtd_buf1;
uint32 qtd_buf2;
uint32 qtd_buf3;
uint32 qtd_buf4;
uint32 malloc_ptr; /* Used to keep track of the unaligned
memory allocated for the data structure */
} USB_QH;
/* USB host queue element transfer descriptor */
typedef struct {
uint32 next_qtd;
uint32 alt_qtd;
uint32 qtd_token;
uint32 qtd_buf0;
uint32 qtd_buf1;
uint32 qtd_buf2;
uint32 qtd_buf3;
uint32 qtd_buf4;
uint32 malloc_ptr; /* Used to keep track of the unaligned
memory allocated for the data structure */
} USB_QTD;
/* USB device endpoint queue head structure */
typedef struct {
uint32 ep_char;
uint32 curr_dtd;
uint32 next_dtd;
uint32 dtd_token;
uint32 dtd_buf0;
uint32 dtd_buf1;
uint32 dtd_buf2;
uint32 dtd_buf3;
uint32 dtd_buf4;
uint32 setup_buf0;
uint32 setup_buf1;
/* The endpoint queue heads are static within the endpoint list.
* The endpoint list is malloc'd, which makes space for the
* endpoint queue heads. So there is no malloc_ptr field for this
* data structure.
*/
} USB_EP_QH;
/* USB device endpoint transfer descriptor */
typedef struct {
uint32 next_dtd;
uint32 dtd_token;
uint32 dtd_buf0;
uint32 dtd_buf1;
uint32 dtd_buf2;
uint32 dtd_buf3;
uint32 dtd_buf4;
uint32 malloc_ptr; /* Used to keep track of the unaligned
memory allocated for the data structure */
} USB_DTD;
/* Macros for accessing individual endpoint queue heads within the
* endpoint list. These macros give the offset index from the endpoint
* list start address.
*/
#define EP_QH_OUT(x) (0x80 * x)
#define EP_QH_IN(x) ((0x80 * x) + 0x40)
#define EP_QH0_OUT 0x0
#define EP_QH0_IN 0x40
#define EP_QH1_OUT 0x80
#define EP_QH1_IN 0xC0
#define EP_QH2_OUT 0x100
#define EP_QH2_IN 0x140
#define EP_QH3_OUT 0x180
#define EP_QH3_IN 0x1C0
#define EP_QH4_OUT 0x200
#define EP_QH4_IN 0x240
#define EP_QH5_OUT 0x280
#define EP_QH5_IN 0x2C0
#endif /* _USB_DATA_STRUCTURES_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -