irq: Change dynamic API to take a constant parameter

All ISRs are meant to take a const struct device pointer, but to
simplify the change let's just move the parameter to constant and that
should be fine.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2020-07-10 14:17:20 +02:00 committed by Carles Cufí
commit 6df8b3995e
6 changed files with 16 additions and 14 deletions

View file

@ -61,7 +61,7 @@ def read_intlist(intlist_path, syms):
/** ISR to call */ /** ISR to call */
void *func; void *func;
/** Parameter for non-direct IRQs */ /** Parameter for non-direct IRQs */
void *param; const void *param;
}; };
""" """
@ -175,7 +175,7 @@ def write_source_file(fp, vt, swt, intlist, syms):
fp.write("\t/* Level 3 interrupts start here (offset: {}) */\n". fp.write("\t/* Level 3 interrupts start here (offset: {}) */\n".
format(level3_offset)) format(level3_offset))
fp.write("\t{{(void *){0:#x}, (void *){1}}},\n".format(param, func_as_string)) fp.write("\t{{(const void *){0:#x}, (void *){1}}},\n".format(param, func_as_string))
fp.write("};\n") fp.write("};\n")
def get_symbols(obj): def get_symbols(obj):

View file

@ -60,6 +60,7 @@ uint32_t __irq_vector_table _irq_vector_table[IRQ_TABLE_SIZE] = {
*/ */
#ifdef CONFIG_GEN_SW_ISR_TABLE #ifdef CONFIG_GEN_SW_ISR_TABLE
struct _isr_table_entry __sw_isr_table _sw_isr_table[IRQ_TABLE_SIZE] = { struct _isr_table_entry __sw_isr_table _sw_isr_table[IRQ_TABLE_SIZE] = {
[0 ...(IRQ_TABLE_SIZE - 1)] = {(void *)0x42, (void *)&z_irq_spurious}, [0 ...(IRQ_TABLE_SIZE - 1)] = {(const void *)0x42,
(void *)&z_irq_spurious},
}; };
#endif #endif

View file

@ -38,8 +38,8 @@
#ifdef CONFIG_DYNAMIC_INTERRUPTS #ifdef CONFIG_DYNAMIC_INTERRUPTS
extern int z_soc_irq_connect_dynamic(unsigned int irq, unsigned int priority, extern int z_soc_irq_connect_dynamic(unsigned int irq, unsigned int priority,
void (*routine)(void *parameter), void (*routine)(const void *parameter),
void *parameter, uint32_t flags); const void *parameter, uint32_t flags);
#endif #endif
#else #else

View file

@ -63,8 +63,8 @@ extern "C" {
*/ */
static inline int static inline int
irq_connect_dynamic(unsigned int irq, unsigned int priority, irq_connect_dynamic(unsigned int irq, unsigned int priority,
void (*routine)(void *parameter), void *parameter, void (*routine)(const void *parameter),
uint32_t flags) const void *parameter, uint32_t flags)
{ {
return arch_irq_connect_dynamic(irq, priority, routine, parameter, return arch_irq_connect_dynamic(irq, priority, routine, parameter,
flags); flags);

View file

@ -28,8 +28,8 @@ extern "C" {
* on ARM Cortex-M (Thumb2). * on ARM Cortex-M (Thumb2).
*/ */
struct _isr_table_entry { struct _isr_table_entry {
void *arg; const void *arg;
void (*isr)(void *); void (*isr)(const void *);
}; };
/* The software ISR table itself, an array of these structures indexed by the /* The software ISR table itself, an array of these structures indexed by the
@ -52,7 +52,7 @@ struct _isr_list {
/** ISR to call */ /** ISR to call */
void *func; void *func;
/** Parameter for non-direct IRQs */ /** Parameter for non-direct IRQs */
void *param; const void *param;
}; };
/** This interrupt gets put directly in the vector table */ /** This interrupt gets put directly in the vector table */
@ -68,12 +68,13 @@ struct _isr_list {
#define Z_ISR_DECLARE(irq, flags, func, param) \ #define Z_ISR_DECLARE(irq, flags, func, param) \
static Z_DECL_ALIGN(struct _isr_list) Z_GENERIC_SECTION(.intList) \ static Z_DECL_ALIGN(struct _isr_list) Z_GENERIC_SECTION(.intList) \
__used _MK_ISR_NAME(func, __COUNTER__) = \ __used _MK_ISR_NAME(func, __COUNTER__) = \
{irq, flags, (void *)&func, (void *)param} {irq, flags, (void *)&func, (const void *)param}
#define IRQ_TABLE_SIZE (CONFIG_NUM_IRQS - CONFIG_GEN_IRQ_START_VECTOR) #define IRQ_TABLE_SIZE (CONFIG_NUM_IRQS - CONFIG_GEN_IRQ_START_VECTOR)
#ifdef CONFIG_DYNAMIC_INTERRUPTS #ifdef CONFIG_DYNAMIC_INTERRUPTS
void z_isr_install(unsigned int irq, void (*routine)(void *), void *param); void z_isr_install(unsigned int irq, void (*routine)(const void *),
const void *param);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View file

@ -280,8 +280,8 @@ int arch_irq_is_enabled(unsigned int irq);
* @return The vector assigned to this interrupt * @return The vector assigned to this interrupt
*/ */
int arch_irq_connect_dynamic(unsigned int irq, unsigned int priority, int arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
void (*routine)(void *parameter), void (*routine)(const void *parameter),
void *parameter, uint32_t flags); const void *parameter, uint32_t flags);
/** /**
* @def ARCH_IRQ_CONNECT(irq, pri, isr, arg, flags) * @def ARCH_IRQ_CONNECT(irq, pri, isr, arg, flags)