git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@6981 35acf78f-673a-0410-8e92-d51de3d6d3f4
This commit is contained in:
parent
31774bb3d7
commit
1859a4ba09
|
@ -285,7 +285,7 @@ static inline void port_init(void) {
|
||||||
*/
|
*/
|
||||||
static inline syssts_t port_get_irq_status(void) {
|
static inline syssts_t port_get_irq_status(void) {
|
||||||
|
|
||||||
return __get_PRIMASK();
|
return (syssts_t)__get_PRIMASK();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -395,12 +395,12 @@ static inline void port_init(void) {
|
||||||
* @return The interrupts status.
|
* @return The interrupts status.
|
||||||
*/
|
*/
|
||||||
static inline syssts_t port_get_irq_status(void) {
|
static inline syssts_t port_get_irq_status(void) {
|
||||||
register uint32_t sts;
|
syssts_t sts;
|
||||||
|
|
||||||
#if !CORTEX_SIMPLIFIED_PRIORITY
|
#if !CORTEX_SIMPLIFIED_PRIORITY
|
||||||
sts = __get_BASEPRI();
|
sts = (syssts_t)__get_BASEPRI();
|
||||||
#else /* CORTEX_SIMPLIFIED_PRIORITY */
|
#else /* CORTEX_SIMPLIFIED_PRIORITY */
|
||||||
sts = __get_PRIMASK();
|
sts = (syssts_t)__get_PRIMASK();
|
||||||
#endif /* CORTEX_SIMPLIFIED_PRIORITY */
|
#endif /* CORTEX_SIMPLIFIED_PRIORITY */
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,6 +338,9 @@ struct context {
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef THUMB_PRESENT
|
||||||
|
syssts_t _port_get_cpsr(void);
|
||||||
|
#endif
|
||||||
#ifdef THUMB
|
#ifdef THUMB
|
||||||
void _port_switch_thumb(thread_t *ntp, thread_t *otp);
|
void _port_switch_thumb(thread_t *ntp, thread_t *otp);
|
||||||
#else
|
#else
|
||||||
|
@ -359,6 +362,55 @@ static inline void port_init(void) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Returns a word encoding the current interrupts status.
|
||||||
|
*
|
||||||
|
* @return The interrupts status.
|
||||||
|
*/
|
||||||
|
static inline syssts_t port_get_irq_status(void) {
|
||||||
|
syssts_t sts;
|
||||||
|
|
||||||
|
#ifdef THUMB
|
||||||
|
sts = _port_get_cpsr();
|
||||||
|
#else
|
||||||
|
asm volatile ("mrs %[p0], CPSR" : [p0] "=r" (sts) :);
|
||||||
|
#endif
|
||||||
|
return sts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Checks the interrupt status.
|
||||||
|
*
|
||||||
|
* @param[in] sts the interrupt status word
|
||||||
|
*
|
||||||
|
* @return The interrupt status.
|
||||||
|
* @retvel false the word specified a disabled interrupts status.
|
||||||
|
* @retvel true the word specified an enabled interrupts status.
|
||||||
|
*/
|
||||||
|
static inline bool port_irq_enabled(syssts_t sts) {
|
||||||
|
|
||||||
|
return (sts & 0x80) == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Determines the current execution context.
|
||||||
|
*
|
||||||
|
* @return The execution context.
|
||||||
|
* @retval false not running in ISR mode.
|
||||||
|
* @retval true running in ISR mode.
|
||||||
|
*/
|
||||||
|
static inline bool port_is_isr_context(void) {
|
||||||
|
syssts_t sts;
|
||||||
|
|
||||||
|
#ifdef THUMB
|
||||||
|
sts = _port_get_cpsr();
|
||||||
|
#else
|
||||||
|
asm volatile ("mrs %[p0], CPSR" : [p0] "=r" (sts) :);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return (sts & 0x1F) == 0x12;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Kernel-lock action.
|
* @brief Kernel-lock action.
|
||||||
* @details In this port it disables the IRQ sources and keeps FIQ sources
|
* @details In this port it disables the IRQ sources and keeps FIQ sources
|
||||||
|
@ -449,6 +501,21 @@ static inline void port_enable(void) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enters an architecture-dependent IRQ-waiting mode.
|
||||||
|
* @details The function is meant to return when an interrupt becomes pending.
|
||||||
|
* The simplest implementation is an empty function or macro but this
|
||||||
|
* would not take advantage of architecture-specific power saving
|
||||||
|
* modes.
|
||||||
|
* @note Implemented as an inlined @p WFI instruction.
|
||||||
|
*/
|
||||||
|
static inline void port_wait_for_interrupt(void) {
|
||||||
|
|
||||||
|
#if ARM_ENABLE_WFI_IDLE
|
||||||
|
ARM_WFI_IMPL;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#if CH_CFG_ST_TIMEDELTA > 0
|
#if CH_CFG_ST_TIMEDELTA > 0
|
||||||
#if !PORT_USE_ALT_TIMER
|
#if !PORT_USE_ALT_TIMER
|
||||||
#include "chcore_timer.h"
|
#include "chcore_timer.h"
|
||||||
|
|
|
@ -47,10 +47,21 @@
|
||||||
.text
|
.text
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Interrupt enable/disable functions, only present if there is THUMB code in
|
* The following functions are only present if there is THUMB code in
|
||||||
* the system because those are inlined in ARM code.
|
* the system.
|
||||||
*/
|
*/
|
||||||
#if defined(THUMB_PRESENT)
|
#if defined(THUMB_PRESENT)
|
||||||
|
.balign 16
|
||||||
|
.code 16
|
||||||
|
.thumb_func
|
||||||
|
.global _port_get_cpsr
|
||||||
|
_port_get_cpsr:
|
||||||
|
mov r0, pc
|
||||||
|
bx r0
|
||||||
|
.code 32
|
||||||
|
mrs r0, CPSR
|
||||||
|
bx lr
|
||||||
|
|
||||||
.balign 16
|
.balign 16
|
||||||
.code 16
|
.code 16
|
||||||
.thumb_func
|
.thumb_func
|
||||||
|
|
|
@ -293,7 +293,7 @@ static inline void port_init(void) {
|
||||||
*/
|
*/
|
||||||
static inline syssts_t port_get_irq_status(void) {
|
static inline syssts_t port_get_irq_status(void) {
|
||||||
|
|
||||||
return __get_PRIMASK();
|
return (syssts_t)__get_PRIMASK();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -396,12 +396,12 @@ static inline void port_init(void) {
|
||||||
* @return The interrupts status.
|
* @return The interrupts status.
|
||||||
*/
|
*/
|
||||||
static inline syssts_t port_get_irq_status(void) {
|
static inline syssts_t port_get_irq_status(void) {
|
||||||
uint32_t sts;
|
syssts_t sts;
|
||||||
|
|
||||||
#if !CORTEX_SIMPLIFIED_PRIORITY
|
#if !CORTEX_SIMPLIFIED_PRIORITY
|
||||||
sts = __get_BASEPRI();
|
sts = (syssts_t)__get_BASEPRI();
|
||||||
#else /* CORTEX_SIMPLIFIED_PRIORITY */
|
#else /* CORTEX_SIMPLIFIED_PRIORITY */
|
||||||
sts = __get_PRIMASK();
|
sts = (syssts_t)__get_PRIMASK();
|
||||||
#endif /* CORTEX_SIMPLIFIED_PRIORITY */
|
#endif /* CORTEX_SIMPLIFIED_PRIORITY */
|
||||||
return sts;
|
return sts;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue