arch: posix: isolate arch-soc/board IF from kernel-arch IF
The POSIX ARCH delegates some of the tasks which normally are taken care of by the ARCH to the SOC or BOARD levels. To avoid changes in the kernel-arch IF propagating into the arch-soc and arch-board interfaces (which would break off-tree posix boards) isolate them. Also move arch inlined functions into the arch.h header, and out from the headers which specify the posix arch-soc and arch-board interfaces. Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
This commit is contained in:
parent
d1aca7f11b
commit
b237597ab9
8 changed files with 121 additions and 118 deletions
|
@ -5,6 +5,7 @@ zephyr_library_compile_definitions(NO_POSIX_CHEATS)
|
||||||
zephyr_library_sources(
|
zephyr_library_sources(
|
||||||
cpuhalt.c
|
cpuhalt.c
|
||||||
fatal.c
|
fatal.c
|
||||||
|
irq.c
|
||||||
posix_core.c
|
posix_core.c
|
||||||
swap.c
|
swap.c
|
||||||
thread.c
|
thread.c
|
||||||
|
|
37
arch/posix/core/irq.c
Normal file
37
arch/posix/core/irq.c
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2019 Oticon A/S
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "posix_soc_if.h"
|
||||||
|
#include "board_irq.h"
|
||||||
|
|
||||||
|
void z_arch_irq_offload(irq_offload_routine_t routine, void *parameter)
|
||||||
|
{
|
||||||
|
posix_irq_offload(routine, parameter);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_DYNAMIC_INTERRUPTS
|
||||||
|
/**
|
||||||
|
* Configure a dynamic interrupt.
|
||||||
|
*
|
||||||
|
* Use this instead of IRQ_CONNECT() if arguments cannot be known at build time.
|
||||||
|
*
|
||||||
|
* @param irq IRQ line number
|
||||||
|
* @param priority Interrupt priority
|
||||||
|
* @param routine Interrupt service routine
|
||||||
|
* @param parameter ISR parameter
|
||||||
|
* @param flags Arch-specific IRQ configuration flags
|
||||||
|
*
|
||||||
|
* @return The vector assigned to this interrupt
|
||||||
|
*/
|
||||||
|
int z_arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
|
||||||
|
void (*routine)(void *parameter),
|
||||||
|
void *parameter, u32_t flags)
|
||||||
|
{
|
||||||
|
posix_isr_declare(irq, (int)flags, routine, parameter);
|
||||||
|
posix_irq_priority_set(irq, priority, flags);
|
||||||
|
return irq;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_DYNAMIC_INTERRUPTS */
|
|
@ -16,6 +16,7 @@
|
||||||
|
|
||||||
#include "posix_trace.h"
|
#include "posix_trace.h"
|
||||||
#include "soc_irq.h" /* Must exist and define _ARCH_IRQ/ISR_* macros */
|
#include "soc_irq.h" /* Must exist and define _ARCH_IRQ/ISR_* macros */
|
||||||
|
#include "irq_offload.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -24,33 +25,14 @@ extern "C" {
|
||||||
void posix_halt_cpu(void);
|
void posix_halt_cpu(void);
|
||||||
void posix_atomic_halt_cpu(unsigned int imask);
|
void posix_atomic_halt_cpu(unsigned int imask);
|
||||||
|
|
||||||
void z_arch_irq_enable(unsigned int irq);
|
void posix_irq_enable(unsigned int irq);
|
||||||
void z_arch_irq_disable(unsigned int irq);
|
void posix_irq_disable(unsigned int irq);
|
||||||
int z_arch_irq_is_enabled(unsigned int irq);
|
int posix_irq_is_enabled(unsigned int irq);
|
||||||
unsigned int posix_irq_lock(void);
|
unsigned int posix_irq_lock(void);
|
||||||
void posix_irq_unlock(unsigned int key);
|
void posix_irq_unlock(unsigned int key);
|
||||||
void posix_irq_full_unlock(void);
|
void posix_irq_full_unlock(void);
|
||||||
int posix_get_current_irq(void);
|
int posix_get_current_irq(void);
|
||||||
/* irq_offload() from irq_offload.h must also be defined by the SOC or board */
|
void posix_irq_offload(irq_offload_routine_t routine, void *parameter);
|
||||||
|
|
||||||
static inline unsigned int z_arch_irq_lock(void)
|
|
||||||
{
|
|
||||||
return posix_irq_lock();
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void z_arch_irq_unlock(unsigned int key)
|
|
||||||
{
|
|
||||||
posix_irq_unlock(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if interrupts were unlocked prior to the
|
|
||||||
* z_arch_irq_lock() call that produced the key argument.
|
|
||||||
*/
|
|
||||||
static inline bool z_arch_irq_unlocked(unsigned int key)
|
|
||||||
{
|
|
||||||
return key == false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _BOARD_IRQ_H
|
#ifndef BOARDS_POSIX_NATIVE_POSIX_BOARD_IRQ_H
|
||||||
#define _BOARD_IRQ_H
|
#define BOARDS_POSIX_NATIVE_POSIX_BOARD_IRQ_H
|
||||||
|
|
||||||
#include "sw_isr_table.h"
|
#include "sw_isr_table.h"
|
||||||
#include "zephyr/types.h"
|
#include "zephyr/types.h"
|
||||||
|
@ -15,9 +15,9 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void z_isr_declare(unsigned int irq_p, int flags, void isr_p(void *),
|
void posix_isr_declare(unsigned int irq_p, int flags, void isr_p(void *),
|
||||||
void *isr_param_p);
|
void *isr_param_p);
|
||||||
void z_irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags);
|
void posix_irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure a static interrupt.
|
* Configure a static interrupt.
|
||||||
|
@ -32,8 +32,8 @@ void z_irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags);
|
||||||
*/
|
*/
|
||||||
#define Z_ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
|
#define Z_ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
|
||||||
({ \
|
({ \
|
||||||
z_isr_declare(irq_p, 0, isr_p, isr_param_p); \
|
posix_isr_declare(irq_p, 0, isr_p, isr_param_p); \
|
||||||
z_irq_priority_set(irq_p, priority_p, flags_p); \
|
posix_irq_priority_set(irq_p, priority_p, flags_p); \
|
||||||
irq_p; \
|
irq_p; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -45,8 +45,9 @@ void z_irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags);
|
||||||
*/
|
*/
|
||||||
#define Z_ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \
|
#define Z_ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \
|
||||||
({ \
|
({ \
|
||||||
z_isr_declare(irq_p, ISR_FLAG_DIRECT, (void (*)(void *))isr_p, NULL); \
|
posix_isr_declare(irq_p, ISR_FLAG_DIRECT, (void (*)(void *))isr_p, \
|
||||||
z_irq_priority_set(irq_p, priority_p, flags_p); \
|
NULL); \
|
||||||
|
posix_irq_priority_set(irq_p, priority_p, flags_p); \
|
||||||
irq_p; \
|
irq_p; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -86,4 +87,4 @@ extern void posix_irq_check_idle_exit(void);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _BOARD_IRQ_H */
|
#endif /* BOARDS_POSIX_NATIVE_POSIX_BOARD_IRQ_H */
|
||||||
|
|
|
@ -194,17 +194,17 @@ void posix_irq_full_unlock(void)
|
||||||
hw_irq_ctrl_change_lock(false);
|
hw_irq_ctrl_change_lock(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void z_arch_irq_enable(unsigned int irq)
|
void posix_irq_enable(unsigned int irq)
|
||||||
{
|
{
|
||||||
hw_irq_ctrl_enable_irq(irq);
|
hw_irq_ctrl_enable_irq(irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void z_arch_irq_disable(unsigned int irq)
|
void posix_irq_disable(unsigned int irq)
|
||||||
{
|
{
|
||||||
hw_irq_ctrl_disable_irq(irq);
|
hw_irq_ctrl_disable_irq(irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
int z_arch_irq_is_enabled(unsigned int irq)
|
int posix_irq_is_enabled(unsigned int irq)
|
||||||
{
|
{
|
||||||
return hw_irq_ctrl_is_irq_enabled(irq);
|
return hw_irq_ctrl_is_irq_enabled(irq);
|
||||||
}
|
}
|
||||||
|
@ -217,8 +217,8 @@ int posix_get_current_irq(void)
|
||||||
/**
|
/**
|
||||||
* Configure a static interrupt.
|
* Configure a static interrupt.
|
||||||
*
|
*
|
||||||
* z_isr_declare will populate the interrupt table table with the interrupt's
|
* posix_isr_declare will populate the interrupt table table with the
|
||||||
* parameters, the vector table and the software ISR table.
|
* interrupt's parameters, the vector table and the software ISR table.
|
||||||
*
|
*
|
||||||
* We additionally set the priority in the interrupt controller at
|
* We additionally set the priority in the interrupt controller at
|
||||||
* runtime.
|
* runtime.
|
||||||
|
@ -229,7 +229,7 @@ int posix_get_current_irq(void)
|
||||||
* @param isr_param_p ISR parameter
|
* @param isr_param_p ISR parameter
|
||||||
* @param flags_p IRQ options
|
* @param flags_p IRQ options
|
||||||
*/
|
*/
|
||||||
void z_isr_declare(unsigned int irq_p, int flags, void isr_p(void *),
|
void posix_isr_declare(unsigned int irq_p, int flags, void isr_p(void *),
|
||||||
void *isr_param_p)
|
void *isr_param_p)
|
||||||
{
|
{
|
||||||
irq_vector_table[irq_p].irq = irq_p;
|
irq_vector_table[irq_p].irq = irq_p;
|
||||||
|
@ -247,35 +247,11 @@ void z_isr_declare(unsigned int irq_p, int flags, void isr_p(void *),
|
||||||
*
|
*
|
||||||
* @return N/A
|
* @return N/A
|
||||||
*/
|
*/
|
||||||
void z_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
|
void posix_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
|
||||||
{
|
{
|
||||||
hw_irq_ctrl_prio_set(irq, prio);
|
hw_irq_ctrl_prio_set(irq, prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DYNAMIC_INTERRUPTS
|
|
||||||
/**
|
|
||||||
* Configure a dynamic interrupt.
|
|
||||||
*
|
|
||||||
* Use this instead of IRQ_CONNECT() if arguments cannot be known at build time.
|
|
||||||
*
|
|
||||||
* @param irq IRQ line number
|
|
||||||
* @param priority Interrupt priority
|
|
||||||
* @param routine Interrupt service routine
|
|
||||||
* @param parameter ISR parameter
|
|
||||||
* @param flags Arch-specific IRQ configuration flags
|
|
||||||
*
|
|
||||||
* @return The vector assigned to this interrupt
|
|
||||||
*/
|
|
||||||
int z_arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
|
|
||||||
void (*routine)(void *parameter), void *parameter,
|
|
||||||
u32_t flags)
|
|
||||||
{
|
|
||||||
z_isr_declare(irq, (int)flags, routine, parameter);
|
|
||||||
z_irq_priority_set(irq, priority, flags);
|
|
||||||
return irq;
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_DYNAMIC_INTERRUPTS */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to ARM's NVIC_SetPendingIRQ
|
* Similar to ARM's NVIC_SetPendingIRQ
|
||||||
* set a pending IRQ from SW
|
* set a pending IRQ from SW
|
||||||
|
@ -318,12 +294,12 @@ static void offload_sw_irq_handler(void *a)
|
||||||
*
|
*
|
||||||
* Raise the SW IRQ assigned to handled this
|
* Raise the SW IRQ assigned to handled this
|
||||||
*/
|
*/
|
||||||
void z_arch_irq_offload(irq_offload_routine_t routine, void *parameter)
|
void posix_irq_offload(irq_offload_routine_t routine, void *parameter)
|
||||||
{
|
{
|
||||||
off_routine = routine;
|
off_routine = routine;
|
||||||
off_parameter = parameter;
|
off_parameter = parameter;
|
||||||
z_isr_declare(OFFLOAD_SW_IRQ, 0, offload_sw_irq_handler, NULL);
|
posix_isr_declare(OFFLOAD_SW_IRQ, 0, offload_sw_irq_handler, NULL);
|
||||||
z_arch_irq_enable(OFFLOAD_SW_IRQ);
|
posix_irq_enable(OFFLOAD_SW_IRQ);
|
||||||
posix_sw_set_pending_IRQ(OFFLOAD_SW_IRQ);
|
posix_sw_set_pending_IRQ(OFFLOAD_SW_IRQ);
|
||||||
z_arch_irq_disable(OFFLOAD_SW_IRQ);
|
posix_irq_disable(OFFLOAD_SW_IRQ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _BOARD_IRQ_H
|
#ifndef BOARDS_POSIX_NRF52_BSIM_BOARD_IRQ_H
|
||||||
#define _BOARD_IRQ_H
|
#define BOARDS_POSIX_NRF52_BSIM_BOARD_IRQ_H
|
||||||
|
|
||||||
#include "sw_isr_table.h"
|
#include "sw_isr_table.h"
|
||||||
#include "zephyr/types.h"
|
#include "zephyr/types.h"
|
||||||
|
@ -15,9 +15,9 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void z_isr_declare(unsigned int irq_p, int flags, void isr_p(void *),
|
void posix_isr_declare(unsigned int irq_p, int flags, void isr_p(void *),
|
||||||
void *isr_param_p);
|
void *isr_param_p);
|
||||||
void z_irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags);
|
void posix_irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure a static interrupt.
|
* Configure a static interrupt.
|
||||||
|
@ -32,8 +32,8 @@ void z_irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags);
|
||||||
*/
|
*/
|
||||||
#define Z_ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
|
#define Z_ARCH_IRQ_CONNECT(irq_p, priority_p, isr_p, isr_param_p, flags_p) \
|
||||||
({ \
|
({ \
|
||||||
z_isr_declare(irq_p, 0, isr_p, isr_param_p); \
|
posix_isr_declare(irq_p, 0, isr_p, isr_param_p); \
|
||||||
z_irq_priority_set(irq_p, priority_p, flags_p); \
|
posix_irq_priority_set(irq_p, priority_p, flags_p); \
|
||||||
irq_p; \
|
irq_p; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -45,8 +45,9 @@ void z_irq_priority_set(unsigned int irq, unsigned int prio, u32_t flags);
|
||||||
*/
|
*/
|
||||||
#define Z_ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \
|
#define Z_ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \
|
||||||
({ \
|
({ \
|
||||||
z_isr_declare(irq_p, ISR_FLAG_DIRECT, (void (*)(void *))isr_p, NULL); \
|
posix_isr_declare(irq_p, ISR_FLAG_DIRECT, (void (*)(void *))isr_p, \
|
||||||
z_irq_priority_set(irq_p, priority_p, flags_p); \
|
NULL); \
|
||||||
|
posix_irq_priority_set(irq_p, priority_p, flags_p); \
|
||||||
irq_p; \
|
irq_p; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -86,4 +87,4 @@ extern void posix_irq_check_idle_exit(void);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* _BOARD_IRQ_H */
|
#endif /* BOARDS_POSIX_NRF52_BSIM_BOARD_IRQ_H */
|
||||||
|
|
|
@ -253,26 +253,21 @@ void posix_irq_full_unlock(void)
|
||||||
hw_irq_ctrl_change_lock(false);
|
hw_irq_ctrl_change_lock(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void z_arch_irq_enable(unsigned int irq)
|
void posix_irq_enable(unsigned int irq)
|
||||||
{
|
{
|
||||||
hw_irq_ctrl_enable_irq(irq);
|
hw_irq_ctrl_enable_irq(irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void z_arch_irq_disable(unsigned int irq)
|
void posix_irq_disable(unsigned int irq)
|
||||||
{
|
{
|
||||||
hw_irq_ctrl_disable_irq(irq);
|
hw_irq_ctrl_disable_irq(irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
int z_arch_irq_is_enabled(unsigned int irq)
|
int posix_irq_is_enabled(unsigned int irq)
|
||||||
{
|
{
|
||||||
return hw_irq_ctrl_is_irq_enabled(irq);
|
return hw_irq_ctrl_is_irq_enabled(irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
void z_arch_isr_direct_header(void)
|
|
||||||
{
|
|
||||||
/* Nothing to be done */
|
|
||||||
}
|
|
||||||
|
|
||||||
int posix_get_current_irq(void)
|
int posix_get_current_irq(void)
|
||||||
{
|
{
|
||||||
return currently_running_irq;
|
return currently_running_irq;
|
||||||
|
@ -281,8 +276,8 @@ int posix_get_current_irq(void)
|
||||||
/**
|
/**
|
||||||
* Configure a static interrupt.
|
* Configure a static interrupt.
|
||||||
*
|
*
|
||||||
* z_isr_declare will populate the interrupt table table with the interrupt's
|
* posix_isr_declare will populate the interrupt table table with the
|
||||||
* parameters, the vector table and the software ISR table.
|
* interrupt's parameters, the vector table and the software ISR table.
|
||||||
*
|
*
|
||||||
* We additionally set the priority in the interrupt controller at
|
* We additionally set the priority in the interrupt controller at
|
||||||
* runtime.
|
* runtime.
|
||||||
|
@ -293,7 +288,7 @@ int posix_get_current_irq(void)
|
||||||
* @param isr_param_p ISR parameter
|
* @param isr_param_p ISR parameter
|
||||||
* @param flags_p IRQ options
|
* @param flags_p IRQ options
|
||||||
*/
|
*/
|
||||||
void z_isr_declare(unsigned int irq_p, int flags, void isr_p(void *),
|
void posix_isr_declare(unsigned int irq_p, int flags, void isr_p(void *),
|
||||||
void *isr_param_p)
|
void *isr_param_p)
|
||||||
{
|
{
|
||||||
irq_vector_table[irq_p].irq = irq_p;
|
irq_vector_table[irq_p].irq = irq_p;
|
||||||
|
@ -311,35 +306,11 @@ void z_isr_declare(unsigned int irq_p, int flags, void isr_p(void *),
|
||||||
*
|
*
|
||||||
* @return N/A
|
* @return N/A
|
||||||
*/
|
*/
|
||||||
void z_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
|
void posix_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
|
||||||
{
|
{
|
||||||
hw_irq_ctrl_prio_set(irq, prio);
|
hw_irq_ctrl_prio_set(irq, prio);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_DYNAMIC_INTERRUPTS
|
|
||||||
/**
|
|
||||||
* Configure a dynamic interrupt.
|
|
||||||
*
|
|
||||||
* Use this instead of IRQ_CONNECT() if arguments cannot be known at build time.
|
|
||||||
*
|
|
||||||
* @param irq IRQ line number
|
|
||||||
* @param priority Interrupt priority
|
|
||||||
* @param routine Interrupt service routine
|
|
||||||
* @param parameter ISR parameter
|
|
||||||
* @param flags Arch-specific IRQ configuration flags
|
|
||||||
*
|
|
||||||
* @return The vector assigned to this interrupt
|
|
||||||
*/
|
|
||||||
int z_arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
|
|
||||||
void (*routine)(void *parameter), void *parameter,
|
|
||||||
u32_t flags)
|
|
||||||
{
|
|
||||||
z_isr_declare(irq, (int)flags, routine, parameter);
|
|
||||||
z_irq_priority_set(irq, priority, flags);
|
|
||||||
return irq;
|
|
||||||
}
|
|
||||||
#endif /* CONFIG_DYNAMIC_INTERRUPTS */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to ARM's NVIC_SetPendingIRQ
|
* Similar to ARM's NVIC_SetPendingIRQ
|
||||||
* set a pending IRQ from SW
|
* set a pending IRQ from SW
|
||||||
|
@ -382,14 +353,14 @@ static void offload_sw_irq_handler(void *a)
|
||||||
*
|
*
|
||||||
* Raise the SW IRQ assigned to handled this
|
* Raise the SW IRQ assigned to handled this
|
||||||
*/
|
*/
|
||||||
void z_arch_irq_offload(irq_offload_routine_t routine, void *parameter)
|
void posix_irq_offload(irq_offload_routine_t routine, void *parameter)
|
||||||
{
|
{
|
||||||
off_routine = routine;
|
off_routine = routine;
|
||||||
off_parameter = parameter;
|
off_parameter = parameter;
|
||||||
z_isr_declare(OFFLOAD_SW_IRQ, 0, offload_sw_irq_handler, NULL);
|
posix_isr_declare(OFFLOAD_SW_IRQ, 0, offload_sw_irq_handler, NULL);
|
||||||
z_arch_irq_enable(OFFLOAD_SW_IRQ);
|
posix_irq_enable(OFFLOAD_SW_IRQ);
|
||||||
posix_sw_set_pending_IRQ(OFFLOAD_SW_IRQ);
|
posix_sw_set_pending_IRQ(OFFLOAD_SW_IRQ);
|
||||||
z_arch_irq_disable(OFFLOAD_SW_IRQ);
|
posix_irq_disable(OFFLOAD_SW_IRQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -59,6 +59,40 @@ static ALWAYS_INLINE void z_arch_nop(void)
|
||||||
__asm__ volatile("nop");
|
__asm__ volatile("nop");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ALWAYS_INLINE unsigned int z_arch_irq_lock(void)
|
||||||
|
{
|
||||||
|
return posix_irq_lock();
|
||||||
|
}
|
||||||
|
|
||||||
|
static ALWAYS_INLINE void z_arch_irq_unlock(unsigned int key)
|
||||||
|
{
|
||||||
|
posix_irq_unlock(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ALWAYS_INLINE void z_arch_irq_enable(unsigned int irq)
|
||||||
|
{
|
||||||
|
posix_irq_enable(irq);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ALWAYS_INLINE void z_arch_irq_disable(unsigned int irq)
|
||||||
|
{
|
||||||
|
posix_irq_disable(irq);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ALWAYS_INLINE int z_arch_irq_is_enabled(unsigned int irq)
|
||||||
|
{
|
||||||
|
return posix_irq_is_enabled(irq);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if interrupts were unlocked prior to the
|
||||||
|
* z_arch_irq_lock() call that produced the key argument.
|
||||||
|
*/
|
||||||
|
static ALWAYS_INLINE bool z_arch_irq_unlocked(unsigned int key)
|
||||||
|
{
|
||||||
|
return key == false;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue