Skip to content

Commit

Permalink
core: interrupt: helper function for raise_pi, raise_sgi, set_affinity
Browse files Browse the repository at this point in the history
Defines helper API functions to call .raise_pi, .raise_sgi and
.set_affinity handlers of a chip controller. Defines API function
to query support of these handlers in the interrupt controller.

Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
  • Loading branch information
etienne-lms authored and jforissier committed Oct 11, 2023
1 parent 1b5c7ca commit b2d6db2
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions core/include/kernel/interrupt.h
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,70 @@ static inline void interrupt_disable(struct itr_chip *chip, size_t itr_num)
chip->ops->disable(chip, itr_num);
}

/*
* interrupt_can_raise_pi() - Return whether controller embeds raise_pi
* @chip Interrupt controller
*/
static inline bool interrupt_can_raise_pi(struct itr_chip *chip)
{
return chip->ops->raise_pi;
}

/*
* interrupt_can_raise_sgi() - Return whether controller embeds raise_sgi
* @chip Interrupt controller
*/
static inline bool interrupt_can_raise_sgi(struct itr_chip *chip)
{
return chip->ops->raise_sgi;
}

/*
* interrupt_can_set_affinity() - Return whether controller embeds set_affinity
* @chip Interrupt controller
*/
static inline bool interrupt_can_set_affinity(struct itr_chip *chip)
{
return chip->ops->set_affinity;
}

/*
* interrupt_raise_pi() - Raise a peripheral interrupt of a controller
* @chip Interrupt controller
* @itr_num Interrupt number to raise
*/
static inline void interrupt_raise_pi(struct itr_chip *chip, size_t itr_num)
{
assert(interrupt_can_raise_pi(chip));
chip->ops->raise_pi(chip, itr_num);
}

/*
* interrupt_raise_sgi() - Raise a software generiated interrupt of a controller
* @chip Interrupt controller
* @itr_num Interrupt number to raise
* @cpu_mask Mask of the CPUs targeted by the interrupt
*/
static inline void interrupt_raise_sgi(struct itr_chip *chip, size_t itr_num,
uint8_t cpu_mask)
{
assert(interrupt_can_raise_sgi(chip));
chip->ops->raise_sgi(chip, itr_num, cpu_mask);
}

/*
* interrupt_set_affinity() - Set CPU affinity for a controller interrupt
* @chip Interrupt controller
* @itr_num Interrupt number to raise
* @cpu_mask Mask of the CPUs targeted by the interrupt
*/
static inline void interrupt_set_affinity(struct itr_chip *chip, size_t itr_num,
uint8_t cpu_mask)
{
assert(interrupt_can_set_affinity(chip));
chip->ops->set_affinity(chip, itr_num, cpu_mask);
}

/*
* interrupt_configure() - Configure an interrupt in an interrupt controller
* @chip Interrupt controller
Expand Down

0 comments on commit b2d6db2

Please sign in to comment.