Skip to content

Commit

Permalink
cpu/arm7_common: Inline thread_yield_higher function
Browse files Browse the repository at this point in the history
  • Loading branch information
bergzand committed Jan 19, 2021
1 parent bce9e3c commit ede0f17
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 10 deletions.
10 changes: 0 additions & 10 deletions cpu/arm7_common/arm_cpu.c
Expand Up @@ -36,16 +36,6 @@ __attribute__((used, section(".svc_stack"), aligned(4))) uint8_t svc_stack[ISR_S
#error "ISR_STACKSIZE must be a multiple of 4"
#endif

void thread_yield_higher(void)
{
if (irq_is_in()) {
sched_context_switch_request = 1;
}
else {
__asm__("svc 0\n");
}
}

/*----------------------------------------------------------------------------
* Processor specific routine - here for ARM7
* sizeof(void*) = sizeof(int)
Expand Down
50 changes: 50 additions & 0 deletions cpu/arm7_common/include/thread_arch.h
@@ -0,0 +1,50 @@
/*
* Copyright (C) 2008, 2009 Heiko Will <hwill@inf.fu-berlin.de>
* Copyright (C) 2009 Kaspar Schleiser <kaspar@schleiser.de>
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License v2.1. See the file LICENSE in the top level directory for more
* details.
*/

/**
* @ingroup cpu_arm7_common
* @{
*
* @file
* @brief Implementation of the kernels thread interface
*
* @author Kaspar Schleiser <kaspar@schleiser.de>
* @author Heiko Will <heiko.will@fu-berlin.de>
*
* @}
*/
#ifndef THREAD_ARCH_H
#define THREAD_ARCH_H

#ifdef __cplusplus
extern "C" {
#endif

#define THREAD_API_INLINED

#ifndef DOXYGEN /* Doxygen is in core/include/thread.h */

static inline __attribute__((always_inline)) void thread_yield_higher(void)
{
if (irq_is_in()) {
sched_context_switch_request = 1;
}
else {
__asm__("svc 0\n");
}
}

#endif /* DOXYGEN */

#ifdef __cplusplus
}
#endif

#endif /* THREAD_ARCH_H */
/** @} */

0 comments on commit ede0f17

Please sign in to comment.