int32 rp64 (int32 dev, int32 pulse, int32 dat) { int32 u, f, c, sb; UNIT *uptr; sb = pulse & 060; if (pulse & 01) { if (sb == 020) /* DPSN */ dat = IOT_SKP | dat; } if (pulse & 02) { if (sb == 000) { /* DPOU */ u = GET_UNIT (rp_sta); uptr = rp_dev.units + u; /* select unit */ dat = dat | uptr->CYL | ((uptr->flags & UNIT_RP03)? CCYL_RP03: 0); } else if (sb == 020) /* DPOA */ dat = dat | rp_da; else if (sb == 040) /* DPOC */ dat = dat | rp_ma; else if (sb == 060) /* DPOW */ dat = dat | rp_wc; } if (pulse & 04) { if (sb == 000) { /* DPCF */ rp_reset (&rp_dev); /* reset dev */ return dat; } if (rp_busy != 0) { /* others: busy? */ rp_updsta (0, STB_PGE); /* prog error */ return dat; } if (sb == 020) /* DPLZ */ rp_sta = rp_sta & (dat | ~STA_RW); else if (sb == 040) /* DPLO */ rp_sta = rp_sta | (dat & STA_RW); else if (sb == 060) /* DPLF */ rp_sta = (rp_sta & ~STA_RW) | (dat & STA_RW); u = GET_UNIT (rp_sta); /* get unit num */ uptr = rp_dev.units + u; /* select unit */ if ((rp_sta & STA_GO) && !sim_is_active (uptr)) { f = uptr->FUNC = GET_FUNC (rp_sta); /* get function */ rp_busy = 1; /* set ctrl busy */ rp_sta = rp_sta & ~STA_HNF; /* clear flag */ rp_stb = rp_stb & ~(STB_FME | STB_WPE | STB_LON | STB_WCE | STB_TME | STB_PGE | STB_EOP | (1 << (STB_V_ATT0 - u))); if (((uptr->flags & UNIT_ATT) == 0) || (f == FN_IDLE) || (f == FN_SEEK) || (f == FN_RECAL)) sim_activate (uptr, RP_MIN); /* short delay */ else { c = GET_CYL (rp_da, uptr->flags); c = abs (c - uptr->CYL) * rp_swait; /* seek time */ sim_activate (uptr, MAX (RP_MIN, c + rp_rwait)); rp_sta = rp_sta & ~STA_DON; /* clear done */ } } } rp_updsta (0, 0); return dat; }
void MainWindow::readSettings() { QVariant v; QSettings s; s.beginGroup("Units"); if (s.value("unit_system").toString() == "metric") { prefs.unit_system = METRIC; prefs.units = SI_units; } else if (s.value("unit_system").toString() == "imperial") { prefs.unit_system = IMPERIAL; prefs.units = IMPERIAL_units; } else { prefs.unit_system = PERSONALIZE; GET_UNIT("length", length, units::FEET, units::METERS); GET_UNIT("pressure", pressure, units::PSI, units::BAR); GET_UNIT("volume", volume, units::CUFT, units::LITER); GET_UNIT("temperature", temperature, units::FAHRENHEIT, units::CELSIUS); GET_UNIT("weight", weight, units::LBS, units::KG); } s.endGroup(); s.beginGroup("DisplayListColumns"); GET_BOOL("CYLINDER", visible_cols.cylinder); GET_BOOL("TEMPERATURE", visible_cols.temperature); GET_BOOL("TOTALWEIGHT", visible_cols.totalweight); GET_BOOL("SUIT", visible_cols.suit); GET_BOOL("NITROX", visible_cols.nitrox); GET_BOOL("OTU", visible_cols.otu); GET_BOOL("MAXCNS", visible_cols.maxcns); GET_BOOL("SAC", visible_cols.sac); s.endGroup(); s.beginGroup("TecDetails"); GET_BOOL("po2graph", pp_graphs.po2); GET_BOOL("pn2graph", pp_graphs.pn2); GET_BOOL("phegraph", pp_graphs.phe); GET_DOUBLE("po2threshold", pp_graphs.po2_threshold); GET_DOUBLE("pn2threshold", pp_graphs.pn2_threshold); GET_DOUBLE("phethreshold", pp_graphs.phe_threshold); GET_BOOL("mod", mod); GET_DOUBLE("modppO2", mod_ppO2); GET_BOOL("ead", ead); GET_BOOL("redceiling", profile_red_ceiling); GET_BOOL("dcceiling", profile_dc_ceiling); GET_BOOL("calcceiling", profile_calc_ceiling); GET_BOOL("calcceiling3m", calc_ceiling_3m_incr); GET_BOOL("calcalltissues", calc_all_tissues); GET_INT("gflow", gflow); GET_INT("gfhigh", gfhigh); set_gf(prefs.gflow, prefs.gfhigh); s.endGroup(); s.beginGroup("Display"); v = s.value(QString("divelist_font")); if (v.isValid()) prefs.divelist_font = strdup(v.toString().toUtf8().data()); }
void rp_updsta (int32 newa, int32 newb) { int32 f; UNIT *uptr; uptr = rp_dev.units + GET_UNIT (rp_sta); rp_sta = (rp_sta & ~(STA_DYN | STA_ERR)) | newa; rp_stb = (rp_stb & ~STB_DYN) | newb; if (uptr->flags & UNIT_WPRT) rp_sta = rp_sta | STA_SUWP; if ((uptr->flags & UNIT_ATT) == 0) rp_stb = rp_stb | STB_SUFU | STB_SUNR; else if (sim_is_active (uptr)) { f = (uptr->FUNC) & STA_M_FUNC; if ((f == FN_SEEK) || (f == FN_RECAL)) rp_stb = rp_stb | STB_SUSU | STB_SUNR; } else if (uptr->CYL >= RP_NUMCY) rp_sta = rp_sta | STA_SUSI; if ((rp_sta & STA_EFLGS) || (rp_stb & STB_EFLGS)) rp_sta = rp_sta | STA_ERR; if (((rp_sta & (STA_ERR | STA_DON)) && (rp_sta & STA_IED)) || ((rp_stb & STB_ATTN) && (rp_sta & STA_IEA))) SET_INT (RP); else CLR_INT (RP); return; }
int32 rp63 (int32 dev, int32 pulse, int32 dat) { int32 sb = pulse & 060; /* subopcode */ rp_updsta (0, 0); if (pulse & 01) { if ((sb == 000) && /* DPSF */ ((rp_sta & (STA_DON | STA_ERR)) || (rp_stb & STB_ATTN))) dat = IOT_SKP | dat; else if ((sb == 020) && (rp_stb & STB_ATTN)) /* DPSA */ dat = IOT_SKP | dat; else if ((sb == 040) && (rp_sta & STA_DON)) /* DPSJ */ dat = IOT_SKP | dat; else if ((sb == 060) && (rp_sta & STA_ERR)) /* DPSE */ dat = IOT_SKP | dat; } if (pulse & 02) { if (sb == 000) /* DPOSA */ dat = dat | rp_sta; else if (sb == 020) /* DPOSB */ dat = dat | rp_stb; } if (pulse & 04) { if (rp_busy) { /* busy? */ rp_updsta (0, STB_PGE); /* prog error */ return dat; } else if (sb == 000) { /* DPLA */ int32 u = GET_UNIT (rp_sta); rp_da = dat & DMASK; if (GET_SECT (rp_da) >= RP_NUMSC) rp_updsta (STA_NXS, 0); if (GET_SURF (rp_da) >= RP_NUMSF) rp_updsta (STA_NXF, 0); if (GET_CYL(rp_da, rp_unit[u].flags) >= RP_QCYL(rp_unit[u].flags)) rp_updsta (STA_NXC, 0); } else if (sb == 020) { /* DPCS */ rp_sta = rp_sta & ~(STA_HNF | STA_DON); /* clr err, done */ rp_stb = rp_stb & ~(STB_FME | STB_WPE | STB_LON | STB_WCE | STB_TME | STB_PGE | STB_EOP); rp_updsta (0, 0); } else if (sb == 040) /* DPCA */ rp_ma = dat & DMASK; else if (sb == 060) /* DPWC */ rp_wc = dat & DMASK; } return dat; }
void MainWindow::readSettings() { QVariant v; QSettings s; s.beginGroup("Units"); if (s.value("unit_system").toString() == "metric") { prefs.unit_system = METRIC; prefs.units = SI_units; } else if (s.value("unit_system").toString() == "imperial") { prefs.unit_system = IMPERIAL; prefs.units = IMPERIAL_units; } else { prefs.unit_system = PERSONALIZE; GET_UNIT("length", length, units::FEET, units::METERS); GET_UNIT("pressure", pressure, units::PSI, units::BAR); GET_UNIT("volume", volume, units::CUFT, units::LITER); GET_UNIT("temperature", temperature, units::FAHRENHEIT, units::CELSIUS); GET_UNIT("weight", weight, units::LBS, units::KG); } GET_UNIT("vertical_speed_time", vertical_speed_time, units::MINUTES, units::SECONDS); s.endGroup(); s.beginGroup("TecDetails"); GET_BOOL("po2graph", pp_graphs.po2); GET_BOOL("pn2graph", pp_graphs.pn2); GET_BOOL("phegraph", pp_graphs.phe); GET_DOUBLE("po2threshold", pp_graphs.po2_threshold); GET_DOUBLE("pn2threshold", pp_graphs.pn2_threshold); GET_DOUBLE("phethreshold", pp_graphs.phe_threshold); GET_BOOL("mod", mod); GET_DOUBLE("modppO2", mod_ppO2); GET_BOOL("ead", ead); GET_BOOL("redceiling", profile_red_ceiling); GET_BOOL("dcceiling", profile_dc_ceiling); GET_BOOL("calcceiling", profile_calc_ceiling); GET_BOOL("calcceiling3m", calc_ceiling_3m_incr); GET_BOOL("calcalltissues", calc_all_tissues); GET_INT("gflow", gflow); GET_INT("gfhigh", gfhigh); set_gf(prefs.gflow, prefs.gfhigh); GET_BOOL("show_time", show_time); GET_BOOL("show_sac", show_sac); s.endGroup(); s.beginGroup("Display"); v = s.value(QString("divelist_font")); if (v.isValid()) prefs.divelist_font = strdup(v.toString().toUtf8().data()); }
/* * Function name: tw_cli_print_req_info * Description: Prints CL internal details of a given request. * * Input: req -- ptr to CL internal request context * Output: None * Return value: None */ TW_VOID tw_cl_print_req_info(struct tw_cl_req_handle *req_handle) { struct tw_cli_req_context *req = req_handle->cl_req_ctxt; struct tw_cli_ctlr_context *ctlr = req->ctlr; struct tw_cl_ctlr_handle *ctlr_handle = ctlr->ctlr_handle; struct tw_cl_command_packet *cmd_pkt = req->cmd_pkt; struct tw_cl_command_9k *cmd9k; union tw_cl_command_7k *cmd7k; TW_UINT8 *cdb; TW_VOID *sgl; TW_UINT32 sgl_entries; TW_UINT32 i; tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "CL details for request:"); tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "req_handle = %p, ctlr = %p,\n" "cmd_pkt = %p, cmd_pkt_phys = 0x%llx,\n" "data = %p, length = 0x%x, data_phys = 0x%llx,\n" "state = 0x%x, flags = 0x%x, error = 0x%x,\n" "orig_req = %p, callback = %p, req_id = 0x%x,\n" "next_req = %p, prev_req = %p", req_handle, ctlr, cmd_pkt, req->cmd_pkt_phys, req->data, req->length, req->data_phys, req->state, req->flags, req->error_code, req->orig_req, req->tw_cli_callback, req->request_id, req->link.next, req->link.prev); if (req->flags & TW_CLI_REQ_FLAGS_9K) { cmd9k = &(cmd_pkt->command.cmd_pkt_9k); sgl = cmd9k->sg_list; sgl_entries = TW_CL_SWAP16( GET_SGL_ENTRIES(cmd9k->lun_h4__sgl_entries)); tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "9K cmd: opcode = 0x%x, unit = 0x%x, req_id = 0x%x,\n" "status = 0x%x, sgl_offset = 0x%x, sgl_entries = 0x%x", GET_OPCODE(cmd9k->res__opcode), cmd9k->unit, TW_CL_SWAP16(GET_REQ_ID(cmd9k->lun_l4__req_id)), cmd9k->status, cmd9k->sgl_offset, sgl_entries); cdb = (TW_UINT8 *)(cmd9k->cdb); tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "CDB: %x %x %x %x %x %x %x %x" "%x %x %x %x %x %x %x %x", cdb[0], cdb[1], cdb[2], cdb[3], cdb[4], cdb[5], cdb[6], cdb[7], cdb[8], cdb[9], cdb[10], cdb[11], cdb[12], cdb[13], cdb[14], cdb[15]); } else { cmd7k = &(cmd_pkt->command.cmd_pkt_7k); sgl = cmd7k->param.sgl; sgl_entries = (cmd7k->generic.size - GET_SGL_OFF(cmd7k->generic.sgl_off__opcode)) / ((ctlr->flags & TW_CL_64BIT_ADDRESSES) ? 3 : 2); tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "7K cmd: opcode = 0x%x, sgl_offset = 0x%x,\n" "size = 0x%x, req_id = 0x%x, unit = 0x%x,\n" "status = 0x%x, flags = 0x%x, count = 0x%x", GET_OPCODE(cmd7k->generic.sgl_off__opcode), GET_SGL_OFF(cmd7k->generic.sgl_off__opcode), cmd7k->generic.size, TW_CL_SWAP16(cmd7k->generic.request_id), GET_UNIT(cmd7k->generic.host_id__unit), cmd7k->generic.status, cmd7k->generic.flags, TW_CL_SWAP16(cmd7k->generic.count)); } tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "SG entries:"); if (ctlr->flags & TW_CL_64BIT_ADDRESSES) { struct tw_cl_sg_desc64 *sgl64 = (struct tw_cl_sg_desc64 *)sgl; for (i = 0; i < sgl_entries; i++) { tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "0x%llx 0x%x", sgl64[i].address, sgl64[i].length); } } else { struct tw_cl_sg_desc32 *sgl32 = (struct tw_cl_sg_desc32 *)sgl; for (i = 0; i < sgl_entries; i++) { tw_cli_dbg_printf(0, ctlr_handle, tw_osl_cur_func(), "0x%x 0x%x", sgl32[i].address, sgl32[i].length); } } }
void PreferencesDialog::loadSettings() { // This code was on the mainwindow, it should belong nowhere, but since we dind't // correctly fixed this code yet ( too much stuff on the code calling preferences ) // force this here. QSettings s; QVariant v; s.beginGroup("Units"); if (s.value("unit_system").toString() == "metric") { prefs.unit_system = METRIC; prefs.units = SI_units; } else if (s.value("unit_system").toString() == "imperial") { prefs.unit_system = IMPERIAL; prefs.units = IMPERIAL_units; } else { prefs.unit_system = PERSONALIZE; GET_UNIT("length", length, units::FEET, units::METERS); GET_UNIT("pressure", pressure, units::PSI, units::BAR); GET_UNIT("volume", volume, units::CUFT, units::LITER); GET_UNIT("temperature", temperature, units::FAHRENHEIT, units::CELSIUS); GET_UNIT("weight", weight, units::LBS, units::KG); } GET_UNIT("vertical_speed_time", vertical_speed_time, units::MINUTES, units::SECONDS); s.endGroup(); s.beginGroup("TecDetails"); GET_BOOL("po2graph", pp_graphs.po2); GET_BOOL("pn2graph", pp_graphs.pn2); GET_BOOL("phegraph", pp_graphs.phe); GET_DOUBLE("po2threshold", pp_graphs.po2_threshold); GET_DOUBLE("pn2threshold", pp_graphs.pn2_threshold); GET_DOUBLE("phethreshold", pp_graphs.phe_threshold); GET_BOOL("mod", mod); GET_DOUBLE("modppO2", mod_ppO2); GET_BOOL("ead", ead); GET_BOOL("redceiling", profile_red_ceiling); GET_BOOL("dcceiling", profile_dc_ceiling); GET_BOOL("calcceiling", profile_calc_ceiling); GET_BOOL("calcceiling3m", calc_ceiling_3m_incr); GET_BOOL("calcndltts", calc_ndl_tts); GET_BOOL("calcalltissues", calc_all_tissues); GET_INT("gflow", gflow); GET_INT("gfhigh", gfhigh); GET_BOOL("gf_low_at_maxdepth", gf_low_at_maxdepth); GET_BOOL("zoomed_plot", zoomed_plot); set_gf(prefs.gflow, prefs.gfhigh, prefs.gf_low_at_maxdepth); GET_BOOL("show_sac", show_sac); GET_BOOL("display_unused_tanks", display_unused_tanks); s.endGroup(); s.beginGroup("GeneralSettings"); GET_TXT("default_filename", default_filename); GET_TXT("default_cylinder", default_cylinder); s.endGroup(); s.beginGroup("Display"); QFont defaultFont = s.value("divelist_font", qApp->font()).value<QFont>(); defaultFont.setPointSizeF(s.value("font_size", qApp->font().pointSizeF()).toFloat()); qApp->setFont(defaultFont); GET_TXT("divelist_font", divelist_font); GET_INT("font_size", font_size); if (prefs.font_size < 0) prefs.font_size = defaultFont.pointSizeF(); GET_INT("displayinvalid", display_invalid_dives); s.endGroup(); }