forked from Imagelibrary/rtems
rtems: Add get/set interrupt priorities
Add directives to get and set the priority of an interrupt vector. Implement the directives for the following BSP families: * arm/lpc24xx * arm/lpc32xx * powerpc/mpc55xxevb * powerpc/qoriq Implement the directives for the following interrupt controllers: * GICv2 and GICv3 (arm and aarch64) * NVIC (arm) * PLIC (riscv) Update #5002.
This commit is contained in:
committed by
Kinsey Moore
parent
89ccc65d1a
commit
ab8817ca03
@@ -153,6 +153,25 @@ rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_interrupt_set_priority(
|
||||
rtems_vector_number vector,
|
||||
uint32_t priority
|
||||
)
|
||||
{
|
||||
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
|
||||
return RTEMS_UNSATISFIED;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_interrupt_get_priority(
|
||||
rtems_vector_number vector,
|
||||
uint32_t *priority
|
||||
)
|
||||
{
|
||||
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
|
||||
bsp_interrupt_assert(priority != NULL);
|
||||
return RTEMS_UNSATISFIED;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_interrupt_get_affinity(
|
||||
rtems_vector_number vector,
|
||||
Processor_mask *affinity
|
||||
|
||||
@@ -356,6 +356,8 @@ rtems_status_code bsp_interrupt_get_attributes(
|
||||
rtems_interrupt_attributes *attributes
|
||||
)
|
||||
{
|
||||
bool is_external = RISCV_INTERRUPT_VECTOR_IS_EXTERNAL(vector);
|
||||
|
||||
attributes->is_maskable = true;
|
||||
attributes->can_enable = true;
|
||||
attributes->maybe_enable = true;
|
||||
@@ -364,8 +366,13 @@ rtems_status_code bsp_interrupt_get_attributes(
|
||||
attributes->can_raise = (vector == RISCV_INTERRUPT_VECTOR_SOFTWARE);
|
||||
attributes->can_raise_on = attributes->can_raise;
|
||||
attributes->cleared_by_acknowledge = true;
|
||||
attributes->can_get_affinity = RISCV_INTERRUPT_VECTOR_IS_EXTERNAL(vector);
|
||||
attributes->can_set_affinity = attributes->can_get_affinity;
|
||||
attributes->can_get_affinity = is_external;
|
||||
attributes->can_set_affinity = is_external;
|
||||
|
||||
/* The PLIC priority is defined by a 32-bit WARL register */
|
||||
attributes->maximum_priority = UINT32_MAX;
|
||||
attributes->can_get_priority = is_external;
|
||||
attributes->can_set_priority = is_external;
|
||||
|
||||
if (vector == RISCV_INTERRUPT_VECTOR_SOFTWARE) {
|
||||
attributes->trigger_signal = RTEMS_INTERRUPT_NO_SIGNAL;
|
||||
@@ -619,6 +626,39 @@ rtems_status_code bsp_interrupt_vector_disable(rtems_vector_number vector)
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_interrupt_set_priority(
|
||||
rtems_vector_number vector,
|
||||
uint32_t priority
|
||||
)
|
||||
{
|
||||
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
|
||||
|
||||
if (!RISCV_INTERRUPT_VECTOR_IS_EXTERNAL(vector)) {
|
||||
return RTEMS_UNSATISFIED;
|
||||
}
|
||||
|
||||
riscv_plic->priority[RISCV_INTERRUPT_VECTOR_EXTERNAL_TO_INDEX(vector)] =
|
||||
UINT32_MAX - priority;
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
rtems_status_code bsp_interrupt_get_priority(
|
||||
rtems_vector_number vector,
|
||||
uint32_t *priority
|
||||
)
|
||||
{
|
||||
bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
|
||||
bsp_interrupt_assert(priority != NULL);
|
||||
|
||||
if (!RISCV_INTERRUPT_VECTOR_IS_EXTERNAL(vector)) {
|
||||
return RTEMS_UNSATISFIED;
|
||||
}
|
||||
|
||||
*priority = UINT32_MAX -
|
||||
riscv_plic->priority[RISCV_INTERRUPT_VECTOR_EXTERNAL_TO_INDEX(vector)];
|
||||
return RTEMS_SUCCESSFUL;
|
||||
}
|
||||
|
||||
#ifdef RTEMS_SMP
|
||||
rtems_status_code bsp_interrupt_set_affinity(
|
||||
rtems_vector_number vector,
|
||||
|
||||
Reference in New Issue
Block a user