diff options
Diffstat (limited to 'lib/chibios/os/sb/host/sbapi.h')
-rw-r--r-- | lib/chibios/os/sb/host/sbapi.h | 127 |
1 files changed, 127 insertions, 0 deletions
diff --git a/lib/chibios/os/sb/host/sbapi.h b/lib/chibios/os/sb/host/sbapi.h new file mode 100644 index 000000000..0895341eb --- /dev/null +++ b/lib/chibios/os/sb/host/sbapi.h | |||
@@ -0,0 +1,127 @@ | |||
1 | /* | ||
2 | ChibiOS - Copyright (C) 2006,2007,2008,2009,2010,2011,2012,2013,2014, | ||
3 | 2015,2016,2017,2018,2019,2020,2021 Giovanni Di Sirio. | ||
4 | |||
5 | This file is part of ChibiOS. | ||
6 | |||
7 | ChibiOS is free software; you can redistribute it and/or modify | ||
8 | it under the terms of the GNU General Public License as published by | ||
9 | the Free Software Foundation version 3 of the License. | ||
10 | |||
11 | ChibiOS is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
18 | */ | ||
19 | |||
20 | /** | ||
21 | * @file sb/host/sbapi.h | ||
22 | * @brief ARM sandbox host API macros and structures. | ||
23 | * | ||
24 | * @addtogroup ARM_SANDBOX_HOSTAPI | ||
25 | * @{ | ||
26 | */ | ||
27 | |||
28 | #ifndef SBAPI_H | ||
29 | #define SBAPI_H | ||
30 | |||
31 | /*===========================================================================*/ | ||
32 | /* Module constants. */ | ||
33 | /*===========================================================================*/ | ||
34 | |||
35 | /*===========================================================================*/ | ||
36 | /* Module pre-compile time settings. */ | ||
37 | /*===========================================================================*/ | ||
38 | |||
39 | /*===========================================================================*/ | ||
40 | /* Derived constants and error checks. */ | ||
41 | /*===========================================================================*/ | ||
42 | |||
43 | /*===========================================================================*/ | ||
44 | /* Module data structures and types. */ | ||
45 | /*===========================================================================*/ | ||
46 | |||
47 | /** | ||
48 | * @brief Type of a syscall handler. | ||
49 | */ | ||
50 | typedef void (*port_syscall_t)(struct port_extctx *ectx); | ||
51 | |||
52 | /** | ||
53 | * @brief Sandbox Stream interface methods. | ||
54 | * @note Is intentionally compatible with HAL streams but we have to | ||
55 | * duplicate is because we don't want dependencies with HAL in | ||
56 | * this subsystem. | ||
57 | */ | ||
58 | struct SandboxStreamVMT { | ||
59 | /** | ||
60 | * @brief Object instance offset. | ||
61 | */ | ||
62 | size_t instance_offset; | ||
63 | /** | ||
64 | * @brief Stream write buffer method. | ||
65 | */ | ||
66 | size_t (*write)(void *instance, const uint8_t *bp, size_t n); | ||
67 | /** | ||
68 | * @brief Stream read buffer method. | ||
69 | */ | ||
70 | size_t (*read)(void *instance, uint8_t *bp, size_t n); | ||
71 | /** | ||
72 | * @brief Channel put method, blocking. | ||
73 | */ | ||
74 | msg_t (*put)(void *instance, uint8_t b); | ||
75 | /** | ||
76 | * @brief Channel get method, blocking. | ||
77 | */ | ||
78 | msg_t (*get)(void *instance); | ||
79 | }; | ||
80 | |||
81 | /** | ||
82 | * @brief Sandbox Stream class. | ||
83 | * @note Is intentionally compatible with HAL streams but we have to | ||
84 | * duplicate is because we don't want dependencies with HAL in | ||
85 | * this subsystem. | ||
86 | */ | ||
87 | typedef struct { | ||
88 | /** | ||
89 | * @brief Virtual Methods Table. | ||
90 | */ | ||
91 | const struct SandboxStreamVMT *vmt; | ||
92 | } SandboxStream; | ||
93 | |||
94 | /*===========================================================================*/ | ||
95 | /* Module macros. */ | ||
96 | /*===========================================================================*/ | ||
97 | |||
98 | /*===========================================================================*/ | ||
99 | /* External declarations. */ | ||
100 | /*===========================================================================*/ | ||
101 | |||
102 | #ifdef __cplusplus | ||
103 | extern "C" { | ||
104 | #endif | ||
105 | void sb_api_stdio(struct port_extctx *ectxp); | ||
106 | void sb_api_exit(struct port_extctx *ctxp); | ||
107 | void sb_api_get_systime(struct port_extctx *ctxp); | ||
108 | void sb_api_get_frequency(struct port_extctx *ctxp); | ||
109 | void sb_api_sleep(struct port_extctx *ctxp); | ||
110 | void sb_api_sleep_until_windowed(struct port_extctx *ctxp); | ||
111 | void sb_api_wait_message(struct port_extctx *ctxp); | ||
112 | void sb_api_reply_message(struct port_extctx *ctxp); | ||
113 | void sb_api_wait_one_timeout(struct port_extctx *ctxp); | ||
114 | void sb_api_wait_any_timeout(struct port_extctx *ctxp); | ||
115 | void sb_api_wait_all_timeout(struct port_extctx *ctxp); | ||
116 | void sb_api_broadcast_flags(struct port_extctx *ctxp); | ||
117 | #ifdef __cplusplus | ||
118 | } | ||
119 | #endif | ||
120 | |||
121 | /*===========================================================================*/ | ||
122 | /* Module inline functions. */ | ||
123 | /*===========================================================================*/ | ||
124 | |||
125 | #endif /* SBAPI_H */ | ||
126 | |||
127 | /** @} */ | ||