The style of header files should be united one day,
but right solution is questionable.
I personally do not feel safe with registers overlay
structures. They are comfortable, but Linux style
access routines over base and offset are more
portable.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
--- /dev/null
+#!/bin/sh
+
+#pdftotext -nopgbrk user.manual.lpc17xx.pdf lpc17xx-um.txt
+
+# 10.1.1 USB Clock Control register (USBClkCtrl - 0x5000 CFF4)
+# #define USBDevIntSt_o 0x0000 /* USB Device Interrupt Status (RO) */
+# #define USBDevIntSt (*(REG32*)(USB_REGS_BASE+USBDevIntSt_o))
+
+cat lpc17xx-um.txt | \
+ sed -n -e 's/^[0-9.]* \+\([^(]*\) \+(\([^ ]*\) - 0x5000 C\([^)]*\)).*$/\3@#define \2_o\t0x0\3\t\/* \1 *\/\nx\3@#define \2\t(*(REG32*)(USB_REGS_BASE+\2_o))/p' | \
+ sort -u | sed -e 's/^.*@\(.*\)$/\1/'
+
#include <usb/usb.h>
#include <usb/lpcusb.h>
+#ifdef MACH_LPC17XX
+#include <lpcUSB.h>
+#endif
+
/* set device address */
int usb_lpc_set_addr( usb_device_t *udev, unsigned char addr) {
lpc_usb_set_addr(addr);
#include <usb/usb.h>
#include <usb/lpcusb.h>
+#ifdef MACH_LPC17XX
+ #include <LPC17xx.h>
+ #include <lpcUSB.h>
+ #ifndef PINSEL1
+ #define PINSEL1 (PINCON->PINSEL1)
+ #define PINSEL3 (PINCON->PINSEL3)
+ #define PINSEL4 (PINCON->PINSEL4)
+ #endif
+ #ifndef PCONP
+ #define PCONP (SC->PCONP)
+ #endif
+#endif
+
#ifndef USB_VBUS_PIN_USED
#define USB_VBUS_PIN_USED 1
#endif