Gsmd/document

From Openmoko

(Difference between revisions)
Jump to: navigation, search
m (ml_parse)
m (ml_parse)
Line 32: Line 32:
 
ml_parse is the call back function that handles:
 
ml_parse is the call back function that handles:
 
* Initial GSM Modem
 
* Initial GSM Modem
*  
+
* handle correspond AT command call back
*
+
* handle notification call back
 +
 
 
===== initial GSM Modem =====
 
===== initial GSM Modem =====
 +
When the modem firmware is ready to initial, it will send '''AT-Command Interpreter ready''' to gsmd. If ml_parse get this string, gsmd will try to initialize the modem.
 +
        if (strlen(buf) == 0 ||
 +
            !strcmp(buf, "AT-Command Interpreter ready")) {
 +
                g->interpreter_ready = 1;
 +
                gsmd_initsettings(g);
 +
                gmsd_alive_start(g);
 +
                return 0;
 +
        }
 +
What modem write to gsmd will put in "buf". And if the contents of the "buf" is "AT-Command Interpreter ready" the automatic gsmd initialize will start.
  
 
==== atcmd_select_cb ====
 
==== atcmd_select_cb ====

Revision as of 17:03, 5 October 2007

Contents

Overview

What is gsmd

Gsmd is a daemon that handles the communication between applications and GSM modem. Applications control gsmd through libgsmd. libgsmd communicates with gsmd through unix socket, and modem goes through Uart. The diagram is as following. http://lh6.google.com/ticktock35/RwDCAWdUPEI/AAAAAAAAAD4/wBrRLv-1oyE/s400/gsmd_overview.jpg

Gsmd

GSMD is a event driven daemon. Each event shall has a response. Every event will pass through the gsmd_select_main() in which finding and executing their correspond call back functions.

gsmd_select_main()

gsmd_select_main this is core of the call back function scheme. All devices, gsmd monitors, are described as a struct gsmd_fd, and gsmd_select_main will select them. Once an event comes out from one of the devices, gsmd_select_main will try to call it's call back function that devices registered.

gsmd_fd

struct gsmd_fd {
    struct llist_head list;
    int fd;                         /* file descriptor */
    unsigned int when;
    int (*cb)(int fd, unsigned int what, void *data);
    void *data;                     /* void * to pass to callback */
};

call back functions

Gsmd will open two devices. One is uart to modem and the other is the Unix socket, communicating with libgsmd.

The default call back function of uart (to modem) is ml_parse, in which dealing with writing AT command, and reading response or notifications from modem.

ml_parse

ml_parse is the call back function that handles:

  • Initial GSM Modem
  • handle correspond AT command call back
  • handle notification call back
initial GSM Modem

When the modem firmware is ready to initial, it will send AT-Command Interpreter ready to gsmd. If ml_parse get this string, gsmd will try to initialize the modem.

       if (strlen(buf) == 0 ||
           !strcmp(buf, "AT-Command Interpreter ready")) {
               g->interpreter_ready = 1;
               gsmd_initsettings(g);
               gmsd_alive_start(g);
               return 0;
       }

What modem write to gsmd will put in "buf". And if the contents of the "buf" is "AT-Command Interpreter ready" the automatic gsmd initialize will start.

atcmd_select_cb

atcmd_fill

atcmd_submit

libgsmd

libgsmd-tool

To-do

Personal tools

Overview

What is gsmd

Gsmd is a daemon that handles the communication between applications and GSM modem. Applications control gsmd through libgsmd. libgsmd communicates with gsmd through unix socket, and modem goes through Uart. The diagram is as following. http://lh6.google.com/ticktock35/RwDCAWdUPEI/AAAAAAAAAD4/wBrRLv-1oyE/s400/gsmd_overview.jpg

Gsmd

GSMD is a event driven daemon. Each event shall has a response. Every event will pass through the gsmd_select_main() in which finding and executing their correspond call back functions.

gsmd_select_main()

gsmd_select_main this is core of the call back function scheme. All devices, gsmd monitors, are described as a struct gsmd_fd, and gsmd_select_main will select them. Once an event comes out from one of the devices, gsmd_select_main will try to call it's call back function that devices registered.

gsmd_fd

struct gsmd_fd {
    struct llist_head list;
    int fd;                         /* file descriptor */
    unsigned int when;
    int (*cb)(int fd, unsigned int what, void *data);
    void *data;                     /* void * to pass to callback */
};

call back functions

Gsmd will open two devices. One is uart to modem and the other is the Unix socket, communicating with libgsmd.

The default call back function of uart (to modem) is ml_parse, in which dealing with writing AT command, and reading response or notifications from modem.

ml_parse

ml_parse is the call back function that handles:

  • Initial GSM Modem
initial GSM Modem

atcmd_select_cb

atcmd_fill

atcmd_submit

libgsmd

libgsmd-tool

To-do