32 #ifndef __HAL_LPC17XX_H__
33 #define __HAL_LPC17XX_H__
35 #if defined(__LPC17XX__)
37 #elif defined(__LPC177X_8X__)
38 #include "LPC177x_8x.h"
41 #define __INCLUDE_FROM_USB_DRIVER
42 #include "../../../USBMode.h"
44 #define USBRAM_SECTION RAM2
46 #if defined(__LPC177X_8X__)
50 #define __DATA(x) __attribute__ ((section("usbram")))
53 #if defined(__ICCARM__)
54 #define __DATA(x) @ "USB_DMA_RAM"
59 #ifdef USB_CAN_BE_DEVICE
61 #define FRAME_INT 0x00000001
62 #define EP_FAST_INT 0x00000002
63 #define EP_SLOW_INT 0x00000004
64 #define DEV_STAT_INT 0x00000008
65 #define CCEMTY_INT 0x00000010
66 #define CDFULL_INT 0x00000020
67 #define RxENDPKT_INT 0x00000040
68 #define TxENDPKT_INT 0x00000080
69 #define EP_RLZED_INT 0x00000100
70 #define ERR_INT 0x00000200
72 #define PKT_LNGTH_MASK 0x000003FF
73 #define PKT_DV 0x00000400
74 #define PKT_RDY 0x00000800
76 #define CTRL_RD_EN 0x00000001
77 #define CTRL_WR_EN 0x00000002
79 #define CMD_SET_ADDR 0x00D00500
80 #define CMD_CFG_DEV 0x00D80500
81 #define CMD_SET_MODE 0x00F30500
82 #define CMD_RD_FRAME 0x00F50500
83 #define DAT_RD_FRAME 0x00F50200
84 #define CMD_RD_TEST 0x00FD0500
85 #define DAT_RD_TEST 0x00FD0200
86 #define CMD_SET_DEV_STAT 0x00FE0500
87 #define CMD_GET_DEV_STAT 0x00FE0500
88 #define DAT_GET_DEV_STAT 0x00FE0200
89 #define CMD_GET_ERR_CODE 0x00FF0500
90 #define DAT_GET_ERR_CODE 0x00FF0200
91 #define CMD_RD_ERR_STAT 0x00FB0500
92 #define DAT_RD_ERR_STAT 0x00FB0200
93 #define DAT_WR_BYTE(x) (0x00000100 | ((x) << 16))
94 #define CMD_SEL_EP(x) (0x00000500 | ((x) << 16))
95 #define DAT_SEL_EP(x) (0x00000200 | ((x) << 16))
96 #define CMD_SEL_EP_CLRI(x) (0x00400500 | ((x) << 16))
97 #define DAT_SEL_EP_CLRI(x) (0x00400200 | ((x) << 16))
98 #define CMD_SET_EP_STAT(x) (0x00400500 | ((x) << 16))
99 #define CMD_CLR_BUF 0x00F20500
100 #define DAT_CLR_BUF 0x00F20200
101 #define CMD_VALID_BUF 0x00FA0500
103 #define DEV_ADDR_MASK 0x7F
106 #define CONF_DVICE 0x01
117 #define DEV_CON_CH 0x02
119 #define DEV_SUS_CH 0x08
122 #define ERR_EC_MASK 0x0F
126 #define ERR_UEPKT 0x02
127 #define ERR_DCRC 0x04
128 #define ERR_TIMOUT 0x08
130 #define ERR_B_OVRN 0x20
131 #define ERR_BTSTF 0x40
134 #define EP_SEL_F 0x01
135 #define EP_SEL_ST 0x02
136 #define EP_SEL_STP 0x04
137 #define EP_SEL_PO 0x08
138 #define EP_SEL_EPN 0x10
139 #define EP_SEL_B_1_FULL 0x20
140 #define EP_SEL_B_2_FULL 0x40
142 #define EP_STAT_ST 0x01
143 #define EP_STAT_DA 0x20
144 #define EP_STAT_RF_MO 0x40
145 #define EP_STAT_CND_ST 0x80
147 #define CLR_BUF_PO 0x01
150 #define NDD_REQ_INT 0x02
151 #define SYS_ERR_INT 0x04
168 uint16_t NextDDValid : 1;
170 uint16_t Isochronous : 1;
171 uint16_t MaxPacketSize : 11;
180 __IO uint16_t Retired : 1;
182 uint16_t IsoPacketValid : 1;
183 uint16_t LSByteExtracted : 1;
184 uint16_t MSByteExtracted : 1;
185 uint16_t MessageLengthPosition : 6;
195 #endif // __HAL_LPC17XX_H__