The system functions to control miscellaneous stuff on the phone.
Usage: #include <swilib.h> or #include <swilib/system.h>
|
| typedef struct MUTEX | MUTEX |
| |
|
| int | isnewSGold (void) |
| | Get the platform type.
|
| |
| void | SUBPROC (void *callback,...) |
| | Run a callback in the background.
|
| |
| uint32_t | GetSessionAge (void) |
| | Get phone uptime in the ticks (1 tick=4.615 ms).
|
| |
| static uint32_t | TicksToMs (uint32_t ticks) |
| | Converts OS ticks to milliseconds.
|
| |
| static uint32_t | TicksToSec (uint32_t ticks) |
| | Converts OS ticks to seconds.
|
| |
| static uint32_t | TicksToUs (uint32_t ticks) |
| | Converts OS ticks to microseconds.
|
| |
| static uint32_t | MsToTicks (uint32_t ms) |
| | Converts milliseconds to OS ticks.
|
| |
| static uint32_t | SecToTicks (uint32_t sec) |
| | Converts seconds to OS ticks.
|
| |
| static uint32_t | UsToTicks (uint32_t us) |
| | Converts microseconds to OS ticks.
|
| |
|
| uint32_t | GetLoaderVersion () |
| | Get ELFLoader version.
|
| |
| void * | AddrLibrary () |
| | Address of the ElfPack function library.
|
| |
| void * | LIB_TOP (void) |
| | Get a pointer to the loaded blib.
|
| |
| void * | SHARED_TOP () |
| | Get a pointer to the list of loaded shared libs.
|
| |
| char ** | getBaseEnviron () |
| | Get a pointer to a list of environment variables.
|
| |
| int | elfclose (void *ex) |
| | Close ELF.
|
| |
| void | kill_elf () |
| | Kill current ELF (in background).
|
| |
| void | kill_data (void *p, void(*func_p)(void *)) |
| | Free data without returning to the current function.
|
| |
|
| int | _dlopen (const char *name) |
| | Load the dynamic shared object (.so).
|
| |
| void * | _dlsym (int handle, const char *name) |
| | Get a pointer to the symbol from the previously loaded dynamic object.
|
| |
| int | _dlclose (int handle) |
| | Close previously loaded dynamic object.
|
| |
| const char * | _dlerror () |
| | Get a string representation of the last error in _dlopen.
|
| |
| int | dlclean_cache () |
| | Call the garbage collector for the loaded dynamic objects.
|
| |
|
| void | loopback0 (void) |
| | Syscall, which is used by the phone OS, swi 0.
|
| |
| void | loopback1 (void) |
| | Syscall, which is used by the phone OS, swi 1.
|
| |
| void | loopback2 (void) |
| | Syscall, which is used by the phone OS, swi 2.
|
| |
| void | loopback3 (void) |
| | Syscall, which is used by the phone OS, swi 3.
|
| |
| void | loopback4 (void) |
| | Syscall, which is used by the phone OS, swi 4.
|
| |
| void | loopback171 (void) |
| | Syscall, which is used by the phone OS, swi 171.
|
| |
◆ MUTEX
◆ OS_TICK_PERIOD_US
| #define OS_TICK_PERIOD_US 4615 |
Duration of one OS tick in microseconds.
Defines the period of a single system tick. All conversions between ticks and real time are based on this value.
1 tick = 4.615 ms = 4615 µs
Definition at line 28 of file system.h.
◆ MUTEX
| typedef struct MUTEX MUTEX |
◆ isnewSGold()
Get the platform type.
- Returns
- 0 - SGold
-
1 - NewSGold
-
2 - NewSGold E71/EL71
◆ SUBPROC()
| void SUBPROC |
( |
void * | callback, |
|
|
| ... ) |
Run a callback in the background.
You can pass up to two additional (32 bit) parameters that are passed to the callback. Callbacks will be called in the RAP queue instead of the MMI.
- Parameters
-
| callback | pointer to the callback |
- Builtin on platforms:
- ELKA, NSG, X75, SG
void test_func(int p1, int p2) {
}
void SUBPROC(void *callback,...)
Run a callback in the background.
◆ GetSessionAge()
| uint32_t GetSessionAge |
( |
void | | ) |
|
Get phone uptime in the ticks (1 tick=4.615 ms).
- Returns
- ticks
◆ TicksToMs()
| static uint32_t TicksToMs |
( |
uint32_t | ticks | ) |
|
|
inlinestatic |
Converts OS ticks to milliseconds.
- Parameters
-
| ticks | Number of ticks (1 tick = 4.615 ms). |
- Returns
- Time in milliseconds.
Definition at line 80 of file system.h.
◆ TicksToSec()
| static uint32_t TicksToSec |
( |
uint32_t | ticks | ) |
|
|
inlinestatic |
Converts OS ticks to seconds.
- Parameters
-
| ticks | Number of ticks (1 tick = 4.615 ms). |
- Returns
- Time in seconds.
Definition at line 89 of file system.h.
◆ TicksToUs()
| static uint32_t TicksToUs |
( |
uint32_t | ticks | ) |
|
|
inlinestatic |
Converts OS ticks to microseconds.
- Parameters
-
| ticks | Number of ticks (1 tick = 4615 µs). |
- Returns
- Time in microseconds.
Definition at line 98 of file system.h.
◆ MsToTicks()
| static uint32_t MsToTicks |
( |
uint32_t | ms | ) |
|
|
inlinestatic |
Converts milliseconds to OS ticks.
- Parameters
-
- Returns
- Number of ticks (1 tick = 4.615 ms).
Definition at line 107 of file system.h.
◆ SecToTicks()
| static uint32_t SecToTicks |
( |
uint32_t | sec | ) |
|
|
inlinestatic |
Converts seconds to OS ticks.
- Parameters
-
- Returns
- Number of ticks (1 tick = 4.615 ms).
Definition at line 116 of file system.h.
◆ UsToTicks()
| static uint32_t UsToTicks |
( |
uint32_t | us | ) |
|
|
inlinestatic |
Converts microseconds to OS ticks.
- Parameters
-
- Returns
- Number of ticks (1 tick = 4615 µs).
Definition at line 125 of file system.h.
◆ LockSched()
◆ UnlockSched()
| void UnlockSched |
( |
void | | ) |
|
◆ MutexCreate()
| void MutexCreate |
( |
MUTEX * | mtx | ) |
|
Init mutex object.
- Parameters
-
| mtx | pointer to the mutex object |
◆ MutexLock()
| void MutexLock |
( |
MUTEX * | mtx | ) |
|
Lock mutex.
- Parameters
-
| mtx | pointer to the mutex object |
◆ MutexLockEx()
| void MutexLockEx |
( |
MUTEX * | mtx, |
|
|
int | flag ) |
Lock mutex.
- Parameters
-
| mtx | pointer to the mutex object |
| flag | unknown |
◆ MutexUnlock()
| void MutexUnlock |
( |
MUTEX * | mtx | ) |
|
Unlock mutex.
- Parameters
-
| mtx | pointer to the mutex object |
◆ MutexDestroy()
| void MutexDestroy |
( |
MUTEX * | mtx | ) |
|
Destroy mutex (free resources).
- Parameters
-
| mtx | pointer to the mutex object |
◆ GetLoaderVersion()
| uint32_t GetLoaderVersion |
( |
| ) |
|
Get ELFLoader version.
- Returns
- 0x030201 -> 3.2.1
- Builtin on platforms:
- ELKA, NSG, X75, SG
◆ AddrLibrary()
Address of the ElfPack function library.
- Returns
- address in memory
- Note
- Defined by the ElfPack placement, not by firmware.
- Pointer to the memory:
- FLASH
◆ LIB_TOP()
Get a pointer to the loaded blib.
- Returns
- pointer
- Builtin on platforms:
- ELKA, NSG, X75, SG
◆ SHARED_TOP()
Get a pointer to the list of loaded shared libs.
- Returns
- pointer to the first element of the linked-list
- Builtin on platforms:
- ELKA, NSG, X75, SG
- Note
- Only for Elfloader 3.0+
◆ getBaseEnviron()
| char ** getBaseEnviron |
( |
| ) |
|
Get a pointer to a list of environment variables.
- Returns
- pointer to the C-like array of strings
- Builtin on platforms:
- ELKA, NSG, X75, SG
- Note
- Only for Elfloader 3.0+
◆ elfclose()
| int elfclose |
( |
void * | ex | ) |
|
Close ELF.
- Parameters
-
| ex | pointer to the opened ELF |
- Returns
- 0 or error
- Builtin on platforms:
- ELKA, NSG, X75, SG
- Note
- Only for Elfloader 3.0+
◆ kill_elf()
Kill current ELF (in background).
- Note
- Only for Elfloader 3.0+
◆ kill_data()
| void kill_data |
( |
void * | p, |
|
|
void(* | func_p )(void *) ) |
|
extern |
Free data without returning to the current function.
- Note
- Only for Elfloader 3.0+
◆ _dlopen()
| int _dlopen |
( |
const char * | name | ) |
|
Load the dynamic shared object (.so).
- Parameters
-
| name | path to the .so file or only name (libNAME.so) |
- Returns
- 0 or error
- Builtin on platforms:
- ELKA, NSG, X75, SG
- Note
- Only for Elfloader 3.0+
◆ _dlsym()
| void * _dlsym |
( |
int | handle, |
|
|
const char * | name ) |
Get a pointer to the symbol from the previously loaded dynamic object.
- Parameters
-
| handle | descriptor obtained from _dlopen |
| name | name of the symbol |
- Returns
- pointer to the symbol
- Builtin on platforms:
- ELKA, NSG, X75, SG
- Note
- Only for Elfloader 3.0+
◆ _dlclose()
| int _dlclose |
( |
int | handle | ) |
|
Close previously loaded dynamic object.
- Parameters
-
| handle | descriptor obtained from _dlopen |
- Returns
- 0 or error
- Builtin on platforms:
- ELKA, NSG, X75, SG
- Note
- Only for Elfloader 3.0+
◆ _dlerror()
| const char * _dlerror |
( |
| ) |
|
Get a string representation of the last error in _dlopen.
- Returns
- C-string
- Builtin on platforms:
- ELKA, NSG, X75, SG
- Note
- Only for Elfloader 3.0+
◆ dlclean_cache()
Call the garbage collector for the loaded dynamic objects.
- Returns
- 0 or error
- Builtin on platforms:
- ELKA, NSG, X75, SG
- Note
- Only for Elfloader 3.0+
◆ StartCpuUsageCount()
| void StartCpuUsageCount |
( |
void | | ) |
|
Enable CPU usage monitor.
◆ getCpuUsedTime_if_ena()
| unsigned long long getCpuUsedTime_if_ena |
( |
void | | ) |
|
Get CPU usage monitor value.
The result depends on the model.
- Returns
- ELKA, S68: time since StartCpuUsageCount in microseconds, or 0 if the monitor is disabled
-
C81, S75, SL75: time of the last StartCpuUsageCount in microseconds, or 0 if the monitor is disabled
-
SG, X75: CPU load in percent (0-100, in the low 32 bits); does not check that the monitor is enabled
- Note
- On NSG and ELKA, nonzero means that the monitor is enabled.
- Warning
- On SG and X75, each call resets the CPU usage counters.
◆ GetCPUClock()
Get CPU freq.
- Returns
- freq in MHz
◆ GetCPULoad()
Get CPU load.
- Returns
- 0-100
◆ SetCpuClockLow()
| void SetCpuClockLow |
( |
int | unk | ) |
|
Set the CPU frequency to the minimum value.
- Parameters
-
◆ SetCpuClockHi()
| void SetCpuClockHi |
( |
int | flag | ) |
|
Set the CPU frequency to the maximum value.
- Parameters
-
◆ SetCpuClockTempHi()
| void SetCpuClockTempHi |
( |
int | unk | ) |
|
Set the CPU frequency to the maximum value.
- Parameters
-
◆ RamRandSeed()
Get PRNG seed value.
- Returns
- pointer to the seed.
◆ RamLastStoreString()
| const char * RamLastStoreString |
( |
| ) |
|
Current pickoff error string.
- Returns
- C-string
◆ GSM_L1_Disable()
| const char * GSM_L1_Disable |
( |
| ) |
|
Disable GSM L1 layer (NetOff).
- Returns
- C-string
◆ loopback0()
Syscall, which is used by the phone OS, swi 0.
◆ loopback1()
Syscall, which is used by the phone OS, swi 1.
◆ loopback2()
Syscall, which is used by the phone OS, swi 2.
◆ loopback3()
Syscall, which is used by the phone OS, swi 3.
◆ loopback4()
Syscall, which is used by the phone OS, swi 4.
◆ loopback171()
| void loopback171 |
( |
void | | ) |
|
Syscall, which is used by the phone OS, swi 171.