36 #ifndef __HAL_LPC17XX_H__
37 #define __HAL_LPC17XX_H__
41 #define __INCLUDE_FROM_USB_DRIVER
42 #include "../../USBMode.h"
44 #define USBRAM_SECTION RAM2
46 #if defined(__LPC177X_8X__) || defined(__LPC407X_8X__)
49 #define __BSS(x) __attribute__ ((section("usbram")))
51 #if defined(__ICCARM__)
52 #define __BSS(x) @ ".sram"
55 #if defined(__CC_ARM) || defined(__ICCARM__)
60 #define USB_REG(CoreID) LPC_USB
71 #ifdef USB_CAN_BE_DEVICE
74 #define FRAME_INT 0x00000001
75 #define EP_FAST_INT 0x00000002
76 #define EP_SLOW_INT 0x00000004
77 #define DEV_STAT_INT 0x00000008
78 #define CCEMTY_INT 0x00000010
79 #define CDFULL_INT 0x00000020
80 #define RxENDPKT_INT 0x00000040
81 #define TxENDPKT_INT 0x00000080
82 #define EP_RLZED_INT 0x00000100
83 #define ERR_INT 0x00000200
86 #define PKT_LNGTH_MASK 0x000003FF
87 #define PKT_DV 0x00000400
88 #define PKT_RDY 0x00000800
91 #define CTRL_RD_EN 0x00000001
92 #define CTRL_WR_EN 0x00000002
95 #define CMD_SET_ADDR 0x00D00500
96 #define CMD_CFG_DEV 0x00D80500
97 #define CMD_SET_MODE 0x00F30500
98 #define CMD_RD_FRAME 0x00F50500
99 #define DAT_RD_FRAME 0x00F50200
100 #define CMD_RD_TEST 0x00FD0500
101 #define DAT_RD_TEST 0x00FD0200
102 #define CMD_SET_DEV_STAT 0x00FE0500
103 #define CMD_GET_DEV_STAT 0x00FE0500
104 #define DAT_GET_DEV_STAT 0x00FE0200
105 #define CMD_GET_ERR_CODE 0x00FF0500
106 #define DAT_GET_ERR_CODE 0x00FF0200
107 #define CMD_RD_ERR_STAT 0x00FB0500
108 #define DAT_RD_ERR_STAT 0x00FB0200
109 #define DAT_WR_BYTE(x) (0x00000100 | ((x) << 16))
110 #define CMD_SEL_EP(x) (0x00000500 | ((x) << 16))
111 #define DAT_SEL_EP(x) (0x00000200 | ((x) << 16))
112 #define CMD_SEL_EP_CLRI(x) (0x00400500 | ((x) << 16))
113 #define DAT_SEL_EP_CLRI(x) (0x00400200 | ((x) << 16))
114 #define CMD_SET_EP_STAT(x) (0x00400500 | ((x) << 16))
115 #define CMD_CLR_BUF 0x00F20500
116 #define DAT_CLR_BUF 0x00F20200
117 #define CMD_VALID_BUF 0x00FA0500
120 #define DEV_ADDR_MASK 0x7F
124 #define CONF_DVICE 0x01
137 #define DEV_CON_CH 0x02
139 #define DEV_SUS_CH 0x08
143 #define ERR_EC_MASK 0x0F
148 #define ERR_UEPKT 0x02
149 #define ERR_DCRC 0x04
150 #define ERR_TIMOUT 0x08
152 #define ERR_B_OVRN 0x20
153 #define ERR_BTSTF 0x40
157 #define EP_SEL_F 0x01
158 #define EP_SEL_ST 0x02
159 #define EP_SEL_STP 0x04
160 #define EP_SEL_PO 0x08
161 #define EP_SEL_EPN 0x10
162 #define EP_SEL_B_1_FULL 0x20
163 #define EP_SEL_B_2_FULL 0x40
166 #define EP_STAT_ST 0x01
167 #define EP_STAT_DA 0x20
168 #define EP_STAT_RF_MO 0x40
169 #define EP_STAT_CND_ST 0x80
172 #define CLR_BUF_PO 0x01
176 #define NDD_REQ_INT 0x02
177 #define SYS_ERR_INT 0x04
210 uint16_t NextDDValid : 1;
212 uint16_t Isochronous : 1;
213 uint16_t MaxPacketSize : 11;
222 __IO uint16_t Retired : 1;
224 uint16_t IsoPacketValid : 1;
225 uint16_t LSByteExtracted : 1;
226 uint16_t MSByteExtracted : 1;
227 uint16_t MessageLengthPosition : 6;
237 #endif // __HAL_LPC17XX_H__