Skip to content

Commit

Permalink
arch: arm: use platform_ for platform hooks
Browse files Browse the repository at this point in the history
Rename platform hooks enabled with Kconfig from z_soc_ to platform_.

Move from private hook names to internal using a common prefix for
platform hooks.

Signed-off-by: Anas Nashif <[email protected]>
  • Loading branch information
nashif committed Dec 1, 2023
1 parent 81fe0a7 commit d8e2b5d
Show file tree
Hide file tree
Showing 14 changed files with 45 additions and 46 deletions.
2 changes: 1 addition & 1 deletion arch/arm/core/cortex_a_r/irq_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ void z_arm_interrupt_init(void)
*/
#ifdef CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER
/* Invoke SoC-specific interrupt controller initialisation */
z_soc_irq_init();
platform_irq_init();
#endif
}
4 changes: 2 additions & 2 deletions arch/arm/core/cortex_a_r/irq_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int arch_irq_is_enabled(unsigned int irq)
* priority levels which are reserved: three for various types of exceptions,
* and possibly one additional to support zero latency interrupts.
*/
void z_arm_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
void arch_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
{
arm_gic_irq_set_priority(irq, prio, flags);
}
Expand Down Expand Up @@ -112,7 +112,7 @@ int arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
const void *parameter, uint32_t flags)
{
z_isr_install(irq, routine, parameter);
z_arm_irq_priority_set(irq, priority, flags);
arch_irq_priority_set(irq, priority, flags);
return irq;
}
#endif /* CONFIG_GEN_ISR_TABLES */
Expand Down
8 changes: 4 additions & 4 deletions arch/arm/core/cortex_a_r/isr_wrapper.S
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ _idle_state_cleared:
#if !defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
bl arm_gic_get_active
#else
bl z_soc_irq_get_active
bl platform_irq_get_active
#endif /* !CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */
push {r0, r1}
lsl r0, r0, #3 /* table is 8-byte wide */
Expand Down Expand Up @@ -217,7 +217,7 @@ spurious_continue:
#if !defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
bl arm_gic_eoi
#else
bl z_soc_irq_eoi
bl platform_irq_eoi
#endif /* !CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */

#ifdef CONFIG_TRACING_ISR
Expand Down Expand Up @@ -291,7 +291,7 @@ _idle_state_cleared:
#if !defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
bl arm_gic_get_active
#else
bl z_soc_irq_get_active
bl platform_irq_get_active
#endif /* !CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */

push {r0, r1}
Expand Down Expand Up @@ -323,7 +323,7 @@ spurious_continue:
#if !defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
bl arm_gic_eoi
#else
bl z_soc_irq_eoi
bl platform_irq_eoi
#endif /* !CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */

#ifdef CONFIG_TRACING_ISR
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/core/cortex_m/irq_manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ int arch_irq_is_enabled(unsigned int irq)
* of priority levels is a little complex, as there are some hardware
* priority levels which are reserved.
*/
void z_arm_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
void arch_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
{
/* The kernel may reserve some of the highest priority levels.
* So we offset the requested priority level with the number
Expand Down Expand Up @@ -245,7 +245,7 @@ int arch_irq_connect_dynamic(unsigned int irq, unsigned int priority,
const void *parameter, uint32_t flags)
{
z_isr_install(irq, routine, parameter);
z_arm_irq_priority_set(irq, priority, flags);
arch_irq_priority_set(irq, priority, flags);
return irq;
}
#endif /* CONFIG_GEN_ISR_TABLES */
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/core/cortex_m/isr_wrapper.S
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ _idle_state_cleared:
#endif /* CONFIG_PM */

#if defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
bl z_soc_irq_get_active
bl platform_irq_get_active
#else
mrs r0, IPSR /* get exception number */
#endif /* CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */
Expand Down Expand Up @@ -129,7 +129,7 @@ _idle_state_cleared:

#if defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
pop {r0}
bl z_soc_irq_eoi
bl platform_irq_eoi
#endif /* CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */

#ifdef CONFIG_TRACING_ISR
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/core/cortex_m/prep_c.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void z_arm_prep_c(void)
z_data_copy();
#if defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
/* Invoke SoC-specific interrupt controller initialization */
z_soc_irq_init();
platform_irq_init();
#else
z_arm_interrupt_init();
#endif /* CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/core/irq_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ void z_arm64_interrupt_init(void)
{
#ifdef CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER
/* Invoke SoC-specific interrupt controller initialisation */
z_soc_irq_init();
platform_irq_init();
#endif
}
4 changes: 2 additions & 2 deletions arch/arm64/core/isr_wrapper.S
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ SECTION_FUNC(TEXT, _isr_wrapper)
#if !defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
bl arm_gic_get_active
#else
bl z_soc_irq_get_active
bl platform_irq_get_active
#endif /* !CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */

#if CONFIG_GIC_VER >= 3
Expand Down Expand Up @@ -104,7 +104,7 @@ spurious_continue:
#if !defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
bl arm_gic_eoi
#else
bl z_soc_irq_eoi
bl platform_irq_eoi
#endif /* !CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */

#ifdef CONFIG_TRACING
Expand Down
2 changes: 1 addition & 1 deletion drivers/interrupt_controller/intc_ra_icu.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ int ra_icu_irq_connect_dynamic(unsigned int irq, unsigned int priority,
irq_disable(irqn);
sys_write32(event, IELSRn_REG(irqn));
z_isr_install(irqn, routine, parameter);
z_arm_irq_priority_set(irqn, priority, flags);
arch_irq_priority_set(irqn, priority, flags);
ra_icu_irq_configure(event, intcfg);
irq_enable(irqn);

Expand Down
23 changes: 11 additions & 12 deletions include/zephyr/arch/arm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ GTEXT(arch_irq_enable)
GTEXT(arch_irq_disable)
GTEXT(arch_irq_is_enabled)
#if defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
GTEXT(z_soc_irq_get_active)
GTEXT(z_soc_irq_eoi)
GTEXT(platform_irq_get_active)
GTEXT(platform_irq_eoi)
#endif /* CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */
#else

Expand All @@ -41,7 +41,7 @@ extern void arch_irq_disable(unsigned int irq);
extern int arch_irq_is_enabled(unsigned int irq);

/* internal routine documented in C file, needed by IRQ_CONNECT() macro */
extern void z_arm_irq_priority_set(unsigned int irq, unsigned int prio,
extern void arch_irq_priority_set(unsigned int irq, unsigned int prio,
uint32_t flags);

#else
Expand All @@ -51,23 +51,22 @@ extern void z_arm_irq_priority_set(unsigned int irq, unsigned int prio,
* interrupt control functions to the SoC layer interrupt control functions.
*/

void z_soc_irq_init(void);
void platform_irq_init(void);
void platform_irq_enable(unsigned int irq);
void platform_irq_disable(unsigned int irq);
int platform_irq_is_enabled(unsigned int irq);

void z_soc_irq_priority_set(
unsigned int irq, unsigned int prio, unsigned int flags);
void platform_irq_priority_set(unsigned int irq, unsigned int prio, unsigned int flags);

unsigned int z_soc_irq_get_active(void);
void z_soc_irq_eoi(unsigned int irq);
unsigned int platform_irq_get_active(void);
void platform_irq_eoi(unsigned int irq);

#define arch_irq_enable(irq) platform_irq_enable(irq)
#define arch_irq_disable(irq) platform_irq_disable(irq)
#define arch_irq_is_enabled(irq) platform_irq_is_enabled(irq)

#define z_arm_irq_priority_set(irq, prio, flags) \
z_soc_irq_priority_set(irq, prio, flags)
#define arch_irq_priority_set(irq, prio, flags) \
platform_irq_priority_set(irq, prio, flags)

#endif /* !CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */

Expand Down Expand Up @@ -119,7 +118,7 @@ extern void z_arm_interrupt_init(void);
"ZLI interrupt registered but feature is disabled"); \
_CHECK_PRIO(priority_p, flags_p) \
Z_ISR_DECLARE(irq_p, 0, isr_p, isr_param_p); \
z_arm_irq_priority_set(irq_p, priority_p, flags_p); \
arch_irq_priority_set(irq_p, priority_p, flags_p); \
}

#define ARCH_IRQ_DIRECT_CONNECT(irq_p, priority_p, isr_p, flags_p) \
Expand All @@ -128,7 +127,7 @@ extern void z_arm_interrupt_init(void);
"ZLI interrupt registered but feature is disabled"); \
_CHECK_PRIO(priority_p, flags_p) \
Z_ISR_DECLARE(irq_p, ISR_FLAG_DIRECT, isr_p, NULL); \
z_arm_irq_priority_set(irq_p, priority_p, flags_p); \
arch_irq_priority_set(irq_p, priority_p, flags_p); \
}

#ifdef CONFIG_PM
Expand Down
14 changes: 7 additions & 7 deletions include/zephyr/arch/arm64/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ GTEXT(arch_irq_enable)
GTEXT(arch_irq_disable)
GTEXT(arch_irq_is_enabled)
#if defined(CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER)
GTEXT(z_soc_irq_get_active)
GTEXT(z_soc_irq_eoi)
GTEXT(platform_irq_get_active)
GTEXT(platform_irq_eoi)
#endif /* CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */
#else

Expand All @@ -50,23 +50,23 @@ extern void z_arm64_irq_priority_set(unsigned int irq, unsigned int prio,
* interrupt control functions to the SoC layer interrupt control functions.
*/

void z_soc_irq_init(void);
void platform_irq_init(void);
void platform_irq_enable(unsigned int irq);
void platform_irq_disable(unsigned int irq);
int platform_irq_is_enabled(unsigned int irq);

void z_soc_irq_priority_set(
void platform_irq_priority_set(
unsigned int irq, unsigned int prio, unsigned int flags);

unsigned int z_soc_irq_get_active(void);
void z_soc_irq_eoi(unsigned int irq);
unsigned int platform_irq_get_active(void);
void platform_irq_eoi(unsigned int irq);

#define arch_irq_enable(irq) platform_irq_enable(irq)
#define arch_irq_disable(irq) platform_irq_disable(irq)
#define arch_irq_is_enabled(irq) platform_irq_is_enabled(irq)

#define z_arm64_irq_priority_set(irq, prio, flags) \
z_soc_irq_priority_set(irq, prio, flags)
platform_irq_priority_set(irq, prio, flags)

#endif /* !CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER */

Expand Down
2 changes: 1 addition & 1 deletion soc/arm/infineon_cat1/psoc6/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ cy_en_sysint_status_t Cy_SysInt_Init(const cy_stc_sysint_t *config, cy_israddres
* PendSV IRQ (which is used in Cortex-M variants to implement thread
* context-switching) is assigned the lowest IRQ priority level.
* If priority is same as PendSV, we will catch assertion in
* z_arm_irq_priority_set function. To avoid this, change priority
* arch_irq_priority_set function. To avoid this, change priority
* to IRQ_PRIO_LOWEST, if it > IRQ_PRIO_LOWEST. Macro IRQ_PRIO_LOWEST
* takes in to account PendSV specific.
*/
Expand Down
16 changes: 8 additions & 8 deletions tests/arch/arm/arm_custom_interrupt/src/arm_custom_interrupt.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ static volatile bool irq_handler_called;
#define REG_FROM_IRQ(irq) (irq / NUM_IRQS_PER_REG)
#define BIT_FROM_IRQ(irq) (irq % NUM_IRQS_PER_REG)

void z_soc_irq_init(void)
void platform_irq_init(void)
{
int irq = 0;

Expand All @@ -36,40 +36,40 @@ void z_soc_irq_init(void)
custom_init_called = true;
}

void z_soc_irq_enable(unsigned int irq)
void platform_irq_enable(unsigned int irq)
{
if (irq == sw_irq_number) {
custom_enable_called = true;
}
NVIC_EnableIRQ((IRQn_Type)irq);
}

void z_soc_irq_disable(unsigned int irq)
void platform_irq_disable(unsigned int irq)
{
if (irq == sw_irq_number) {
custom_disable_called = true;
}
NVIC_DisableIRQ((IRQn_Type)irq);
}

int z_soc_irq_is_enabled(unsigned int irq)
int platform_irq_is_enabled(unsigned int irq)
{
return NVIC->ISER[REG_FROM_IRQ(irq)] & BIT(BIT_FROM_IRQ(irq));
}

void z_soc_irq_eoi(unsigned int irq)
void platform_irq_eoi(unsigned int irq)
{
if (irq == sw_irq_number) {
custom_eoi_called = true;
}
}

inline __attribute__((always_inline)) unsigned int z_soc_irq_get_active(void)
inline __attribute__((always_inline)) unsigned int platform_irq_get_active(void)
{
return __get_IPSR();
}

void z_soc_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
void platform_irq_priority_set(unsigned int irq, unsigned int prio, uint32_t flags)
{
if (irq == sw_irq_number) {
custom_set_priority_called = true;
Expand Down Expand Up @@ -105,7 +105,7 @@ void arm_isr_handler(const void *args)
#endif

/* IRQ numbers are offset by 16 on Cortex-M. */
unsigned int this_irq = z_soc_irq_get_active() - 16;
unsigned int this_irq = platform_irq_get_active() - 16;

TC_PRINT("Got IRQ: %u\n", this_irq);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void isr2(void)
* NVIC_SetPendingIRQ(), to trigger the pending interrupt. And we check
* that the corresponding interrupt handler is getting called or not.
*
* @see irq_enable(), z_irq_priority_set(), NVIC_SetPendingIRQ()
* @see irq_enable(), arch_irq_priority_set(), NVIC_SetPendingIRQ()
*
*/
ZTEST(vector_table, test_arm_irq_vector_table)
Expand All @@ -143,7 +143,7 @@ ZTEST(vector_table, test_arm_irq_vector_table)

for (int ii = 0; ii < 3; ii++) {
irq_enable(_ISR_OFFSET + ii);
z_arm_irq_priority_set(_ISR_OFFSET + ii, 0, 0);
arch_irq_priority_set(_ISR_OFFSET + ii, 0, 0);
k_sem_init(&sem[ii], 0, K_SEM_MAX_LIMIT);
}

Expand Down

0 comments on commit d8e2b5d

Please sign in to comment.