working on nrf52

This commit is contained in:
hathach
2018-03-13 16:30:53 +07:00
parent 2435abb0a8
commit ffca1f5e64
20 changed files with 186 additions and 100 deletions

View File

@@ -41,13 +41,13 @@
#if TUSB_CFG_MCU == MCU_LPC11UXX
void tusb_hal_init_enable(uint8_t port)
void tusb_hal_int_enable(uint8_t port)
{
(void) port; // discard compiler's warning
NVIC_EnableIRQ(USB_IRQn);
}
void tusb_hal_init_disable(uint8_t port)
void tusb_hal_int_disable(uint8_t port)
{
(void) port; // discard compiler's warning
NVIC_DisableIRQ(USB_IRQn);

View File

@@ -41,13 +41,13 @@
#if TUSB_CFG_MCU == MCU_LPC13UXX
void tusb_hal_init_enable(uint8_t port)
void tusb_hal_int_enable(uint8_t port)
{
(void) port; // discard compiler's warning
NVIC_EnableIRQ(USB_IRQ_IRQn);
}
void tusb_hal_init_disable(uint8_t port)
void tusb_hal_int_disable(uint8_t port)
{
(void) port; // discard compiler's warning
NVIC_DisableIRQ(USB_IRQ_IRQn);

View File

@@ -41,13 +41,13 @@
#if TUSB_CFG_MCU == MCU_LPC175X_6X
void tusb_hal_init_enable(uint8_t port)
void tusb_hal_int_enable(uint8_t port)
{
(void) port; // discard compiler's warning
NVIC_EnableIRQ(USB_IRQn);
}
void tusb_hal_init_disable(uint8_t port)
void tusb_hal_int_disable(uint8_t port)
{
(void) port; // discard compiler's warning
NVIC_DisableIRQ(USB_IRQn);
@@ -111,4 +111,10 @@ void USB_IRQHandler(void)
#endif
}
void check_failed(uint8_t *file, uint32_t line)
{
(void) file;
(void) line;
}
#endif

View File

@@ -160,6 +160,9 @@ bool tusb_dcd_init(uint8_t port)
lpc_usb->USBCMD_D &= ~0x00FF0000; // Interrupt Threshold Interval = 0
lpc_usb->USBCMD_D |= BIT_(0); // connect
// enable interrupt
NVIC_EnableIRQ(port ? USB1_IRQn : USB0_IRQn);
return true;
}

View File

@@ -53,6 +53,22 @@ enum {
LPC43XX_USBMODE_VBUS_HIGH = 1
};
#if TUSB_CFG_OS == TUSB_OS_NONE
volatile uint32_t system_ticks = 0;
void SysTick_Handler (void)
{
system_ticks++;
}
uint32_t tusb_hal_tick_get(void)
{
return system_ticks;
}
#endif
void tusb_hal_dbg_breakpoint(void)
{
// M0 cannot check if debugger is attached or not
@@ -65,12 +81,12 @@ void tusb_hal_dbg_breakpoint(void)
#endif
}
void tusb_hal_init_enable(uint8_t port)
void tusb_hal_int_enable(uint8_t port)
{
NVIC_EnableIRQ(port ? USB1_IRQn : USB0_IRQn);
}
void tusb_hal_init_disable(uint8_t port)
void tusb_hal_int_disable(uint8_t port)
{
NVIC_DisableIRQ(port ? USB1_IRQn : USB0_IRQn);
}
@@ -167,4 +183,11 @@ void USB1_IRQHandler(void)
}
#endif
void check_failed(uint8_t *file, uint32_t line)
{
(void) file;
(void) line;
}
#endif