Revision 36cd6f6f

b/arch_init.c
899 899
    } init;
900 900
};
901 901

  
902
static struct soundhw soundhw[] = {
903
#ifdef HAS_AUDIO_CHOICE
904
#ifdef CONFIG_PCSPK
905
    {
906
        "pcspk",
907
        "PC speaker",
908
        0,
909
        1,
910
        { .init_isa = pcspk_audio_init }
911
    },
912
#endif
913

  
914
#ifdef CONFIG_SB16
915
    {
916
        "sb16",
917
        "Creative Sound Blaster 16",
918
        0,
919
        1,
920
        { .init_isa = SB16_init }
921
    },
922
#endif
923

  
924
#ifdef CONFIG_CS4231A
925
    {
926
        "cs4231a",
927
        "CS4231A",
928
        0,
929
        1,
930
        { .init_isa = cs4231a_init }
931
    },
932
#endif
933

  
934
#ifdef CONFIG_ADLIB
935
    {
936
        "adlib",
937
#ifdef HAS_YMF262
938
        "Yamaha YMF262 (OPL3)",
939
#else
940
        "Yamaha YM3812 (OPL2)",
941
#endif
942
        0,
943
        1,
944
        { .init_isa = Adlib_init }
945
    },
946
#endif
947

  
948
#ifdef CONFIG_GUS
949
    {
950
        "gus",
951
        "Gravis Ultrasound GF1",
952
        0,
953
        1,
954
        { .init_isa = GUS_init }
955
    },
956
#endif
957

  
958
#ifdef CONFIG_AC97
959
    {
960
        "ac97",
961
        "Intel 82801AA AC97 Audio",
962
        0,
963
        0,
964
        { .init_pci = ac97_init }
965
    },
966
#endif
902
static struct soundhw soundhw[9];
903
static int soundhw_count;
967 904

  
968
#ifdef CONFIG_ES1370
969
    {
970
        "es1370",
971
        "ENSONIQ AudioPCI ES1370",
972
        0,
973
        0,
974
        { .init_pci = es1370_init }
975
    },
976
#endif
977

  
978
#ifdef CONFIG_HDA
979
    {
980
        "hda",
981
        "Intel HD Audio",
982
        0,
983
        0,
984
        { .init_pci = intel_hda_and_codec_init }
985
    },
986
#endif
987

  
988
#endif /* HAS_AUDIO_CHOICE */
905
void isa_register_soundhw(const char *name, const char *descr,
906
                          int (*init_isa)(ISABus *bus))
907
{
908
    assert(soundhw_count < ARRAY_SIZE(soundhw) - 1);
909
    soundhw[soundhw_count].name = name;
910
    soundhw[soundhw_count].descr = descr;
911
    soundhw[soundhw_count].isa = 1;
912
    soundhw[soundhw_count].init.init_isa = init_isa;
913
    soundhw_count++;
914
}
989 915

  
990
    { NULL, NULL, 0, 0, { NULL } }
991
};
916
void pci_register_soundhw(const char *name, const char *descr,
917
                          int (*init_pci)(PCIBus *bus))
918
{
919
    assert(soundhw_count < ARRAY_SIZE(soundhw) - 1);
920
    soundhw[soundhw_count].name = name;
921
    soundhw[soundhw_count].descr = descr;
922
    soundhw[soundhw_count].isa = 0;
923
    soundhw[soundhw_count].init.init_pci = init_pci;
924
    soundhw_count++;
925
}
992 926

  
993 927
void select_soundhw(const char *optarg)
994 928
{
......
997 931
    if (is_help_option(optarg)) {
998 932
    show_valid_cards:
999 933

  
1000
#ifdef HAS_AUDIO_CHOICE
1001
        printf("Valid sound card names (comma separated):\n");
1002
        for (c = soundhw; c->name; ++c) {
1003
            printf ("%-11s %s\n", c->name, c->descr);
934
        if (soundhw_count) {
935
             printf("Valid sound card names (comma separated):\n");
936
             for (c = soundhw; c->name; ++c) {
937
                 printf ("%-11s %s\n", c->name, c->descr);
938
             }
939
             printf("\n-soundhw all will enable all of the above\n");
940
        } else {
941
             printf("Machine has no user-selectable audio hardware "
942
                    "(it may or may not have always-present audio hardware).\n");
1004 943
        }
1005
        printf("\n-soundhw all will enable all of the above\n");
1006
#else
1007
        printf("Machine has no user-selectable audio hardware "
1008
               "(it may or may not have always-present audio hardware).\n");
1009
#endif
1010 944
        exit(!is_help_option(optarg));
1011 945
    }
1012 946
    else {
b/configure
4459 4459

  
4460 4460
if test "$target_softmmu" = "yes" ; then
4461 4461
  case "$TARGET_BASE_ARCH" in
4462
  arm)
4462
  arm|lm32|i386|mips|ppc)
4463 4463
    cflags="-DHAS_AUDIO $cflags"
4464 4464
  ;;
4465
  lm32)
4466
    cflags="-DHAS_AUDIO $cflags"
4467
  ;;
4468
  i386|mips|ppc)
4469
    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
4470
  ;;
4471 4465
  esac
4472 4466
fi
4473 4467

  
b/hw/audio/ac97.c
1396 1396
    memory_region_destroy (&s->io_nabm);
1397 1397
}
1398 1398

  
1399
int ac97_init (PCIBus *bus)
1399
static int ac97_init (PCIBus *bus)
1400 1400
{
1401 1401
    pci_create_simple (bus, -1, "AC97");
1402 1402
    return 0;
......
1433 1433
static void ac97_register_types (void)
1434 1434
{
1435 1435
    type_register_static (&ac97_info);
1436
    pci_register_soundhw("ac97", "Intel 82801AA AC97 Audio", ac97_init);
1436 1437
}
1437 1438

  
1438 1439
type_init (ac97_register_types)
b/hw/audio/adlib.c
372 372
    .class_init    = adlib_class_initfn,
373 373
};
374 374

  
375
int Adlib_init (ISABus *bus)
375
static int Adlib_init (ISABus *bus)
376 376
{
377 377
    isa_create_simple (bus, TYPE_ADLIB);
378 378
    return 0;
......
381 381
static void adlib_register_types (void)
382 382
{
383 383
    type_register_static (&adlib_info);
384
    isa_register_soundhw("adlib", ADLIB_DESC, Adlib_init);
384 385
}
385 386

  
386 387
type_init (adlib_register_types)
b/hw/audio/cs4231a.c
659 659
    return 0;
660 660
}
661 661

  
662
int cs4231a_init (ISABus *bus)
662
static int cs4231a_init (ISABus *bus)
663 663
{
664 664
    isa_create_simple (bus, "cs4231a");
665 665
    return 0;
......
692 692
static void cs4231a_register_types (void)
693 693
{
694 694
    type_register_static (&cs4231a_info);
695
    isa_register_soundhw("cs4231a", "CS4231A", cs4231a_init);
695 696
}
696 697

  
697 698
type_init (cs4231a_register_types)
b/hw/audio/es1370.c
1051 1051
    memory_region_destroy (&s->io);
1052 1052
}
1053 1053

  
1054
int es1370_init (PCIBus *bus)
1054
static int es1370_init (PCIBus *bus)
1055 1055
{
1056 1056
    pci_create_simple (bus, -1, "ES1370");
1057 1057
    return 0;
......
1083 1083
static void es1370_register_types (void)
1084 1084
{
1085 1085
    type_register_static (&es1370_info);
1086
    pci_register_soundhw("es1370", "ENSONIQ AudioPCI ES1370", es1370_init);
1086 1087
}
1087 1088

  
1088 1089
type_init (es1370_register_types)
b/hw/audio/gus.c
293 293
    return 0;
294 294
}
295 295

  
296
int GUS_init (ISABus *bus)
296
static int GUS_init (ISABus *bus)
297 297
{
298 298
    isa_create_simple (bus, "gus");
299 299
    return 0;
......
327 327
static void gus_register_types (void)
328 328
{
329 329
    type_register_static (&gus_info);
330
    isa_register_soundhw("gus", "Gravis Ultrasound GF1", GUS_init);
330 331
}
331 332

  
332 333
type_init (gus_register_types)
b/hw/audio/intel-hda.c
1300 1300
    .class_init = hda_codec_device_class_init,
1301 1301
};
1302 1302

  
1303
static void intel_hda_register_types(void)
1304
{
1305
    type_register_static(&hda_codec_bus_info);
1306
    type_register_static(&intel_hda_info_ich6);
1307
    type_register_static(&intel_hda_info_ich9);
1308
    type_register_static(&hda_codec_device_type_info);
1309
}
1310

  
1311
type_init(intel_hda_register_types)
1312

  
1313 1303
/*
1314 1304
 * create intel hda controller with codec attached to it,
1315 1305
 * so '-soundhw hda' works.
1316 1306
 */
1317
int intel_hda_and_codec_init(PCIBus *bus)
1307
static int intel_hda_and_codec_init(PCIBus *bus)
1318 1308
{
1319 1309
    PCIDevice *controller;
1320 1310
    BusState *hdabus;
......
1327 1317
    return 0;
1328 1318
}
1329 1319

  
1320
static void intel_hda_register_types(void)
1321
{
1322
    type_register_static(&hda_codec_bus_info);
1323
    type_register_static(&intel_hda_info_ich6);
1324
    type_register_static(&intel_hda_info_ich9);
1325
    type_register_static(&hda_codec_device_type_info);
1326
    pci_register_soundhw("hda", "Intel HD Audio", intel_hda_and_codec_init);
1327
}
1328

  
1329
type_init(intel_hda_register_types)
b/hw/audio/pcspk.c
25 25
#include "hw/hw.h"
26 26
#include "hw/i386/pc.h"
27 27
#include "hw/isa/isa.h"
28
#include "hw/audio/audio.h"
28 29
#include "audio/audio.h"
29 30
#include "qemu/timer.h"
30 31
#include "hw/timer/i8254.h"
......
108 109
    }
109 110
}
110 111

  
111
int pcspk_audio_init(ISABus *bus)
112
static int pcspk_audio_init(ISABus *bus)
112 113
{
113 114
    PCSpkState *s = pcspk_state;
114 115
    struct audsettings as = {PCSPK_SAMPLE_RATE, 1, AUD_FMT_U8, 0};
......
200 201
static void pcspk_register(void)
201 202
{
202 203
    type_register_static(&pcspk_info);
204
    isa_register_soundhw("pcspk", "PC speaker", pcspk_audio_init);
203 205
}
204 206
type_init(pcspk_register)
b/hw/audio/sb16.c
1386 1386
    return 0;
1387 1387
}
1388 1388

  
1389
int SB16_init (ISABus *bus)
1389
static int SB16_init (ISABus *bus)
1390 1390
{
1391 1391
    isa_create_simple (bus, TYPE_SB16);
1392 1392
    return 0;
......
1421 1421
static void sb16_register_types (void)
1422 1422
{
1423 1423
    type_register_static (&sb16_info);
1424
    isa_register_soundhw("sb16", "Creative Sound Blaster 16", SB16_init);
1424 1425
}
1425 1426

  
1426 1427
type_init (sb16_register_types)
b/hw/usb/dev-audio.c
33 33
#include "hw/usb.h"
34 34
#include "hw/usb/desc.h"
35 35
#include "hw/hw.h"
36
#include "hw/audio/audio.h"
37 36
#include "audio/audio.h"
38 37

  
39 38
#define USBAUDIO_VENDOR_NUM     0x46f4 /* CRC16() of "QEMU" */
b/include/hw/audio/audio.h
1 1
#ifndef HW_AUDIODEV_H
2 2
#define HW_AUDIODEV_H 1
3 3

  
4
/* es1370.c */
5
int es1370_init(PCIBus *bus);
4
void isa_register_soundhw(const char *name, const char *descr,
5
                          int (*init_isa)(ISABus *bus));
6 6

  
7
/* sb16.c */
8
int SB16_init(ISABus *bus);
9

  
10
/* adlib.c */
11
int Adlib_init(ISABus *bus);
12

  
13
/* gus.c */
14
int GUS_init(ISABus *bus);
15

  
16
/* ac97.c */
17
int ac97_init(PCIBus *bus);
18

  
19
/* cs4231a.c */
20
int cs4231a_init(ISABus *bus);
21

  
22
/* intel-hda.c + hda-audio.c */
23
int intel_hda_and_codec_init(PCIBus *bus);
7
void pci_register_soundhw(const char *name, const char *descr,
8
                          int (*init_pci)(PCIBus *bus));
24 9

  
25 10
#endif
b/include/hw/audio/pcspk.h
42 42
    return dev;
43 43
}
44 44

  
45
int pcspk_audio_init(ISABus *bus);
46

  
47 45
#endif /* !HW_PCSPK_H */

Also available in: Unified diff