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 */
24extern double   qemu_net_upload_speed;
25extern double   qemu_net_download_speed;
26
27/* emulated network min-max latency, expressed in ms */
28extern int      qemu_net_min_latency;
29extern int      qemu_net_max_latency;
30
31/* global flag, when true, network is disabled */
32extern int      qemu_net_disable;
33
34/* list of supported network speed names and values in bits/seconds */
35typedef struct {
36    const char*  name;
37    const char*  display;
38    int          upload;
39    int          download;
40} NetworkSpeed;
41
42extern const NetworkSpeed   android_netspeeds[];
43
44/* list of supported network latency names and min-max values in ms */
45typedef struct {
46    const char*  name;
47    const char*  display;
48    int          min_ms;
49    int          max_ms;
50} NetworkLatency;
51
52extern const NetworkLatency  android_netdelays[];
53
54/* enable/disable interrupt polling mode. the emulator will always use 100%
55 * of host CPU time, but will get high-quality time measurments. this is
56 * required for the tracing mode unless you can bear 10ms granularities
57 */
58extern void  qemu_polling_enable(void);
59extern void  qemu_polling_disable(void);
60
61/**in hw/goldfish_fb.c */
62
63/* framebuffer dimensions in pixels, note these can change dynamically */
64extern int  android_framebuffer_w;
65extern int  android_framebuffer_h;
66/* framebuffer dimensions in mm */
67extern int  android_framebuffer_phys_w;
68extern int  android_framebuffer_phys_h;
69
70/* framebuffer rotation, relative to device */
71typedef enum {
72    ANDROID_ROTATION_0 = 0,
73    ANDROID_ROTATION_90,
74    ANDROID_ROTATION_180,
75    ANDROID_ROTATION_270
76} AndroidRotation;
77
78extern AndroidRotation  android_framebuffer_rotation;
79
80/**  in android_main.c */
81
82/* this is the port used for the control console in this emulator instance.
83 * starts at 5554, with increments of 2 */
84extern int   android_base_port;
85
86/* parses a network speed parameter and sets qemu_net_upload_speed and
87 * qemu_net_download_speed accordingly. returns -1 on failure, 0 on success */
88extern int   android_parse_network_speed(const char*  speed);
89
90/* parse a network delay parameter and sets qemu_net_min/max_latency
91 * accordingly. returns -1 on error, 0 on success */
92extern int   android_parse_network_latency(const char*  delay);
93
94extern void  android_emulation_setup( void );
95extern void  android_emulation_teardown( void );
96
97#endif /* _qemu_android_h */
98