Very Simple Kernel 0.1.0
Loading...
Searching...
No Matches
vsk_Inbox.h
Go to the documentation of this file.
1/**
2 * @file
3 */
4#ifndef VSK_INBOX_H
5#define VSK_INBOX_H
6/**
7 * @ingroup vsk
8 * @defgroup vsk_Inbox vsk_Inbox
9 * @{
10 */
11
12/**
13 * @brief Inbox class
14 */
16
17/**
18 * @brief Inbox
19 */
20typedef struct vsk_Inbox vsk_Inbox_t;
21
22#include "ctb_Queue.h"
23#include "vsk_Message.h"
24#include "vsk_Task.h"
25
26/**
27 * @brief Inbox class
28 */
30 ctb_DList_t inboxes;
31};
32
33/**
34 * @brief Inbox
35 */
36struct vsk_Inbox {
37 vsk_Inbox_Class_t * cls; /**< Inbox class reference */
38 ctb_DNode_t node; /**< Node to allow inbox to be added to a list */
39 vsk_Task_t * task; /**< Associated Task reference */
40 ctb_Queue_t messageQueue; /**< Queue of messages */
41};
42
43/**
44 * @brief Inbox class instance
45 */
47
48/**
49 * @brief Initializes the Inbox class
50 *
51 * @param cls Inbox class reference
52 * @return Initialized Inbox class reference
53 */
55
56/**
57 * @brief Propagates the system tick to all inboxes
58 *
59 * @param cls Inbox class reference
60 */
62
63/**
64 * @brief Initializes an Inbox
65 *
66 * @param self Inbox reference
67 * @param task Associated Task reference
68 * @return Initialized Inbox reference
69 */
70vsk_Inbox_t * vsk_Inbox_init(vsk_Inbox_t * const self, vsk_Task_t * const task);
71
72/**
73 * @brief Checks if the inbox is empty
74 *
75 * @param self Inbox reference
76 * @return true if the inbox is empty
77 * @return false if the inbox is not empty
78 */
79bool vsk_Inbox_isEmpty(vsk_Inbox_t * const self);
80
81/**
82 * @brief Posts a message to the inbox
83 *
84 * @param self Inbox reference
85 * @param message Message reference
86 */
87void vsk_Inbox_postMessage(vsk_Inbox_t * const self, vsk_Message_t * const message);
88
89/**
90 * @brief Reads a message from the inbox
91 *
92 * @param self Inbox reference
93 * @return Message reference
94 */
96
97/**
98 * @brief Clears the inbox
99 *
100 * @param self Inbox reference
101 */
102void vsk_Inbox_clear(vsk_Inbox_t * const self);
103
104/** @} */
105#endif // VSK_INBOX_H
vsk_Inbox_Class_t * vsk_Inbox_Class_init(vsk_Inbox_Class_t *const cls)
Initializes the Inbox class.
Definition vsk_Inbox.c:12
void vsk_Inbox_clear(vsk_Inbox_t *const self)
Clears the inbox.
Definition vsk_Inbox.c:70
void vsk_Inbox_Class_onTick(vsk_Inbox_Class_t *const cls)
Propagates the system tick to all inboxes.
Definition vsk_Inbox.c:30
void vsk_Inbox_postMessage(vsk_Inbox_t *const self, vsk_Message_t *const message)
Posts a message to the inbox.
Definition vsk_Inbox.c:50
vsk_Message_t * vsk_Inbox_readMessage(vsk_Inbox_t *const self)
Reads a message from the inbox.
Definition vsk_Inbox.c:59
vsk_Inbox_t * vsk_Inbox_init(vsk_Inbox_t *const self, vsk_Task_t *const task)
Initializes an Inbox.
Definition vsk_Inbox.c:34
vsk_Inbox_Class_t vsk_Inbox_Class
Inbox class instance.
Definition vsk_Inbox.c:5
bool vsk_Inbox_isEmpty(vsk_Inbox_t *const self)
Checks if the inbox is empty.
Definition vsk_Inbox.c:42
Inbox class.
Definition vsk_Inbox.h:29
Inbox.
Definition vsk_Inbox.h:36
ctb_DNode_t node
Definition vsk_Inbox.h:38
vsk_Task_t * task
Definition vsk_Inbox.h:39
ctb_Queue_t messageQueue
Definition vsk_Inbox.h:40
vsk_Inbox_Class_t * cls
Definition vsk_Inbox.h:37
Message.
Definition vsk_Message.h:27
Task.
Definition vsk_Task.h:63