From 5e9fde8743d4d3d733303bef99e20000c0769148 Mon Sep 17 00:00:00 2001 From: tick Date: Fri, 16 Nov 2007 08:55:01 +0000 Subject: [gsmd] Adding timeout scheme, and merge gta01 wakeup scheme as machine plug-in with timeout. (L. Sean) git-svn-id: http://svn.openmoko.org/trunk/src/target/gsm@3430 99fdad57-331a-0410-800a-d7fa5415bdb3 --- include/gsmd/atcmd.h | 5 ++++- include/gsmd/gsmd.h | 7 +++++-- include/gsmd/machineplugin.h | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'include/gsmd') diff --git a/include/gsmd/atcmd.h b/include/gsmd/atcmd.h index 719b943..e328934 100644 --- a/include/gsmd/atcmd.h +++ b/include/gsmd/atcmd.h @@ -7,11 +7,14 @@ typedef int atcmd_cb_t(struct gsmd_atcmd *cmd, void *ctx, char *resp); -extern struct gsmd_atcmd *atcmd_fill(const char *cmd, int rlen, atcmd_cb_t *cb, void *ctx, u_int16_t id); +extern struct gsmd_atcmd *atcmd_fill(const char *cmd, int rlen, atcmd_cb_t *cb, void *ctx, u_int16_t id, + create_timer_t ct); extern int atcmd_submit(struct gsmd *g, struct gsmd_atcmd *cmd); extern int cancel_atcmd(struct gsmd *g, struct gsmd_atcmd *cmd); extern int atcmd_init(struct gsmd *g, int sockfd); extern void atcmd_drain(int fd); +extern void atcmd_wake_pending_queue (struct gsmd *g); +extern void atcmd_wait_pending_queue (struct gsmd *g); #endif /* __GSMD__ */ diff --git a/include/gsmd/gsmd.h b/include/gsmd/gsmd.h index c511fc3..5b2a9e6 100644 --- a/include/gsmd/gsmd.h +++ b/include/gsmd/gsmd.h @@ -19,6 +19,7 @@ void *gsmd_tallocs; #define LGSM_ATCMD_F_PARAM 0x02 /* as opposed to action */ #define LGSM_ATCMD_F_LFCR 0x04 /* accept LFCR as a line terminator */ +typedef struct gsmd_timer * (create_timer_t)(struct gsmd *data); struct gsmd_atcmd { struct llist_head list; void *ctx; @@ -28,6 +29,8 @@ struct gsmd_atcmd { u_int32_t buflen; u_int16_t id; u_int8_t flags; + struct gsmd_timer *timeout; + create_timer_t * create_timer_func; char *cur; char buf[]; }; @@ -67,7 +70,7 @@ struct gsmd; #define GSMD_FLAG_V0 0x0001 /* V0 responses to be expected from TA */ #define GSMD_FLAG_SMS_FMT_TEXT 0x0002 /* TODO Use TEXT rather than PDU mode */ -#define GSMD_MODEM_WAKEUP_TIMEOUT 3 +#define GSMD_ATCMD_TIMEOUT 60 /* If doesn get respond within 60 secs, discard */ struct gsmd { unsigned int flags; @@ -86,7 +89,7 @@ struct gsmd { unsigned char *mlbuf; /* ml_parse buffer */ unsigned int mlbuf_len; int mlunsolicited; - struct gsmd_timer *wakeup_timer; + int alive_responded; }; struct gsmd_user { diff --git a/include/gsmd/machineplugin.h b/include/gsmd/machineplugin.h index aee5d65..7a66031 100644 --- a/include/gsmd/machineplugin.h +++ b/include/gsmd/machineplugin.h @@ -11,6 +11,7 @@ struct gsmd; struct gsmd_machine_plugin { struct llist_head list; unsigned char *name; + int (*ex_submit)(struct gsmd *g); int (*detect)(struct gsmd *g); int (*init)(struct gsmd *g, int fd); }; -- cgit v1.2.3