• R/O
  • SSH
  • HTTPS

chibios: Commit


Commit MetaInfo

Revision15618 (tree)
Time2022-04-30 18:57:04
Authorgdisirio

Log Message

Preparation for SB Virtual IRQs. Removed some obsolete code from SBs.

Change Summary

Incremental Difference

--- trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_DYNAMIC/cfg/sbconf.h (revision 15617)
+++ trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_DYNAMIC/cfg/sbconf.h (revision 15618)
@@ -39,6 +39,13 @@
3939 #endif
4040
4141 /**
42+ * @brief Enables support for sandbox Virtual IRQs.
43+ */
44+#if !defined(SB_CFG_ENABLE_VRQ) || defined(__DOXYGEN__)
45+#define SB_CFG_ENABLE_VRQ TRUE
46+#endif
47+
48+/**
4249 * @brief Enables Posix API in sandboxes using VFS.
4350 */
4451 #if !defined(SB_CFG_ENABLE_VFS) || defined(__DOXYGEN__)
--- trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/cfg/sbconf.h (revision 15617)
+++ trunk/demos/STM32/RT-STM32G474RE-NUCLEO64-SB_HOST_STATIC/cfg/sbconf.h (revision 15618)
@@ -39,6 +39,13 @@
3939 #endif
4040
4141 /**
42+ * @brief Enables support for sandbox Virtual IRQs.
43+ */
44+#if !defined(SB_CFG_ENABLE_VRQ) || defined(__DOXYGEN__)
45+#define SB_CFG_ENABLE_VRQ TRUE
46+#endif
47+
48+/**
4249 * @brief Enables Posix API in sandboxes using VFS.
4350 */
4451 #if !defined(SB_CFG_ENABLE_VFS) || defined(__DOXYGEN__)
--- trunk/demos/STM32/RT-STM32L4R9-DISCOVERY-RAM_SB_HOST_DYNAMIC/cfg/sbconf.h (revision 15617)
+++ trunk/demos/STM32/RT-STM32L4R9-DISCOVERY-RAM_SB_HOST_DYNAMIC/cfg/sbconf.h (revision 15618)
@@ -39,6 +39,13 @@
3939 #endif
4040
4141 /**
42+ * @brief Enables support for sandbox Virtual IRQs.
43+ */
44+#if !defined(SB_CFG_ENABLE_VRQ) || defined(__DOXYGEN__)
45+#define SB_CFG_ENABLE_VRQ TRUE
46+#endif
47+
48+/**
4249 * @brief Enables Posix API in sandboxes using VFS.
4350 */
4451 #if !defined(SB_CFG_ENABLE_VFS) || defined(__DOXYGEN__)
--- trunk/demos/STM32/RT-STM32L4R9-DISCOVERY-SB_HOST_STATIC/cfg/sbconf.h (revision 15617)
+++ trunk/demos/STM32/RT-STM32L4R9-DISCOVERY-SB_HOST_STATIC/cfg/sbconf.h (revision 15618)
@@ -39,6 +39,13 @@
3939 #endif
4040
4141 /**
42+ * @brief Enables support for sandbox Virtual IRQs.
43+ */
44+#if !defined(SB_CFG_ENABLE_VRQ) || defined(__DOXYGEN__)
45+#define SB_CFG_ENABLE_VRQ TRUE
46+#endif
47+
48+/**
4249 * @brief Enables Posix API in sandboxes using VFS.
4350 */
4451 #if !defined(SB_CFG_ENABLE_VFS) || defined(__DOXYGEN__)
--- trunk/os/sb/host/sb.h (revision 15617)
+++ trunk/os/sb/host/sb.h (revision 15618)
@@ -94,6 +94,10 @@
9494 #error "SB_CFG_NUM_REGIONS not defined in sbconf.h"
9595 #endif
9696
97+#if !defined(SB_CFG_ENABLE_VRQ) || defined(__DOXYGEN__)
98+#error "SB_CFG_ENABLE_VRQ not defined in sbconf.h"
99+#endif
100+
97101 #if !defined(SB_CFG_ENABLE_VFS) || defined(__DOXYGEN__)
98102 #error "SB_CFG_ENABLE_VFS not defined in sbconf.h"
99103 #endif
@@ -281,6 +285,7 @@
281285 /*===========================================================================*/
282286
283287 #include "sbsysc.h"
288+#include "sbvrq.h"
284289 #include "sbelf.h"
285290 #include "sbposix.h"
286291 #include "sbapi.h"
--- trunk/os/sb/host/sbapi.c (revision 15617)
+++ trunk/os/sb/host/sbapi.c (revision 15618)
@@ -36,6 +36,20 @@
3636 /* Module local definitions. */
3737 /*===========================================================================*/
3838
39+static void sb_api_stdio(struct port_extctx *ectxp);
40+static void sb_api_exit(struct port_extctx *ctxp);
41+static void sb_api_get_systime(struct port_extctx *ctxp);
42+static void sb_api_get_frequency(struct port_extctx *ctxp);
43+static void sb_api_sleep(struct port_extctx *ctxp);
44+static void sb_api_sleep_until_windowed(struct port_extctx *ctxp);
45+static void sb_api_wait_message(struct port_extctx *ctxp);
46+static void sb_api_reply_message(struct port_extctx *ctxp);
47+static void sb_api_wait_one_timeout(struct port_extctx *ctxp);
48+static void sb_api_wait_any_timeout(struct port_extctx *ctxp);
49+static void sb_api_wait_all_timeout(struct port_extctx *ctxp);
50+static void sb_api_broadcast_flags(struct port_extctx *ctxp);
51+static void sb_api_loadelf(struct port_extctx *ectxp);
52+
3953 /**
4054 * @name Standard API handlers
4155 * @{
@@ -960,26 +974,8 @@
960974 #endif
961975 }
962976
963-/*===========================================================================*/
964-/* Module exported functions. */
965-/*===========================================================================*/
966-
967-void __sb_abort(msg_t msg) {
968-
969- chSysUnlock();
970-
971- sb_cleanup();
972-
973- chSysLock();
974-#if CH_CFG_USE_EVENTS == TRUE
975- chEvtBroadcastI(&sb.termination_es);
976-#endif
977- chThdExitS(msg);
978- chSysHalt("zombies");
979-}
980-
981977 #if (SB_CFG_ENABLE_VFS == TRUE) || defined(__DOXYGEN__)
982-void sb_api_stdio(struct port_extctx *ectxp) {
978+static void sb_api_stdio(struct port_extctx *ectxp) {
983979
984980 switch (ectxp->r0) {
985981 case SB_POSIX_OPEN:
@@ -1052,7 +1048,7 @@
10521048 }
10531049 #endif /* SB_CFG_ENABLE_VFS == TRUE */
10541050
1055-void sb_api_exit(struct port_extctx *ectxp) {
1051+static void sb_api_exit(struct port_extctx *ectxp) {
10561052
10571053 sb_cleanup();
10581054
@@ -1067,17 +1063,17 @@
10671063 ectxp->r0 = CH_RET_ENOSYS;
10681064 }
10691065
1070-void sb_api_get_systime(struct port_extctx *ectxp) {
1066+static void sb_api_get_systime(struct port_extctx *ectxp) {
10711067
10721068 ectxp->r0 = (uint32_t)chVTGetSystemTimeX();
10731069 }
10741070
1075-void sb_api_get_frequency(struct port_extctx *ectxp) {
1071+static void sb_api_get_frequency(struct port_extctx *ectxp) {
10761072
10771073 ectxp->r0 = (uint32_t)CH_CFG_ST_FREQUENCY;
10781074 }
10791075
1080-void sb_api_sleep(struct port_extctx *ectxp) {
1076+static void sb_api_sleep(struct port_extctx *ectxp) {
10811077 sysinterval_t interval = (sysinterval_t )ectxp->r0;
10821078
10831079 if (interval != TIME_IMMEDIATE) {
@@ -1087,7 +1083,7 @@
10871083 ectxp->r0 = CH_RET_SUCCESS;
10881084 }
10891085
1090-void sb_api_sleep_until_windowed(struct port_extctx *ectxp) {
1086+static void sb_api_sleep_until_windowed(struct port_extctx *ectxp) {
10911087
10921088 chThdSleepUntilWindowed((systime_t )ectxp->r0, (systime_t )ectxp->r1);
10931089
@@ -1094,7 +1090,7 @@
10941090 ectxp->r0 = CH_RET_SUCCESS;
10951091 }
10961092
1097-void sb_api_wait_message(struct port_extctx *ectxp) {
1093+static void sb_api_wait_message(struct port_extctx *ectxp) {
10981094 #if CH_CFG_USE_MESSAGES == TRUE
10991095 sb_class_t *sbp = (sb_class_t *)chThdGetSelfX()->ctx.syscall.p;
11001096
@@ -1117,7 +1113,7 @@
11171113 #endif
11181114 }
11191115
1120-void sb_api_reply_message(struct port_extctx *ectxp) {
1116+static void sb_api_reply_message(struct port_extctx *ectxp) {
11211117 #if CH_CFG_USE_MESSAGES == TRUE
11221118 sb_class_t *sbp = (sb_class_t *)chThdGetSelfX()->ctx.syscall.p;
11231119
@@ -1139,7 +1135,7 @@
11391135 #endif
11401136 }
11411137
1142-void sb_api_wait_one_timeout(struct port_extctx *ectxp) {
1138+static void sb_api_wait_one_timeout(struct port_extctx *ectxp) {
11431139 #if CH_CFG_USE_EVENTS == TRUE
11441140
11451141 ectxp->r0 = (uint32_t)chEvtWaitOneTimeout((eventmask_t )ectxp->r0,
@@ -1149,7 +1145,7 @@
11491145 #endif
11501146 }
11511147
1152-void sb_api_wait_any_timeout(struct port_extctx *ectxp) {
1148+static void sb_api_wait_any_timeout(struct port_extctx *ectxp) {
11531149 #if CH_CFG_USE_EVENTS == TRUE
11541150
11551151 ectxp->r0 = (uint32_t)chEvtWaitAnyTimeout((eventmask_t )ectxp->r0,
@@ -1159,7 +1155,7 @@
11591155 #endif
11601156 }
11611157
1162-void sb_api_wait_all_timeout(struct port_extctx *ectxp) {
1158+static void sb_api_wait_all_timeout(struct port_extctx *ectxp) {
11631159 #if CH_CFG_USE_EVENTS == TRUE
11641160
11651161 ectxp->r0 = (uint32_t)chEvtWaitAllTimeout((eventmask_t )ectxp->r0,
@@ -1169,7 +1165,7 @@
11691165 #endif
11701166 }
11711167
1172-void sb_api_broadcast_flags(struct port_extctx *ectxp) {
1168+static void sb_api_broadcast_flags(struct port_extctx *ectxp) {
11731169 #if CH_CFG_USE_EVENTS == TRUE
11741170 sb_class_t *sbp = (sb_class_t *)chThdGetSelfX()->ctx.syscall.p;
11751171
@@ -1180,7 +1176,7 @@
11801176 #endif
11811177 }
11821178
1183-void sb_api_loadelf(struct port_extctx *ectxp) {
1179+static void sb_api_loadelf(struct port_extctx *ectxp) {
11841180 #if (SB_CFG_ENABLE_VFS == TRUE) || defined(__DOXYGEN__)
11851181 sb_class_t *sbp = (sb_class_t *)chThdGetSelfX()->ctx.syscall.p;
11861182 const char *fname = (const char *)ectxp->r0;
@@ -1202,4 +1198,22 @@
12021198 #endif
12031199 }
12041200
1201+/*===========================================================================*/
1202+/* Module exported functions. */
1203+/*===========================================================================*/
1204+
1205+void __sb_abort(msg_t msg) {
1206+
1207+ chSysUnlock();
1208+
1209+ sb_cleanup();
1210+
1211+ chSysLock();
1212+#if CH_CFG_USE_EVENTS == TRUE
1213+ chEvtBroadcastI(&sb.termination_es);
1214+#endif
1215+ chThdExitS(msg);
1216+ chSysHalt("zombies");
1217+}
1218+
12051219 /** @} */
--- trunk/os/sb/host/sbapi.h (revision 15617)
+++ trunk/os/sb/host/sbapi.h (revision 15618)
@@ -49,48 +49,6 @@
4949 */
5050 typedef void (*port_syscall_t)(struct port_extctx *ectx);
5151
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-
9452 /*===========================================================================*/
9553 /* Module macros. */
9654 /*===========================================================================*/
@@ -102,19 +60,7 @@
10260 #ifdef __cplusplus
10361 extern "C" {
10462 #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- void sb_api_loadelf(struct port_extctx *ectxp);
63+
11864 #ifdef __cplusplus
11965 }
12066 #endif
--- trunk/os/sb/host/sbvrq.c (nonexistent)
+++ trunk/os/sb/host/sbvrq.c (revision 15618)
@@ -0,0 +1,58 @@
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/sbvrq.c
22+ * @brief ARM SandBox host Virtual IRQs code.
23+ *
24+ * @addtogroup ARM_SANDBOX_VRQ
25+ * @{
26+ */
27+
28+#include "sb.h"
29+
30+#if (SB_CFG_ENABLE_VRQ == TRUE) || defined(__DOXYGEN__)
31+
32+/*===========================================================================*/
33+/* Module local definitions. */
34+/*===========================================================================*/
35+
36+/*===========================================================================*/
37+/* Module exported variables. */
38+/*===========================================================================*/
39+
40+/*===========================================================================*/
41+/* Module local types. */
42+/*===========================================================================*/
43+
44+/*===========================================================================*/
45+/* Module local variables. */
46+/*===========================================================================*/
47+
48+/*===========================================================================*/
49+/* Module local functions. */
50+/*===========================================================================*/
51+
52+/*===========================================================================*/
53+/* Module exported functions. */
54+/*===========================================================================*/
55+
56+#endif /* SB_CFG_ENABLE_VRQ == TRUE */
57+
58+/** @} */
--- trunk/os/sb/host/sbvrq.h (nonexistent)
+++ trunk/os/sb/host/sbvrq.h (revision 15618)
@@ -0,0 +1,78 @@
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/sbvrq.h
22+ * @brief ARM SandBox host Virtual IRQs macros and structures.
23+ *
24+ * @addtogroup ARM_SANDBOX_HOSTAPI
25+ * @{
26+ */
27+
28+#ifndef SBVRQ_H
29+#define SBVRQ_H
30+
31+#if (SB_CFG_ENABLE_VRQ == TRUE) || defined(__DOXYGEN__)
32+
33+/*===========================================================================*/
34+/* Module constants. */
35+/*===========================================================================*/
36+
37+/*===========================================================================*/
38+/* Module pre-compile time settings. */
39+/*===========================================================================*/
40+
41+/*===========================================================================*/
42+/* Derived constants and error checks. */
43+/*===========================================================================*/
44+
45+/*===========================================================================*/
46+/* Module data structures and types. */
47+/*===========================================================================*/
48+
49+/**
50+ * @brief Type of a mask of Virtual IRQs.
51+ */
52+typedef uint32_t sb_vrqmask_t;
53+
54+/*===========================================================================*/
55+/* Module macros. */
56+/*===========================================================================*/
57+
58+/*===========================================================================*/
59+/* External declarations. */
60+/*===========================================================================*/
61+
62+#ifdef __cplusplus
63+extern "C" {
64+#endif
65+ void sbVRQPendI(sb_class_t *sbp, sb_vrqmask_t vmask);
66+#ifdef __cplusplus
67+}
68+#endif
69+
70+/*===========================================================================*/
71+/* Module inline functions. */
72+/*===========================================================================*/
73+
74+#endif /* SB_CFG_ENABLE_VRQ == TRUE */
75+
76+#endif /* SBVRQ_H */
77+
78+/** @} */
Show on old repository browser