SWILIB API (SG)    
Loading...
Searching...
No Matches
gbs.h
Go to the documentation of this file.
1#pragma once
2
11#ifndef __IN_SWILIB__
12#include "base.h"
13#endif
14
16
17typedef struct GBS_MSG GBS_MSG;
18typedef struct MOPI_MSG MOPI_MSG;
19typedef struct GBSTMR GBSTMR;
20typedef struct IPC_REQ IPC_REQ;
21typedef struct PGROUP PGROUP;
22
23typedef void (*GBSTMR_CALLBACK)(GBSTMR *);
24typedef void (*GBS_PROC_CALLBACK)();
25
30 MMI_CEPID = 0x4209,
33#ifdef NEWSGOLD
34 HELPER_CEPID = 0x440A,
35#else
36 HELPER_CEPID = 0x4407,
37#endif
38};
39
44#ifdef NEWSGOLD
45 /* CALLS */
46 MSG_INCOMMING_CALL = 0x6000,
47 MSG_STATE_OF_CALL = 0x6009,
48 MSG_END_CALL = 0x600B,
50 /* HELPER */
51 MSG_HELPER_TRANSLATOR = 0xDEAE,
52 MSG_RECONFIGURE_REQ = 0xDEAF,
53 MSG_IPC = 0xDEB0,
55 /* SMS */
56 MSG_SMS_TX = 0x5802,
57 MSG_SMS_RX = 0x5803,
59 /* USSD */
60 MSG_USSD_RX = 0x60E2,
61 MSG_AUTOUSSD_RX = 0x60E5,
63 /* AUDIO */
64 MSG_PLAYFILE_REPORT = 0x70BC,
66 /* CSM */
67 MSG_CSM_DESTROYED = 0x6400,
68 MSG_CSM_DESTROY_NOTIFY = 0x6402,
70 /* GUI */
71 MSG_GUI_DESTROYED = 0x640E,
72 MSG_IDLETMR_EXPIRED = 0x6401,
73#else
74 /* CALLS */
77 MSG_END_CALL = 0x0D,
79 /* HELPER */
82 MSG_IPC = 0x3F2,
84 /* SMS */
85 MSG_SMS_TX = 0xC1,
86 MSG_SMS_RX = 0xC2,
88 /* USSD */
89 MSG_USSD_RX = 0x42,
92 /* AUDIO */
93#ifdef X75
94 MSG_PLAYFILE_REPORT = 0x174,
95#else
97#endif
98
99 /* CSM */
103 /* GUI */
106#endif
107};
108
112struct GBS_MSG {
113#ifdef NEWSGOLD
114 int pid_from;
115 int msg;
116#else
117 short pid_from;
118 short msg;
119#endif
121 void *data0;
122 void *data1;
123};
124
128struct MOPI_MSG {
130#ifdef NEWSGOLD
131 void (*on_destroy)(MOPI_MSG **msg);
132 uint32_t flags;
133#else
134 uint16_t flags;
135 uint16_t unk1;
136#endif
137 uint16_t cepid_to;
138 uint16_t cepid_from;
139 uint16_t msg_id;
140 uint16_t unk2;
141 uint16_t size;
142 uint16_t unk3;
143};
144
148struct GBSTMR {
149 int param0;
150 int param1;
151 int param2;
152 int param3;
153 int param4;
154 int param5;
155 int param6;
156};
157
161struct IPC_REQ {
162 const char *name_to;
163 const char *name_from;
164 void *data;
165};
166
170struct PGROUP {
171#ifdef NEWSGOLD
172 uint32_t id;
173 char *name;
174 uint16_t prio;
175 uint16_t stacksize;
176 uint32_t maxmembers;
177#else
178 uint8_t id;
179 uint8_t prio;
180 uint16_t stacksize;
181 uint16_t maxmembers;
182#endif
183};
184
194__swi_begin(0x145)
196__swi_end(0x145, GBS_GetCurCepid, ());
197
204__swi_begin(0x04D)
205void GBS_StartTimerProc(GBSTMR *timer, long ticks, GBSTMR_CALLBACK callback)
206__swi_end(0x04D, GBS_StartTimerProc, (timer, ticks, callback));
207
216__swi_begin(0x143)
217void GBS_StartTimer(GBSTMR *timer, int ticks, int msg_id, int unk, int cepid)
218__swi_end(0x143, GBS_StartTimer, (timer, ticks, msg_id, unk, cepid));
219
225__swi_begin(0x1A6)
227__swi_end(0x1A6, IsTimerProc, (timer));
228
233__swi_begin(0x144)
235__swi_end(0x144, GBS_StopTimer, (timer));
236
241__swi_begin(0x18C)
243__swi_end(0x18C, GBS_DelTimer, (timer));
244
259void GBS_SendMessage(int cepid, int msg, ...)
260__swi_variadic_end(0x100, GBS_SendMessage, cepid, msg); // (int cepid, int msg, int submess, void *data0, void *data1)
261
267__swi_begin(0x101)
269__swi_end(0x101, GBS_ReciveMessage, (msg));
270
276__swi_begin(0x153)
278__swi_end(0x153, GBS_RecActDstMessage, (msg));
279
286__swi_begin(0x423)
288__swi_end(0x423, GBS_GetMsgPayload, (msg));
289
295__swi_begin(0x463)
297__swi_end(0x463, GBS_GetProcGroup, (cepid));
298
308__swi_begin(0x4E1)
309void *MOPI_CreateMessage(MOPI_MSG **msg, int cepid_to, int msg_id, int size)
310__swi_end(0x4E1, MOPI_CreateMessage, (msg, cepid_to, msg_id, size));
311
316__swi_begin(0x4E2)
318__swi_end(0x4E2, MOPI_PostMessage, (msg));
319
324__swi_begin(0x4E1)
325void *GBS_CreateMsg(void **msg, int cepid_to, int msg_id, int size)
326__swi_end(0x4E1, GBS_CreateMsg, (msg, cepid_to, msg_id, size));
327
332__swi_begin(0x4E2)
333void GBS_PostMsg(void **msg)
334__swi_end(0x4E2, GBS_PostMsg, (msg));
335
339__swi_begin(0x102)
341__swi_end(0x102, GBS_AcceptMessage, ());
342
346__swi_begin(0x103)
348__swi_end(0x103, GBS_ClearMessage, ());
349
354__swi_begin(0x104)
356__swi_end(0x104, GBS_PendMessage, (msg));
357
362__swi_begin(0x232)
364__swi_end(0x232, GBS_DestroyMessage, (msg));
365
374__swi_begin(0x185)
375int GBS_WaitForMsg(const int *msg_list, int msgs_num, GBS_MSG *msgs, int timeout_ms)
376__swi_end(0x185, GBS_WaitForMsg, (msg_list, msgs_num, msgs, timeout_ms));
377
393__swi_begin(0x105)
394void CreateGBSproc(int cepid, const char *name, GBS_PROC_CALLBACK callback, int prio, int unk)
395__swi_end(0x105, CreateGBSproc, (cepid, name, callback, prio, unk));
396
401__swi_begin(0x154)
402void KillGBSproc(int cepid)
403__swi_end(0x154, KillGBSproc, (cepid));
404
410__swi_begin(0x385)
411void* GetGBSProcAddress(short cepid)
412__swi_end(0x385, GetGBSProcAddress, (cepid));
413
418__swi_begin(0x38E)
419void CreateICL(PGROUP *pgroup)
420__swi_end(0x38E, CreateICL, (pgroup));
421
429__swi_begin(0x38F)
430void *GBS_CreateProcessGroupResource(int mask, int unk_zero, PGROUP *pgroup, int size)
431__swi_end(0x38F, GBS_CreateProcessGroupResource, (mask, unk_zero, pgroup, size));
432
437__swi_begin(0x390)
439__swi_end(0x390, GBS_GetCurrentTask, ());
440
447__swi_begin(0x391)
448void *MemMBPAlloc(void *pool, int size)
449__swi_end(0x391, MemMBPAlloc, (pool, size));
450
456__swi_begin(0x392)
457void MemMBPFree(void *pool, void *ptr)
458__swi_end(0x392, MemMBPFree, (pool, ptr));
459
464__swi_begin(0x8393)
466__swi_end(0x8393, RamMopiResourcePool, ());
467
471
#define __swi_variadic_begin(number)
Definition doxygen.h:40
#define __swilib_begin
Definition doxygen.h:29
#define __swi_end(number, func, call)
Definition doxygen.h:33
#define __swi_variadic_end(number, func,...)
Definition doxygen.h:41
#define __swi_begin(number)
Definition doxygen.h:32
#define __swilib_end
Definition doxygen.h:30
uint8_t id
Process group ID (first byte of CEPID)
Definition gbs.h:178
int param6
Custom user param.
Definition gbs.h:155
int param5
Custom user param.
Definition gbs.h:154
void * data0
Custom payload.
Definition gbs.h:121
uint16_t maxmembers
Maximum members in the group.
Definition gbs.h:181
int submess
Sub message ID.
Definition gbs.h:120
uint16_t msg_id
Message ID.
Definition gbs.h:139
uint16_t unk2
Definition gbs.h:140
uint8_t prio
Nucleus task priority.
Definition gbs.h:179
short pid_from
Sender cepid.
Definition gbs.h:117
void * data1
Custom payload.
Definition gbs.h:122
int param4
Custom user param.
Definition gbs.h:153
const char * name_from
IPC sender.
Definition gbs.h:163
void * data
IPC payload.
Definition gbs.h:164
uint16_t unk3
Definition gbs.h:142
uint16_t flags
Definition gbs.h:134
uint16_t size
Payload size.
Definition gbs.h:141
int param2
Custom user param.
Definition gbs.h:151
short msg
Message ID.
Definition gbs.h:118
int param0
Internal timer data, do not change.
Definition gbs.h:149
MOPI_MSG * next
Definition gbs.h:129
int param3
Custom user param.
Definition gbs.h:152
uint16_t cepid_to
Destination CEPID.
Definition gbs.h:137
uint16_t cepid_from
Sender CEPID.
Definition gbs.h:138
uint16_t unk1
Definition gbs.h:135
uint16_t stacksize
Nucleus task stack size.
Definition gbs.h:180
const char * name_to
IPC receiver.
Definition gbs.h:162
int param1
Internal timer state, do not change.
Definition gbs.h:150
void * GBS_GetCurrentTask()
Get current GBS task.
void GBS_StopTimer(GBSTMR *timer)
Stop active timer.
void GBS_StartTimerProc(GBSTMR *timer, long ticks, GBSTMR_CALLBACK callback)
Start GBS timer with callback.
void(* GBS_PROC_CALLBACK)()
Definition gbs.h:24
void * GBS_CreateMsg(void **msg, int cepid_to, int msg_id, int size)
Create a MOPI message.
void * MemMBPAlloc(void *pool, int size)
Alloc memory in the given memory pool.
void * GBS_GetMsgPayload(GBS_MSG *msg)
Get the payload of a received GBS message.
void * GBS_CreateProcessGroupResource(int mask, int unk_zero, PGROUP *pgroup, int size)
Create new GBS Process Group Resource.
int GBS_GetCurCepid(void)
Get current CEPID.
void GBS_PostMsg(void **msg)
Post a message created with MOPI_CreateMessage to its destination (sets the handle to NULL).
void * RamMopiResourcePool()
Pointer to the MOPI memory pool.
void(* GBSTMR_CALLBACK)(GBSTMR *)
Definition gbs.h:23
void GBS_AcceptMessage(void)
ACK message received with GBS_RecActDstMessage.
void GBS_SendMessage(int cepid, int msg,...)
Send message to the GBS event processor.
int GBS_WaitForMsg(const int *msg_list, int msgs_num, GBS_MSG *msgs, int timeout_ms)
Wait for the GBS messages.
void * MOPI_CreateMessage(MOPI_MSG **msg, int cepid_to, int msg_id, int size)
Create a MOPI message.
int IsTimerProc(GBSTMR *timer)
Check if timer is not yet expired.
void MemMBPFree(void *pool, void *ptr)
Free memory allocated with MemMBPAlloc.
void CreateICL(PGROUP *pgroup)
Create new GBS Process Group.
GbsCepID
GBS CEP IDs.
Definition gbs.h:29
GbsMsgID
Common GBS message IDs.
Definition gbs.h:43
void GBS_DelTimer(GBSTMR *timer)
Delete timer.
void * GetGBSProcAddress(short cepid)
Get address of the GBS event processor.
int GBS_ReciveMessage(GBS_MSG *msg)
Receive GBS message inside GBS processor.
PGROUP * GBS_GetProcGroup(int cepid)
Find a GBS process group.
void KillGBSproc(int cepid)
Delete GBS Event Processor.
void GBS_StartTimer(GBSTMR *timer, int ticks, int msg_id, int unk, int cepid)
Start GBS timer that sends a message to cepid when it expires.
void CreateGBSproc(int cepid, const char *name, GBS_PROC_CALLBACK callback, int prio, int unk)
Create GBS Event Processor.
int GBS_RecActDstMessage(GBS_MSG *msg)
Receive a message from the queue without auto-ACK.
void GBS_DestroyMessage(GBS_MSG *msg)
Destroy GSB_MSG object.
void GBS_PendMessage(const GBS_MSG *msg)
Pend the message for future processing.
void MOPI_PostMessage(MOPI_MSG **msg)
Post a message created with MOPI_CreateMessage to its destination (sets the handle to NULL).
void GBS_ClearMessage(void)
Clear the message queue of the current GBS process.
@ HELPER_CEPID
HELPER.
Definition gbs.h:36
@ LCD_DISPLAYQUEUE_CEPID
LCD_DISPLAYQUEUE.
Definition gbs.h:31
@ MMI_CEPID
MMI.
Definition gbs.h:30
@ IDM_PROCESS_CEPID
IDM_PROCESS.
Definition gbs.h:32
@ MSG_STATE_OF_CALL
State of the call.
Definition gbs.h:76
@ MSG_HELPER_TRANSLATOR
Translated msg from HELPER to MMI.
Definition gbs.h:80
@ MSG_SMS_RX
Incoming SMS.
Definition gbs.h:86
@ MSG_IDLETMR_EXPIRED
IDLE timer expired.
Definition gbs.h:105
@ MSG_SMS_TX
Outgoint SMS.
Definition gbs.h:85
@ MSG_CSM_DESTROYED
CSM destroyed.
Definition gbs.h:100
@ MSG_IPC
ELFs IPC message.
Definition gbs.h:82
@ MSG_PLAYFILE_REPORT
PlayFile status reporting.
Definition gbs.h:96
@ MSG_CSM_DESTROY_NOTIFY
CSM will be destroyed.
Definition gbs.h:101
@ MSG_USSD_RX
USSD result.
Definition gbs.h:89
@ MSG_AUTOUSSD_RX
USSD result (???)
Definition gbs.h:90
@ MSG_INCOMMING_CALL
Incoming call.
Definition gbs.h:75
@ MSG_RECONFIGURE_REQ
Config chaged (BCFG Editor)
Definition gbs.h:81
@ MSG_GUI_DESTROYED
GUI destroyed.
Definition gbs.h:104
@ MSG_END_CALL
End of the call.
Definition gbs.h:77
GBS Message.
Definition gbs.h:112
GBS Timer.
Definition gbs.h:148
Message for MSG_IPC.
Definition gbs.h:161
MOPI message header, the payload follows it.
Definition gbs.h:128
Process group definition.
Definition gbs.h:170
#define const
Definition zconf.h:115