lpc40xx device work, moving Chip_USB_Init out of tinyusb
This commit is contained in:
@@ -103,7 +103,7 @@ typedef struct
|
||||
|
||||
} dcd_data_t;
|
||||
|
||||
ATTR_ALIGNED(128) static dcd_data_t _dcd;
|
||||
CFG_TUSB_MEM_SECTION ATTR_ALIGNED(128) static dcd_data_t _dcd;
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
@@ -59,30 +59,6 @@ void tusb_hal_int_disable(uint8_t rhport)
|
||||
//--------------------------------------------------------------------+
|
||||
bool tusb_hal_init(void)
|
||||
{
|
||||
enum {
|
||||
USBCLK_DEVCIE = 0x12, // AHB + Device
|
||||
USBCLK_HOST = 0x19, // AHB + Host + OTG (!)
|
||||
};
|
||||
|
||||
Chip_USB_Init();
|
||||
|
||||
#if MODE_HOST_SUPPORTED
|
||||
// TODO move pin config to BSP
|
||||
PINSEL_ConfigPin( &(PINSEL_CFG_Type) { .Portnum = 1, .Pinnum = 22, .Funcnum = 2} ); // P1.22 as USB_PWRD
|
||||
PINSEL_ConfigPin( &(PINSEL_CFG_Type) { .Portnum = 1, .Pinnum = 19, .Funcnum = 2} ); // P1.19 as USB_PPWR
|
||||
|
||||
// Enable host
|
||||
LPC_USB->USBClkCtrl = USBCLK_HOST;
|
||||
while ((LPC_USB->USBClkSt & USBCLK_HOST) != USBCLK_HOST);
|
||||
LPC_USB->OTGClkSt = 0x3;
|
||||
#endif
|
||||
|
||||
#if TUSB_OPT_DEVICE_ENABLED
|
||||
// Enable Device
|
||||
LPC_USB->USBClkCtrl = USBCLK_DEVCIE;
|
||||
while ((LPC_USB->USBClkSt & USBCLK_DEVCIE) != USBCLK_DEVCIE);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -153,6 +153,10 @@
|
||||
#define CFG_TUSB_MEM_SECTION
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUSB_MEM_ALIGN
|
||||
#define CFG_TUSB_MEM_ALIGN ATTR_ALIGNED(4)
|
||||
#endif
|
||||
|
||||
#ifndef CFG_TUSB_OS
|
||||
#define CFG_TUSB_OS OPT_OS_NONE
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user