30 #ifndef USB_DEVICE_H_INCLUDED 31 #define USB_DEVICE_H_INCLUDED 35 extern void UDD_WaitIN(
void);
36 extern void UDD_WaitOUT(
void);
37 extern void UDD_ClearIN(
void);
38 extern void UDD_ClearOUT(
void);
39 extern uint32_t UDD_WaitForINOrOUT(
void);
40 extern void UDD_ClearRxFlag(
unsigned char bEndpoint);
41 extern uint32_t UDD_ReceivedSetupInt(
void);
42 extern void UDD_ClearSetupInt(
void);
43 extern uint32_t UDD_ReadWriteAllowed(uint32_t ep);
44 extern uint32_t UDD_FifoByteCount(uint32_t ep);
45 extern uint8_t UDD_FifoFree(
void);
46 extern void UDD_ReleaseRX(uint32_t ep);
47 extern void UDD_ReleaseTX(uint32_t ep);
48 extern uint8_t UDD_FrameNumber(
void);
49 extern uint8_t UDD_GetConfiguration(
void);
51 extern uint32_t UDD_Send(uint32_t ep,
const void* data, uint32_t len);
52 extern void UDD_Send8(uint32_t ep, uint8_t data );
53 extern uint8_t UDD_Recv8(uint32_t ep);
54 extern void UDD_Recv(uint32_t ep, uint8_t* data, uint32_t len);
56 extern void UDD_InitEndpoints(
const uint32_t* eps_table,
const uint32_t ul_eps_table_size);
57 extern void UDD_InitControl(
int end);
58 extern uint32_t UDD_Init(
void);
59 extern void UDD_InitEP( uint32_t ul_ep, uint32_t ul_ep_cfg );
61 extern void UDD_Attach(
void);
62 extern void UDD_Detach(
void);
64 extern void UDD_SetStack(
void (*pf_isr)(
void));
65 extern void UDD_SetAddress(uint32_t
addr);
66 extern void UDD_Stall(
void);
67 extern uint32_t UDD_GetFrameNumber(
void);
74 typedef unsigned char Bool;
76 #if !defined(__bool_true_false_are_defined) 77 typedef unsigned char bool;
84 typedef uint16_t le16_t;
85 typedef uint16_t be16_t;
88 typedef uint32_t le32_t;
89 typedef uint32_t be32_t;
94 typedef uint32_t iram_size_t;
109 #define Rd_bits( value, mask) ((value) & (mask)) 119 #define Wr_bits(lvalue, mask, bits) ((lvalue) = ((lvalue) & ~(mask)) |\ 129 #define Tst_bits( value, mask) (Rd_bits(value, mask) != 0) 138 #define Clr_bits(lvalue, mask) ((lvalue) &= ~(mask)) 147 #define Set_bits(lvalue, mask) ((lvalue) |= (mask)) 156 #define Tgl_bits(lvalue, mask) ((lvalue) ^= (mask)) 165 #define Rd_bitfield( value, mask) (Rd_bits( value, mask) >> ctz(mask)) 175 #define Wr_bitfield(lvalue, mask, bitfield) (Wr_bits(lvalue, mask, (U32)(bitfield) << ctz(mask))) 192 #define TPASTE2( a, b) a##b 193 #define TPASTE3( a, b, c) a##b##c 194 #define TPASTE4( a, b, c, d) a##b##c##d 195 #define TPASTE5( a, b, c, d, e) a##b##c##d##e 196 #define TPASTE6( a, b, c, d, e, f) a##b##c##d##e##f 197 #define TPASTE7( a, b, c, d, e, f, g) a##b##c##d##e##f##g 198 #define TPASTE8( a, b, c, d, e, f, g, h) a##b##c##d##e##f##g##h 199 #define TPASTE9( a, b, c, d, e, f, g, h, i) a##b##c##d##e##f##g##h##i 200 #define TPASTE10(a, b, c, d, e, f, g, h, i, j) a##b##c##d##e##f##g##h##i##j 216 #define ATPASTE2( a, b) TPASTE2( a, b) 217 #define ATPASTE3( a, b, c) TPASTE3( a, b, c) 218 #define ATPASTE4( a, b, c, d) TPASTE4( a, b, c, d) 219 #define ATPASTE5( a, b, c, d, e) TPASTE5( a, b, c, d, e) 220 #define ATPASTE6( a, b, c, d, e, f) TPASTE6( a, b, c, d, e, f) 221 #define ATPASTE7( a, b, c, d, e, f, g) TPASTE7( a, b, c, d, e, f, g) 222 #define ATPASTE8( a, b, c, d, e, f, g, h) TPASTE8( a, b, c, d, e, f, g, h) 223 #define ATPASTE9( a, b, c, d, e, f, g, h, i) TPASTE9( a, b, c, d, e, f, g, h, i) 224 #define ATPASTE10(a, b, c, d, e, f, g, h, i, j) TPASTE10(a, b, c, d, e, f, g, h, i, j) 234 #if (defined __GNUC__) || (defined __CC_ARM) 235 # define ctz(u) __builtin_ctz(u) 237 # define ctz(u) ((u) & (1ul << 0) ? 0 : \ 238 (u) & (1ul << 1) ? 1 : \ 239 (u) & (1ul << 2) ? 2 : \ 240 (u) & (1ul << 3) ? 3 : \ 241 (u) & (1ul << 4) ? 4 : \ 242 (u) & (1ul << 5) ? 5 : \ 243 (u) & (1ul << 6) ? 6 : \ 244 (u) & (1ul << 7) ? 7 : \ 245 (u) & (1ul << 8) ? 8 : \ 246 (u) & (1ul << 9) ? 9 : \ 247 (u) & (1ul << 10) ? 10 : \ 248 (u) & (1ul << 11) ? 11 : \ 249 (u) & (1ul << 12) ? 12 : \ 250 (u) & (1ul << 13) ? 13 : \ 251 (u) & (1ul << 14) ? 14 : \ 252 (u) & (1ul << 15) ? 15 : \ 253 (u) & (1ul << 16) ? 16 : \ 254 (u) & (1ul << 17) ? 17 : \ 255 (u) & (1ul << 18) ? 18 : \ 256 (u) & (1ul << 19) ? 19 : \ 257 (u) & (1ul << 20) ? 20 : \ 258 (u) & (1ul << 21) ? 21 : \ 259 (u) & (1ul << 22) ? 22 : \ 260 (u) & (1ul << 23) ? 23 : \ 261 (u) & (1ul << 24) ? 24 : \ 262 (u) & (1ul << 25) ? 25 : \ 263 (u) & (1ul << 26) ? 26 : \ 264 (u) & (1ul << 27) ? 27 : \ 265 (u) & (1ul << 28) ? 28 : \ 266 (u) & (1ul << 29) ? 29 : \ 267 (u) & (1ul << 30) ? 30 : \ 268 (u) & (1ul << 31) ? 31 : \ 292 #if (defined __GNUC__) || (defined __CC_ARM) 293 # define clz(u) __builtin_clz(u) 294 #elif (defined __ICCARM__) 295 # define clz(u) __CLZ(u) 297 # define clz(u) (((u) == 0) ? 32 : \ 298 ((u) & (1ul << 31)) ? 0 : \ 299 ((u) & (1ul << 30)) ? 1 : \ 300 ((u) & (1ul << 29)) ? 2 : \ 301 ((u) & (1ul << 28)) ? 3 : \ 302 ((u) & (1ul << 27)) ? 4 : \ 303 ((u) & (1ul << 26)) ? 5 : \ 304 ((u) & (1ul << 25)) ? 6 : \ 305 ((u) & (1ul << 24)) ? 7 : \ 306 ((u) & (1ul << 23)) ? 8 : \ 307 ((u) & (1ul << 22)) ? 9 : \ 308 ((u) & (1ul << 21)) ? 10 : \ 309 ((u) & (1ul << 20)) ? 11 : \ 310 ((u) & (1ul << 19)) ? 12 : \ 311 ((u) & (1ul << 18)) ? 13 : \ 312 ((u) & (1ul << 17)) ? 14 : \ 313 ((u) & (1ul << 16)) ? 15 : \ 314 ((u) & (1ul << 15)) ? 16 : \ 315 ((u) & (1ul << 14)) ? 17 : \ 316 ((u) & (1ul << 13)) ? 18 : \ 317 ((u) & (1ul << 12)) ? 19 : \ 318 ((u) & (1ul << 11)) ? 20 : \ 319 ((u) & (1ul << 10)) ? 21 : \ 320 ((u) & (1ul << 9)) ? 22 : \ 321 ((u) & (1ul << 8)) ? 23 : \ 322 ((u) & (1ul << 7)) ? 24 : \ 323 ((u) & (1ul << 6)) ? 25 : \ 324 ((u) & (1ul << 5)) ? 26 : \ 325 ((u) & (1ul << 4)) ? 27 : \ 326 ((u) & (1ul << 3)) ? 28 : \ 327 ((u) & (1ul << 2)) ? 29 : \ 328 ((u) & (1ul << 1)) ? 30 : \ 353 #define Abs(a) (((a) < 0 ) ? -(a) : (a)) 364 #define Min(a, b) (((a) < (b)) ? (a) : (b)) 375 #define Max(a, b) (((a) > (b)) ? (a) : (b)) 388 #define min(a, b) Min(a, b) 399 #define max(a, b) Max(a, b) union emac_rx_addr addr
Definition: emac.h:123