void check_usb_connection() { int vbus = AT91C_BASE_PIOA->PIO_PDSR & VBUS; if (vbus && usb_state == USB_Disconnected) { // Initialize the USB controller. // This will disconnect from the host (important if we have just reset after reprogramming). // The host will notice disconnection while we check the FPGA below. CDCDSerialDriver_Initialize(); USBD_Connect(); usb_state = USB_Connected; } if (!vbus) { usb_state = USB_Disconnected; } if (usb_state == USB_Connected && USBD_GetState() >= USBD_STATE_CONFIGURED) { console_init(); usb_state = USB_Working; } if (usb_state == USB_Working) { if (!console_run()) { controller = 0; } } }
int main(int argc, char **argv) { struct vte * vte; struct screenop * screen; struct kbdop * kbd; struct fontop * font; struct tty * tty; //open I/O device, screen and seat screen = screen_sdl_new(); kbd = kbd_sdl_new(); // font init font = font_static_new(); // tty device create tty = tty_cuse_new(); // VT init vte = vte_new(); // console init console_init(screen,kbd,font); // attatch vte to console console_attatch_vte(vte); // bind vte to tty vte_bint_tty(vte,tty); // main loop console_run(); return 0; }
// The task to process Console events static void cmd_task(iptr_t timer) { //static void cmd_task(struct Event *evt) { //Silence "args not used" warning. (void)timer; //kprintf("Parse CMD\n"); //console_run((KFile*)(evt->Ev.Int.user_data)); console_run(&dbg_port.fd); // Reset suspended CHs mask if (!chResumeCountdown) chSuspended = 0x0000; else chResumeCountdown--; // Check for periodic re-calibration recalibrationCountdown--; if (!recalibrationCountdown) { resetCalibrationCountdown(); LOG_INFO("\n\n!!!!! Ri-calibrazione periodica !!!!!\n\n"); controlCalibration(); } // Reschedule this timer synctimer_add(&cmd_tmr, &timers_lst); }
void run_app() { /* * Builder for the application */ Repository* repo = repository_init("Files/cheltuieli.txt"); Validator* valid = validator_init(); Controller* ctr = controller_init(repo, valid); Console* cons = console_init(ctr); console_run(cons); console_destroy(cons); controller_destroy(ctr); validator_destroy(valid); repository_destroy(repo); }
void menu_event(Entity *ent, ALLEGRO_EVENT *ev) { MenuEntityData *data = entity_data(ent); if (ev->type == ALLEGRO_EVENT_KEY_DOWN) { if (ev->keyboard.keycode == ALLEGRO_KEY_DOWN || ev->keyboard.keycode == ALLEGRO_KEY_UP) { data->server.focus = !data->server.focus; data->port.focus = !data->port.focus; } else if (ev->keyboard.keycode == ALLEGRO_KEY_ENTER) { if (strlen(data->server.buffer) && strlen(data->port.buffer)) { char full_command[256]; sprintf(full_command, "join %s %s", data->server.buffer, data->port.buffer); console_run(full_command); } } } textbox_on_event(&data->server, ev); textbox_on_event(&data->port, ev); }
virtual int run(int argc, char_t** argv, char_t** env) { int err = 0, err2 = 0; inet::cgi::environment::variable::value gateway_interface(inet::cgi::environment::variable::GATEWAY_INTERFACE); if ((is_cgi_run_ = (gateway_interface.has_chars()))) { if (!(err = before_cgi_run(argc, argv, env))) { err = cgi_run(argc, argv, env); if ((err2 = after_cgi_run(argc, argv, env))) { if (!(err)) err = err2; } } } else { if (!(err = before_console_run(argc, argv, env))) { err = console_run(argc, argv, env); if ((err2 = after_console_run(argc, argv, env))) { if (!(err)) err = err2; } } } return err; }