summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-11-29 22:59:00 +0700
committerhathach <[email protected]>2018-11-29 22:59:00 +0700
commit522b0c11efa9be870f806b452d0ca734738880c9 (patch)
tree78cf822abe2c6fae8d8bb2abd5b0b77fbef38b85
parent57b85262b21333b3fe59f8abaeddda59c86b808b (diff)
move nvic prio in hal/dcd to bsp for portability
-rw-r--r--hw/bsp/board.h14
-rw-r--r--hw/bsp/lpcxpresso/board_lpcxpresso11u14.h3
-rw-r--r--hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.h3
-rw-r--r--hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c18
-rw-r--r--hw/bsp/lpcxpresso1769/board_lpcxpresso1769.h6
-rw-r--r--src/portable/nxp/lpc17xx/dcd_lpc175x_6x.c10
6 files changed, 13 insertions, 41 deletions
diff --git a/hw/bsp/board.h b/hw/bsp/board.h
index 2a946025c..92c5f2854 100644
--- a/hw/bsp/board.h
+++ b/hw/bsp/board.h
@@ -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
diff --git a/hw/bsp/lpcxpresso/board_lpcxpresso11u14.h b/hw/bsp/lpcxpresso/board_lpcxpresso11u14.h
index 5da48c33b..ce46cb939 100644
--- a/hw/bsp/lpcxpresso/board_lpcxpresso11u14.h
+++ b/hw/bsp/lpcxpresso/board_lpcxpresso11u14.h
@@ -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
diff --git a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.h b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.h
index fa62315e5..6296a6d27 100644
--- a/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.h
+++ b/hw/bsp/lpcxpresso11u68/board_lpcxpresso11u68.h
@@ -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
diff --git a/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c b/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c
index 6c29298c2..edbe7c8f0 100644
--- a/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c
+++ b/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.c
@@ -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));
}
}
diff --git a/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.h b/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.h
index afec82282..427c9ebee 100644
--- a/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.h
+++ b/hw/bsp/lpcxpresso1769/board_lpcxpresso1769.h
@@ -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
}
diff --git a/src/portable/nxp/lpc17xx/dcd_lpc175x_6x.c b/src/portable/nxp/lpc17xx/dcd_lpc175x_6x.c
index 517f037d0..af7ceae0c 100644
--- a/src/portable/nxp/lpc17xx/dcd_lpc175x_6x.c
+++ b/src/portable/nxp/lpc17xx/dcd_lpc175x_6x.c
@@ -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);