summaryrefslogtreecommitdiff
path: root/tinyusb/hal
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-06-08 02:50:10 +0700
committerhathach <[email protected]>2013-06-08 02:50:10 +0700
commit503d279af58538f8c00966c48f3ff862f4cde2a0 (patch)
tree586a83a4697fbd74aab640ca861705563785d0c0 /tinyusb/hal
parente3bb5e9f2fcdf2d5f3e224ede4a85d38276dc462 (diff)
ADDING LPC176X device
implementing dcd_lpc175x_6x.c add usbd_dcd.h add usbd_isr with TUSB_EVENT_SETUP_RECEIVED & TUSB_EVENT_BUS_RESET event parameterize TUSB_CFG_DEVICE_CONTROL_PACKET_SIZE (replace USB_MAX_PACKET0) --> able to get interrupt and receive setup packet, but SET ADDRESS (expected get device descriptor). uncomment write zero length will cause issue, no more interrupt ?
Diffstat (limited to 'tinyusb/hal')
-rw-r--r--tinyusb/hal/hal_lpc175x_6x.c7
-rw-r--r--tinyusb/hal/hal_lpc175x_6x.h3
2 files changed, 9 insertions, 1 deletions
diff --git a/tinyusb/hal/hal_lpc175x_6x.c b/tinyusb/hal/hal_lpc175x_6x.c
index 82ba772d1..3f1b2a357 100644
--- a/tinyusb/hal/hal_lpc175x_6x.c
+++ b/tinyusb/hal/hal_lpc175x_6x.c
@@ -46,11 +46,16 @@
#include "common/common.h"
#include "hal.h"
+enum {
+ PCONP_PCUSB = 31
+};
+
//--------------------------------------------------------------------+
// IMPLEMENTATION
//--------------------------------------------------------------------+
tusb_error_t hal_init(void)
{
+ //------------- user manual 11.13 usb device controller initialization -------------//
// TODO remove magic number
/* Enable AHB clock to the USB block and USB RAM. */
// LPC_SYSCON->SYSAHBCLKCTRL |= ((0x1<<14) | (0x1<<27));
@@ -61,7 +66,7 @@ tusb_error_t hal_init(void)
// LPC_PINCON->PINSEL3 &= ~(3<<6); TODO HOST
// LPC_PINCON->PINSEL3 |= (2<<6);
- LPC_SC->PCONP |= (1UL<<31); /* USB PCLK -> enable USB Per.*/
+ LPC_SC->PCONP |= BIT_(PCONP_PCUSB); /* USB PCLK -> enable USB Per.*/
// DEVICE mode
LPC_USB->USBClkCtrl = 0x12; /* Dev, PortSel, AHB clock enable */
diff --git a/tinyusb/hal/hal_lpc175x_6x.h b/tinyusb/hal/hal_lpc175x_6x.h
index e57048e14..3b94b23c3 100644
--- a/tinyusb/hal/hal_lpc175x_6x.h
+++ b/tinyusb/hal/hal_lpc175x_6x.h
@@ -52,6 +52,9 @@
#include "LPC17xx.h"
+//--------------------------------------------------------------------+
+//
+//--------------------------------------------------------------------+
static inline void hal_interrupt_enable(uint8_t controller_id)
{
(void) controller_id; // discard compiler's warning