]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Configurable PCI device IRQ callback.
authorToni Wilen <twilen@winuae.net>
Sat, 11 Jun 2016 16:19:04 +0000 (19:19 +0300)
committerToni Wilen <twilen@winuae.net>
Sat, 11 Jun 2016 16:19:04 +0000 (19:19 +0300)
include/pci_hw.h
pci.cpp
qemuvga/es1370.cpp
qemuvga/ne2000.cpp
qemuvga/ne2000.h
sndboard.cpp

index 508db12553ef7a01db23b9c761f8831583ba2745..0608919c81165dd6bf5e2fd437376630d46967d3 100644 (file)
@@ -47,7 +47,6 @@ struct pci_board
        pci_dev_free free;
        pci_dev_reset reset;
        pci_dev_hsync hsync;
-       pci_dev_irq irq;
        pci_addrbank bars[MAX_PCI_BARS];
 };
 
@@ -67,6 +66,7 @@ struct pci_board_state
        bool memory_map_active;
        bool io_map_active;
        struct pci_bridge *bridge;
+       pci_dev_irq irq_callback;
 };
 
 struct pci_bridge
diff --git a/pci.cpp b/pci.cpp
index 38e14694929cc2f1c8fec687587ef1e9729fb1ff..ae6d698fd38a32e5722d8ccae97a0bb8a30ceac6 100644 (file)
--- a/pci.cpp
+++ b/pci.cpp
@@ -113,6 +113,7 @@ static void pci_board_add(struct pci_bridge *pcib, const struct pci_board *pci,
        pcibs->slot = slot;
        pcibs->func = func;
        pcibs->bridge = pcib;
+       pcibs->irq_callback = pci_irq_callback;
        memset(pcibs->config_data, 0, sizeof pcibs->config_data);
        for (int i = 0; i < MAX_PCI_BARS; i++) {
                pcibs->bar_size[i] = pci->config->bars[i];
@@ -1452,7 +1453,7 @@ static const struct pci_config ncr_53c815_pci_config =
 static const struct pci_board ncr_53c815_pci_board =
 {
        _T("NCR53C815"),
-       &ncr_53c815_pci_config, NULL, NULL, NULL, NULL, pci_irq_callback,
+       &ncr_53c815_pci_config, NULL, NULL, NULL, NULL,
        {
                { wildfire_lget, wildfire_wget, wildfire_bget, wildfire_lput, wildfire_wput, wildfire_bput },
                { wildfire_lget, wildfire_wget, wildfire_bget, wildfire_lput, wildfire_wput, wildfire_bput },
index 46e6fab0e4565e4cc2faf4e2e82f75107fade8b2..33e5d26add2bb24439a4ffd73f2d2e9cc7be03d2 100644 (file)
@@ -317,6 +317,7 @@ typedef struct ES1370State {
     uint32_t mempage;
     uint32_t codec;
     uint32_t sctl;
+       pci_dev_irq irq_callback;
 } ES1370State;
 
 struct chan_bits {
@@ -362,7 +363,7 @@ static void es1370_update_status (ES1370State *s, uint32_t new_status)
     } else {
         s->status = new_status & ~STAT_INTR;
     }
-       es1370state.device->irq(es1370state.dev, !!level);
+       es1370state.irq_callback(es1370state.dev, !!level);
 //    pci_set_irq(&s->dev, !!level);
 }
 
@@ -388,7 +389,7 @@ static void es1370_reset (ES1370State *s)
             s->dac_voice[i] = NULL;
         }
        }
-       es1370state.device->irq(es1370state.dev, false);
+       es1370state.irq_callback(es1370state.dev, false);
 //    pci_irq_deassert(&s->dev);
 }
 
@@ -1185,6 +1186,7 @@ static bool es1370_init(struct pci_board_state *pcibs)
 {
        init(pcibs);
        es1370_reset(&es1370state);
+       es1370state.irq_callback = pcibs->irq_callback;
        return true;
 }
 
@@ -1197,7 +1199,7 @@ static const struct pci_config es1370_pci_config =
 const struct pci_board es1370_pci_board =
 {
        _T("ES1370"),
-       &es1370_pci_config, es1370_init, es1370_free, es1370_reset, NULL, pci_irq_callback,
+       &es1370_pci_config, es1370_init, es1370_free, es1370_reset, NULL,
        {
                { es1370_lget, es1370_wget, es1370_bget, es1370_lput, es1370_wput, es1370_bput },
                { NULL },
index 891d2fac247c3dab060f61bd884596eb65741ba9..111cca4f1e5a2c6e84bffde40acf1f3f3b7f0bf2 100644 (file)
@@ -231,7 +231,7 @@ static void ne2000_update_irq(NE2000State *s)
     write_log("NE2000: Set IRQ to %d (%02x %02x)\n",
           isr ? 1 : 0, s->isr, s->imr);
 #endif
-       ncs.device->irq(ncs.pcistate, isr != 0);
+       s->irq_callback(ncs.pcistate, isr != 0);
 //    qemu_set_irq(s->irq, (isr != 0));
 }
 
@@ -1046,6 +1046,7 @@ static bool ne2000_init(struct pci_board_state *pcibs)
        ncs.pcistate = pcibs;
        ncs.ne2000state = &ne2000state;
        memset(&ne2000state, 0, sizeof ne2000state);
+       ncs.ne2000state->irq_callback = pcibs->irq_callback;
 
        uae_sem_init(&ne2000_sem, 0, 1);
        if (!receive_buffer) {
@@ -1054,8 +1055,9 @@ static bool ne2000_init(struct pci_board_state *pcibs)
 
        td = NULL;
        uae_u8 *m = ncs.ne2000state->c.macaddr.a;
+       const TCHAR *name = currprefs.ne2000pciname[0] ? currprefs.ne2000pciname : currprefs.ne2000pcmcianame; // hack!
        memset(m, 0, 6);
-       if (ethernet_enumerate(&td, currprefs.ne2000pciname)) {
+       if (ethernet_enumerate(&td, name)) {
                memcpy(m, td->mac, 6);
                if (!m[0] && !m[1] && !m[2]) {
                        m[0] = 0x52;
@@ -1097,7 +1099,7 @@ static const struct pci_config ne2000_pci_config =
 const struct pci_board ne2000_pci_board =
 {
        _T("RTL8029"),
-       &ne2000_pci_config, ne2000_init, ne2000_free, ne2000_reset, ne2000_hsync_handler, pci_irq_callback,
+       &ne2000_pci_config, ne2000_init, ne2000_free, ne2000_reset, ne2000_hsync_handler,
        {
                { ne2000_lget, ne2000_wget, ne2000_bget, ne2000_lput, ne2000_wput, ne2000_bput },
                { NULL },
index fd4fffd0c3a2157a265282c5e6346b346b06afab..b9a8a2ade37a76edf665a025fb47352a5d81bea0 100644 (file)
@@ -29,6 +29,7 @@ typedef struct NE2000State {
     //NICState *nic;
     NICConf c;
     uint8_t mem[NE2000_MEM_SIZE];
+       pci_dev_irq irq_callback;
 } NE2000State;
 
 #if 0
index 7351e52c9c7ef19743b896dc886a04bb6b83362b..7d4b6df25d767636eeff4bbd6afaddaf1fd4443e 100644 (file)
@@ -361,7 +361,7 @@ void sndboard_hsync(void)
                                capture_read_index = 0;
                }
                
-               write_log(_T("%d %d %d %d\n"), capture_read_index, capture_write_index, size, bytes);
+               //write_log(_T("%d %d %d %d\n"), capture_read_index, capture_write_index, size, bytes);
 
                if (data->data_in_record_fifo > FIFO_SIZE_HALF && oldfifo <= FIFO_SIZE_HALF) {
                        data->fifo_half |= STATUS_FIFO_RECORD;
@@ -704,9 +704,9 @@ static void fm801_swap_buffers(struct fm801_data *data)
 static void fm801_interrupt(struct fm801_data *data)
 {
        if ((data->interrupt_status & 0x100) && !(data->interrupt_control & 1)) {
-               data->pcibs->board->irq(data->pcibs, true);
+               data->pcibs->irq_callback(data->pcibs, true);
        } else {
-               data->pcibs->board->irq(data->pcibs, false);
+               data->pcibs->irq_callback(data->pcibs, false);
        }
 }
 
@@ -934,7 +934,7 @@ static const struct pci_config fm801_pci_config_func1 =
 const struct pci_board fm801_pci_board =
 {
        _T("FM801"),
-       &fm801_pci_config, fm801_init, fm801_free, fm801_reset, fm801_hsync_handler, pci_irq_callback,
+       &fm801_pci_config, fm801_init, fm801_free, fm801_reset, fm801_hsync_handler,
        {
                { fm801_lget, fm801_wget, fm801_bget, fm801_lput, fm801_wput, fm801_bput },
                { NULL },
@@ -949,7 +949,7 @@ const struct pci_board fm801_pci_board =
 const struct pci_board fm801_pci_board_func1 =
 {
        _T("FM801-2"),
-       &fm801_pci_config_func1, NULL, NULL, NULL, NULL, NULL,
+       &fm801_pci_config_func1, NULL, NULL, NULL, NULL,
        {
                { fm801_lget, fm801_wget, fm801_bget, fm801_lput, fm801_wput, fm801_bput },
                { NULL },
@@ -1042,7 +1042,7 @@ static const struct pci_config solo1_pci_config =
 const struct pci_board solo1_pci_board =
 {
        _T("SOLO1"),
-       &solo1_pci_config, solo1_init, solo1_free, solo1_reset, NULL, pci_irq_callback,
+       &solo1_pci_config, solo1_init, solo1_free, solo1_reset, NULL,
        {
                { solo1_lget, solo1_wget, solo1_bget, solo1_lput, solo1_wput, solo1_bput },
                { solo1_lget, solo1_wget, solo1_bget, solo1_lput, solo1_wput, solo1_bput },