aboutsummaryrefslogtreecommitdiffstats
path: root/telephony/sysdeps.h
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:30:32 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 19:30:32 -0800
commit8b23a6c7e1aee255004dd19098d4c2462b61b849 (patch)
tree7a4d682ba51f0ff0364c5ca2509f515bdaf96de9 /telephony/sysdeps.h
parentf721e3ac031f892af46f255a47d7f54a91317b30 (diff)
downloadexternal_qemu-8b23a6c7e1aee255004dd19098d4c2462b61b849.zip
external_qemu-8b23a6c7e1aee255004dd19098d4c2462b61b849.tar.gz
external_qemu-8b23a6c7e1aee255004dd19098d4c2462b61b849.tar.bz2
auto import from //depot/cupcake/@135843
Diffstat (limited to 'telephony/sysdeps.h')
-rw-r--r--telephony/sysdeps.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/telephony/sysdeps.h b/telephony/sysdeps.h
new file mode 100644
index 0000000..19ca8d3
--- /dev/null
+++ b/telephony/sysdeps.h
@@ -0,0 +1,80 @@
+/* Copyright (C) 2007-2008 The Android Open Source Project
+**
+** This software is licensed under the terms of the GNU General Public
+** License version 2, as published by the Free Software Foundation, and
+** may be copied, distributed, and modified under those terms.
+**
+** This program is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+** GNU General Public License for more details.
+*/
+#ifndef __sysdeps_h__
+#define __sysdeps_h__
+
+/* system-dependent platform abstraction used by the emulated GSM modem
+ */
+
+/* to be called before anything else */
+
+extern void sys_main_init( void );
+
+/** callbacks
+ **/
+typedef void (*SysCallback)( void* opaque );
+
+/** events
+ **/
+enum {
+ SYS_EVENT_READ = 0x01,
+ SYS_EVENT_WRITE = 0x02,
+ SYS_EVENT_ERROR = 0x04,
+ SYS_EVENT_ALL = 0x07
+};
+
+/** channels
+ **/
+typedef struct SysChannelRec_* SysChannel;
+
+typedef void (*SysChannelCallback)( void* opaque, int event_flags );
+
+/* XXX: TODO: channel creation functions */
+extern SysChannel sys_channel_create_tcp_server( int port );
+extern SysChannel sys_channel_create_tcp_handler( SysChannel server_channel );
+extern SysChannel sys_channel_create_tcp_client( const char* hostname, int port );
+extern int sys_channel_set_non_block( SysChannel channel );
+
+extern void sys_channel_on( SysChannel channel,
+ int event_flags,
+ SysChannelCallback event_callback,
+ void* event_opaqe );
+
+extern int sys_channel_read( SysChannel channel, void* buffer, int size );
+
+extern int sys_channel_write( SysChannel channel, const void* buffer, int size );
+
+extern void sys_channel_close( SysChannel channel );
+
+
+/** time measurement
+ **/
+typedef long long SysTime;
+
+extern SysTime sys_time_now( void );
+
+/** timers
+ **/
+typedef struct SysTimerRec_* SysTimer;
+
+extern SysTimer sys_timer_create( void );
+extern void sys_timer_set( SysTimer timer, SysTime when, SysCallback callback, void* opaque );
+extern void sys_timer_unset( SysTimer timer );
+extern void sys_timer_destroy( SysTimer timer );
+
+extern long long sys_time_ms( void );
+
+/** main loop (may return immediately on some platform)
+ **/
+extern int sys_main_loop( void );
+
+#endif /* __sysdeps_h__ */