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 extern const size_t android_netspeeds_count; 44 45 /* list of supported network latency names and min-max values in ms */ 46 typedef struct { 47 const char* name; 48 const char* display; 49 int min_ms; 50 int max_ms; 51 } NetworkLatency; 52 53 extern const NetworkLatency android_netdelays[]; 54 extern const size_t android_netdelays_count; 55 56 /* default network settings for emulator */ 57 #define DEFAULT_NETSPEED "full" 58 #define DEFAULT_NETDELAY "none" 59 60 /* enable/disable interrupt polling mode. the emulator will always use 100% 61 * of host CPU time, but will get high-quality time measurments. this is 62 * required for the tracing mode unless you can bear 10ms granularities 63 */ 64 extern void qemu_polling_enable(void); 65 extern void qemu_polling_disable(void); 66 67 /**in hw/goldfish_fb.c */ 68 69 /* framebuffer dimensions in pixels, note these can change dynamically */ 70 extern int android_framebuffer_w; 71 extern int android_framebuffer_h; 72 /* framebuffer dimensions in mm */ 73 extern int android_framebuffer_phys_w; 74 extern int android_framebuffer_phys_h; 75 76 /* framebuffer rotation, relative to device */ 77 typedef enum { 78 ANDROID_ROTATION_0 = 0, 79 ANDROID_ROTATION_90, 80 ANDROID_ROTATION_180, 81 ANDROID_ROTATION_270 82 } AndroidRotation; 83 84 extern AndroidRotation android_framebuffer_rotation; 85 86 /** in android_main.c */ 87 88 /* this is the port used for the control console in this emulator instance. 89 * starts at 5554, with increments of 2 */ 90 extern int android_base_port; 91 92 /* parses a network speed parameter and sets qemu_net_upload_speed and 93 * qemu_net_download_speed accordingly. returns -1 on failure, 0 on success */ 94 extern int android_parse_network_speed(const char* speed); 95 96 /* parse a network delay parameter and sets qemu_net_min/max_latency 97 * accordingly. returns -1 on error, 0 on success */ 98 extern int android_parse_network_latency(const char* delay); 99 100 extern void android_emulation_setup( void ); 101 extern void android_emulation_teardown( void ); 102 103 #endif /* _qemu_android_h */ 104