mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
use max32 cmsis, fix NVIC_GetEnableIRQ() not defined when using with CMISIS < 5
This commit is contained in:
parent
f6b96f7ea9
commit
0be427bae9
@ -24,12 +24,24 @@
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "bsp/board_api.h"
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes" // _mxc_crit_get_state()
|
||||
#endif
|
||||
|
||||
#include "gpio.h"
|
||||
#include "mxc_sys.h"
|
||||
#include "mxc_device.h"
|
||||
#include "uart.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "board.h"
|
||||
#include "bsp/board_api.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -74,7 +74,6 @@ function(add_board_target BOARD_TARGET)
|
||||
)
|
||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||
${CMSIS_5}/CMSIS/Core/Include
|
||||
${MAX32_CMSIS}/Include
|
||||
${MAX32_CMSIS}/Device/Maxim/MAX32650/Include
|
||||
${MAX32_PERIPH}/Include/MAX32650
|
||||
|
@ -82,14 +82,13 @@ SRC_C += \
|
||||
$(PERIPH_SRC)/ICC/icc_reva.c \
|
||||
$(PERIPH_SRC)/ICC/icc_common.c \
|
||||
$(PERIPH_SRC)/TPU/tpu_me10.c \
|
||||
$(PERIPH_SRC)/TPU/tpu_reva.c \
|
||||
$(PERIPH_SRC)/TPU/tpu_reva.c \
|
||||
$(PERIPH_SRC)/UART/uart_common.c \
|
||||
$(PERIPH_SRC)/UART/uart_me10.c \
|
||||
$(PERIPH_SRC)/UART/uart_reva.c \
|
||||
|
||||
INC += \
|
||||
$(TOP)/$(BOARD_PATH) \
|
||||
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \
|
||||
$(TOP)/$(MAX32_CMSIS)/Include \
|
||||
$(TOP)/$(MAX32_CMSIS)/Device/Maxim/MAX32650/Include \
|
||||
$(TOP)/$(MAX32_PERIPH)/Include/MAX32650 \
|
||||
|
@ -24,13 +24,24 @@
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "bsp/board_api.h"
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes" // _mxc_crit_get_state()
|
||||
#endif
|
||||
|
||||
#include "gpio.h"
|
||||
#include "mxc_sys.h"
|
||||
#include "mcr_regs.h"
|
||||
#include "mxc_device.h"
|
||||
#include "uart.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "board.h"
|
||||
#include "bsp/board_api.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -70,7 +70,6 @@ function(add_board_target BOARD_TARGET)
|
||||
)
|
||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||
${CMSIS_5}/CMSIS/Core/Include
|
||||
${MAX32_CMSIS}/Include
|
||||
${MAX32_CMSIS}/Device/Maxim/MAX32665/Include
|
||||
${MAX32_PERIPH}/Include/MAX32665
|
||||
|
@ -82,7 +82,6 @@ SRC_C += \
|
||||
|
||||
INC += \
|
||||
$(TOP)/$(BOARD_PATH) \
|
||||
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \
|
||||
$(TOP)/$(MAX32_CMSIS)/Include \
|
||||
$(TOP)/$(MAX32_CMSIS)/Device/Maxim/MAX32665/Include \
|
||||
$(TOP)/$(MAX32_PERIPH)/Include/MAX32665 \
|
||||
|
@ -24,13 +24,25 @@
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "bsp/board_api.h"
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes" // _mxc_crit_get_state()
|
||||
#endif
|
||||
|
||||
#include "gpio.h"
|
||||
#include "mxc_sys.h"
|
||||
#include "mcr_regs.h"
|
||||
#include "mxc_device.h"
|
||||
#include "uart.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "board.h"
|
||||
#include "bsp/board_api.h"
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -75,7 +75,6 @@ function(add_board_target BOARD_TARGET)
|
||||
)
|
||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||
${CMSIS_5}/CMSIS/Core/Include
|
||||
${MAX32_CMSIS}/Include
|
||||
${MAX32_CMSIS}/Device/Maxim/MAX32690/Include
|
||||
${MAX32_PERIPH}/Include/MAX32690
|
||||
|
@ -90,7 +90,6 @@ SRC_C += \
|
||||
|
||||
INC += \
|
||||
$(TOP)/$(BOARD_PATH) \
|
||||
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \
|
||||
$(TOP)/$(MAX32_CMSIS)/Include \
|
||||
$(TOP)/$(MAX32_CMSIS)/Device/Maxim/MAX32690/Include \
|
||||
$(TOP)/$(MAX32_PERIPH)/Include/MAX32690 \
|
||||
|
@ -24,13 +24,24 @@
|
||||
* This file is part of the TinyUSB stack.
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "bsp/board_api.h"
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-prototypes" // _mxc_crit_get_state()
|
||||
#endif
|
||||
|
||||
#include "gpio.h"
|
||||
#include "mxc_sys.h"
|
||||
#include "mcr_regs.h"
|
||||
#include "mxc_device.h"
|
||||
#include "uart.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#include "board.h"
|
||||
#include "bsp/board_api.h"
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// Forward USB interrupt events to TinyUSB IRQ Handler
|
||||
//--------------------------------------------------------------------+
|
||||
|
@ -72,7 +72,6 @@ function(add_board_target BOARD_TARGET)
|
||||
)
|
||||
target_include_directories(${BOARD_TARGET} PUBLIC
|
||||
${CMAKE_CURRENT_FUNCTION_LIST_DIR}
|
||||
${CMSIS_5}/CMSIS/Core/Include
|
||||
${MAX32_CMSIS}/Include
|
||||
${MAX32_CMSIS}/Device/Maxim/MAX78002/Include
|
||||
${MAX32_PERIPH}/Include/MAX78002
|
||||
|
@ -87,7 +87,6 @@ SRC_C += \
|
||||
|
||||
INC += \
|
||||
$(TOP)/$(BOARD_PATH) \
|
||||
$(TOP)/lib/CMSIS_5/CMSIS/Core/Include \
|
||||
$(TOP)/$(MAX32_CMSIS)/Include \
|
||||
$(TOP)/$(MAX32_CMSIS)/Device/Maxim/MAX78002/Include \
|
||||
$(TOP)/$(MAX32_PERIPH)/Include/MAX78002 \
|
||||
|
@ -31,13 +31,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if TU_CHECK_MCU(OPT_MCU_MAX32690, OPT_MCU_MAX32650, OPT_MCU_MAX32666, OPT_MCU_MAX78002)
|
||||
#include "mxc_device.h"
|
||||
#include "usbhs_regs.h"
|
||||
#else
|
||||
#error "Unsupported MCUs"
|
||||
#endif
|
||||
|
||||
#include "mxc_device.h"
|
||||
#include "usbhs_regs.h"
|
||||
|
||||
#if CFG_TUD_ENABLED
|
||||
#define USBHS_M31_CLOCK_RECOVERY
|
||||
@ -48,39 +43,39 @@ static mxc_usbhs_regs_t* const musb_periph_inst[] = {
|
||||
};
|
||||
|
||||
// Mapping of IRQ numbers to port. Currently just 1.
|
||||
static const IRQn_Type musb_irqs[] = {
|
||||
static const IRQn_Type musb_irqs[] = {
|
||||
USB_IRQn
|
||||
};
|
||||
|
||||
TU_ATTR_ALWAYS_INLINE
|
||||
static inline void musb_dcd_int_enable(uint8_t rhport)
|
||||
{
|
||||
static inline void musb_dcd_int_enable(uint8_t rhport) {
|
||||
NVIC_EnableIRQ(musb_irqs[rhport]);
|
||||
}
|
||||
|
||||
TU_ATTR_ALWAYS_INLINE
|
||||
static inline void musb_dcd_int_disable(uint8_t rhport)
|
||||
{
|
||||
static inline void musb_dcd_int_disable(uint8_t rhport) {
|
||||
NVIC_DisableIRQ(musb_irqs[rhport]);
|
||||
}
|
||||
|
||||
TU_ATTR_ALWAYS_INLINE
|
||||
static inline unsigned musb_dcd_get_int_enable(uint8_t rhport)
|
||||
{
|
||||
static inline unsigned musb_dcd_get_int_enable(uint8_t rhport) {
|
||||
#ifdef NVIC_GetEnableIRQ // only defined in CMSIS 5
|
||||
return NVIC_GetEnableIRQ(musb_irqs[rhport]);
|
||||
#else
|
||||
uint32_t IRQn = (uint32_t) musb_irqs[rhport];
|
||||
return ((NVIC->ISER[IRQn >> 5UL] & (1UL << (IRQn & 0x1FUL))) != 0UL) ? 1UL : 0UL;
|
||||
#endif
|
||||
}
|
||||
|
||||
TU_ATTR_ALWAYS_INLINE
|
||||
static inline void musb_dcd_int_clear(uint8_t rhport)
|
||||
{
|
||||
NVIC_ClearPendingIRQ(musb_irqs[rhport]);
|
||||
static inline void musb_dcd_int_clear(uint8_t rhport) {
|
||||
NVIC_ClearPendingIRQ(musb_irqs[rhport]);
|
||||
}
|
||||
|
||||
//Used to save and restore user's register map when interrupt occurs
|
||||
static volatile unsigned isr_saved_index = 0;
|
||||
|
||||
static inline void musb_dcd_int_handler_enter(uint8_t rhport)
|
||||
{
|
||||
static inline void musb_dcd_int_handler_enter(uint8_t rhport) {
|
||||
uint32_t mxm_int, mxm_int_en, mxm_is;
|
||||
|
||||
//save current register index
|
||||
|
@ -26,7 +26,7 @@ deps_optional = {
|
||||
'fc100s'],
|
||||
'hw/mcu/analog/max32' : ['https://github.com/analogdevicesinc/msdk.git',
|
||||
'b20b398d3e5e2007594e54a74ba3d2a2e50ddd75',
|
||||
'max32690 max32650 max32666 max78002'],
|
||||
'max32650 max32666 max32690 max78002'],
|
||||
'hw/mcu/bridgetek/ft9xx/ft90x-sdk': ['https://github.com/BRTSG-FOSS/ft90x-sdk.git',
|
||||
'91060164afe239fcb394122e8bf9eb24d3194eb1',
|
||||
'brtmm90x'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user