mirror of
https://github.com/Fishwaldo/bl_mcu_sdk.git
synced 2025-07-07 21:38:38 +00:00
[fix][irq] add nesting process for enable irq and disable irq
This commit is contained in:
parent
d92d1e9019
commit
97df783484
3 changed files with 10 additions and 18 deletions
|
@ -9,6 +9,7 @@ PROJECT(${BOARD} C CXX ASM)
|
||||||
ENABLE_LANGUAGE(ASM)
|
ENABLE_LANGUAGE(ASM)
|
||||||
|
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/common/misc)
|
include_directories(${CMAKE_SOURCE_DIR}/common/misc)
|
||||||
|
include_directories(${CMAKE_SOURCE_DIR}/drivers/${CHIP}_driver/risc-v/Core/Include)
|
||||||
include_directories(${CMAKE_SOURCE_DIR}/bsp/bsp_common/platform)
|
include_directories(${CMAKE_SOURCE_DIR}/bsp/bsp_common/platform)
|
||||||
|
|
||||||
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/bsp/board/${CHIP})
|
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/bsp/board/${CHIP})
|
||||||
|
|
|
@ -38,6 +38,11 @@ __WEAK__ void bl_show_info(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
__WEAK__ int bflb_get_board_config(uint8_t func, uint8_t *pinlist)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
__WEAK__ enum uart_index_type board_get_debug_uart_index(void)
|
__WEAK__ enum uart_index_type board_get_debug_uart_index(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -45,7 +50,7 @@ __WEAK__ enum uart_index_type board_get_debug_uart_index(void)
|
||||||
|
|
||||||
void bflb_platform_init(uint32_t baudrate)
|
void bflb_platform_init(uint32_t baudrate)
|
||||||
{
|
{
|
||||||
disable_irq();
|
__disable_irq();
|
||||||
|
|
||||||
board_init();
|
board_init();
|
||||||
|
|
||||||
|
@ -73,7 +78,7 @@ void bflb_platform_init(uint32_t baudrate)
|
||||||
else
|
else
|
||||||
MSG("dynamic memory init error\r\n");
|
MSG("dynamic memory init error\r\n");
|
||||||
|
|
||||||
enable_irq();
|
__enable_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ((defined BOOTROM) || (defined BFLB_EFLASH_LOADER))
|
#if ((defined BOOTROM) || (defined BFLB_EFLASH_LOADER))
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "gcc.h"
|
#include "gcc.h"
|
||||||
|
#include "cmsis_compatible_gcc.h"
|
||||||
|
|
||||||
/*@} end of group COMMON_Public_Types */
|
/*@} end of group COMMON_Public_Types */
|
||||||
|
|
||||||
/** @defgroup COMMON_Public_Constants
|
/** @defgroup COMMON_Public_Constants
|
||||||
|
@ -88,22 +90,6 @@
|
||||||
|
|
||||||
#define BIT(x) (1 << (x))
|
#define BIT(x) (1 << (x))
|
||||||
|
|
||||||
static uint8_t nesting = 0;
|
|
||||||
|
|
||||||
__attribute__((always_inline)) __STATIC_INLINE__ void enable_irq(void)
|
|
||||||
{
|
|
||||||
nesting--;
|
|
||||||
if (nesting == 0) {
|
|
||||||
__ASM__ volatile("csrsi mstatus, 8");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
__attribute__((always_inline)) __STATIC_INLINE__ void disable_irq(void)
|
|
||||||
{
|
|
||||||
__ASM__ volatile("csrci mstatus, 8");
|
|
||||||
nesting++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Error type definition
|
* @brief Error type definition
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue