Loading...
Searching...
No Matches
msg.h
1/*
2 * SPDX-FileCopyrightText: 2022 HAW Hamburg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
22
23#include "msg.h"
24#include "thread.h"
25#include "bhp.h"
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
34#define BHP_MSG_BH_REQUEST 0x1539
35
44
53void bhp_msg_init(bhp_msg_t *bhp_msg, bhp_cb_t cb, void *ctx);
54
69void bhp_msg_isr_cb(void *bhp_msg_ctx);
70
77static inline void bhp_msg_claim_thread(bhp_msg_t *bhp_msg, kernel_pid_t pid)
78{
79 bhp_msg->pid = pid;
80}
81
91static 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:134
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
struct bhp bhp_t
Forward declaration of the Bottom Half Processor descriptor.
Definition bhp.h:35
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
Describes a message object which can be sent between threads.
Definition msg.h:193
uint16_t type
Type field.
Definition msg.h:196
union msg_t::@320015036040264217111030043207077155207261357035 content
Content of the message.
void * ptr
Pointer content field.
Definition msg.h:198