Commit 6a36d84e1024ce41860751b449727f4ddca91aa2
1 parent
3f9f3aa1
suppressed -enable-audio and simplified -soundhw option handling (malc)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1725 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
4 changed files
with
115 additions
and
77 deletions
hw/pc.c
@@ -574,6 +574,38 @@ static int serial_irq[MAX_SERIAL_PORTS] = { 4, 3, 4, 3 }; | @@ -574,6 +574,38 @@ static int serial_irq[MAX_SERIAL_PORTS] = { 4, 3, 4, 3 }; | ||
574 | static int parallel_io[MAX_PARALLEL_PORTS] = { 0x378, 0x278, 0x3bc }; | 574 | static int parallel_io[MAX_PARALLEL_PORTS] = { 0x378, 0x278, 0x3bc }; |
575 | static int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 }; | 575 | static int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 }; |
576 | 576 | ||
577 | +#ifdef HAS_AUDIO | ||
578 | +static void audio_init (PCIBus *pci_bus) | ||
579 | +{ | ||
580 | + struct soundhw *c; | ||
581 | + int audio_enabled = 0; | ||
582 | + | ||
583 | + for (c = soundhw; !audio_enabled && c->name; ++c) { | ||
584 | + audio_enabled = c->enabled; | ||
585 | + } | ||
586 | + | ||
587 | + if (audio_enabled) { | ||
588 | + AudioState *s; | ||
589 | + | ||
590 | + s = AUD_init (); | ||
591 | + if (s) { | ||
592 | + for (c = soundhw; c->name; ++c) { | ||
593 | + if (c->enabled) { | ||
594 | + if (c->isa) { | ||
595 | + c->init.init_isa (s); | ||
596 | + } | ||
597 | + else { | ||
598 | + if (pci_bus) { | ||
599 | + c->init.init_pci (pci_bus, s); | ||
600 | + } | ||
601 | + } | ||
602 | + } | ||
603 | + } | ||
604 | + } | ||
605 | + } | ||
606 | +} | ||
607 | +#endif | ||
608 | + | ||
577 | /* PC hardware initialisation */ | 609 | /* PC hardware initialisation */ |
578 | static void pc_init1(int ram_size, int vga_ram_size, int boot_device, | 610 | static void pc_init1(int ram_size, int vga_ram_size, int boot_device, |
579 | DisplayState *ds, const char **fd_filename, int snapshot, | 611 | DisplayState *ds, const char **fd_filename, int snapshot, |
@@ -789,26 +821,9 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, | @@ -789,26 +821,9 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, | ||
789 | 821 | ||
790 | kbd_init(); | 822 | kbd_init(); |
791 | DMA_init(0); | 823 | DMA_init(0); |
792 | - | ||
793 | - if (audio_enabled) { | ||
794 | - AudioState *audio; | ||
795 | - | ||
796 | - audio = AUD_init(); | ||
797 | - if (audio) { | ||
798 | - if (sb16_enabled) | ||
799 | - SB16_init (audio); | ||
800 | -#ifdef CONFIG_ADLIB | ||
801 | - if (adlib_enabled) | ||
802 | - Adlib_init (audio); | ||
803 | -#endif | ||
804 | -#ifdef CONFIG_GUS | ||
805 | - if (gus_enabled) | ||
806 | - GUS_init (audio); | 824 | +#ifdef HAS_AUDIO |
825 | + audio_init(pci_enabled ? pci_bus : NULL); | ||
807 | #endif | 826 | #endif |
808 | - if (pci_enabled && es1370_enabled) | ||
809 | - es1370_init (pci_bus, audio); | ||
810 | - } | ||
811 | - } | ||
812 | 827 | ||
813 | floppy_controller = fdctrl_init(6, 2, 0, 0x3f0, fd_table); | 828 | floppy_controller = fdctrl_init(6, 2, 0, 0x3f0, fd_table); |
814 | 829 |
qemu-doc.texi
@@ -201,16 +201,12 @@ de en-us fi fr-be hr it lv nl-be pt sl tr | @@ -201,16 +201,12 @@ de en-us fi fr-be hr it lv nl-be pt sl tr | ||
201 | 201 | ||
202 | The default is @code{en-us}. | 202 | The default is @code{en-us}. |
203 | 203 | ||
204 | -@item -enable-audio | ||
205 | - | ||
206 | -Will enable audio and all the sound hardware QEMU was built with. | ||
207 | - | ||
208 | @item -audio-help | 204 | @item -audio-help |
209 | 205 | ||
210 | Will show the audio subsystem help: list of drivers, tunable | 206 | Will show the audio subsystem help: list of drivers, tunable |
211 | parameters. | 207 | parameters. |
212 | 208 | ||
213 | -@item -soundhw card1,card2,... | 209 | +@item -soundhw card1,card2,... or -soundhw all |
214 | 210 | ||
215 | Enable audio and selected sound hardware. Use ? to print all | 211 | Enable audio and selected sound hardware. Use ? to print all |
216 | available sound hardware. | 212 | available sound hardware. |
@@ -218,6 +214,7 @@ available sound hardware. | @@ -218,6 +214,7 @@ available sound hardware. | ||
218 | @example | 214 | @example |
219 | qemu -soundhw sb16,adlib hda | 215 | qemu -soundhw sb16,adlib hda |
220 | qemu -soundhw es1370 hda | 216 | qemu -soundhw es1370 hda |
217 | +qemu -soundhw all hda | ||
221 | qemu -soundhw ? | 218 | qemu -soundhw ? |
222 | @end example | 219 | @end example |
223 | 220 |
vl.c
@@ -124,13 +124,6 @@ int nb_nics; | @@ -124,13 +124,6 @@ int nb_nics; | ||
124 | NICInfo nd_table[MAX_NICS]; | 124 | NICInfo nd_table[MAX_NICS]; |
125 | QEMUTimer *gui_timer; | 125 | QEMUTimer *gui_timer; |
126 | int vm_running; | 126 | int vm_running; |
127 | -#ifdef HAS_AUDIO | ||
128 | -int audio_enabled = 0; | ||
129 | -int sb16_enabled = 0; | ||
130 | -int adlib_enabled = 0; | ||
131 | -int gus_enabled = 0; | ||
132 | -int es1370_enabled = 0; | ||
133 | -#endif | ||
134 | int rtc_utc = 1; | 127 | int rtc_utc = 1; |
135 | int cirrus_vga_enabled = 1; | 128 | int cirrus_vga_enabled = 1; |
136 | #ifdef TARGET_SPARC | 129 | #ifdef TARGET_SPARC |
@@ -3977,11 +3970,11 @@ void help(void) | @@ -3977,11 +3970,11 @@ void help(void) | ||
3977 | "-k language use keyboard layout (for example \"fr\" for French)\n" | 3970 | "-k language use keyboard layout (for example \"fr\" for French)\n" |
3978 | #endif | 3971 | #endif |
3979 | #ifdef HAS_AUDIO | 3972 | #ifdef HAS_AUDIO |
3980 | - "-enable-audio enable audio support, and all the sound cards\n" | ||
3981 | "-audio-help print list of audio drivers and their options\n" | 3973 | "-audio-help print list of audio drivers and their options\n" |
3982 | "-soundhw c1,... enable audio support\n" | 3974 | "-soundhw c1,... enable audio support\n" |
3983 | " and only specified sound cards (comma separated list)\n" | 3975 | " and only specified sound cards (comma separated list)\n" |
3984 | " use -soundhw ? to get the list of supported cards\n" | 3976 | " use -soundhw ? to get the list of supported cards\n" |
3977 | + " use -soundhw all to enable all of them\n" | ||
3985 | #endif | 3978 | #endif |
3986 | "-localtime set the real time clock to local time [default=utc]\n" | 3979 | "-localtime set the real time clock to local time [default=utc]\n" |
3987 | "-full-screen start in full screen\n" | 3980 | "-full-screen start in full screen\n" |
@@ -4097,7 +4090,6 @@ enum { | @@ -4097,7 +4090,6 @@ enum { | ||
4097 | QEMU_OPTION_m, | 4090 | QEMU_OPTION_m, |
4098 | QEMU_OPTION_nographic, | 4091 | QEMU_OPTION_nographic, |
4099 | #ifdef HAS_AUDIO | 4092 | #ifdef HAS_AUDIO |
4100 | - QEMU_OPTION_enable_audio, | ||
4101 | QEMU_OPTION_audio_help, | 4093 | QEMU_OPTION_audio_help, |
4102 | QEMU_OPTION_soundhw, | 4094 | QEMU_OPTION_soundhw, |
4103 | #endif | 4095 | #endif |
@@ -4159,7 +4151,6 @@ const QEMUOption qemu_options[] = { | @@ -4159,7 +4151,6 @@ const QEMUOption qemu_options[] = { | ||
4159 | { "nographic", 0, QEMU_OPTION_nographic }, | 4151 | { "nographic", 0, QEMU_OPTION_nographic }, |
4160 | { "k", HAS_ARG, QEMU_OPTION_k }, | 4152 | { "k", HAS_ARG, QEMU_OPTION_k }, |
4161 | #ifdef HAS_AUDIO | 4153 | #ifdef HAS_AUDIO |
4162 | - { "enable-audio", 0, QEMU_OPTION_enable_audio }, | ||
4163 | { "audio-help", 0, QEMU_OPTION_audio_help }, | 4154 | { "audio-help", 0, QEMU_OPTION_audio_help }, |
4164 | { "soundhw", HAS_ARG, QEMU_OPTION_soundhw }, | 4155 | { "soundhw", HAS_ARG, QEMU_OPTION_soundhw }, |
4165 | #endif | 4156 | #endif |
@@ -4280,58 +4271,90 @@ void register_machines(void) | @@ -4280,58 +4271,90 @@ void register_machines(void) | ||
4280 | } | 4271 | } |
4281 | 4272 | ||
4282 | #ifdef HAS_AUDIO | 4273 | #ifdef HAS_AUDIO |
4283 | -static void select_soundhw (const char *optarg) | ||
4284 | -{ | ||
4285 | - if (*optarg == '?') { | ||
4286 | - show_valid_cards: | ||
4287 | - printf ("Valid sound card names (comma separated):\n"); | ||
4288 | - printf ("sb16 Creative Sound Blaster 16\n"); | 4274 | +struct soundhw soundhw[] = { |
4275 | + { | ||
4276 | + "sb16", | ||
4277 | + "Creative Sound Blaster 16", | ||
4278 | + 0, | ||
4279 | + 1, | ||
4280 | + { .init_isa = SB16_init } | ||
4281 | + }, | ||
4282 | + | ||
4289 | #ifdef CONFIG_ADLIB | 4283 | #ifdef CONFIG_ADLIB |
4284 | + { | ||
4285 | + "adlib", | ||
4290 | #ifdef HAS_YMF262 | 4286 | #ifdef HAS_YMF262 |
4291 | - printf ("adlib Yamaha YMF262 (OPL3)\n"); | 4287 | + "Yamaha YMF262 (OPL3)", |
4292 | #else | 4288 | #else |
4293 | - printf ("adlib Yamaha YM3812 (OPL2)\n"); | 4289 | + "Yamaha YM3812 (OPL2)", |
4294 | #endif | 4290 | #endif |
4291 | + 0, | ||
4292 | + 1, | ||
4293 | + { .init_isa = Adlib_init } | ||
4294 | + }, | ||
4295 | #endif | 4295 | #endif |
4296 | + | ||
4296 | #ifdef CONFIG_GUS | 4297 | #ifdef CONFIG_GUS |
4297 | - printf ("gus Gravis Ultrasound GF1\n"); | 4298 | + { |
4299 | + "gus", | ||
4300 | + "Gravis Ultrasound GF1", | ||
4301 | + 0, | ||
4302 | + 1, | ||
4303 | + { .init_isa = GUS_init } | ||
4304 | + }, | ||
4298 | #endif | 4305 | #endif |
4299 | - printf ("es1370 ENSONIQ AudioPCI ES1370\n"); | 4306 | + |
4307 | + { | ||
4308 | + "es1370", | ||
4309 | + "ENSONIQ AudioPCI ES1370", | ||
4310 | + 0, | ||
4311 | + 0, | ||
4312 | + { .init_pci = es1370_init } | ||
4313 | + }, | ||
4314 | + | ||
4315 | + { NULL, NULL, 0, 0, { NULL } } | ||
4316 | +}; | ||
4317 | + | ||
4318 | +static void select_soundhw (const char *optarg) | ||
4319 | +{ | ||
4320 | + struct soundhw *c; | ||
4321 | + | ||
4322 | + if (*optarg == '?') { | ||
4323 | + show_valid_cards: | ||
4324 | + | ||
4325 | + printf ("Valid sound card names (comma separated):\n"); | ||
4326 | + for (c = soundhw; c->name; ++c) { | ||
4327 | + printf ("%-11s %s\n", c->name, c->descr); | ||
4328 | + } | ||
4329 | + printf ("\n-soundhw all will enable all of the above\n"); | ||
4300 | exit (*optarg != '?'); | 4330 | exit (*optarg != '?'); |
4301 | } | 4331 | } |
4302 | else { | 4332 | else { |
4303 | - struct { | ||
4304 | - char *name; | ||
4305 | - int *enabledp; | ||
4306 | - } soundhw_tab[] = { | ||
4307 | - { "sb16", &sb16_enabled }, | ||
4308 | -#ifdef CONFIG_ADLIB | ||
4309 | - { "adlib", &adlib_enabled }, | ||
4310 | -#endif | ||
4311 | -#ifdef CONFIG_GUS | ||
4312 | - { "gus", &gus_enabled }, | ||
4313 | -#endif | ||
4314 | - { "es1370", &es1370_enabled }, | ||
4315 | - }; | ||
4316 | - size_t tablen, l, i; | 4333 | + size_t l; |
4317 | const char *p; | 4334 | const char *p; |
4318 | char *e; | 4335 | char *e; |
4319 | int bad_card = 0; | 4336 | int bad_card = 0; |
4320 | 4337 | ||
4321 | - p = optarg; | ||
4322 | - tablen = sizeof (soundhw_tab) / sizeof (soundhw_tab[0]); | 4338 | + if (!strcmp (optarg, "all")) { |
4339 | + for (c = soundhw; c->name; ++c) { | ||
4340 | + c->enabled = 1; | ||
4341 | + } | ||
4342 | + return; | ||
4343 | + } | ||
4323 | 4344 | ||
4345 | + p = optarg; | ||
4324 | while (*p) { | 4346 | while (*p) { |
4325 | e = strchr (p, ','); | 4347 | e = strchr (p, ','); |
4326 | l = !e ? strlen (p) : (size_t) (e - p); | 4348 | l = !e ? strlen (p) : (size_t) (e - p); |
4327 | - for (i = 0; i < tablen; ++i) { | ||
4328 | - if (!strncmp (soundhw_tab[i].name, p, l)) { | ||
4329 | - audio_enabled = 1; | ||
4330 | - *soundhw_tab[i].enabledp = 1; | 4349 | + |
4350 | + for (c = soundhw; c->name; ++c) { | ||
4351 | + if (!strncmp (c->name, p, l)) { | ||
4352 | + c->enabled = 1; | ||
4331 | break; | 4353 | break; |
4332 | } | 4354 | } |
4333 | } | 4355 | } |
4334 | - if (i == tablen) { | 4356 | + |
4357 | + if (!c->name) { | ||
4335 | if (l > 80) { | 4358 | if (l > 80) { |
4336 | fprintf (stderr, | 4359 | fprintf (stderr, |
4337 | "Unknown sound card name (too big to show)\n"); | 4360 | "Unknown sound card name (too big to show)\n"); |
@@ -4592,13 +4615,6 @@ int main(int argc, char **argv) | @@ -4592,13 +4615,6 @@ int main(int argc, char **argv) | ||
4592 | break; | 4615 | break; |
4593 | #endif | 4616 | #endif |
4594 | #ifdef HAS_AUDIO | 4617 | #ifdef HAS_AUDIO |
4595 | - case QEMU_OPTION_enable_audio: | ||
4596 | - audio_enabled = 1; | ||
4597 | - sb16_enabled = 1; | ||
4598 | - adlib_enabled = 1; | ||
4599 | - gus_enabled = 1; | ||
4600 | - es1370_enabled = 1; | ||
4601 | - break; | ||
4602 | case QEMU_OPTION_audio_help: | 4618 | case QEMU_OPTION_audio_help: |
4603 | AUD_help (); | 4619 | AUD_help (); |
4604 | exit (0); | 4620 | exit (0); |
vl.h
@@ -126,11 +126,6 @@ void qemu_system_powerdown(void); | @@ -126,11 +126,6 @@ void qemu_system_powerdown(void); | ||
126 | 126 | ||
127 | void main_loop_wait(int timeout); | 127 | void main_loop_wait(int timeout); |
128 | 128 | ||
129 | -extern int audio_enabled; | ||
130 | -extern int sb16_enabled; | ||
131 | -extern int adlib_enabled; | ||
132 | -extern int gus_enabled; | ||
133 | -extern int es1370_enabled; | ||
134 | extern int ram_size; | 129 | extern int ram_size; |
135 | extern int bios_size; | 130 | extern int bios_size; |
136 | extern int rtc_utc; | 131 | extern int rtc_utc; |
@@ -621,6 +616,21 @@ typedef struct HeathrowPICS HeathrowPICS; | @@ -621,6 +616,21 @@ typedef struct HeathrowPICS HeathrowPICS; | ||
621 | void heathrow_pic_set_irq(void *opaque, int num, int level); | 616 | void heathrow_pic_set_irq(void *opaque, int num, int level); |
622 | HeathrowPICS *heathrow_pic_init(int *pmem_index); | 617 | HeathrowPICS *heathrow_pic_init(int *pmem_index); |
623 | 618 | ||
619 | +#ifdef HAS_AUDIO | ||
620 | +struct soundhw { | ||
621 | + const char *name; | ||
622 | + const char *descr; | ||
623 | + int enabled; | ||
624 | + int isa; | ||
625 | + union { | ||
626 | + int (*init_isa) (AudioState *s); | ||
627 | + int (*init_pci) (PCIBus *bus, AudioState *s); | ||
628 | + } init; | ||
629 | +}; | ||
630 | + | ||
631 | +extern struct soundhw soundhw[]; | ||
632 | +#endif | ||
633 | + | ||
624 | /* vga.c */ | 634 | /* vga.c */ |
625 | 635 | ||
626 | #define VGA_RAM_SIZE (4096 * 1024) | 636 | #define VGA_RAM_SIZE (4096 * 1024) |