void zx8302_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) { case TIMER_TXD: transmit_serial_data(); break; case TIMER_BAUDX4: m_baudx4 = !m_baudx4; m_out_baudx4_func(m_baudx4); break; case TIMER_RTC: m_ctr++; break; case TIMER_GAP: trigger_interrupt(INT_GAP); break; case TIMER_IPC: m_idr = param; m_ipc_state = IPC_START; m_ipc_rx = 0; transmit_ipc_data(); break; } }
inline void zx8302_device::transmit_serial_data() { switch (m_tx_bits) { case TXD_START: if (!(m_irq & INT_TRANSMIT)) { transmit_bit(0); m_tx_bits++; } break; default: transmit_bit(BIT(m_tdr, 0)); m_tdr >>= 1; m_tx_bits++; break; case TXD_STOP: transmit_bit(1); m_tx_bits++; break; case TXD_STOP2: transmit_bit(1); m_tx_bits = TXD_START; m_status &= ~STATUS_TX_BUFFER_FULL; trigger_interrupt(INT_TRANSMIT); break; } }
void portfolio_state::scan_keyboard() { UINT8 keycode = 0xff; UINT8 keydata[8] = { m_y0->read(), m_y1->read(), m_y2->read(), m_y3->read(), m_y4->read(), m_y5->read(), m_y6->read(), m_y7->read() }; for (int row = 0; row < 8; row++) { UINT8 data = keydata[row]; if (data != 0xff) { for (int col = 0; col < 8; col++) { if (!BIT(data, col)) { keycode = (row * 8) + col; } } } } if (keycode != 0xff) { // key pressed if (keycode != m_keylatch) { m_keylatch = keycode; trigger_interrupt(INT_KEYBOARD); } } else { // key released if (m_keylatch != 0xff) { m_keylatch |= 0x80; trigger_interrupt(INT_KEYBOARD); } } }
void portfolio_state::scan_keyboard() { UINT8 keycode = 0xff; static const char *const keynames[] = { "ROW0", "ROW1", "ROW2", "ROW3", "ROW4", "ROW5", "ROW6", "ROW7" }; for (int row = 0; row < 8; row++) { UINT8 data = input_port_read(machine(), keynames[row]); if (data != 0xff) { for (int col = 0; col < 8; col++) { if (!BIT(data, col)) { keycode = (row * 8) + col; } } } } if (keycode != 0xff) { // key pressed if (keycode != m_keylatch) { m_keylatch = keycode; trigger_interrupt(INT_KEYBOARD); } } else { // key released if (m_keylatch != 0xff) { m_keylatch |= 0x80; trigger_interrupt(INT_KEYBOARD); } } }
void z80dma_device::timerproc() { int done; if (--m_cur_cycle) { return; } if (m_is_read && !is_ready()) return; if (m_is_read) { /* TODO: there's a nasty recursion bug with Alpha for Sharp X1 Turbo on the transfers with this function! */ do_read(); done = 0; m_is_read = false; m_cur_cycle = (PORTA_IS_SOURCE ? PORTA_CYCLE_LEN : PORTB_CYCLE_LEN); } else { done = do_write(); m_is_read = true; m_cur_cycle = (PORTB_IS_SOURCE ? PORTA_CYCLE_LEN : PORTB_CYCLE_LEN); } if (done) { m_dma_enabled = 0; //FIXME: Correct? m_status = 0x09; m_status |= !is_ready() << 1; // ready line status if(TRANSFER_MODE == TM_TRANSFER) m_status |= 0x10; // no match found update_status(); if (LOG) logerror("Z80DMA '%s' End of Block\n", tag()); if (INT_ON_END_OF_BLOCK) { trigger_interrupt(INT_END_OF_BLOCK); } if (AUTO_RESTART) { if (LOG) logerror("Z80DMA '%s' Auto Restart\n", tag()); m_dma_enabled = 1; m_addressA = PORTA_ADDRESS; m_addressB = PORTB_ADDRESS; m_count = BLOCKLEN; m_status |= 0x30; } } }
void portfolio_state::scan_keyboard() { uint8_t keycode = 0xff; for (int row = 0; row < 8; row++) { uint8_t data = static_cast<int>(m_y[row]->read()); if (data != 0xff) { for (int col = 0; col < 8; col++) { if (!BIT(data, col)) { keycode = (row * 8) + col; } } } } if (keycode != 0xff) { // key pressed if (keycode != m_keylatch) { m_keylatch = keycode; trigger_interrupt(INT_KEYBOARD); } } else { // key released if (!(m_keylatch & 0x80)) { m_keylatch |= 0x80; trigger_interrupt(INT_KEYBOARD); } } }
void i8214_device::check_interrupt() { if (m_int_dis || !m_etlg || !m_inte) return; for (int level = 7; level >= 0; level--) { if (!BIT(m_r, 7 - level)) { if (m_sgs) { if (level > m_current_status) { trigger_interrupt(level); } } else { trigger_interrupt(level); } } } }
void z80dma_device::rdy_write_callback(int state) { // normalize state m_rdy = state; m_status = (m_status & 0xFD) | (!is_ready() << 1); update_status(); if (is_ready() && INT_ON_READY) { trigger_interrupt(INT_RDY); } }
/* * The typical workload of the driver: * Handle the network interface interrupts. */ static void de600_interrupt(int reg_ptr) { int irq = -(((struct pt_regs *)reg_ptr)->orig_eax+2); struct device *dev = irq2dev_map[irq]; byte irq_status; int retrig = 0; int boguscount = 0; /* This might just as well be deleted now, no crummy drivers present :-) */ if ((dev == NULL) || (dev->start == 0) || (DE600_IRQ != irq)) { printk("%s: bogus interrupt %d\n", dev?dev->name:"DE-600", irq); return; } dev->interrupt = 1; select_nic(); irq_status = de600_read_status(dev); do { PRINTK(("de600_interrupt (%02X)\n", irq_status)); if (irq_status & RX_GOOD) de600_rx_intr(dev); else if (!(irq_status & RX_BUSY)) de600_put_command(RX_ENABLE); /* Any transmission in progress? */ if (free_tx_pages < TX_PAGES) retrig = de600_tx_intr(dev, irq_status); else retrig = 0; irq_status = de600_read_status(dev); } while ( (irq_status & RX_GOOD) || ((++boguscount < 100) && retrig) ); /* * Yeah, it _looks_ like busy waiting, smells like busy waiting * and I know it's not PC, but please, it will only occur once * in a while and then only for a loop or so (< 1ms for sure!) */ /* Enable adapter interrupts */ dev->interrupt = 0; select_prn(); if (retrig) trigger_interrupt(dev); sti(); return; }
void z80dma_device::do_search() { UINT8 load_byte,match_byte; load_byte = m_latch | MASK_BYTE; match_byte = MATCH_BYTE | MASK_BYTE; //if (LOG) logerror("%02x %02x\n",load_byte,match_byte)); if (load_byte == match_byte) { if (INT_ON_MATCH) { trigger_interrupt(INT_MATCH); } } }
inline void i8214_device::check_interrupt() { int level; if (m_int_dis || !m_etlg) return; for (level = 7; level >= 0; level--) { if (!BIT(m_r, 7 - level)) { if (m_sgs) { if (level > m_b) { trigger_interrupt(level); } } else { trigger_interrupt(level); } } } }
void pit68230_device::tick_clock() { if (m_tcr & REG_TCR_TIMER_ENABLE) { if (m_cntr-- == 0) // Zero detect { LOGINT("Timer reached zero!\n"); if ((m_tcr & REG_TCR_ZD) == 0) m_cntr = m_cpr; else // mask off to 24 bit on rollover m_cntr &= 0xffffff; m_tsr = 1; trigger_interrupt(INT_TIMER); } } }
static irqreturn_t de600_interrupt(int irq, void *dev_id, struct pt_regs * regs) { struct net_device *dev = dev_id; u8 irq_status; int retrig = 0; int boguscount = 0; /* This might just as well be deleted now, no crummy drivers present :-) */ if ((dev == NULL) || (DE600_IRQ != irq)) { printk(KERN_ERR "%s: bogus interrupt %d\n", dev?dev->name:"DE-600", irq); return IRQ_NONE; } spin_lock(&de600_lock); select_nic(); irq_status = de600_read_status(dev); do { PRINTK(("de600_interrupt (%02X)\n", irq_status)); if (irq_status & RX_GOOD) de600_rx_intr(dev); else if (!(irq_status & RX_BUSY)) de600_put_command(RX_ENABLE); /* Any transmission in progress? */ if (free_tx_pages < TX_PAGES) retrig = de600_tx_intr(dev, irq_status); else retrig = 0; irq_status = de600_read_status(dev); } while ( (irq_status & RX_GOOD) || ((++boguscount < 100) && retrig) ); /* * Yeah, it _looks_ like busy waiting, smells like busy waiting * and I know it's not PC, but please, it will only occur once * in a while and then only for a loop or so (< 1ms for sure!) */ /* Enable adapter interrupts */ select_prn(); if (retrig) trigger_interrupt(dev); spin_unlock(&de600_lock); return IRQ_HANDLED; }
void z80dma_device::timerproc() { int done; if (--m_cur_cycle) { return; } if (m_is_read && !is_ready()) return; if (m_is_read) { do_read(); done = 0; m_is_read = false; m_cur_cycle = (PORTA_IS_SOURCE ? PORTA_CYCLE_LEN : PORTB_CYCLE_LEN); } else { done = do_write(); m_is_read = true; m_cur_cycle = (PORTB_IS_SOURCE ? PORTA_CYCLE_LEN : PORTB_CYCLE_LEN); } if (done) { m_dma_enabled = 0; //FIXME: Correct? m_status = 0x19; m_status |= !is_ready() << 1; // ready line status if(TRANSFER_MODE == TM_TRANSFER) m_status |= 0x10; // no match found update_status(); if (LOG) logerror("Z80DMA '%s' End of Block\n", tag()); if (INT_ON_END_OF_BLOCK) { trigger_interrupt(INT_END_OF_BLOCK); } } }
static irqreturn_t de600_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; u8 irq_status; int retrig = 0; int boguscount = 0; spin_lock(&de600_lock); select_nic(); irq_status = de600_read_status(dev); do { PRINTK(("de600_interrupt (%02X)\n", irq_status)); if (irq_status & RX_GOOD) de600_rx_intr(dev); else if (!(irq_status & RX_BUSY)) de600_put_command(RX_ENABLE); /* Any transmission in progress? */ if (free_tx_pages < TX_PAGES) retrig = de600_tx_intr(dev, irq_status); else retrig = 0; irq_status = de600_read_status(dev); } while ( (irq_status & RX_GOOD) || ((++boguscount < 100) && retrig) ); /* * Yeah, it _looks_ like busy waiting, smells like busy waiting * and I know it's not PC, but please, it will only occur once * in a while and then only for a loop or so (< 1ms for sure!) */ /* Enable adapter interrupts */ select_prn(); if (retrig) trigger_interrupt(dev); spin_unlock(&de600_lock); return IRQ_HANDLED; }
static irqreturn_t de600_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; u8 irq_status; int retrig = 0; int boguscount = 0; spin_lock(&de600_lock); select_nic(); irq_status = de600_read_status(dev); do { pr_debug("de600_interrupt (%02X)\n", irq_status); if (irq_status & RX_GOOD) de600_rx_intr(dev); else if (!(irq_status & RX_BUSY)) de600_put_command(RX_ENABLE); /* */ if (free_tx_pages < TX_PAGES) retrig = de600_tx_intr(dev, irq_status); else retrig = 0; irq_status = de600_read_status(dev); } while ( (irq_status & RX_GOOD) || ((++boguscount < 100) && retrig) ); /* */ /* */ select_prn(); if (retrig) trigger_interrupt(dev); spin_unlock(&de600_lock); return IRQ_HANDLED; }
void zx8302_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { switch (id) { case TIMER_BAUDX4: m_baudx4 = !m_baudx4; m_out_baudx4_cb(m_baudx4); break; case TIMER_RTC: m_ctr++; break; case TIMER_GAP: trigger_interrupt(INT_GAP); break; default: break; } }
void zx8302_device::tra_complete() { m_status &= ~STATUS_TX_BUFFER_FULL; trigger_interrupt(INT_TRANSMIT); }
void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { int x = m_screen->hpos(); int y = m_screen->vpos(); switch (id) { case TIMER_HSYNC: m_hs = param; if (LOG) logerror("CRT9007 '%s' y %03u x %04u : HS %u\n", tag(), y, x, m_hs); m_out_hs_func(m_hs); update_cblank_line(); update_hsync_timer(param); break; case TIMER_VSYNC: m_vs = param; if (LOG) logerror("CRT9007 '%s' y %03u x %04u : VS %u\n", tag(), y, x, m_vs); m_out_vs_func(param); if (m_vs) { // reset all other bits except Light Pen Update to logic 0 m_status &= STATUS_LIGHT_PEN_UPDATE; } else { trigger_interrupt(IE_VERTICAL_RETRACE); update_cblank_line(); } update_vsync_timer(param); break; case TIMER_VLT: m_vlt = param; if (LOG) logerror("CRT9007 '%s' y %03u x %04u : VLT %u\n", tag(), y, x, m_vlt); m_out_vlt_func(param); update_vlt_timer(param); break; case TIMER_CURS: if (LOG) logerror("CRT9007 '%s' y %03u x %04u : CURS %u\n", tag(), y, x, param); m_out_curs_func(param); update_curs_timer(param); break; case TIMER_DRB: m_drb = param; if (LOG) logerror("CRT9007 '%s' y %03u x %04u : DRB %u\n", tag(), y, x, m_drb); m_out_drb_func(param); if (!m_drb && !DMA_DISABLE) { // start DMA burst sequence m_dma_count = CHARACTERS_PER_DATA_ROW; m_dma_burst = DMA_BURST_COUNT ? (DMA_BURST_COUNT * 4) : CHARACTERS_PER_DATA_ROW; m_dma_delay = DMA_BURST_DELAY; m_dmar = 1; if (LOG) logerror("CRT9007 '%s' DMAR 1\n", tag()); m_out_dmar_func(ASSERT_LINE); } update_drb_timer(param); break; case TIMER_DMA: readbyte(AUXILIARY_ADDRESS_2); update_dma_timer(); break; } }
int z80dma_device::do_write() { int done = 0; UINT8 mode; mode = TRANSFER_MODE; if (m_count == 0x0000) { //FIXME: Any signal here } switch(mode) { case TM_TRANSFER: if (PORTA_IS_SOURCE) { if (PORTB_MEMORY) devcb_call_write8(&m_out_mreq_func, m_addressB, m_latch); else devcb_call_write8(&m_out_iorq_func, m_addressB, m_latch); if (LOG) logerror("Z80DMA '%s' B dst: %04x %s\n", tag(), m_addressB, PORTB_MEMORY ? "mem" : "i/o"); m_addressB += PORTB_FIXED ? 0 : PORTB_INC ? PORTB_STEP : -PORTB_STEP; } else { if (PORTA_MEMORY) devcb_call_write8(&m_out_mreq_func, m_addressA, m_latch); else devcb_call_write8(&m_out_iorq_func, m_addressA, m_latch); if (LOG) logerror("Z80DMA '%s' A dst: %04x %s\n", tag(), m_addressA, PORTA_MEMORY ? "mem" : "i/o"); m_addressA += PORTA_FIXED ? 0 : PORTA_INC ? PORTA_STEP : -PORTA_STEP; } m_count--; done = (m_count == 0xFFFF); break; case TM_SEARCH: { UINT8 load_byte,match_byte; load_byte = m_latch | MASK_BYTE; match_byte = MATCH_BYTE | MASK_BYTE; //if (LOG) logerror("%02x %02x\n",load_byte,match_byte)); if (load_byte == match_byte) { if (INT_ON_MATCH) { trigger_interrupt(INT_MATCH); } } m_count--; done = (m_count == 0xFFFF); //correct? } break; case TM_SEARCH_TRANSFER: fatalerror("z80dma_do_operation: unhandled search & transfer mode !\n"); break; default: logerror("z80dma_do_operation: invalid mode %d!\n", mode); break; } if (done) { //FIXME: interrupt ? } return done; }