mFrame
載入中...
搜尋中...
無符合項目
System.h
1
8#ifndef MFRAME_DB2618AE_F498_4792_900C_A4BD1DC2E35C
9#define MFRAME_DB2618AE_F498_4792_900C_A4BD1DC2E35C
10
11/* ***************************************************************************************
12 * Include
13 */
14
15//----------------------------------------------------------------------------------------
16
17//----------------------------------------------------------------------------------------
18#include "./../func/Runnable.h"
19#include "./../io/PrintStream.h"
20#include "./../lang/NonInstantiable.h"
21#include "./../sys/Allocator.h"
22#include "./../sys/ErrorCode.h"
23#include "./../sys/HardwareInfo.h"
24#include "./../sys/Kernel.h"
25#include "./../sys/Svchost.h"
26#include "./../sys/Thread.h"
27
28/* ***************************************************************************************
29 * Namespace
30 */
31namespace ufm::lang {
41 extern void system_error(const char* message,
42 const char* path,
44
45 class System;
46} // namespace ufm::lang
47
48/* ***************************************************************************************
49 * Class/struct/Struct
50 */
51
68 friend Object;
69
70 /* *************************************************************************************
71 * Variable
72 */
73
74 /* *************************************************************************************
75 * Abstract Method
76 */
77
78 /* *************************************************************************************
79 * Construct Method
80 */
81 protected:
86 virtual ~System(void) override = default;
87
88 /* *************************************************************************************
89 * Operator Method
90 */
91
92 /* *************************************************************************************
93 * Override Method
94 */
95
96 /* *************************************************************************************
97 * Public Method
98 */
99
100 /* *************************************************************************************
101 * Protected Method
102 */
103
104 /* *************************************************************************************
105 * Private Method
106 */
107
108 /* *************************************************************************************
109 * Static Variable
110 */
111 public:
112 static ufm::sys::Allocator* vAllocator;
113 static ufm::sys::Kernel* vKernel;
114 static ufm::sys::HardwareInfo* vHardwareInfo;
115
116 /* *************************************************************************************
117 * Static Method
118 */
119 public:
127 static inline ufm::io::PrintStream& out(void) {
128 return ufm::sys::Svchost::getInstance().vProvider.out();
129 }
130
138 static inline ufm::lang::Readable& in(void) {
139 return ufm::sys::Svchost::getInstance().vProvider.in();
140 }
141
147 static void reboot(void);
148
156 static void setup(ufm::sys::SystemProvider& provider);
157
163 static void start(void);
164
173 static void error(const void* address, ufm::sys::ErrorCode code);
174
184 static void throwError(const char* message, const char* path, ufm::sys::ErrorCode code);
185
191 static uint32 getCoreSpeed(void);
192
200 static void lowerDelay(uint32 times);
201
210 static bool delay(int milliseconds);
211
217 static void wait(void);
218
227 static bool wait(int timeout);
228
234 static bool yield(void);
235
243 static int lock(void);
244
252 static int unlock(void);
253
260
268 static void execute(ufm::func::Runnable& runnable);
269
275 static inline ufm::sys::Allocator* getAllocator(void) {
276 return System::vAllocator;
277 }
278
287 static inline uint32 microseconds(void) {
288 return static_cast<uint32>(ufm::sys::Svchost::getInstance().microseconds());
289 }
290
299 static inline uint64 microseconds64(void) {
301 }
302
311 static inline uint32 seconds(void) {
313 }
314
323 static inline ufm::util::Application& getAppMgr(void) {
324 return ufm::sys::Svchost::getInstance().vApplicationManager;
325 }
326};
327
328/* ***************************************************************************************
329 * End of file
330 */
331
332#endif /* MFRAME_DB2618AE_F498_4792_900C_A4BD1DC2E35C */
格式化輸出串流
Definition PrintStream.h:43
Definition NonInstantiable.h:29
物件基底類別
Definition Object.h:63
系統核心入口
Definition System.h:67
static void wait(void)
無條件等待
static ufm::io::PrintStream & out(void)
獲取系統輸出緩衝區
Definition System.h:127
static void setup(ufm::sys::SystemProvider &provider)
系統初始化
static bool wait(int timeout)
等待指定超時時間
static uint64 microseconds64(void)
取得系統時間微秒數
Definition System.h:299
static void throwError(const char *message, const char *path, ufm::sys::ErrorCode code)
拋出錯誤並中斷執行
static ufm::lang::Readable & in(void)
獲取系統輸入緩衝區
Definition System.h:138
static void start(void)
啟動系統核心
static void error(const void *address, ufm::sys::ErrorCode code)
拋出系統錯誤
static ufm::util::Application & getAppMgr(void)
取得應用程式管理器
Definition System.h:323
static uint32 seconds(void)
取得系統時間秒數
Definition System.h:311
virtual ~System(void) override=default
Destroy the System object.
static ufm::sys::Allocator * getAllocator(void)
取得記憶體分配器
Definition System.h:275
static uint32 microseconds(void)
取得系統時間微秒數
Definition System.h:287
static bool delay(int milliseconds)
延遲指定毫秒數
static void reboot(void)
重新啟動系統
static bool yield(void)
主動讓渡 CPU 使他人執行
static void lowerDelay(uint32 times)
低階延遲
static int unlock(void)
解鎖系統資源
static void execute(ufm::func::Runnable &runnable)
執行 Runnable 任務
static int lock(void)
鎖定系統資源
static ufm::sys::Thread * currentThread(void)
取得當前執行緒指標
static uint32 getCoreSpeed(void)
取得處理器核心運行頻率
static Svchost & getInstance(void)
取得CoreChip的實例
Definition Svchost.h:193
uint32 seconds(void) const
取得當前時間(微秒,64位)
Definition Svchost.h:166
uint64 microseconds(void) const
取得當前時間(微秒,64位)
Definition Svchost.h:157
執行緒類別
Definition Thread.h:49
應用程式管理器 管理所有應用程式實例的生命週期,包括創建、初始化、執行、停止、銷毀。 以 PArraySet 儲存並管理。
Definition Application.h:42
System
Micro Tick Timer 0 Reset Control.
Definition Appendable.h:23
void system_error(const char *message, const char *path, ufm::sys::ErrorCode code)
處理系統錯誤並輸出錯誤資訊
ErrorCode
系統錯誤碼列舉
Definition ErrorCode.h:35
[Interface] 可執行函數式介面
Definition Runnable.h:40
[Interface] 定義資料讀取介面
Definition Readable.h:46
[Interface] 記憶體分配器介面
Definition Allocator.h:38
[Interface] 硬體資訊介面
Definition HardwareInfo.h:39
[Interface] 系統核心介面
Definition Kernel.h:50
系統資源提供者抽象介面
Definition SystemProvider.h:44
virtual ufm::lang::Readable & in(void) override
取得標準輸入裝置 (Readable)
virtual ufm::io::PrintStream & out(void) override
取得標準輸出裝置 (PrintStream)