1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

cpu/esp_common: add missing functions for ESP-EDF v 4.4

This commit is contained in:
Gunar Schorcht 2022-02-01 21:48:14 +01:00
parent ec5993d888
commit 9fd056f8ec
2 changed files with 45 additions and 2 deletions

View File

@ -28,8 +28,9 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef XTENSA_API_H
#define XTENSA_API_H
#include <xtensa/hal.h>
#include <stdbool.h>
#include <xtensa/hal.h>
#include "xtensa_context.h"
#ifdef __cplusplus
@ -120,6 +121,25 @@ static inline void xt_set_intclear(unsigned int arg)
xthal_set_intclear(arg);
}
/*
-------------------------------------------------------------------------------
Call this function to get handler's argument for the specified interrupt.
n - Interrupt number.
-------------------------------------------------------------------------------
*/
extern void * xt_get_interrupt_handler_arg(int n);
/*
-------------------------------------------------------------------------------
Call this function to check if the specified interrupt is free to use.
intr - Interrupt number.
cpu - cpu number.
-------------------------------------------------------------------------------
*/
bool xt_int_has_handler(int intr, int cpu);
#ifdef __cplusplus
}
#endif

View File

@ -95,7 +95,6 @@ void xt_unhandled_interrupt(void * arg)
exit(-1);
}
/*
This function registers a handler for the specified interrupt. The "arg"
parameter specifies the argument to be passed to the handler when it is
@ -127,5 +126,29 @@ xt_handler xt_set_interrupt_handler(int n, xt_handler f, void * arg)
return ((old == &xt_unhandled_interrupt) ? 0 : old);
}
bool xt_int_has_handler(int intr, int cpu)
{
/* TODO multiple cores */
(void)cpu;
return (_xt_interrupt_table[intr].handler != xt_unhandled_interrupt);
}
#if CONFIG_APPTRACE_SV_ENABLE
void * xt_get_interrupt_handler_arg(int n)
{
/* TODO multiple cores */
xt_handler_table_entry * entry;
if( n < 0 || n >= XCHAL_NUM_INTERRUPTS )
return 0; /* invalid interrupt number */
/* Convert exception number to _xt_exception_table name */
n = n * portNUM_PROCESSORS + xPortGetCoreID();
entry = _xt_interrupt_table + n;
return entry->arg;
}
#endif
#endif /* XCHAL_HAVE_INTERRUPTS */