Loading...
Searching...
No Matches
msg.h
1/*
2 * Copyright (C) 2022 HAW Hamburg
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser General
5 * Public License v2.1. See the file LICENSE in the top level directory for more
6 * details.
7 */
8
9#pragma once
10
25
26#include "msg.h"
27#include "thread.h"
28#include "bhp.h"
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
37#define BHP_MSG_BH_REQUEST 0x1539
38
47
56void bhp_msg_init(bhp_msg_t *bhp_msg, bhp_cb_t cb, void *ctx);
57
72void bhp_msg_isr_cb(void *bhp_msg_ctx);
73
80static inline void bhp_msg_claim_thread(bhp_msg_t *bhp_msg, kernel_pid_t pid)
81{
82 bhp_msg->pid = pid;
83}
84
94static inline void bhp_msg_handler(msg_t *msg)
95{
98}
99
100#ifdef __cplusplus
101}
102#endif
103
#define assert(cond)
abort the program if assertion is false
Definition assert.h:135
int16_t kernel_pid_t
Unique process identifier.
Definition sched.h:138
static void bhp_msg_handler(msg_t *msg)
Handle a Bottom Half Processor message with type BHP_MSG_BH_REQUEST.
Definition msg.h:94
#define BHP_MSG_BH_REQUEST
The message type to trigger Bottom Half Processing.
Definition msg.h:37
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:80
static void bhp_irq_handler(bhp_t *bhp)
Call the IRQ handler associated to a Bottom Half Processor descriptor.
Definition bhp.h:63
struct bhp bhp_t
Forward declaration of the Bottom Half Processor descriptor.
Definition bhp.h:38
void(* bhp_cb_t)(void *arg)
A Bottom Half Processor callback.
Definition bhp.h:45
Message based Bottom Half Processor descriptor.
Definition msg.h:42
bhp_t bhp
Bottom Half Processor descriptor.
Definition msg.h:43
msg_t msg
Message containing the Bottom Half Processing request.
Definition msg.h:45
kernel_pid_t pid
PID of the thread that process the Bottom Half Processor.
Definition msg.h:44
Describes a message object which can be sent between threads.
Definition msg.h:195
uint16_t type
Type field.
Definition msg.h:198
union msg_t::@320015036040264217111030043207077155207261357035 content
Content of the message.
void * ptr
Pointer content field.
Definition msg.h:200