static bool_t timer_handler(void *arg) { milandr_mil1553_t *mil = arg; if (mil->urgent_desc.raw != 0) { //debug_printf("urgent_desc "); //int i; //int wc = (mil->urgent_desc.words_count==0?32:mil->urgent_desc.words_count); //for(i=0;i<wc;i++) { // debug_printf("%04x ", mil->urgent_data[i]); //} //debug_printf("\n"); mil->urgent_desc.reserve = 1; // Признак того, что идёт передача вне очереди start_slot(mil, mil->urgent_desc, mil->urgent_data); } else if (mil->cur_slot == mil->cyclogram) { if (mil->cur_slot != 0) { start_slot(mil, mil->cur_slot->desc, mil->cur_slot->data); } } mil->tim_reg->TIM_STATUS = ARM_TIM_CNT_ZERO_EVENT; arch_intr_allow(mil->tim_irq); return 1; }
static int mil_start(mil1553if_t *_mil) { milandr_mil1553_t *mil = (milandr_mil1553_t *)_mil; if (_mil->is_started(_mil)) return MIL_ERR_OK; unsigned control = MIL_STD_CONTROL_DIV((KHZ/MIL_STD_CLOCK_DIV)/1000);// на блок подается MAIN_CLK/MIL_STD_CLOCK_DIV if ((mil->mode == MIL_MODE_BC_MAIN) || (mil->mode == MIL_MODE_BC_RSRV)) { control |= MIL_STD_CONTROL_MODE(MIL_STD_MODE_BC); if (mil->mode == MIL_MODE_BC_MAIN) control |= MIL_STD_CONTROL_TRA; else control |= MIL_STD_CONTROL_TRB; if (mil->tim_reg) { if (mil->period_ms==0) { mil->tim_reg->TIM_ARR = 0; } else { mil->tim_reg->TIM_ARR = mil->period_ms * KHZ-1; } mil->tim_reg->TIM_IE = ARM_TIM_CNT_ARR_EVENT_IE; mil->tim_reg->TIM_CNTRL = ARM_TIM_CNT_EN; } mil->reg->INTEN = MIL_STD_INTEN_VALMESSIE | MIL_STD_INTEN_ERRIE; mil->reg->CONTROL = control; mil->cur_slot = mil->cyclogram; if (mil->urgent_desc.raw != 0) { mil->urgent_desc.reserve = 1; // Признак того, что идёт передача вне очереди start_slot(mil, mil->urgent_desc, mil->urgent_data); } else { if (mil->cur_slot != 0) { start_slot(mil, mil->cur_slot->desc, mil->cur_slot->data); } } } else if (mil->mode == MIL_MODE_RT) { control |= MIL_STD_CONTROL_MODE(MIL_STD_MODE_RT); control |= MIL_STD_CONTROL_ADDR(mil->addr_self) | MIL_STD_CONTROL_TRA | MIL_STD_CONTROL_TRB; //control |= 1<<21; // выключаем автоподстройку //control |= 1UL<<20; // включаем фильтрацию mil->reg->StatusWord1 = MIL_STD_STATUS_ADDR_OU(mil->addr_self); mil->reg->INTEN = MIL_STD_INTEN_RFLAGNIE | MIL_STD_INTEN_VALMESSIE | MIL_STD_INTEN_ERRIE; mil->reg->CONTROL = control; } else { return MIL_ERR_NOT_SUPP; } mil->is_running = 1; return MIL_ERR_OK; }
static void radio_state_changed(struct ril_msg *message, gpointer user_data) { struct socket_data *sock = user_data; int radio_state = g_ril_unsol_parse_radio_state_changed(sock->ril, message); if (radio_state != sock->radio_state) { struct socket_data *sock_c = socket_complement(sock); ofono_info("%s, %s, state: %s", __func__, sock->path, ril_radio_state_to_string(radio_state)); /* * If there is just one slot, just start it. Otherwise, we ask * who owns the 3G capabilities in case both slots have already * radio state different from UNAVAILABLE. */ if (mtk_data_1 == NULL) { mtk_data_0->has_3g = TRUE; start_slot(mtk_data_0, sock, hex_slot_0); } else if (sock->radio_state == RADIO_STATE_UNAVAILABLE && sock_c != NULL && sock_c->radio_state != RADIO_STATE_UNAVAILABLE) { query_3g_caps(sock); } sock->radio_state = radio_state; } }
static void query_3g_caps_cb(struct ril_msg *message, gpointer user_data) { struct socket_data *sock = user_data; struct socket_data *sock_for_md_0, *sock_for_md_1; int slot_3g; if (message->error != RIL_E_SUCCESS) { ofono_error("%s: error %s", __func__, ril_error_to_string(message->error)); return; } slot_3g = g_mtk_reply_parse_get_3g_capability(sock->ril, message); /* * The socket at sock_slot_0 always connects to the slot with 3G * capabilities, while sock_slot_1 connects to the slot that is just 2G. * However, the physical slot that owns the 3G capabilities can be * changed dynamically using a RILd request, so the sockets can connect * to different physical slots depending on the current configuration. * We want to keep the relationship between the physical slots and * the modem names in DBus (so /ril_0 and /ril_1 always refer to the * same physical slots), so here we assign the sockets needed by * mtk_data_0 and mtk_data_1 structures to make sure that happens. */ if (slot_3g == MULTISIM_SLOT_0) { sock_for_md_0 = sock_0; sock_for_md_1 = sock_1; mtk_data_0->has_3g = TRUE; mtk_data_1->has_3g = FALSE; } else { sock_for_md_0 = sock_1; sock_for_md_1 = sock_0; mtk_data_0->has_3g = FALSE; mtk_data_1->has_3g = TRUE; } start_slot(mtk_data_0, sock_for_md_0, hex_slot_0); start_slot(mtk_data_1, sock_for_md_1, hex_slot_1); g_free(sock_0); sock_0 = NULL; g_free(sock_1); sock_1 = NULL; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { th = new StartThread; ui->setupUi(this); ui->progressBar->setValue(0); ui->spinBox_max_url->setValue(1); ui->spinBox_max_url->setMinimum(1); ui->spinBox_max_url->setMaximum(10000); ui->spinBox_number_scan_theads->setValue(1); ui->spinBox_number_scan_theads->setMinimum(1); ui->spinBox_number_scan_theads->setMaximum(1000); ui->lineEdit_url->setText("https://www.gentoo.org/"); ui->plainTextEdit_search_text->appendPlainText("Gentoo"); // for find end log browsers html_style = "<style>" "p.find{color: green; margin: 0; padding: 0;}" "p.error{color: red; margin: 0; padding: 0;}" "</style>"; format_find = "<p class=\"find\">%1</p>"; format_error = "<p class=\"error\">%1</p>"; ui->textBrowser_find->setHtml(html_style); ui->textBrowser_log->setHtml(html_style); connect(ui->pushButton_start, SIGNAL(clicked()), this, SLOT(start_slot())); connect(ui->pushButton_pause, SIGNAL(clicked()), th->tree, SLOT(pause_slot())); connect(ui->pushButton_stop, SIGNAL(clicked()), th->tree, SLOT(stop_slot())); connect(th->tree, SIGNAL(update_progress(int)), ui->progressBar, SLOT(setValue(int))); connect(th->tree, SIGNAL(message_to_log(QString)), ui->textBrowser_log, SLOT(append(QString))); connect(th->tree, SIGNAL(message_to_find(QString)), ui->textBrowser_find, SLOT(append(QString))); connect(th->tree, SIGNAL(html_to_find_browser(QString,QString)), this, SLOT(html_to_find_browser(QString,QString))); connect(th->tree, SIGNAL(html_to_log_browser(QString,QString)), this, SLOT(html_to_log_browser(QString,QString))); connect(ui->actionExit, SIGNAL(triggered(bool)), this->window(), SLOT(close())); connect(ui->actionFull_screen, SIGNAL(triggered(bool)), this->window(), SLOT(showFullScreen())); connect(ui->actionMaximize, SIGNAL(triggered(bool)), this->window(), SLOT(showMaximized())); connect(ui->actionMinimize, SIGNAL(triggered(bool)), this->window(), SLOT(showMinimized())); connect(ui->actionHide, SIGNAL(triggered(bool)), this->window(), SLOT(setHidden(bool))); }
static void handle_packet(struct connection* c) { str* packet; const char* id; const char* runas; const char* command; const char* envstart; long slot; unsigned int i; struct passwd* pw; packet = &c->packet; id = packet->s; if (*id == NUL) FAIL(id, "DInvalid ID"); if ((slot = pick_slot()) < 0) FAIL(id, "DCould not allocate a slot"); wrap_str(str_copys(&slots[slot].id, id)); if ((i = str_findfirst(packet, NUL) + 1) >= packet->len) FAIL(id, "DInvalid packet"); runas = packet->s + i; if (*runas == NUL || (pw = getpwnam(runas)) == 0) FAIL(id, "DInvalid username"); if ((i = str_findnext(packet, NUL, i) + 1) >= packet->len) FAIL(id, "DInvalid packet"); command = packet->s + i; if ((i = str_findnext(packet, NUL, i) + 1) >= packet->len) envstart = 0; else { envstart = packet->s + i; wrap_str(str_catc(packet, 0)); } if (!init_slot(slot, pw)) FAIL(id, "ZOut of memory"); start_slot(slot, command, envstart); }