blob: 0eaa2c50de3fc0021c143f077ca4c7be7a8a08d1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
/* -------------------------------------------
Copyright Zeta Electronics Corporation.
File: newstd.hxx.
Purpose: System Call Interface.
------------------------------------------- */
#ifndef _INC_COMM_NEWSTD_HXX_
#define _INC_COMM_NEWSTD_HXX_
#ifdef __KERNEL__
#error !!! including header in kernel mode !!!
#endif // __KERNEL__
#define ML_IMPORT_CXX extern "C++"
#define ML_IMPORT_C extern "C"
#define cRestrictR "r"
#define cRestrictRB "rb"
#define cRestrictW "w"
#define cRestrictRW "rw"
class NSyscall; /// @brief System call class.
typedef int OSType;
typedef bool Bool;
typedef void UInt0;
typedef __UINT64_TYPE__ UInt64;
typedef __UINT32_TYPE__ UInt32;
typedef __UINT16_TYPE__ UInt16;
typedef __UINT8_TYPE__ UInt8;
typedef __SIZE_TYPE__ SizeT;
typedef __INT64_TYPE__ SInt64;
typedef __INT32_TYPE__ SInt32;
typedef __INT16_TYPE__ SInt16;
typedef __INT8_TYPE__ SInt8;
typedef char UTFChar;
typedef UInt32 MBCIType;
/**
@brief Application class.
*/
class NSyscall
{
public:
explicit NSyscall() = default;
virtual ~NSyscall() = default;
NSyscall& operator=(const NSyscall&) = default;
NSyscall(const NSyscall&) = default;
public:
/// @brief disable device.
virtual UInt0 PowerOff(MBCIType) = 0;
/// @brief enable device.
virtual UInt0 PowerOn(MBCIType) = 0;
/// @brief reboot device.
virtual UInt0 PowerReboot(MBCIType) = 0;
/// @brief check if MBCI device is wokeup.
virtual Bool PowerIsWokeup(MBCIType) = 0;
/// @brief probe MBCI device from phone.
virtual MBCIType PowerProbeDevice(const char* namepace, const int index) = 0;
// THOSE DOESNT REQUIRE PERMISSIONS FROM THE USER. //
/// @brief terminate app.
virtual UInt0 Terminate() = 0;
/// @brief exit thread.
virtual Bool Exit(OSType code) = 0;
/// @brief alloc pointer.
virtual UInt0* New(long long sz) = 0;
/// @brief free pointer.
virtual UInt0 Delete(void* ptr) = 0;
// THOSE MAY REQUIRE PERMISSIONS FROM THE USER. //
/// @brief Open descriptor.
virtual OSType OpenStorage(const char* path, const char* restr) = 0;
/// @brief Close descriptor.
virtual UInt0 CloseStorage(OSType descriptorType) = 0;
/// @brief Execute from shell.
virtual OSType URLExecute(const UTFChar* shellLink) = 0;
/// @brief Read descriptor.
virtual UInt0* ReadStorage(const UTFChar* cmdNameOrData, SizeT cmdSize, OSType descriptorType) = 0;
/// @brief Seek in storage file
virtual UInt64 SeekStorage(OSType descriptorType, UInt64 offset) = 0;
/// @brief Tell storage cursor.
virtual UInt64 TellStorage(OSType descriptorType) = 0;
/// @brief Remove stored file.
virtual UInt64 RemoveStorage(OSType descriptorType) = 0;
/// @brief Create stored file.
virtual OSType CreateStorage(const UTFChar* fileName, UInt64 flags) = 0;
/// @brief Write descriptor.
virtual UInt0* WriteStorage(const UTFChar* cmdNameOrData, SizeT cmdSize, OSType descriptorType) = 0;
};
/// @brief Request syscall object.
/// @return Syscall implementation.
ML_IMPORT_C NSyscall* NRequestSyscall(UInt0);
/// @brief Release syscall object.
/// @param syscall System call object.
ML_IMPORT_C UInt0 NReleaseSyscall(NSyscall* syscall);
#endif // ifndef _INC_COMM_NEWSTD_HXX_
|