Revision ba516b61 os/core/inc/aos_system.h
os/core/inc/aos_system.h | ||
---|---|---|
19 | 19 |
#ifndef _AMIROOS_SYSTEM_H_ |
20 | 20 |
#define _AMIROOS_SYSTEM_H_ |
21 | 21 |
|
22 |
#include <aos_ssm.h>
|
|
22 |
#include <aos_iostream.h>
|
|
23 | 23 |
#include <amiro-lld.h> |
24 | 24 |
#include <aos_shell.h> |
25 | 25 |
#include <aos_time.h> |
26 | 26 |
#include <chprintf.h> |
27 | 27 |
|
28 | 28 |
/** |
29 |
* @brief Default system I/O stream. |
|
30 |
*/ |
|
31 |
#define AOS_SYSTEM_STDIO ((BaseSequentialStream*)aos.ssm) |
|
32 |
|
|
33 |
/** |
|
34 |
* @brief Printf function that uses the default system I/O stream. |
|
29 |
* @brief Resolution of the system time measurement. |
|
35 | 30 |
*/ |
36 |
#define aosprintf(fmt, ...) chprintf((BaseSequentialStream*)AOS_SYSTEM_STDIO, fmt, ##__VA_ARGS__)
|
|
31 |
#define AOS_SYSTEM_TIME_RESOLUTION ((MICROSECONDS_PER_SECOND + CH_CFG_ST_FREQUENCY - 1) / CH_CFG_ST_FREQUENCY)
|
|
37 | 32 |
|
38 | 33 |
/** |
39 |
* @brief Resolution of the system time measurement.
|
|
34 |
* @brief System event flag which is emitted when a shutdown was initiated.
|
|
40 | 35 |
*/ |
41 |
#define AOS_SYSTEM_TIME_RESOLUTION ((MICROSECONDS_PER_SECOND + CH_CFG_ST_FREQUENCY - 1) / CH_CFG_ST_FREQUENCY)
|
|
36 |
#define AOS_SYSTEM_EVENTFLAGS_SHUTDOWN (eventflags_t)(1 << 0)
|
|
42 | 37 |
|
43 | 38 |
/** |
44 | 39 |
* @brief System event flag which is emitted when a shutdown to transportation mode was initiated. |
45 | 40 |
*/ |
46 |
#define AOS_SYSTEM_EVENTFLAGS_TRANSPORTATION (eventflags_t)(1 << 0)
|
|
41 |
#define AOS_SYSTEM_EVENTFLAGS_TRANSPORTATION (AOS_SYSTEM_EVENTFLAGS_SHUTDOWN | (eventflags_t)(1 << 1))
|
|
47 | 42 |
|
48 | 43 |
/** |
49 | 44 |
* @brief System event flag which is emitted when a shutdown to deepsleep mode was initiated. |
50 | 45 |
*/ |
51 |
#define AOS_SYSTEM_EVENTFLAGS_DEEPSLEEP (eventflags_t)(1 << 1)
|
|
46 |
#define AOS_SYSTEM_EVENTFLAGS_DEEPSLEEP (AOS_SYSTEM_EVENTFLAGS_SHUTDOWN | (eventflags_t)(1 << 2))
|
|
52 | 47 |
|
53 | 48 |
/** |
54 | 49 |
* @brief System event flag which is emitted when a shutdown to hibernate mode was initiated. |
55 | 50 |
*/ |
56 |
#define AOS_SYSTEM_EVENTFLAGS_HIBERNATE (eventflags_t)(1 << 2)
|
|
51 |
#define AOS_SYSTEM_EVENTFLAGS_HIBERNATE (AOS_SYSTEM_EVENTFLAGS_SHUTDOWN | (eventflags_t)(1 << 3))
|
|
57 | 52 |
|
58 | 53 |
/** |
59 | 54 |
* @brief System event flag which is emitted when a system restart was initiated. |
60 | 55 |
*/ |
61 |
#define AOS_SYSTEM_EVENTFLAGS_RESTART (eventflags_t)(1 << 3)
|
|
56 |
#define AOS_SYSTEM_EVENTFLAGS_RESTART (AOS_SYSTEM_EVENTFLAGS_SHUTDOWN | (eventflags_t)(1 << 4))
|
|
62 | 57 |
|
63 | 58 |
/** |
64 | 59 |
* @brief Major version of the implemented SSSP. |
... | ... | |
114 | 109 |
aos_ssspstage_t ssspStage; |
115 | 110 |
|
116 | 111 |
/** |
112 |
* @brief System I/O stream. |
|
113 |
*/ |
|
114 |
AosIOStream iostream; |
|
115 |
|
|
116 |
/** |
|
117 | 117 |
* @brief Event structure. |
118 | 118 |
*/ |
119 | 119 |
struct { |
... | ... | |
149 | 149 |
} os; |
150 | 150 |
} events; |
151 | 151 |
|
152 |
/** |
|
153 |
* @brief Sequentiel Stream Multiplexer for system I/O |
|
154 |
*/ |
|
155 |
SequentialStreamMux* ssm; |
|
156 |
|
|
157 | 152 |
#if (AMIROOS_CFG_SHELL_ENABLE == true) || defined(__DOXYGEN__) |
158 | 153 |
/** |
159 | 154 |
* @brief Pointer to the shell object. |
... | ... | |
168 | 163 |
*/ |
169 | 164 |
extern aos_system_t aos; |
170 | 165 |
|
166 |
/** |
|
167 |
* @brief Printf function that uses the default system I/O stream. |
|
168 |
*/ |
|
169 |
#define aosprintf(fmt, ...) chprintf((BaseSequentialStream*)&aos.iostream, fmt, ##__VA_ARGS__) |
|
170 |
|
|
171 | 171 |
#ifdef __cplusplus |
172 | 172 |
extern "C" { |
173 | 173 |
#endif |
Also available in: Unified diff