arm: cmsis: Convert _ScbIsInThreadMode to use direct CMSIS register access

Jira: ZEP-1568

Change-Id: Idc14817ce85042ec86bdf67b8939f783224329ff
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
This commit is contained in:
Kumar Gala 2017-01-25 08:29:03 -06:00
commit 772cbd1955
3 changed files with 2 additions and 17 deletions

View file

@ -36,7 +36,7 @@ static void software_reboot(void)
*/
__asm__ volatile("cpsie i" :::);
if (_ScbIsInThreadMode()) {
if ((SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) == 0) {
_do_software_reboot();
} else {
__asm__ volatile(

View file

@ -35,7 +35,7 @@ void k_thread_abort(k_tid_t thread)
_thread_monitor_exit(thread);
if (_current == thread) {
if (_ScbIsInThreadMode()) {
if ((SCB->ICSR & SCB_ICSR_VECTACTIVE_Msk) == 0) {
_Swap(key);
CODE_UNREACHABLE;
} else {

View file

@ -51,21 +51,6 @@ extern "C" {
#include <misc/util.h>
#include <stdint.h>
/**
*
* @brief Find out if running in thread mode
*
* This routine determines if the current mode is thread mode.
*
* @return 1 if in thread mode, 0 otherwise
*/
static inline int _ScbIsInThreadMode(void)
{
/* 0 == thread mode */
return !__scs.scb.icsr.bit.vectactive;
}
/**
*
* @brief Obtain the currently executing vector