+static void lpc_usb_configure_pins(void)
+{
+#ifdef USB_PPWR2_PIN
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB_PPWR2_PIN);
+#endif
+#ifdef USB_DPLUS_PIN
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB_DPLUS_PIN);
+#endif
+#ifdef USB_DMINUS_PIN
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB_DMINUS_PIN);
+#endif
+#ifdef USB1_DPLUS_PIN
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB1_DPLUS_PIN);
+#endif
+#ifdef USB1_DMINUS_PIN
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB1_DMINUS_PIN);
+#endif
+#ifdef USB2_DPLUS_PIN
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB2_DPLUS_PIN);
+#endif
+#ifdef USB2_DMINUS_PIN
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB2_DMINUS_PIN);
+#endif
+#ifdef USB2_OVRCR_PIN
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB2_OVRCR_PIN);
+#endif
+#ifdef USB_CONNECT_PIN
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB_CONNECT_PIN);
+#endif
+#ifdef USB1_CONNECT_PIN
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB1_CONNECT_PIN);
+#endif
+#ifdef USB1_PWR_SW_PIN
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB1_PWR_SW_PIN);
+#endif
+#ifdef USB1_ID_PIN
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB1_ID_PIN);
+#endif
+#if defined(USB_VBUS_PIN) && defined(USB_VBUS_PIN_USED)
+ #define NEW_USB_PIN_CFG
+ hal_pin_conf(USB_VBUS_PIN);
+#endif
+
+#ifndef NEW_USB_PIN_CFG
+#if defined(INC_LPC214x_H) || defined(MACH_LPC21XX)
+ PINSEL1 &= ~0xC000C000;
+// PINSEL1 |= 0x40004000; /* Select USB Link, VBUS */
+ PINSEL1 |= 0x80000000; /* Select USB Link, VBUS */
+#endif /* MACH_LPC21XX */
+#if defined(MACH_LPC23XX) || defined(MACH_LPC17XX) || defined(MACH_LPC178X)
+ /* set up USB pins */
+ PINSEL1 = (PINSEL1 & ~(0x3<<26)) | (0x1<<26); /* USB_D+,- @ P0.29,30 */
+ PINSEL4 = (PINSEL4 & ~(0x3<<18)) | (0x1<<18); /* USB_CONNECT @ P2.9 */
+#if USB_VBUS_PIN_USED
+ PINSEL3 = (PINSEL3 & ~(0x3<<28)) | (0x2<<28); /* Vbus @ P1.30 */
+#endif
+#endif /* Known LPC MACH */
+#endif /*NEW_USB_PIN_CFG*/
+}
+