sb16.c (36cd6f6f20724d49aac1910e310f81a43e0cb657) sb16.c (db895a1e6a97e919f9b86d60c969377357b05066)
1/*
2 * QEMU Soundblaster 16 emulation
3 *
4 * Copyright (c) 2003-2005 Vassili Karpov (malc)
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 1342 unchanged lines hidden (view full) ---

1351 { 6, 1, 1, .read = dsp_read, .write = dsp_write },
1352 { 10, 1, 1, .read = dsp_read },
1353 { 12, 1, 1, .write = dsp_write },
1354 { 12, 4, 1, .read = dsp_read },
1355 PORTIO_END_OF_LIST (),
1356};
1357
1358
1/*
2 * QEMU Soundblaster 16 emulation
3 *
4 * Copyright (c) 2003-2005 Vassili Karpov (malc)
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights

--- 1342 unchanged lines hidden (view full) ---

1351 { 6, 1, 1, .read = dsp_read, .write = dsp_write },
1352 { 10, 1, 1, .read = dsp_read },
1353 { 12, 1, 1, .write = dsp_write },
1354 { 12, 4, 1, .read = dsp_read },
1355 PORTIO_END_OF_LIST (),
1356};
1357
1358
1359static int sb16_initfn (ISADevice *dev)
1359static void sb16_initfn (Object *obj)
1360{
1360{
1361 SB16State *s = SB16 (dev);
1361 SB16State *s = SB16 (obj);
1362
1363 s->cmd = -1;
1362
1363 s->cmd = -1;
1364 isa_init_irq (dev, &s->pic, s->irq);
1364}
1365
1365
1366static void sb16_realizefn (DeviceState *dev, Error **errp)
1367{
1368 ISADevice *isadev = ISA_DEVICE (dev);
1369 SB16State *s = SB16 (dev);
1370
1371 isa_init_irq (isadev, &s->pic, s->irq);
1372
1366 s->mixer_regs[0x80] = magic_of_irq (s->irq);
1367 s->mixer_regs[0x81] = (1 << s->dma) | (1 << s->hdma);
1368 s->mixer_regs[0x82] = 2 << 5;
1369
1370 s->csp_regs[5] = 1;
1371 s->csp_regs[9] = 0xf8;
1372
1373 reset_mixer (s);
1374 s->aux_ts = qemu_new_timer_ns (vm_clock, aux_timer, s);
1375 if (!s->aux_ts) {
1376 dolog ("warning: Could not create auxiliary timer\n");
1377 }
1378
1373 s->mixer_regs[0x80] = magic_of_irq (s->irq);
1374 s->mixer_regs[0x81] = (1 << s->dma) | (1 << s->hdma);
1375 s->mixer_regs[0x82] = 2 << 5;
1376
1377 s->csp_regs[5] = 1;
1378 s->csp_regs[9] = 0xf8;
1379
1380 reset_mixer (s);
1381 s->aux_ts = qemu_new_timer_ns (vm_clock, aux_timer, s);
1382 if (!s->aux_ts) {
1383 dolog ("warning: Could not create auxiliary timer\n");
1384 }
1385
1379 isa_register_portio_list (dev, s->port, sb16_ioport_list, s, "sb16");
1386 isa_register_portio_list (isadev, s->port, sb16_ioport_list, s, "sb16");
1380
1381 DMA_register_channel (s->hdma, SB_read_DMA, s);
1382 DMA_register_channel (s->dma, SB_read_DMA, s);
1383 s->can_write = 1;
1384
1385 AUD_register_card ("sb16", &s->card);
1387
1388 DMA_register_channel (s->hdma, SB_read_DMA, s);
1389 DMA_register_channel (s->dma, SB_read_DMA, s);
1390 s->can_write = 1;
1391
1392 AUD_register_card ("sb16", &s->card);
1386 return 0;
1387}
1388
1389static int SB16_init (ISABus *bus)
1390{
1391 isa_create_simple (bus, TYPE_SB16);
1392 return 0;
1393}
1394

--- 4 unchanged lines hidden (view full) ---

1399 DEFINE_PROP_UINT32 ("dma", SB16State, dma, 1),
1400 DEFINE_PROP_UINT32 ("dma16", SB16State, hdma, 5),
1401 DEFINE_PROP_END_OF_LIST (),
1402};
1403
1404static void sb16_class_initfn (ObjectClass *klass, void *data)
1405{
1406 DeviceClass *dc = DEVICE_CLASS (klass);
1393}
1394
1395static int SB16_init (ISABus *bus)
1396{
1397 isa_create_simple (bus, TYPE_SB16);
1398 return 0;
1399}
1400

--- 4 unchanged lines hidden (view full) ---

1405 DEFINE_PROP_UINT32 ("dma", SB16State, dma, 1),
1406 DEFINE_PROP_UINT32 ("dma16", SB16State, hdma, 5),
1407 DEFINE_PROP_END_OF_LIST (),
1408};
1409
1410static void sb16_class_initfn (ObjectClass *klass, void *data)
1411{
1412 DeviceClass *dc = DEVICE_CLASS (klass);
1407 ISADeviceClass *ic = ISA_DEVICE_CLASS (klass);
1408 ic->init = sb16_initfn;
1413
1414 dc->realize = sb16_realizefn;
1409 dc->desc = "Creative Sound Blaster 16";
1410 dc->vmsd = &vmstate_sb16;
1411 dc->props = sb16_properties;
1412}
1413
1414static const TypeInfo sb16_info = {
1415 .name = TYPE_SB16,
1416 .parent = TYPE_ISA_DEVICE,
1417 .instance_size = sizeof (SB16State),
1415 dc->desc = "Creative Sound Blaster 16";
1416 dc->vmsd = &vmstate_sb16;
1417 dc->props = sb16_properties;
1418}
1419
1420static const TypeInfo sb16_info = {
1421 .name = TYPE_SB16,
1422 .parent = TYPE_ISA_DEVICE,
1423 .instance_size = sizeof (SB16State),
1424 .instance_init = sb16_initfn,
1418 .class_init = sb16_class_initfn,
1419};
1420
1421static void sb16_register_types (void)
1422{
1423 type_register_static (&sb16_info);
1424 isa_register_soundhw("sb16", "Creative Sound Blaster 16", SB16_init);
1425}
1426
1427type_init (sb16_register_types)
1425 .class_init = sb16_class_initfn,
1426};
1427
1428static void sb16_register_types (void)
1429{
1430 type_register_static (&sb16_info);
1431 isa_register_soundhw("sb16", "Creative Sound Blaster 16", SB16_init);
1432}
1433
1434type_init (sb16_register_types)