1 /* Copyright (C) 2007 The Android Open Source Project 2 ** 3 ** This software is licensed under the terms of the GNU General Public 4 ** License version 2, as published by the Free Software Foundation, and 5 ** may be copied, distributed, and modified under those terms. 6 ** 7 ** This program is distributed in the hope that it will be useful, 8 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 9 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 ** GNU General Public License for more details. 11 */ 12 #ifndef _qemu_android_h 13 #define _qemu_android_h 14 15 #define CONFIG_SHAPER 1 16 17 #include <stdlib.h> 18 #include <stdio.h> 19 #include <string.h> 20 21 /** in vl.c */ 22 23 /* emulated network up/down speeds, expressed in bits/seconds */ 24 extern double qemu_net_upload_speed; 25 extern double qemu_net_download_speed; 26 27 /* emulated network min-max latency, expressed in ms */ 28 extern int qemu_net_min_latency; 29 extern int qemu_net_max_latency; 30 31 /* global flag, when true, network is disabled */ 32 extern int qemu_net_disable; 33 34 /* list of supported network speed names and values in bits/seconds */ 35 typedef struct { 36 const char* name; 37 const char* display; 38 int upload; 39 int download; 40 } NetworkSpeed; 41 42 extern const NetworkSpeed android_netspeeds[]; 43 44 /* list of supported network latency names and min-max values in ms */ 45 typedef struct { 46 const char* name; 47 const char* display; 48 int min_ms; 49 int max_ms; 50 } NetworkLatency; 51 52 extern const NetworkLatency android_netdelays[]; 53 54 /* default network settings for emulator */ 55 #define DEFAULT_NETSPEED "full" 56 #define DEFAULT_NETDELAY "none" 57 58 /* enable/disable interrupt polling mode. the emulator will always use 100% 59 * of host CPU time, but will get high-quality time measurments. this is 60 * required for the tracing mode unless you can bear 10ms granularities 61 */ 62 extern void qemu_polling_enable(void); 63 extern void qemu_polling_disable(void); 64 65 /**in hw/goldfish_fb.c */ 66 67 /* framebuffer dimensions in pixels, note these can change dynamically */ 68 extern int android_framebuffer_w; 69 extern int android_framebuffer_h; 70 /* framebuffer dimensions in mm */ 71 extern int android_framebuffer_phys_w; 72 extern int android_framebuffer_phys_h; 73 74 /* framebuffer rotation, relative to device */ 75 typedef enum { 76 ANDROID_ROTATION_0 = 0, 77 ANDROID_ROTATION_90, 78 ANDROID_ROTATION_180, 79 ANDROID_ROTATION_270 80 } AndroidRotation; 81 82 extern AndroidRotation android_framebuffer_rotation; 83 84 /** in android_main.c */ 85 86 /* this is the port used for the control console in this emulator instance. 87 * starts at 5554, with increments of 2 */ 88 extern int android_base_port; 89 90 /* parses a network speed parameter and sets qemu_net_upload_speed and 91 * qemu_net_download_speed accordingly. returns -1 on failure, 0 on success */ 92 extern int android_parse_network_speed(const char* speed); 93 94 /* parse a network delay parameter and sets qemu_net_min/max_latency 95 * accordingly. returns -1 on error, 0 on success */ 96 extern int android_parse_network_latency(const char* delay); 97 98 extern void android_emulation_setup( void ); 99 extern void android_emulation_teardown( void ); 100 101 #endif /* _qemu_android_h */ 102