arch: common: irq: relocate internal functions into a private header
Relocate new and existing internal software-managed table access functions from the public `sw_isr_table.h` into a private header that should only be accessed internally. Signed-off-by: Yong Cong Sin <ycsin@meta.com>
This commit is contained in:
parent
ad788a335f
commit
ec93404a26
6 changed files with 64 additions and 29 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
zephyr_library()
|
zephyr_library()
|
||||||
|
|
||||||
|
zephyr_library_include_directories(include)
|
||||||
|
|
||||||
# Library may be empty due to kconfigs
|
# Library may be empty due to kconfigs
|
||||||
zephyr_library_property(ALLOW_EMPTY TRUE)
|
zephyr_library_property(ALLOW_EMPTY TRUE)
|
||||||
|
|
||||||
|
|
57
arch/common/include/sw_isr_common.h
Normal file
57
arch/common/include/sw_isr_common.h
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2023, Meta
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief Private header for the software-managed ISR table's functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef ZEPHYR_ARCH_COMMON_INCLUDE_SW_ISR_COMMON_H_
|
||||||
|
#define ZEPHYR_ARCH_COMMON_INCLUDE_SW_ISR_COMMON_H_
|
||||||
|
|
||||||
|
#if !defined(_ASMLANGUAGE)
|
||||||
|
#include <zephyr/device.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper function used to compute the index in _sw_isr_table
|
||||||
|
* based on passed IRQ.
|
||||||
|
*
|
||||||
|
* @param irq IRQ number in its zephyr format
|
||||||
|
*
|
||||||
|
* @return corresponding index in _sw_isr_table
|
||||||
|
*/
|
||||||
|
unsigned int z_get_sw_isr_table_idx(unsigned int irq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper function used to get the parent interrupt controller device based on passed IRQ.
|
||||||
|
*
|
||||||
|
* @param irq IRQ number in its zephyr format
|
||||||
|
*
|
||||||
|
* @return corresponding interrupt controller device in _sw_isr_table
|
||||||
|
*/
|
||||||
|
const struct device *z_get_sw_isr_device_from_irq(unsigned int irq);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Helper function used to get the IRQN of the passed in parent interrupt
|
||||||
|
* controller device.
|
||||||
|
*
|
||||||
|
* @param dev parent interrupt controller device
|
||||||
|
*
|
||||||
|
* @return IRQN of the interrupt controller
|
||||||
|
*/
|
||||||
|
unsigned int z_get_sw_isr_irq_from_device(const struct device *dev);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _ASMLANGUAGE */
|
||||||
|
|
||||||
|
#endif /* ZEPHYR_ARCH_COMMON_INCLUDE_SW_ISR_COMMON_H_ */
|
|
@ -4,6 +4,8 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "sw_isr_common.h"
|
||||||
|
|
||||||
#include <zephyr/sw_isr_table.h>
|
#include <zephyr/sw_isr_table.h>
|
||||||
#include <zephyr/spinlock.h>
|
#include <zephyr/spinlock.h>
|
||||||
|
|
||||||
|
|
|
@ -84,35 +84,6 @@ void z_shared_isr(const void *data);
|
||||||
extern struct z_shared_isr_table_entry z_shared_sw_isr_table[];
|
extern struct z_shared_isr_table_entry z_shared_sw_isr_table[];
|
||||||
#endif /* CONFIG_SHARED_INTERRUPTS */
|
#endif /* CONFIG_SHARED_INTERRUPTS */
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Helper function used to compute the index in _sw_isr_table
|
|
||||||
* based on passed IRQ.
|
|
||||||
*
|
|
||||||
* @param irq IRQ number in its zephyr format
|
|
||||||
*
|
|
||||||
* @return corresponding index in _sw_isr_table
|
|
||||||
*/
|
|
||||||
unsigned int z_get_sw_isr_table_idx(unsigned int irq);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Helper function used to get the parent interrupt controller device based on passed IRQ.
|
|
||||||
*
|
|
||||||
* @param irq IRQ number in its zephyr format
|
|
||||||
*
|
|
||||||
* @return corresponding interrupt controller device in _sw_isr_table
|
|
||||||
*/
|
|
||||||
const struct device *z_get_sw_isr_device_from_irq(unsigned int irq);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Helper function used to get the IRQN of the passed in parent interrupt
|
|
||||||
* controller device.
|
|
||||||
*
|
|
||||||
* @param dev parent interrupt controller device
|
|
||||||
*
|
|
||||||
* @return IRQN of the interrupt controller
|
|
||||||
*/
|
|
||||||
unsigned int z_get_sw_isr_irq_from_device(const struct device *dev);
|
|
||||||
|
|
||||||
/** This interrupt gets put directly in the vector table */
|
/** This interrupt gets put directly in the vector table */
|
||||||
#define ISR_FLAG_DIRECT BIT(0)
|
#define ISR_FLAG_DIRECT BIT(0)
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ project(interrupt)
|
||||||
target_include_directories(app PRIVATE
|
target_include_directories(app PRIVATE
|
||||||
${ZEPHYR_BASE}/kernel/include
|
${ZEPHYR_BASE}/kernel/include
|
||||||
${ZEPHYR_BASE}/arch/${ARCH}/include
|
${ZEPHYR_BASE}/arch/${ARCH}/include
|
||||||
|
${ZEPHYR_BASE}/arch/common/include
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(app PRIVATE
|
target_sources(app PRIVATE
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "sw_isr_common.h"
|
||||||
|
|
||||||
#include <zephyr/ztest.h>
|
#include <zephyr/ztest.h>
|
||||||
|
|
||||||
extern const struct _irq_parent_entry _lvl2_irq_list[];
|
extern const struct _irq_parent_entry _lvl2_irq_list[];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue