mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-17 05:32:55 +08:00
move nvic prio in hal/dcd to bsp for portability
This commit is contained in:
parent
57b85262b2
commit
522b0c11ef
@ -52,20 +52,6 @@
|
||||
|
||||
#include "ansi_escape.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// PRINTF TARGET DEFINE
|
||||
//--------------------------------------------------------------------+
|
||||
/** \defgroup group_printf Printf Retarget
|
||||
* \brief Retarget the standard stdio printf/getchar to other IOs
|
||||
* @{ */
|
||||
#define PRINTF_TARGET_SEMIHOST 1 ///< Using the semihost support from toolchain, requires no hardware but is the slowest
|
||||
#define PRINTF_TARGET_UART 2 ///< Using UART as stdio, this is the default for most of the board
|
||||
#define PRINTF_TARGET_SWO 3 ///< Using non-instructive serial wire output (SWO), is the best option since it does not slow down MCU but requires supported from debugger and IDE
|
||||
#define PRINTF_TARGET_NONE 4 ///< Using none at all.
|
||||
/** @} */
|
||||
|
||||
#define PRINTF(...) printf(__VA_ARGS__)
|
||||
|
||||
#if defined BOARD_LPCXPRESSO11U14
|
||||
#include "lpcxpresso11u14/board_lpcxpresso11u14.h"
|
||||
#elif defined BOARD_LPCXPRESSO11U68
|
||||
|
@ -47,9 +47,6 @@
|
||||
#include "lpc11uxx_gpio.h"
|
||||
#include "lpc11uxx_uart.h"
|
||||
|
||||
//#define CFG_PRINTF_TARGET PRINTF_TARGET_SEMIHOST
|
||||
#define CFG_PRINTF_TARGET PRINTF_TARGET_UART
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -47,9 +47,6 @@
|
||||
#include "lpc11uxx_gpio.h"
|
||||
#include "lpc11uxx_uart.h"
|
||||
|
||||
//#define CFG_PRINTF_TARGET PRINTF_TARGET_SEMIHOST
|
||||
#define CFG_PRINTF_TARGET PRINTF_TARGET_UART
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -37,15 +37,18 @@
|
||||
/**************************************************************************/
|
||||
|
||||
#include "bsp/board.h"
|
||||
#include "tusb.h"
|
||||
|
||||
#ifdef BOARD_LPCXPRESSO1769
|
||||
|
||||
#include "LPC17xx.h"
|
||||
#include "lpc17xx_clkpwr.h"
|
||||
#include "lpc17xx_gpio.h"
|
||||
#include "lpc17xx_uart.h"
|
||||
#include "lpc17xx_pinsel.h"
|
||||
|
||||
#define BOARD_LED_PORT (0)
|
||||
#define BOARD_LED_PIN (22)
|
||||
#include "tusb.h"
|
||||
|
||||
#define BOARD_LED0_PORT (0)
|
||||
|
||||
static const struct {
|
||||
uint8_t port;
|
||||
@ -73,10 +76,13 @@ void board_init(void)
|
||||
|
||||
#if CFG_TUSB_OS == OPT_OS_NONE // TODO may move to main.c
|
||||
SysTick_Config(SystemCoreClock / BOARD_TICKS_HZ); // 1 msec tick timer
|
||||
#elif CFG_TUSB_OS == OPT_OS_FREERTOS
|
||||
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
|
||||
NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
||||
#endif
|
||||
|
||||
//------------- LED -------------//
|
||||
GPIO_SetDir(BOARD_LED_PORT, BIT_(BOARD_LED_PIN), 1);
|
||||
GPIO_SetDir(BOARD_LED0_PORT, BIT_(BOARD_LED0), 1);
|
||||
|
||||
//------------- BUTTON -------------//
|
||||
for(uint8_t i=0; i<BOARD_BUTTON_COUNT; i++) GPIO_SetDir(buttons[i].port, BIT_(buttons[i].pin), 0);
|
||||
@ -146,10 +152,10 @@ void board_led_control(uint32_t id, bool state)
|
||||
|
||||
if (state)
|
||||
{
|
||||
GPIO_SetValue(BOARD_LED_PORT, BIT_(BOARD_LED_PIN));
|
||||
GPIO_SetValue(BOARD_LED0_PORT, BIT_(BOARD_LED0));
|
||||
}else
|
||||
{
|
||||
GPIO_ClearValue(BOARD_LED_PORT, BIT_(BOARD_LED_PIN));
|
||||
GPIO_ClearValue(BOARD_LED0_PORT, BIT_(BOARD_LED0));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,12 +49,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CFG_PRINTF_TARGET PRINTF_TARGET_UART
|
||||
//#define CFG_PRINTF_TARGET PRINTF_TARGET_SWO
|
||||
|
||||
#define BOARD_LED_NUM 1
|
||||
#define BOARD_LED0 0
|
||||
|
||||
#define BOARD_LED0 22
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -44,8 +44,6 @@
|
||||
#include "dcd_lpc175x_6x.h"
|
||||
#include "LPC17xx.h"
|
||||
|
||||
#include "osal/osal.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
@ -199,14 +197,6 @@ bool dcd_init(uint8_t rhport)
|
||||
sie_write(SIE_CMDCODE_DEVICE_STATUS, 1, 1); // connect
|
||||
|
||||
// USB IRQ priority should be set by application previously
|
||||
// If freeRTOS is used, IRQ priority is limit by max syscall ( smaller is higher )
|
||||
#if CFG_TUSB_OS == OPT_OS_FREERTOS
|
||||
if ( NVIC_GetPriority(USB_IRQn) < configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY )
|
||||
{
|
||||
NVIC_SetPriority(USB_IRQn, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
|
||||
}
|
||||
#endif
|
||||
|
||||
NVIC_ClearPendingIRQ(USB_IRQn);
|
||||
NVIC_EnableIRQ(USB_IRQn);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user