this is the Peter Barrett USBHostShell program, a bit modified for being a bit more talkactive, just to let u know how the USB protocol layer is going on, and all the data trasnfers. Also there is a small implementation of HID descriptors, but not functional... yet :S the aim is to at least implement the gamepad HID, and make an array of function pointer to each HID function

Dependencies:   mbed

Committer:
Sergio
Date:
Mon Sep 13 12:40:05 2010 +0000
Revision:
0:e1e03118b8fe

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sergio 0:e1e03118b8fe 1
Sergio 0:e1e03118b8fe 2 typedef unsigned char u8;
Sergio 0:e1e03118b8fe 3 typedef unsigned short u16;
Sergio 0:e1e03118b8fe 4 typedef unsigned long u32;
Sergio 0:e1e03118b8fe 5
Sergio 0:e1e03118b8fe 6 void DelayMS(int ms);
Sergio 0:e1e03118b8fe 7
Sergio 0:e1e03118b8fe 8 void printfBytes(const char* label,const u8* data, int len);
Sergio 0:e1e03118b8fe 9 void printHex(const u8* d, int len);
Sergio 0:e1e03118b8fe 10
Sergio 0:e1e03118b8fe 11 #ifndef min
Sergio 0:e1e03118b8fe 12 #define min(_a,_b) ((_a) < (_b) ? (_a) : (_b))
Sergio 0:e1e03118b8fe 13 #endif
Sergio 0:e1e03118b8fe 14
Sergio 0:e1e03118b8fe 15 inline int LE16(const u8* d)
Sergio 0:e1e03118b8fe 16 {
Sergio 0:e1e03118b8fe 17 return d[0] | (d[1] << 8);
Sergio 0:e1e03118b8fe 18 }
Sergio 0:e1e03118b8fe 19
Sergio 0:e1e03118b8fe 20 inline u32 BE32(const u8* d)
Sergio 0:e1e03118b8fe 21 {
Sergio 0:e1e03118b8fe 22 return (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | d[3];
Sergio 0:e1e03118b8fe 23 }
Sergio 0:e1e03118b8fe 24
Sergio 0:e1e03118b8fe 25 inline void BE32(u32 n, u8* d)
Sergio 0:e1e03118b8fe 26 {
Sergio 0:e1e03118b8fe 27 d[0] = (u8)(n >> 24);
Sergio 0:e1e03118b8fe 28 d[1] = (u8)(n >> 16);
Sergio 0:e1e03118b8fe 29 d[2] = (u8)(n >> 8);
Sergio 0:e1e03118b8fe 30 d[3] = (u8)n;
Sergio 0:e1e03118b8fe 31 }
Sergio 0:e1e03118b8fe 32
Sergio 0:e1e03118b8fe 33 inline void BE16(u32 n, u8* d)
Sergio 0:e1e03118b8fe 34 {
Sergio 0:e1e03118b8fe 35 d[0] = (u8)(n >> 8);
Sergio 0:e1e03118b8fe 36 d[1] = (u8)n;
Sergio 0:e1e03118b8fe 37 }