posix arch: Untangle headers

posix_soc_if.h is meant to be a private header between
the POSIX ARCH, SOC, and maybe boards,
it should not contain definitions meant to be used directly
by the kernel or app.

Some definitions were placed here due to a dependency moebius
loop.
Unravel that by removing all header dependencies in posix_soc_if.h,
move those definitions out to a more logical place,
and while we are here reduce the amount of users of
irq_offload.h in POSIX arch related code

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
This commit is contained in:
Alberto Escolar Piedras 2019-10-25 14:54:17 +02:00 committed by Andrew Boie
commit f974cb0ae1
5 changed files with 19 additions and 17 deletions

View file

@ -8,6 +8,8 @@
#include "board_irq.h"
#ifdef CONFIG_IRQ_OFFLOAD
#include "irq_offload.h"
void z_arch_irq_offload(irq_offload_routine_t routine, void *parameter)
{
posix_irq_offload(routine, parameter);

View file

@ -16,7 +16,6 @@
#include "posix_trace.h"
#include "soc_irq.h" /* Must exist and define _ARCH_IRQ/ISR_* macros */
#include "irq_offload.h"
#ifdef __cplusplus
extern "C" {
@ -33,20 +32,9 @@ void posix_irq_unlock(unsigned int key);
void posix_irq_full_unlock(void);
int posix_get_current_irq(void);
#ifdef CONFIG_IRQ_OFFLOAD
void posix_irq_offload(irq_offload_routine_t routine, void *parameter);
void posix_irq_offload(void (*routine)(void *), void *parameter);
#endif
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);
}
#ifdef __cplusplus
}
#endif

View file

@ -278,7 +278,7 @@ void posix_sw_clear_pending_IRQ(unsigned int IRQn)
/**
* Storage for functions offloaded to IRQ
*/
static irq_offload_routine_t off_routine;
static void (*off_routine)(void *);
static void *off_parameter;
/**
@ -295,7 +295,7 @@ static void offload_sw_irq_handler(void *a)
*
* Raise the SW IRQ assigned to handled this
*/
void posix_irq_offload(irq_offload_routine_t routine, void *parameter)
void posix_irq_offload(void (*routine)(void *), void *parameter)
{
off_routine = routine;
off_parameter = parameter;

View file

@ -337,7 +337,7 @@ void posix_sw_clear_pending_IRQ(unsigned int IRQn)
/**
* Storage for functions offloaded to IRQ
*/
static irq_offload_routine_t off_routine;
static void (*off_routine)(void *);
static void *off_parameter;
/**
@ -354,7 +354,7 @@ static void offload_sw_irq_handler(void *a)
*
* Raise the SW IRQ assigned to handled this
*/
void posix_irq_offload(irq_offload_routine_t routine, void *parameter)
void posix_irq_offload(void (*routine)(void *), void *parameter)
{
off_routine = routine;
off_parameter = parameter;

View file

@ -25,6 +25,7 @@
#include <arch/posix/asm_inline.h>
#include <board_irq.h> /* Each board must define this */
#include <sw_isr_table.h>
#include <posix_soc_if.h>
#ifdef __cplusplus
extern "C" {
@ -61,6 +62,17 @@ static ALWAYS_INLINE bool z_arch_irq_unlocked(unsigned int key)
return key == false;
}
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);
}
#ifdef __cplusplus
}
#endif