Skip to content

Commit 399b462

Browse files
committed
esb: Make IRQ priorities configurable with Kconfig
IRQ_DIRECT_CONNECT expects now that the IRQ priority is known compile-time therefore it's no loger possible to set it based on the config structure at runtime. Fix this by removing the IRQ priorities from the config structure and making them configurable with Kconfig instead. Signed-off-by: Robert Lubos <[email protected]>
1 parent f639390 commit 399b462

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

include/esb.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,6 @@ extern "C" {
5454
.retransmit_delay = 600, \
5555
.retransmit_count = 3, \
5656
.tx_mode = ESB_TXMODE_AUTO, \
57-
.radio_irq_priority = 1, \
58-
.event_irq_priority = 2, \
5957
.payload_length = 32, \
6058
.selective_auto_ack = false \
6159
}
@@ -75,8 +73,6 @@ extern "C" {
7573
.retransmit_delay = 600, \
7674
.retransmit_count = 3, \
7775
.tx_mode = ESB_TXMODE_AUTO, \
78-
.radio_irq_priority = 1, \
79-
.event_irq_priority = 2, \
8076
.payload_length = 32, \
8177
.selective_auto_ack = false \
8278
}
@@ -238,9 +234,6 @@ struct esb_config {
238234
/* Control settings */
239235
enum esb_tx_mode tx_mode; /**< Transmission mode. */
240236

241-
uint8_t radio_irq_priority; /**< nRF radio interrupt priority. */
242-
uint8_t event_irq_priority; /**< ESB event interrupt priority. */
243-
244237
uint8_t payload_length; /**< Length of the payload (maximum length depends
245238
* on the platforms that are used on each side).
246239
*/

subsys/esb/Kconfig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,18 @@ config ESB_PIPE_COUNT
4343
accidental use of additional pipes, but it's not a problem leaving
4444
this at 8 even if fewer pipes are used.
4545

46+
config ESB_RADIO_IRQ_PRIORITY
47+
int "Radio interrupt priority"
48+
range 0 5 if ZERO_LATENCY_IRQS
49+
range 0 6
50+
default 1
51+
52+
config ESB_EVENT_IRQ_PRIORITY
53+
int "Event interrupt priority"
54+
range 0 5 if ZERO_LATENCY_IRQS
55+
range 0 6
56+
default 2
57+
4658
menu "Hardware selection (alter with care)"
4759

4860
choice ESB_SYS_TIMER

subsys/esb/esb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,11 +1050,11 @@ int esb_init(const struct esb_config *config)
10501050
sys_timer_init();
10511051
ppi_init();
10521052

1053-
IRQ_DIRECT_CONNECT(RADIO_IRQn, config->radio_irq_priority,
1053+
IRQ_DIRECT_CONNECT(RADIO_IRQn, CONFIG_ESB_RADIO_IRQ_PRIORITY,
10541054
RADIO_IRQHandler, 0);
1055-
IRQ_DIRECT_CONNECT(ESB_EVT_IRQ, config->event_irq_priority,
1055+
IRQ_DIRECT_CONNECT(ESB_EVT_IRQ, CONFIG_ESB_EVENT_IRQ_PRIORITY,
10561056
ESB_EVT_IRQHandler, 0);
1057-
IRQ_DIRECT_CONNECT(ESB_SYS_TIMER_IRQn, config->event_irq_priority,
1057+
IRQ_DIRECT_CONNECT(ESB_SYS_TIMER_IRQn, CONFIG_ESB_EVENT_IRQ_PRIORITY,
10581058
ESB_SYS_TIMER_IRQHandler, 0);
10591059

10601060
irq_enable(RADIO_IRQn);

0 commit comments

Comments
 (0)