Bottom Half Processor module for generic IRQ offloading using messages.
More...
Bottom Half Processor module for generic IRQ offloading using messages.
- Note
- Offloading ISRs with messages is in general a terrible idea, because messages can be lost. Use it with care or prefer alternatives such as Event based implementation of Bottom Half Processor.
- Author
- José I. Alamos jose..nosp@m.alam.nosp@m.os@ha.nosp@m.w-ha.nosp@m.mburg.nosp@m..de
◆ BHP_MSG_BH_REQUEST
#define BHP_MSG_BH_REQUEST 0x1539 |
The message type to trigger Bottom Half Processing.
Definition at line 38 of file msg.h.
◆ bhp_msg_claim_thread()
Claim a thread with a message queue to be used as Bottom Half Processor.
- Parameters
-
[in] | bhp_msg | The message based Bottom Half Processor descriptor |
[in] | pid | PID of the target thread |
Definition at line 81 of file msg.h.
◆ bhp_msg_handler()
static void bhp_msg_handler |
( |
msg_t * |
msg | ) |
|
|
inlinestatic |
Handle a Bottom Half Processor message with type BHP_MSG_BH_REQUEST.
This function will call bhp_irq_handler internally.
- Note
- This function asserts that the message type is BHP_MSG_BH_REQUEST.
- Parameters
-
[in] | msg | Pointer to the Bottom Half Processor message. |
Definition at line 95 of file msg.h.
◆ bhp_msg_init()
Init a Bottom Half Processor to be used with messages.
- Postcondition
- the target PID is set to KERNEL_PID_UNDEF
- Parameters
-
[in] | bhp_msg | The message based Bottom Half Processor descriptor |
[in] | cb | Bottom Half Processor callback |
[in] | ctx | Context of cb |
◆ bhp_msg_isr_cb()
void bhp_msg_isr_cb |
( |
void * |
bhp_msg_ctx | ) |
|
Message based Bottom Half Processor ISR callback To be called from ISR in order to trigger the Bottom Half Processor.
This sends a message with type BHP_MSG_BH_REQUEST to the target thread, which should process the event accordingly by calling bhp_msg_handler.
- Note
- This function asserts that the target PID is valid. Therefore, make sure to call bhp_msg_claim_thread beforehand.
- Parameters
-
[in] | bhp_msg_ctx | Pointer to the message based Bottom Half Processor (bhp_msg_t) Bottom Half Processor. |