git-svn-id: svn://svn.code.sf.net/p/chibios/svn/branches/kernel_3_dev@6667 35acf78f-673a-0410-8e92-d51de3d6d3f4

This commit is contained in:
gdisirio 2014-02-05 19:55:42 +00:00
parent d60e38b55f
commit 23f759922d
3 changed files with 34 additions and 4 deletions

View File

@ -205,7 +205,7 @@ void st_lld_init(void) {
SysTick_CTRL_TICKINT_Msk;
/* IRQ enabled.*/
nvicSetSystemHandlerPriority(SysTick_IRQn, STM32_ST_IRQ_PRIORITY);
nvicSetSystemHandlerPriority(HANDLER_SYSTICK, STM32_ST_IRQ_PRIORITY);
#endif /* OSAL_ST_MODE == OSAL_ST_MODE_PERIODIC */
}

View File

@ -50,10 +50,9 @@
/**
* @brief Sets the priority of an interrupt handler and enables it.
* @note The parameters are not tested for correctness.
*
* @param[in] n the interrupt number
* @param[in] prio the interrupt priority mask
* @param[in] prio the interrupt priority
*/
void nvicEnableVector(uint32_t n, uint32_t prio) {
@ -64,7 +63,6 @@ void nvicEnableVector(uint32_t n, uint32_t prio) {
/**
* @brief Disables an interrupt handler.
* @note The parameters are not tested for correctness.
*
* @param[in] n the interrupt number
*/
@ -74,4 +72,17 @@ void nvicDisableVector(uint32_t n) {
NVIC->IP[n] = 0;
}
/**
* @brief Changes the priority of a system handler.
*
* @param[in] handler the system handler number
* @param[in] prio the system handler priority
*/
void nvicSetSystemHandlerPriority(uint32_t handler, uint32_t prio) {
osalDbgCheck((handler >= 4) && (handler <= 15));
SCB->SHP[handler - 4] = NVIC_PRIORITY_MASK(prio);
}
/** @} */

View File

@ -29,6 +29,24 @@
/* Driver constants. */
/*===========================================================================*/
/**
* @name System vectors numbers
* @{
*/
#define HANDLER_MEM_MANAGE 0 /**< MEM MANAGE vector id. */
#define HANDLER_BUS_FAULT 1 /**< BUS FAULT vector id. */
#define HANDLER_USAGE_FAULT 2 /**< USAGE FAULT vector id. */
#define HANDLER_RESERVED_3 3
#define HANDLER_RESERVED_4 4
#define HANDLER_RESERVED_5 5
#define HANDLER_RESERVED_6 6
#define HANDLER_SVCALL 7 /**< SVCALL vector id. */
#define HANDLER_DEBUG_MONITOR 8 /**< DEBUG MONITOR vector id. */
#define HANDLER_RESERVED_9 9
#define HANDLER_PENDSV 10 /**< PENDSV vector id. */
#define HANDLER_SYSTICK 11 /**< SYS TCK vector id. */
/** @} */
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@ -59,6 +77,7 @@ extern "C" {
#endif
void nvicEnableVector(uint32_t n, uint32_t prio);
void nvicDisableVector(uint32_t n);
void nvicSetSystemHandlerPriority(uint32_t handler, uint32_t prio);
#ifdef __cplusplus
}
#endif