#include "usbdebug.h"\r
#include "usbhw_lpc.h"\r
#include "usbapi.h"\r
-// Configure LED pin functions\r
-//\r
-// LED pin functions\r
-//\r
-// Function Pin Port Bits Pin Select Register\r
-// ------------------- --- ----- ---- -------------------\r
-// P2.0 GPIO Port 2.0 xx P2.0 1:0 PINSEL4\r
-// P2.1 GPIO Port 2.1 xx P2.1 3:2 PINSEL4\r
-// P2.2 GPIO Port 2.2 xx P2.2 5:4 PINSEL4\r
-// P2.3 GPIO Port 2.3 xx P2.3 7:6 PINSEL4\r
-// P2.4 GPIO Port 2.4 xx P2.4 9:8 PINSEL4\r
-// P2.5 GPIO Port 2.5 xx P2.5 11:10 PINSEL4\r
-// P2.6 GPIO Port 2.6 xx P2.6 13:12 PINSEL4\r
-// P2.7 GPIO Port 2.7 xx P2.7 15:14 PINSEL4\r
-//\r
-// OFF - LED state 0\r
-// ON - LED state 1\r
-//\r
-// '*' as GPIO\r
-\r
-#define NO_LEDS 8\r
-\r
-#define LED_0 (1 << 0)\r
-#define LED_1 (1 << 1)\r
-#define LED_2 (1 << 2)\r
-#define LED_3 (1 << 3)\r
-#define LED_4 (1 << 4)\r
-#define LED_5 (1 << 5)\r
-#define LED_6 (1 << 6)\r
-#define LED_7 (1 << 7)\r
\r
#ifdef DEBUG\r
// comment out the following line if you don't want to use debug LEDs\r
//#define DEBUG_LED\r
#endif\r
\r
-#ifdef DEBUG_LED\r
-#define DEBUG_LED_ON(x) FIO2SET = (1 << x);\r
-#define DEBUG_LED_OFF(x) FIO2CLR = (1 << x);\r
-#define DEBUG_LED_INIT(x) PINSEL2 &= ~(0x3 << (2*x)); FIO2DIR |= (1 << x); DEBUG_LED_OFF(x);\r
-#else\r
-#define DEBUG_LED_INIT(x) /**< LED initialisation macro */\r
-#define DEBUG_LED_ON(x) /**< turn LED on */\r
-#define DEBUG_LED_OFF(x) /**< turn LED off */\r
-#endif\r
-\r
/** Installed device interrupt handler */\r
static TFnDevIntHandler *_pfnDevIntHandler = NULL;\r
/** Installed endpoint interrupt handlers */\r
int i;\r
unsigned short wFrame;\r
\r
- // LED9 monitors total time in interrupt routine\r
- DEBUG_LED_ON(6);\r
-\r
// handle device interrupts\r
dwStatus = USB->USBDevIntSt;\r
\r
((bDevStat & RST) ? DEV_STATUS_RESET : 0);\r
// call handler\r
if (_pfnDevIntHandler != NULL) {\r
- DEBUG_LED_ON(5); \r
_pfnDevIntHandler(bStat);\r
- DEBUG_LED_OFF(5); \r
}\r
}\r
}\r
((bEPStat & EPSTAT_PO) ? EP_STATUS_ERROR : 0);\r
// call handler\r
if (_apfnEPIntHandlers[i / 2] != NULL) {\r
- DEBUG_LED_ON(7); \r
_apfnEPIntHandlers[i / 2](IDX2EP(i), bStat);\r
- DEBUG_LED_OFF(7);\r
}\r
}\r
}\r
}\r
- \r
- DEBUG_LED_OFF(6); \r
}\r
\r
\r
/**\r
Initialises the USB hardware\r
\r
- This function assumes that the hardware is connected as shown in\r
- section 10.1 of the LPC2148 data sheet:\r
- * P0.31 controls a switch to connect a 1.5k pull-up to D+ if low.\r
- * P0.23 is connected to USB VCC.\r
- \r
- Embedded artists board: make sure to disconnect P0.23 LED as it\r
- acts as a pull-up and so prevents detection of USB disconnect.\r
\r
@return TRUE if the hardware was successfully initialised\r
*/\r