msg.h
1 /*
2  * SPDX-FileCopyrightText: 2022 HAW Hamburg
3  * SPDX-License-Identifier: LGPL-2.1-only
4  */
5 
6 #pragma once
7 
23 #include "msg.h"
24 #include "thread.h"
25 #include "bhp.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
34 #define BHP_MSG_BH_REQUEST 0x1539
35 
39 typedef struct {
43 } bhp_msg_t;
44 
53 void bhp_msg_init(bhp_msg_t *bhp_msg, bhp_cb_t cb, void *ctx);
54 
69 void bhp_msg_isr_cb(void *bhp_msg_ctx);
70 
77 static inline void bhp_msg_claim_thread(bhp_msg_t *bhp_msg, kernel_pid_t pid)
78 {
79  bhp_msg->pid = pid;
80 }
81 
91 static inline void bhp_msg_handler(msg_t *msg)
92 {
95 }
96 
97 #ifdef __cplusplus
98 }
99 #endif
100 
#define assert(cond)
abort the program if assertion is false
Definition: assert.h:143
int16_t kernel_pid_t
Unique process identifier.
Definition: sched.h:135
static void bhp_msg_handler(msg_t *msg)
Handle a Bottom Half Processor message with type BHP_MSG_BH_REQUEST.
Definition: msg.h:91
#define BHP_MSG_BH_REQUEST
The message type to trigger Bottom Half Processing.
Definition: msg.h:34
void bhp_msg_init(bhp_msg_t *bhp_msg, bhp_cb_t cb, void *ctx)
Init a Bottom Half Processor to be used with messages.
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...
static void bhp_msg_claim_thread(bhp_msg_t *bhp_msg, kernel_pid_t pid)
Claim a thread with a message queue to be used as Bottom Half Processor.
Definition: msg.h:77
static void bhp_irq_handler(bhp_t *bhp)
Call the IRQ handler associated to a Bottom Half Processor descriptor.
Definition: bhp.h:60
void(* bhp_cb_t)(void *arg)
A Bottom Half Processor callback.
Definition: bhp.h:42
Message based Bottom Half Processor descriptor.
Definition: msg.h:39
bhp_t bhp
Bottom Half Processor descriptor.
Definition: msg.h:40
msg_t msg
Message containing the Bottom Half Processing request.
Definition: msg.h:42
kernel_pid_t pid
PID of the thread that process the Bottom Half Processor.
Definition: msg.h:41
Bottom Half Processor descriptor.
Definition: bhp.h:47
Describes a message object which can be sent between threads.
Definition: msg.h:192
uint16_t type
Type field.
Definition: msg.h:195
union msg_t::@1 content
Content of the message.
void * ptr
Pointer content field.
Definition: msg.h:197
Definitions for parsing and composition of DNS messages.