]> rtime.felk.cvut.cz Git - sysless.git/commitdiff
Ugly part of the LPC17xx USB compatibility changes.
authorPavel Pisa <pisa@cmp.felk.cvut.cz>
Sun, 26 Sep 2010 23:26:06 +0000 (01:26 +0200)
committerPavel Pisa <pisa@cmp.felk.cvut.cz>
Sun, 26 Sep 2010 23:26:06 +0000 (01:26 +0200)
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>
arch/arm/mach-lpc17xx/defines/lpc17xx-um2reg.sh [new file with mode: 0644]
libs4c/usb/lpcusb/lpc.c
libs4c/usb/lpcusb/lpcusb.c

diff --git a/arch/arm/mach-lpc17xx/defines/lpc17xx-um2reg.sh b/arch/arm/mach-lpc17xx/defines/lpc17xx-um2reg.sh
new file mode 100644 (file)
index 0000000..2e11eed
--- /dev/null
@@ -0,0 +1,12 @@
+#!/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/'
+
index 159c899851883ec9c1a94e88c05756de8f14c870..bace715fa25c9c3c8c656d06b1ef6443f43fc20e 100644 (file)
@@ -8,6 +8,10 @@
 #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);
index 6a597877ffd654e3653344906f1ae3e136013141..4041371cac03d849dd6c5abeb8267d6af71deb86 100644 (file)
@@ -8,6 +8,19 @@
 #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