urtware / inc / urt_node.h @ fb72e91b
History | View | Annotate | Download (3.948 KB)
1 | 1fb06240 | skenneweg | /*
|
---|---|---|---|
2 | µRtWare is a lightweight publish/subscribe middleware for real-time
|
||
3 | applications. It was developed as part of the software habitat for the
|
||
4 | Autonomous Mini Robot [1] (AMiRo) but can be used for other purposes as well.
|
||
5 | |||
6 | Copyright (C) 2018..2020 Thomas Schöpping et al.
|
||
7 | |||
8 | This program is free software: you can redistribute it and/or modify
|
||
9 | it under the terms of the GNU General Public License as published by
|
||
10 | the Free Software Foundation, either version 3 of the License, or
|
||
11 | (at your option) any later version.
|
||
12 | |||
13 | This program is distributed in the hope that it will be useful,
|
||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
16 | GNU General Public License for more details.
|
||
17 | |||
18 | You should have received a copy of the GNU General Public License
|
||
19 | along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||
20 | */
|
||
21 | |||
22 | #ifndef URTWARE_NODE_H
|
||
23 | #define URTWARE_NODE_H
|
||
24 | |||
25 | 7d9678db | skenneweg | #include <urtware.h> |
26 | |||
27 | 1fb06240 | skenneweg | /******************************************************************************/
|
28 | /* CONSTANTS */
|
||
29 | /******************************************************************************/
|
||
30 | |||
31 | /******************************************************************************/
|
||
32 | /* SETTINGS */
|
||
33 | /******************************************************************************/
|
||
34 | |||
35 | /******************************************************************************/
|
||
36 | /* CHECKS */
|
||
37 | /******************************************************************************/
|
||
38 | |||
39 | /******************************************************************************/
|
||
40 | /* DATA STRUCTURES AND TYPES */
|
||
41 | /******************************************************************************/
|
||
42 | |||
43 | 4ea18a07 | Svenja | /*
|
44 | fb72e91b | skenneweg | * forward declaration
|
45 | 4ea18a07 | Svenja | */
|
46 | typedef struct urt_node urt_node_t; |
||
47 | |||
48 | 7d9678db | skenneweg | /**
|
49 | 017b2ac7 | skenneweg | * @brief
|
50 | *
|
||
51 | */
|
||
52 | 4ea18a07 | Svenja | typedef void (*urt_nodeShutdownCallback_t)(urt_node_t* node, urt_status_t cause, void* arg); |
53 | 017b2ac7 | skenneweg | |
54 | |||
55 | /**
|
||
56 | * @brief
|
||
57 | *
|
||
58 | */
|
||
59 | 4ea18a07 | Svenja | typedef urt_osEventMask_t (*urt_nodeSetupCallback_t)(urt_node_t* node, void* arg); |
60 | 017b2ac7 | skenneweg | |
61 | |||
62 | /**
|
||
63 | * @brief
|
||
64 | */
|
||
65 | 4ea18a07 | Svenja | typedef urt_osEventMask_t (*urt_nodeLoopCallback_t)(urt_node_t* node, urt_osEventMask_t events, void* arg); |
66 | 64fde4ba | skenneweg | |
67 | /**
|
||
68 | * @brief node
|
||
69 | */
|
||
70 | 4ea18a07 | Svenja | struct urt_node
|
71 | 64fde4ba | skenneweg | { |
72 | struct urt_node* next;
|
||
73 | urt_osThread_t* thread; |
||
74 | 1bfc6b25 | skenneweg | urt_nodeSetupCallback_t setupcallback; |
75 | 64fde4ba | skenneweg | void* setupparams;
|
76 | 1bfc6b25 | skenneweg | urt_nodeLoopCallback_t loopcallback; |
77 | 64fde4ba | skenneweg | void* loopparams;
|
78 | 1bfc6b25 | skenneweg | urt_nodeShutdownCallback_t shutdowncallback; |
79 | 64fde4ba | skenneweg | void* shutdownparams;
|
80 | urt_nodestage_t stage; |
||
81 | urt_osEventListener_t listener; |
||
82 | #if (URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING)
|
||
83 | uint64_t loops; |
||
84 | #endif /* URT_CFG_PUBSUB_PROFILING || URT_CFG_RPC_PROFILING */ |
||
85 | 4ea18a07 | Svenja | }; |
86 | 64fde4ba | skenneweg | |
87 | 017b2ac7 | skenneweg | |
88 | 1fb06240 | skenneweg | /******************************************************************************/
|
89 | /* MACROS */
|
||
90 | /******************************************************************************/
|
||
91 | |||
92 | /******************************************************************************/
|
||
93 | /* EXTERN DECLARATIONS */
|
||
94 | /******************************************************************************/
|
||
95 | |||
96 | 7d9678db | skenneweg | #if defined(__cplusplus)
|
97 | extern "C" { |
||
98 | #endif /* defined(__cplusplus) */ |
||
99 | |||
100 | 4ea18a07 | Svenja | void urtNodeInit(urt_node_t* node, urt_osThread_t* thread, urt_osThreadPrio_t prio, urt_nodeSetupCallback_t setupcallback,
|
101 | void* setupparams, urt_nodeLoopCallback_t loopcallback, void* loopparams, |
||
102 | urt_nodeShutdownCallback_t shutdowncallback, void* shutdownparams);
|
||
103 | 7d9678db | skenneweg | #if defined(__cplusplus)
|
104 | } |
||
105 | #endif /* defined(__cplusplus) */ |
||
106 | |||
107 | 1fb06240 | skenneweg | /******************************************************************************/
|
108 | /* INLINE FUNCTIONS */
|
||
109 | /******************************************************************************/
|
||
110 | |||
111 | #endif /* URTWARE_NODE_H */ |