SWILIB API (NSG)    
Loading...
Searching...
No Matches
GBS

Detailed Description

General Bus System API

Usage: #include <swilib.h> or #include <swilib/gbs.h>

Data Structures

struct  GBS_MSG
 GBS Message. More...
 
struct  MOPI_MSG
 MOPI message header, the payload follows it. More...
 
struct  GBSTMR
 GBS Timer. More...
 
struct  IPC_REQ
 Message for MSG_IPC. More...
 
struct  PGROUP
 Process group definition. More...
 

Typedefs

typedef struct GBS_MSG GBS_MSG
 
typedef struct MOPI_MSG MOPI_MSG
 
typedef struct GBSTMR GBSTMR
 
typedef struct IPC_REQ IPC_REQ
 
typedef struct PGROUP PGROUP
 
typedef void(* GBSTMR_CALLBACK) (GBSTMR *)
 
typedef void(* GBS_PROC_CALLBACK) ()
 

Enumerations

enum  GbsCepID {
  MMI_CEPID = 0x4209 ,
  LCD_DISPLAYQUEUE_CEPID = 0x4200 ,
  IDM_PROCESS_CEPID = 0x403D ,
  HELPER_CEPID = 0x440A
}
 GBS CEP IDs. More...
 
enum  GbsMsgID {
  MSG_INCOMMING_CALL = 0x6000 ,
  MSG_STATE_OF_CALL = 0x6009 ,
  MSG_END_CALL = 0x600B ,
  MSG_HELPER_TRANSLATOR = 0xDEAE ,
  MSG_RECONFIGURE_REQ = 0xDEAF ,
  MSG_IPC = 0xDEB0 ,
  MSG_SMS_TX = 0x5802 ,
  MSG_SMS_RX = 0x5803 ,
  MSG_USSD_RX = 0x60E2 ,
  MSG_AUTOUSSD_RX = 0x60E5 ,
  MSG_PLAYFILE_REPORT = 0x70BC ,
  MSG_CSM_DESTROYED = 0x6400 ,
  MSG_CSM_DESTROY_NOTIFY = 0x6402 ,
  MSG_GUI_DESTROYED = 0x640E ,
  MSG_IDLETMR_EXPIRED = 0x6401
}
 Common GBS message IDs. More...
 

Timers

int GBS_GetCurCepid (void)
 Get current CEPID.
 
void GBS_StartTimerProc (GBSTMR *timer, long ticks, GBSTMR_CALLBACK callback)
 Start GBS timer with callback.
 
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.
 
int IsTimerProc (GBSTMR *timer)
 Check if timer is not yet expired.
 
void GBS_StopTimer (GBSTMR *timer)
 Stop active timer.
 
void GBS_DelTimer (GBSTMR *timer)
 Delete timer.
 

Messages

void GBS_SendMessage (int cepid, int msg,...)
 Send message to the GBS event processor.
 
int GBS_ReciveMessage (GBS_MSG *msg)
 Receive GBS message inside GBS processor.
 
int GBS_RecActDstMessage (GBS_MSG *msg)
 Receive a message from the queue without auto-ACK.
 
void * GBS_GetMsgPayload (GBS_MSG *msg)
 Get the payload of a received GBS message.
 
PGROUP * GBS_GetProcGroup (int cepid)
 Find a GBS process group.
 
void * MOPI_CreateMessage (MOPI_MSG **msg, int cepid_to, int msg_id, int size)
 Create a MOPI message.
 
void MOPI_PostMessage (MOPI_MSG **msg)
 Post a message created with MOPI_CreateMessage to its destination (sets the handle to NULL).
 
void * GBS_CreateMsg (void **msg, int cepid_to, int msg_id, int size)
 Create a MOPI message.
 
void GBS_PostMsg (void **msg)
 Post a message created with MOPI_CreateMessage to its destination (sets the handle to NULL).
 
void GBS_AcceptMessage (void)
 ACK message received with GBS_RecActDstMessage.
 
void GBS_ClearMessage (void)
 Clear the message queue of the current GBS process.
 
void GBS_PendMessage (const GBS_MSG *msg)
 Pend the message for future processing.
 
void GBS_DestroyMessage (GBS_MSG *msg)
 Destroy GSB_MSG object.
 
int GBS_WaitForMsg (const int *msg_list, int msgs_num, GBS_MSG *msgs, int timeout_ms)
 Wait for the GBS messages.
 

Event processors

void CreateGBSproc (int cepid, const char *name, GBS_PROC_CALLBACK callback, int prio, int unk)
 Create GBS Event Processor.
 
void KillGBSproc (int cepid)
 Delete GBS Event Processor.
 
void * GetGBSProcAddress (short cepid)
 Get address of the GBS event processor.
 
void CreateICL (PGROUP *pgroup)
 Create new GBS Process Group.
 
void * GBS_CreateProcessGroupResource (int mask, int unk_zero, PGROUP *pgroup, int size)
 Create new GBS Process Group Resource.
 
void * GBS_GetCurrentTask ()
 Get current GBS task.
 
void * MemMBPAlloc (void *pool, int size)
 Alloc memory in the given memory pool.
 
void MemMBPFree (void *pool, void *ptr)
 Free memory allocated with MemMBPAlloc.
 
void * RamMopiResourcePool ()
 Pointer to the MOPI memory pool.
 

Data Structure Documentation

◆ GBS_MSG

struct GBS_MSG

◆ MOPI_MSG

struct MOPI_MSG

◆ GBSTMR

struct GBSTMR

◆ IPC_REQ

struct IPC_REQ

◆ PGROUP

struct PGROUP

Typedef Documentation

◆ GBS_MSG

typedef struct GBS_MSG GBS_MSG

Definition at line 17 of file gbs.h.

◆ MOPI_MSG

typedef struct MOPI_MSG MOPI_MSG

Definition at line 18 of file gbs.h.

◆ GBSTMR

typedef struct GBSTMR GBSTMR

Definition at line 19 of file gbs.h.

◆ IPC_REQ

typedef struct IPC_REQ IPC_REQ

Definition at line 20 of file gbs.h.

◆ PGROUP

typedef struct PGROUP PGROUP

Definition at line 21 of file gbs.h.

◆ GBSTMR_CALLBACK

typedef void(* GBSTMR_CALLBACK) (GBSTMR *)

Definition at line 23 of file gbs.h.

◆ GBS_PROC_CALLBACK

typedef void(* GBS_PROC_CALLBACK) ()

Definition at line 24 of file gbs.h.

Enumeration Type Documentation

◆ GbsCepID

enum GbsCepID

GBS CEP IDs.

Enumerator
MMI_CEPID 

MMI.

LCD_DISPLAYQUEUE_CEPID 

LCD_DISPLAYQUEUE.

IDM_PROCESS_CEPID 

IDM_PROCESS.

HELPER_CEPID 

HELPER.

Definition at line 29 of file gbs.h.

◆ GbsMsgID

enum GbsMsgID

Common GBS message IDs.

Enumerator
MSG_INCOMMING_CALL 

Incoming call.

MSG_STATE_OF_CALL 

State of the call.

MSG_END_CALL 

End of the call.

MSG_HELPER_TRANSLATOR 

Translated msg from HELPER to MMI.

MSG_RECONFIGURE_REQ 

Config chaged (BCFG Editor)

MSG_IPC 

ELFs IPC message.

MSG_SMS_TX 

Outgoing SMS.

MSG_SMS_RX 

Incoming SMS.

MSG_USSD_RX 

USSD result.

MSG_AUTOUSSD_RX 

USSD result (???)

MSG_PLAYFILE_REPORT 

PlayFile status reporting.

MSG_CSM_DESTROYED 

CSM destroyed.

MSG_CSM_DESTROY_NOTIFY 

CSM will be destroyed.

MSG_GUI_DESTROYED 

GUI destroyed.

MSG_IDLETMR_EXPIRED 

IDLE timer expired.

Definition at line 43 of file gbs.h.

Function Documentation

◆ GBS_GetCurCepid()

int GBS_GetCurCepid ( void )

Get current CEPID.

Returns
cepid number

◆ GBS_StartTimerProc()

void GBS_StartTimerProc ( GBSTMR * timer,
long ticks,
GBSTMR_CALLBACK callback )

Start GBS timer with callback.

Parameters
timerpointer to the GBS timer
ticksnumber of ticks to expire the timer (1 tick - 4.615 ms)
callbacktimer expire callback

◆ GBS_StartTimer()

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.

Parameters
timerpointer to the GBS timer
ticksnumber of ticks to expire the timer (1 tick - 4.615 ms)
msg_idID of the GBS message that will be sent when the timer expires
unkunknown
cepiddestination CEPID

◆ IsTimerProc()

int IsTimerProc ( GBSTMR * timer)

Check if timer is not yet expired.

Parameters
timerpointer to the GBS timer
Returns
1: not expired, 0: expired

◆ GBS_StopTimer()

void GBS_StopTimer ( GBSTMR * timer)

Stop active timer.

Parameters
timerpointer to the GBS timer

◆ GBS_DelTimer()

void GBS_DelTimer ( GBSTMR * timer)

Delete timer.

Parameters
timerpointer to the GBS timer

◆ GBS_SendMessage()

void GBS_SendMessage ( int cepid,
int msg,
... )

Send message to the GBS event processor.

You can pass up to 3 additional parameters (submsg, data0, data1 - see GBS_MSG).

Parameters
cepiddestination CEPID.
msgID of the message

◆ GBS_ReciveMessage()

int GBS_ReciveMessage ( GBS_MSG * msg)

Receive GBS message inside GBS processor.

Parameters
msgpointer where the received message will be stored
Returns
count of messages in the queue

◆ GBS_RecActDstMessage()

int GBS_RecActDstMessage ( GBS_MSG * msg)

Receive a message from the queue without auto-ACK.

Parameters
msgpointer where the received message will be stored
Returns
count of messages in the queue

◆ GBS_GetMsgPayload()

void * GBS_GetMsgPayload ( GBS_MSG * msg)

Get the payload of a received GBS message.

Parameters
msgreceived GBS message
Returns
the payload of the MOPI_MSG in data0 for a long message (bit 16 of msg on NSG/ELKA, bit 10 on SG/X75), otherwise &msg->submess. It is freed with the message

◆ GBS_GetProcGroup()

PGROUP * GBS_GetProcGroup ( int cepid)

Find a GBS process group.

Parameters
cepidCEPID whose group (cepid & 0xFF00) is looked up
Returns
process group, or NULL if the group does not exist

◆ MOPI_CreateMessage()

void * MOPI_CreateMessage ( MOPI_MSG ** msg,
int cepid_to,
int msg_id,
int size )

Create a MOPI message.

Parameters
[out]msgmessage handle, pass it to MOPI_PostMessage
cepid_todestination CEPID
msg_idmessage id
sizepayload size in bytes
Returns
payload (right after the MOPI_MSG header), NULL when size is 0
Note
msg->cepid_from is set to the current process and may be changed before MOPI_PostMessage.

◆ MOPI_PostMessage()

void MOPI_PostMessage ( MOPI_MSG ** msg)

Post a message created with MOPI_CreateMessage to its destination (sets the handle to NULL).

Parameters
msgmessage handle

◆ GBS_CreateMsg()

void * GBS_CreateMsg ( void ** msg,
int cepid_to,
int msg_id,
int size )

Create a MOPI message.

Parameters
[out]msgmessage handle, pass it to MOPI_PostMessage
cepid_todestination CEPID
msg_idmessage id
sizepayload size in bytes
Returns
payload (right after the MOPI_MSG header), NULL when size is 0
Note
msg->cepid_from is set to the current process and may be changed before MOPI_PostMessage.
Deprecated
Use MOPI_CreateMessage instead.

◆ GBS_PostMsg()

void GBS_PostMsg ( void ** msg)

Post a message created with MOPI_CreateMessage to its destination (sets the handle to NULL).

Parameters
msgmessage handle
Deprecated
Use MOPI_PostMessage instead.

◆ GBS_AcceptMessage()

void GBS_AcceptMessage ( void )

ACK message received with GBS_RecActDstMessage.

◆ GBS_ClearMessage()

void GBS_ClearMessage ( void )

Clear the message queue of the current GBS process.

◆ GBS_PendMessage()

void GBS_PendMessage ( const GBS_MSG * msg)

Pend the message for future processing.

Parameters
msgpointer to the GBS_MSG

◆ GBS_DestroyMessage()

void GBS_DestroyMessage ( GBS_MSG * msg)

Destroy GSB_MSG object.

Parameters
msgpointer to the GBS_MSG

◆ GBS_WaitForMsg()

int GBS_WaitForMsg ( const int * msg_list,
int msgs_num,
GBS_MSG * msgs,
int timeout_ms )

Wait for the GBS messages.

Parameters
msg_listlist of message IDs to wait for
msgs_numcount message IDs in msg_list
msgspointer where the received messages will be stored (array of msgs_num items)
timeout_mstimeout in milliseconds
Returns
number of received messages

◆ CreateGBSproc()

void CreateGBSproc ( int cepid,
const char * name,
GBS_PROC_CALLBACK callback,
int prio,
int unk )

Create GBS Event Processor.

Parameters
cepidCEPID of this event processor
namename of the event processor
callbackcallback for the message
priopriority of the event processor
unkset to 0

◆ KillGBSproc()

void KillGBSproc ( int cepid)

Delete GBS Event Processor.

Parameters
cepidCEPID of event processor for deletion

◆ GetGBSProcAddress()

void * GetGBSProcAddress ( short cepid)

Get address of the GBS event processor.

Parameters
cepidCEPID of event processor
Returns
pointer

◆ CreateICL()

void CreateICL ( PGROUP * pgroup)

Create new GBS Process Group.

Parameters
pgroupprocess group definition

◆ GBS_CreateProcessGroupResource()

void * GBS_CreateProcessGroupResource ( int mask,
int unk_zero,
PGROUP * pgroup,
int size )

Create new GBS Process Group Resource.

Parameters
maskresource mask (???)
unk_zeroset to 0
pgroupprocess group config
sizesize of the resource

◆ GBS_GetCurrentTask()

void * GBS_GetCurrentTask ( )

Get current GBS task.

Returns
pointer to the GBS task

◆ MemMBPAlloc()

void * MemMBPAlloc ( void * pool,
int size )

Alloc memory in the given memory pool.

Parameters
poolmemory pool
sizerequested memory size
Returns
pointer to the allocated memory

◆ MemMBPFree()

void MemMBPFree ( void * pool,
void * ptr )

Free memory allocated with MemMBPAlloc.

Parameters
poolmemory pool
ptrpointer to the allocated memory

◆ RamMopiResourcePool()

void * RamMopiResourcePool ( )

Pointer to the MOPI memory pool.

Returns
pointer