Skip to content

Commit cf1e896

Browse files
committed
Simplify android/config/config.h
This removes the definitions of CONFIG_NAND and CONFIG_SHAPER from android/config/config.h since these defines are no longer conditional. Note that CONFIG_SOFTMMU is not conditional, but is kept inside of the file because it doesn't belong to config-host.h which is supposed to define macros corresponding to the host system's properties, not the emulation engine. CONFIG_NAND_LIMITS is kept since it's currently still conditional. + Remove un-necessary includes of "android/android/config.h" from misc sources. + Fix minor header inclusion order issues. Change-Id: I1492404d766334b3ec7b76a0f932a97aeea4b0f4
1 parent fb34155 commit cf1e896

File tree

9 files changed

+29
-303
lines changed

9 files changed

+29
-303
lines changed

android/android.h

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
#ifndef _qemu_android_h
1313
#define _qemu_android_h
1414

15-
#define CONFIG_SHAPER 1
16-
1715
#include <stdlib.h>
1816
#include <stdio.h>
1917
#include <string.h>

android/avd/info.c

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include "android/avd/util.h"
1414
#include "android/avd/keys.h"
1515

16-
#include "android/config/config.h"
1716
#include "android/utils/bufprint.h"
1817
#include "android/utils/debug.h"
1918
#include "android/utils/dirscanner.h"

android/avd/info.h

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#define ANDROID_AVD_INFO_H
1414

1515
#include "android/avd/hw-config.h"
16-
#include "android/config/config.h"
1716
#include "android/utils/compiler.h"
1817
#include "android/utils/file_data.h"
1918
#include "android/utils/ini.h"

android/config/config.h

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
*/
77
#include "config-host.h"
88

9-
#define CONFIG_NAND 1
10-
#define CONFIG_SHAPER 1
119
#define CONFIG_SOFTMMU 1
1210
#ifndef _WIN32
1311
#define CONFIG_NAND_LIMITS 1

android/console.c

+25-279
Original file line numberDiff line numberDiff line change
@@ -21,45 +21,45 @@
2121
*
2222
*/
2323

24-
#include "android/sockets.h"
25-
#include "sysemu/char.h"
26-
#include "sysemu/sysemu.h"
2724
#include "android/android.h"
28-
#include "cpu.h"
29-
#include "hw/android/goldfish/device.h"
30-
#include "hw/power_supply.h"
31-
#include "android/shaper.h"
32-
#include "telephony/modem_driver.h"
25+
#include "android/display-core.h"
3326
#include "android/gps.h"
3427
#include "android/globals.h"
28+
#include "android/hw-events.h"
29+
#include "android/hw-fingerprint.h"
30+
#include "android/hw-sensors.h"
31+
#include "android/shaper.h"
32+
#include "android/skin/charmap.h"
33+
#include "android/skin/keycode-buffer.h"
34+
#include "android/sockets.h"
35+
#include "android/tcpdump.h"
36+
#include "android/user-events.h"
3537
#include "android/utils/bufprint.h"
3638
#include "android/utils/debug.h"
3739
#include "android/utils/eintr_wrapper.h"
3840
#include "android/utils/http_utils.h"
3941
#include "android/utils/stralloc.h"
4042
#include "android/utils/utf8_utils.h"
41-
#include "android/config/config.h"
42-
#include "android/tcpdump.h"
43-
#include "net/net.h"
43+
44+
#include "config-host.h"
45+
#include "cpu.h"
46+
#include "hw/android/goldfish/device.h"
47+
#include "hw/power_supply.h"
48+
#if defined(CONFIG_SLIRP)
49+
#include "libslirp.h"
50+
#endif
4451
#include "monitor/monitor.h"
52+
#include "net/net.h"
53+
#include "telephony/modem_driver.h"
54+
#include "sysemu/char.h"
55+
#include "sysemu/sysemu.h"
4556

46-
#include <stdlib.h>
47-
#include <stdio.h>
57+
#include <fcntl.h>
4858
#include <stdarg.h>
59+
#include <stdio.h>
60+
#include <stdlib.h>
4961
#include <string.h>
5062
#include <unistd.h>
51-
#include <fcntl.h>
52-
#include "android/hw-events.h"
53-
#include "android/user-events.h"
54-
#include "android/hw-fingerprint.h"
55-
#include "android/hw-sensors.h"
56-
#include "android/skin/charmap.h"
57-
#include "android/skin/keycode-buffer.h"
58-
#include "android/display-core.h"
59-
60-
#if defined(CONFIG_SLIRP)
61-
#include "libslirp.h"
62-
#endif
6363

6464
extern void android_emulator_set_window_scale(double, int);
6565

@@ -118,23 +118,6 @@ typedef struct ControlGlobalRec_
118118

119119
} ControlGlobalRec;
120120

121-
#ifdef CONFIG_STANDALONE_CORE
122-
/* UI client currently attached to the core. */
123-
ControlClient attached_ui_client = NULL;
124-
125-
/* User events service client. */
126-
ControlClient user_events_client = NULL;
127-
128-
/* UI control service client (UI -> Core). */
129-
ControlClient ui_core_ctl_client = NULL;
130-
131-
/* UI control service (UI -> Core. */
132-
// CoreUICtl* ui_core_ctl = NULL;
133-
134-
/* UI control service client (Core-> UI). */
135-
ControlClient core_ui_ctl_client = NULL;
136-
#endif // CONFIG_STANDALONE_CORE
137-
138121
static int
139122
control_global_add_redir( ControlGlobal global,
140123
int host_port,
@@ -222,28 +205,6 @@ control_client_destroy( ControlClient client )
222205

223206
D(( "destroying control client %p\n", client ));
224207

225-
#ifdef CONFIG_STANDALONE_CORE
226-
if (client == attached_ui_client) {
227-
attachUiProxy_destroy();
228-
attached_ui_client = NULL;
229-
}
230-
231-
if (client == user_events_client) {
232-
userEventsImpl_destroy();
233-
user_events_client = NULL;
234-
}
235-
236-
if (client == ui_core_ctl_client) {
237-
coreCmdImpl_destroy();
238-
ui_core_ctl_client = NULL;
239-
}
240-
241-
if (client == core_ui_ctl_client) {
242-
uiCmdProxy_destroy();
243-
core_ui_ctl_client = NULL;
244-
}
245-
#endif // CONFIG_STANDALONE_CORE
246-
247208
sock = control_client_detach( client );
248209
if (sock >= 0)
249210
socket_close(sock);
@@ -2641,227 +2602,12 @@ do_qemu_monitor( ControlClient client, char* args )
26412602
return -1;
26422603
}
26432604

2644-
#ifdef CONFIG_STANDALONE_CORE
2645-
/* UI settings, passed to the core via -ui-settings command line parameter. */
2646-
extern char* android_op_ui_settings;
2647-
2648-
static int
2649-
do_attach_ui( ControlClient client, char* args )
2650-
{
2651-
// Make sure that there are no UI already attached to this console.
2652-
if (attached_ui_client != NULL) {
2653-
control_write( client, "KO: Another UI is attached to this core!\r\n" );
2654-
control_client_destroy(client);
2655-
return -1;
2656-
}
2657-
2658-
if (!attachUiProxy_create(client->sock)) {
2659-
char reply_buf[4096];
2660-
attached_ui_client = client;
2661-
// Reply "OK" with the saved -ui-settings property.
2662-
snprintf(reply_buf, sizeof(reply_buf), "OK: %s\r\n", android_op_ui_settings);
2663-
control_write( client, reply_buf);
2664-
} else {
2665-
control_write( client, "KO\r\n" );
2666-
control_client_destroy(client);
2667-
return -1;
2668-
}
2669-
2670-
return 0;
2671-
}
2672-
2673-
void
2674-
destroy_attach_ui_client(void)
2675-
{
2676-
if (attached_ui_client != NULL) {
2677-
control_client_destroy(attached_ui_client);
2678-
}
2679-
}
2680-
2681-
static int
2682-
do_create_framebuffer_service( ControlClient client, char* args )
2683-
{
2684-
ProxyFramebuffer* core_fb;
2685-
const char* protocol = "-raw"; // Default framebuffer exchange protocol.
2686-
char reply_buf[64];
2687-
2688-
// Protocol type is defined by the arguments passed with the stream switch
2689-
// command.
2690-
if (args != NULL && *args != '\0') {
2691-
size_t token_len;
2692-
const char* param_end = strchr(args, ' ');
2693-
if (param_end == NULL) {
2694-
param_end = args + strlen(args);
2695-
}
2696-
token_len = param_end - args;
2697-
protocol = args;
2698-
2699-
// Make sure that this is one of the supported protocols.
2700-
if (strncmp(protocol, "-raw", token_len) &&
2701-
strncmp(protocol, "-shared", token_len)) {
2702-
derror("Invalid framebuffer parameter %s\n", protocol);
2703-
control_write( client, "KO: Invalid parameter\r\n" );
2704-
control_client_destroy(client);
2705-
return -1;
2706-
}
2707-
}
2708-
2709-
core_fb = proxyFb_create(client->sock, protocol);
2710-
if (core_fb == NULL) {
2711-
control_write( client, "KO\r\n" );
2712-
control_client_destroy(client);
2713-
return -1;
2714-
}
2715-
2716-
// Reply "OK" with the framebuffer's bits per pixel
2717-
snprintf(reply_buf, sizeof(reply_buf), "OK: -bitsperpixel=%d\r\n",
2718-
proxyFb_get_bits_per_pixel(core_fb));
2719-
control_write( client, reply_buf);
2720-
return 0;
2721-
}
2722-
2723-
static int
2724-
do_create_user_events_service( ControlClient client, char* args )
2725-
{
2726-
// Make sure that there are no user events client already existing.
2727-
if (user_events_client != NULL) {
2728-
control_write( client, "KO: Another user events service is already existing!\r\n" );
2729-
control_client_destroy(client);
2730-
return -1;
2731-
}
2732-
2733-
if (!userEventsImpl_create(client->sock)) {
2734-
char reply_buf[4096];
2735-
user_events_client = client;
2736-
snprintf(reply_buf, sizeof(reply_buf), "OK\r\n");
2737-
control_write( client, reply_buf);
2738-
} else {
2739-
control_write( client, "KO\r\n" );
2740-
control_client_destroy(client);
2741-
return -1;
2742-
}
2743-
2744-
return 0;
2745-
}
2746-
2747-
void
2748-
destroy_user_events_client(void)
2749-
{
2750-
if (user_events_client != NULL) {
2751-
control_client_destroy(user_events_client);
2752-
}
2753-
}
2754-
2755-
static int
2756-
do_create_ui_core_ctl_service( ControlClient client, char* args )
2757-
{
2758-
// Make sure that there are no ui control client already existing.
2759-
if (ui_core_ctl_client != NULL) {
2760-
control_write( client, "KO: Another UI control service is already existing!\r\n" );
2761-
control_client_destroy(client);
2762-
return -1;
2763-
}
2764-
2765-
if (!coreCmdImpl_create(client->sock)) {
2766-
char reply_buf[4096];
2767-
ui_core_ctl_client = client;
2768-
snprintf(reply_buf, sizeof(reply_buf), "OK\r\n");
2769-
control_write( client, reply_buf);
2770-
} else {
2771-
control_write( client, "KO\r\n" );
2772-
control_client_destroy(client);
2773-
return -1;
2774-
}
2775-
2776-
return 0;
2777-
}
2778-
2779-
void
2780-
destroy_ui_core_ctl_client(void)
2781-
{
2782-
if (ui_core_ctl_client != NULL) {
2783-
control_client_destroy(ui_core_ctl_client);
2784-
}
2785-
}
2786-
2787-
void
2788-
destroy_corecmd_client(void)
2789-
{
2790-
if (ui_core_ctl_client != NULL) {
2791-
control_client_destroy(ui_core_ctl_client);
2792-
}
2793-
}
2794-
2795-
static int
2796-
do_create_core_ui_ctl_service( ControlClient client, char* args )
2797-
{
2798-
// Make sure that there are no ui control client already existing.
2799-
if (core_ui_ctl_client != NULL) {
2800-
control_write( client, "KO: Another UI control service is already existing!\r\n" );
2801-
control_client_destroy(client);
2802-
return -1;
2803-
}
2804-
2805-
if (!uiCmdProxy_create(client->sock)) {
2806-
char reply_buf[4096];
2807-
core_ui_ctl_client = client;
2808-
snprintf(reply_buf, sizeof(reply_buf), "OK\r\n");
2809-
control_write( client, reply_buf);
2810-
} else {
2811-
control_write( client, "KO\r\n" );
2812-
control_client_destroy(client);
2813-
return -1;
2814-
}
2815-
2816-
return 0;
2817-
}
2818-
2819-
void
2820-
destroy_core_ui_ctl_client(void)
2821-
{
2822-
if (core_ui_ctl_client != NULL) {
2823-
control_client_destroy(core_ui_ctl_client);
2824-
}
2825-
}
2826-
2827-
void
2828-
destroy_uicmd_client(void)
2829-
{
2830-
if (core_ui_ctl_client != NULL) {
2831-
control_client_destroy(core_ui_ctl_client);
2832-
}
2833-
}
2834-
2835-
#endif // CONFIG_STANDALONE_CORE
2836-
28372605
static const CommandDefRec qemu_commands[] =
28382606
{
28392607
{ "monitor", "enter QEMU monitor",
28402608
"Enter the QEMU virtual machine monitor\r\n",
28412609
NULL, do_qemu_monitor, NULL },
28422610

2843-
#ifdef CONFIG_STANDALONE_CORE
2844-
{ "attach-UI", "attach UI to the core",
2845-
"Attach UI to the core\r\n",
2846-
NULL, do_attach_ui, NULL },
2847-
2848-
{ "framebuffer", "create framebuffer service",
2849-
"Create framebuffer service\r\n",
2850-
NULL, do_create_framebuffer_service, NULL },
2851-
2852-
{ "user-events", "create user events service",
2853-
"Create user events service\r\n",
2854-
NULL, do_create_user_events_service, NULL },
2855-
2856-
{ "ui-core-control", "create UI control service",
2857-
"Create UI control service\r\n",
2858-
NULL, do_create_ui_core_ctl_service, NULL },
2859-
2860-
{ "core-ui-control", "create UI control service",
2861-
"Create UI control service\r\n",
2862-
NULL, do_create_core_ui_ctl_service, NULL },
2863-
#endif // CONFIG_STANDALONE_CORE
2864-
28652611
{ NULL, NULL, NULL, NULL, NULL, NULL }
28662612
};
28672613

hw/android/android_arm.c

-2
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,8 @@ static void android_arm_init_(ram_addr_t ram_size,
120120
goldfish_add_device_no_io(&event0_device);
121121
events_dev_init(event0_device.base, goldfish_pic[event0_device.irq]);
122122

123-
#ifdef CONFIG_NAND
124123
goldfish_add_device_no_io(&nand_device);
125124
nand_dev_init(nand_device.base);
126-
#endif
127125

128126
trace_dev_init();
129127

0 commit comments

Comments
 (0)