//------------------------------------------------- // z80daisy_irq_state - get interrupt status //------------------------------------------------- int z80sio_device::z80daisy_irq_state() { int state = 0; int i; LOGINT("%s %s A:%d%d%d%d B:%d%d%d%d ",FUNCNAME, tag(), m_int_state[0], m_int_state[1], m_int_state[2], m_int_state[3], m_int_state[4], m_int_state[5], m_int_state[6], m_int_state[7]); // loop over all interrupt sources for (i = 0; i < 8; i++) { // if we're servicing a request, don't indicate more interrupts if (m_int_state[i] & Z80_DAISY_IEO) { state |= Z80_DAISY_IEO; break; } state |= m_int_state[i]; } LOGINT("Interrupt State %u\n", state); return state; }
void m68705_device::interrupt() { if (m_pending_interrupts & M68705_INT_MASK) { if ((CC & IFLAG) == 0) { pushword(m_pc); pushbyte(m_x); pushbyte(m_a); pushbyte(m_cc); SEI; standard_irq_callback(0); if (BIT(m_pending_interrupts, M68705_IRQ_LINE)) { LOGINT("servicing /INT interrupt\n"); m_pending_interrupts &= ~(1 << M68705_IRQ_LINE); rm16(M68705_VECTOR_INT, m_pc); } else if (BIT(m_pending_interrupts, M68705_INT_TIMER)) { LOGINT("servicing timer/counter interrupt\n"); rm16(M68705_VECTOR_TIMER, m_pc); } else { throw emu_fatalerror("Unknown pending interrupt"); } m_icount -= 11; burn_cycles(11); } } }
void fccpu30_state::update_irq_to_maincpu() { LOGINT(("%s()\n", FUNCNAME)); LOGINT((" - fga_irq_level: %02x\n", fga_irq_level)); LOGINT((" - fga_irq_state: %02x\n", fga_irq_state)); switch (fga_irq_level & 0x07) { case 1: m_maincpu->set_input_line(M68K_IRQ_1, fga_irq_state); break; case 2: m_maincpu->set_input_line(M68K_IRQ_2, fga_irq_state); break; case 3: m_maincpu->set_input_line(M68K_IRQ_3, fga_irq_state); break; case 4: m_maincpu->set_input_line(M68K_IRQ_4, fga_irq_state); break; case 5: m_maincpu->set_input_line(M68K_IRQ_5, fga_irq_state); break; case 6: m_maincpu->set_input_line(M68K_IRQ_6, fga_irq_state); break; case 7: m_maincpu->set_input_line(M68K_IRQ_7, fga_irq_state); break; default: logerror("Programmatic error in %s, please report\n", FUNCNAME); } }
void fga002_device::trigger_interrupt(uint8_t data) { uint8_t icr = 0; LOGINT(("%s(%02x)\n", FUNCNAME, data)); /* The Interrupt Control Register (ICR*) bit, must be set for the correspondning channel */ // TODO: Support programmable assert level for interrupt source switch(data) { case INT_LOCAL0: icr = m_fga002[FGA_ICRLOCAL0]; m_fga002[FGA_ISLOCAL0] = 0x00; break; case INT_LOCAL1: icr = m_fga002[FGA_ICRLOCAL1]; m_fga002[FGA_ISLOCAL1] = 0x00; break; case INT_LOCAL2: icr = m_fga002[FGA_ICRLOCAL2]; m_fga002[FGA_ISLOCAL2] = 0x00; break; case INT_LOCAL3: icr = m_fga002[FGA_ICRLOCAL3]; m_fga002[FGA_ISLOCAL3] = 0x00; break; case INT_LOCAL4: icr = m_fga002[FGA_ICRLOCAL4]; m_fga002[FGA_ISLOCAL4] = 0x00; break; case INT_LOCAL5: icr = m_fga002[FGA_ICRLOCAL5]; m_fga002[FGA_ISLOCAL5] = 0x00; break; case INT_LOCAL6: icr = m_fga002[FGA_ICRLOCAL6]; m_fga002[FGA_ISLOCAL6] = 0x00; break; case INT_LOCAL7: icr = m_fga002[FGA_ICRLOCAL7]; m_fga002[FGA_ISLOCAL7] = 0x00; break; default: LOGINT((" - interrupt source %d - not supported", data)); return; } if ((icr & REG_ICR_ENABLE) == 0 || (icr & REG_ICR_LVL_MSK) == 0) { LOGINT((" - The Interrupt Control Register bit for channel %02x is not set or level is 0, blocking attempt to interrupt\n", data)); return; } m_irq_level = icr & REG_ICR_LVL_MSK; LOGINT((" - Interrupt Level %d, caused by ICR %02x with vector %02x\n", m_irq_level, icr, data )); // trigger intrrupt to CPU through board driver callback. m_out_int_cb(ASSERT_LINE); }
//------------------------------------------------- // z80daisy_irq_ack - interrupt acknowledge //------------------------------------------------- int z80sio_device::z80daisy_irq_ack() { int i; LOGINT("%s %s \n",FUNCNAME, tag()); // loop over all interrupt sources for (i = 0; i < 8; i++) { // find the first channel with an interrupt requested if (m_int_state[i] & Z80_DAISY_INT) { // clear interrupt, switch to the IEO state, and update the IRQs m_int_state[i] = Z80_DAISY_IEO; m_chanA->m_rr0 &= ~z80sio_channel::RR0_INTERRUPT_PENDING; check_interrupts(); //LOG("%s %s \n",FUNCNAME, tag(), m_chanB->m_rr2); return m_chanB->m_rr2; } } //logerror("z80sio_irq_ack: failed to find an interrupt to ack!\n"); return m_chanB->m_rr2; }
int ly_write_skipped(struct lyout *out, size_t position, const char *buf, size_t count) { switch (out->type) { case LYOUT_MEMORY: /* write */ memcpy(&out->method.mem.buf[position], buf, count); break; case LYOUT_FD: case LYOUT_STREAM: case LYOUT_CALLBACK: if (out->buf_len < position + count) { LOGINT(NULL); return -1; } /* write into the hole */ memcpy(&out->buffered[position], buf, count); /* decrease hole counter */ --out->hole_count; if (!out->hole_count) { /* all holes filled, we can write the buffer */ count = ly_write(out, out->buffered, out->buf_len); out->buf_len = 0; } break; } return count; }
static void lyb_read_stop_subtree(struct lyb_state *lybs) { if (lybs->written[lybs->used - 1]) { LOGINT(NULL); } --lybs->used; }
//------------------------------------------------- // reset_interrupts - //------------------------------------------------- void z80sio_device::reset_interrupts() { LOGINT("%s %s \n",FUNCNAME, tag()); // reset internal interrupt sources for (auto & elem : m_int_state) { elem = 0; } check_interrupts(); }
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); } } }
/* * trigger_interrupt - called when a potential interrupt condition occurs * but will only generate an interrupt when the PIT is programmed to do so. */ void pit68230_device::trigger_interrupt(int source) { LOGINT("%s %s Source: %02x\n",tag(), FUNCNAME, source); if (source == INT_TIMER) { // TODO: implement priorities and support nested interrupts if ( (m_tcr & REG_TCR_TOUT_TIACK_MASK) == REG_TCR_TOUT_TIACK_INT || (m_tcr & REG_TCR_TOUT_TIACK_MASK) == REG_TCR_TOUT_PC7_INT ) { m_tirq_out_cb(ASSERT_LINE); } } else { // TODO: implement priorities and support nested interrupts for the H1-H4 sources m_pirq_out_cb(ASSERT_LINE); } }
//------------------------------------------------- // z80daisy_irq_reti - return from interrupt //------------------------------------------------- void z80sio_device::z80daisy_irq_reti() { int i; LOGINT("%s %s \n",FUNCNAME, tag()); // loop over all interrupt sources for (i = 0; i < 8; i++) { // find the first channel with an IEO pending if (m_int_state[i] & Z80_DAISY_IEO) { // clear the IEO state and update the IRQs m_int_state[i] &= ~Z80_DAISY_IEO; check_interrupts(); return; } } //logerror("z80sio_irq_reti: failed to find an interrupt to clear IEO on!\n"); }
//------------------------------------------------- // trigger_interrupt - TODO: needs attention for SIO //------------------------------------------------- void z80sio_device::trigger_interrupt(int index, int state) { uint8_t vector = m_chanB->m_wr2; int priority; LOGINT("%s %s \n",FUNCNAME, tag()); #if 0 if((m_variant == TYPE_I8274) || (m_variant == TYPE_UPD7201)) { int prio_level = 0; switch(state) { case z80sio_channel::INT_TRANSMIT: prio_level = 1; break; case z80sio_channel::INT_RECEIVE: case z80sio_channel::INT_SPECIAL: prio_level = 0; break; case z80sio_channel::INT_EXTERNAL: prio_level = 2; break; } if(m_chanA->m_wr2 & z80sio_channel::WR2_PRIORITY) { priority = (prio_level * 2) + index; } else { priority = (prio_level == 2) ? index + 4 : ((index * 2) + prio_level); } if (m_chanB->m_wr1 & z80sio_channel::WR1_STATUS_VECTOR) { vector = (!index << 2) | state; if((m_chanA->m_wr1 & 0x18) == z80sio_channel::WR2_MODE_8086_8088) { vector = (m_chanB->m_wr2 & 0xf8) | vector; } else { vector = (m_chanB->m_wr2 & 0xe3) | (vector << 2); } } } else { #endif priority = (index << 2) | state; if (m_chanB->m_wr1 & z80sio_channel::WR1_STATUS_VECTOR) { // status affects vector vector = (m_chanB->m_wr2 & 0xf1) | (!index << 3) | (state << 1); } // } // update vector register m_chanB->m_rr2 = vector; // trigger interrupt m_int_state[priority] |= Z80_DAISY_INT; m_chanA->m_rr0 |= z80sio_channel::RR0_INTERRUPT_PENDING; // check for interrupt check_interrupts(); } //------------------------------------------------- // m1_r - interrupt acknowledge //------------------------------------------------- int z80sio_device::m1_r() { LOGINT("%s %s \n",FUNCNAME, tag()); return z80daisy_irq_ack(); }
//------------------------------------------------- // check_interrupts - //------------------------------------------------- void z80sio_device::check_interrupts() { LOGINT("%s %s \n",FUNCNAME, tag()); int state = (z80daisy_irq_state() & Z80_DAISY_INT) ? ASSERT_LINE : CLEAR_LINE; m_out_int_cb(state); }
int lys_print_target(struct lyout *out, const struct lys_module *module, const char *target_schema_path, void (*clb_print_typedef)(struct lyout*, const struct lys_tpdf*, int*), void (*clb_print_identity)(struct lyout*, const struct lys_ident*, int*), void (*clb_print_feature)(struct lyout*, const struct lys_feature*, int*), void (*clb_print_type)(struct lyout*, const struct lys_type*, int*), void (*clb_print_grouping)(struct lyout*, const struct lys_node*, int*), void (*clb_print_container)(struct lyout*, const struct lys_node*, int*), void (*clb_print_choice)(struct lyout*, const struct lys_node*, int*), void (*clb_print_leaf)(struct lyout*, const struct lys_node*, int*), void (*clb_print_leaflist)(struct lyout*, const struct lys_node*, int*), void (*clb_print_list)(struct lyout*, const struct lys_node*, int*), void (*clb_print_anydata)(struct lyout*, const struct lys_node*, int*), void (*clb_print_case)(struct lyout*, const struct lys_node*, int*), void (*clb_print_notif)(struct lyout*, const struct lys_node*, int*), void (*clb_print_rpc)(struct lyout*, const struct lys_node*, int*), void (*clb_print_action)(struct lyout*, const struct lys_node*, int*), void (*clb_print_input)(struct lyout*, const struct lys_node*, int*), void (*clb_print_output)(struct lyout*, const struct lys_node*, int*)) { int rc, i, f = 1; char *spec_target = NULL; struct lys_node *target = NULL; struct lys_tpdf *tpdf = NULL; uint8_t tpdf_size = 0; if ((target_schema_path[0] == '/') || !strncmp(target_schema_path, "type/", 5)) { rc = resolve_absolute_schema_nodeid((target_schema_path[0] == '/' ? target_schema_path : target_schema_path + 4), module, LYS_ANY & ~(LYS_USES | LYS_AUGMENT | LYS_GROUPING), (const struct lys_node **)&target); if (rc || !target) { LOGERR(module->ctx, LY_EINVAL, "Target %s could not be resolved.", (target_schema_path[0] == '/' ? target_schema_path : target_schema_path + 4)); return EXIT_FAILURE; } } else if (!strncmp(target_schema_path, "grouping/", 9)) { /* cut the data part off */ if ((spec_target = strchr(target_schema_path + 9, '/'))) { /* HACK only temporary */ spec_target[0] = '\0'; ++spec_target; } rc = resolve_absolute_schema_nodeid(target_schema_path + 8, module, LYS_GROUPING, (const struct lys_node **)&target); if (rc || !target) { ly_print(out, "Grouping %s not found.\n", target_schema_path + 8); return EXIT_FAILURE; } } else if (!strncmp(target_schema_path, "typedef/", 8)) { if ((spec_target = strrchr(target_schema_path + 8, '/'))) { /* schema node typedef */ /* HACK only temporary */ spec_target[0] = '\0'; ++spec_target; rc = resolve_absolute_schema_nodeid(target_schema_path + 7, module, LYS_CONTAINER | LYS_LIST | LYS_NOTIF | LYS_RPC | LYS_ACTION, (const struct lys_node **)&target); if (rc || !target) { /* perhaps it's in a grouping */ rc = resolve_absolute_schema_nodeid(target_schema_path + 7, module, LYS_GROUPING, (const struct lys_node **)&target); } if (!rc && target) { switch (target->nodetype) { case LYS_CONTAINER: tpdf = ((struct lys_node_container *)target)->tpdf; tpdf_size = ((struct lys_node_container *)target)->tpdf_size; break; case LYS_LIST: tpdf = ((struct lys_node_list *)target)->tpdf; tpdf_size = ((struct lys_node_list *)target)->tpdf_size; break; case LYS_NOTIF: tpdf = ((struct lys_node_notif *)target)->tpdf; tpdf_size = ((struct lys_node_notif *)target)->tpdf_size; break; case LYS_RPC: case LYS_ACTION: tpdf = ((struct lys_node_rpc_action *)target)->tpdf; tpdf_size = ((struct lys_node_rpc_action *)target)->tpdf_size; break; case LYS_GROUPING: tpdf = ((struct lys_node_grp *)target)->tpdf; tpdf_size = ((struct lys_node_grp *)target)->tpdf_size; break; default: LOGINT(module->ctx); return EXIT_FAILURE; } } } else { /* module typedef */ spec_target = (char *)target_schema_path + 8; tpdf = module->tpdf; tpdf_size = module->tpdf_size; } for (i = 0; i < tpdf_size; ++i) { if (!strcmp(tpdf[i].name, spec_target)) { clb_print_typedef(out, &tpdf[i], &f); break; } } /* HACK return previous hack */ --spec_target; spec_target[0] = '/'; if (i == tpdf_size) { ly_print(out, "Typedef %s not found.\n", target_schema_path); return EXIT_FAILURE; } return EXIT_SUCCESS; } else if (!strncmp(target_schema_path, "identity/", 9)) { target_schema_path += 9; for (i = 0; i < (signed)module->ident_size; ++i) { if (!strcmp(module->ident[i].name, target_schema_path)) { break; } } if (i == (signed)module->ident_size) { ly_print(out, "Identity %s not found.\n", target_schema_path); return EXIT_FAILURE; } clb_print_identity(out, &module->ident[i], &f); return EXIT_SUCCESS; } else if (!strncmp(target_schema_path, "feature/", 8)) { target_schema_path += 8; for (i = 0; i < module->features_size; ++i) { if (!strcmp(module->features[i].name, target_schema_path)) { break; } } if (i == module->features_size) { ly_print(out, "Feature %s not found.\n", target_schema_path); return EXIT_FAILURE; } clb_print_feature(out, &module->features[i], &f); return EXIT_SUCCESS; } else { ly_print(out, "Target could not be resolved.\n"); return EXIT_FAILURE; } if (!strncmp(target_schema_path, "type/", 5)) { if (!(target->nodetype & (LYS_LEAF | LYS_LEAFLIST))) { LOGERR(module->ctx, LY_EINVAL, "Target is not a leaf or a leaf-list."); return EXIT_FAILURE; } clb_print_type(out, &((struct lys_node_leaf *)target)->type, &f); return EXIT_SUCCESS; } else if (!strncmp(target_schema_path, "grouping/", 9) && !spec_target) { clb_print_grouping(out, target, &f); return EXIT_SUCCESS; } /* find the node in the grouping */ if (spec_target) { rc = resolve_descendant_schema_nodeid(spec_target, target->child, LYS_NO_RPC_NOTIF_NODE, 0, (const struct lys_node **)&target); if (rc || !target) { ly_print(out, "Grouping %s child \"%s\" not found.\n", target_schema_path + 9, spec_target); return EXIT_FAILURE; } /* HACK return previous hack */ --spec_target; spec_target[0] = '/'; } switch (target->nodetype) { case LYS_CONTAINER: clb_print_container(out, target, &f); break; case LYS_CHOICE: clb_print_choice(out, target, &f); break; case LYS_LEAF: clb_print_leaf(out, target, &f); break; case LYS_LEAFLIST: clb_print_leaflist(out, target, &f); break; case LYS_LIST: clb_print_list(out, target, &f); break; case LYS_ANYXML: case LYS_ANYDATA: clb_print_anydata(out, target, &f); break; case LYS_CASE: clb_print_case(out, target, &f); break; case LYS_NOTIF: clb_print_notif(out, target, &f); break; case LYS_RPC: clb_print_rpc(out, target, &f); break; case LYS_ACTION: clb_print_action(out, target, &f); break; case LYS_INPUT: clb_print_input(out, target, &f); break; case LYS_OUTPUT: clb_print_output(out, target, &f); break; default: ly_print(out, "Nodetype %s not supported.\n", strnodetype(target->nodetype)); break; } return EXIT_SUCCESS; }
/* * TIACK* provides the Timer vector in an iack cycle */ uint8_t pit68230_device::irq_tiack() { LOGINT("%s %s <- %02x\n",tag(), FUNCNAME, m_tivr); return m_tivr; }