void run_test(void) { test_reset(); RUN_TEST(test_initialization); RUN_TEST(test_priority); RUN_TEST(test_charge_ceil); RUN_TEST(test_new_power_request); RUN_TEST(test_override); RUN_TEST(test_dual_role); RUN_TEST(test_rejected_port); RUN_TEST(test_unknown_dualrole_capability); test_print_result(); }
/* * Creates two new processes with different priorities. When the main * thread calls resign(), execution should continue with test_process_c() * This process then removes itself from the ready queue and calls resign() * again. Execution should then continue in test_process_a() */ void test_dispatcher_4() { test_reset(); create_process(test_dispatcher_4_process_a, 5, 42, "Test process A"); kprintf("Created process A\n"); create_process(test_dispatcher_4_process_c, 7, 0, "Test process C"); kprintf("Created process C\n"); check_sum = 0; resign(); if (check_sum == 0) test_failed(21); if (check_sum != 3) test_failed(22); }
/* * This test creates a sender and a receiver process. The sender process * has the higher priority and will be scheduled first. * The execution sequence is as follow: * 1. The sender executes a send(). Since the receiver is not RECEIVE_BLOCKED, * the sender will be SEND_BLOCKED. * 2. Execution resumes with the receiver. The receiver executes a receive(), * which will return immediately, and change the sender to state * REPLY_BLOCKED. * 3. The receivers does a reply(), and put the sender back on the ready queue. * The resign() in the reply() will therefore transfer the control back to * the sender. * 4. The sender executes a message(). Since the receiver is not * RECEIVE_BLOCKED, the sender will be MESSAGE_BLOCKED. * 5. Execution resumes with the receiver. The receiver executes a receive(), * which will return immediately, and change the sender to STATE_READY. * 6. The receiver does a resign() and pass the execution back to the sender. * This test send() and message() in the case that the receiver is not * ready to receive. It also test receive() in the case that there are messages * pending. */ void test_ipc_2 () { PORT new_port; test_reset(); new_port = create_process (test_ipc_2_receiver_process, 5, 0, "Receiver"); create_process (test_ipc_2_sender_process, 6, (PARAM) new_port, "Sender"); check_num_proc_on_ready_queue(3); check_process("Sender", STATE_READY, TRUE); check_process("Receiver", STATE_READY, TRUE); if (test_result != 0) test_failed(test_result); resign(); }
void do_tests() { plan(49); ok(my_timer_init_ext() == 0, "my_timer_init_ext"); test_create_and_delete(); test_reset(); test_timer(); test_timer_reuse(); test_independent_timers(); test_concurrently("per-thread", test_timer_per_thread, THREADS, 5); test_reinitialization(); my_timer_deinit(); }
/* * This test creates two processes with the same priority. Doing * a resign() in the main process should continue execution in * test_process_e(). When this process does a resign(), execution * should resume in test_process_d(). Then the execution should * be passed back to test_process_e(). This basically tests Round- * Robin of ready processes. */ void test_dispatcher_5() { test_reset(); create_process(test_dispatcher_5_process_e, 5, 0, "Test process E"); kprintf("Created process E\n"); create_process(test_dispatcher_5_process_d, 5, 0, "Test process D"); kprintf("Created process D\n"); check_sum = 0; resign(); if(check_sum == 0) test_failed(21); if(check_sum != 7) test_failed(25); }
void test_isr_2() { test_reset(); check_sum = 0; test_isr_2_check_sum = 0; init_interrupts(); kprintf("=== test_isr_2 === \n"); kprintf("This test will take a while.\n\n\n"); kprintf("Process 1: A\n"); kprintf("Process 2: Z\n"); create_process(test_isr_2_process_1, 5, 0, "Process 1"); create_process(test_isr_2_process_2, 5, 0, "Process 2"); resign(); if (check_sum == 0 || test_isr_2_check_sum == 0) test_failed(71); }
END_TEST START_TEST(test_insert_insert_expire_swap) { #define NOW 12345678 struct bstring key; struct val val; rstatus_i status; char keystring[30]; uint64_t i; int hits = 0; metrics = (cuckoo_metrics_st) { CUCKOO_METRIC(METRIC_INIT) }; test_reset(CUCKOO_POLICY_EXPIRE, false); now = NOW; for (i = 0; metrics.item_curr.counter < CUCKOO_NITEM; i++) { key.len = sprintf(keystring, "%"PRIu64, i); key.data = keystring; val.type = VAL_TYPE_INT; val.vint = i; status = cuckoo_insert(&key, &val, now + i); ck_assert_msg(status == CC_OK, "cuckoo_insert not OK - return status %d", status); } key.len = sprintf(keystring, "%"PRIu64, i); key.data = keystring; val.type = VAL_TYPE_INT; val.vint = i; status = cuckoo_insert(&key, &val, now + i); ck_assert_msg(status == CC_OK, "cuckoo_insert not OK - return status %d", status); for (;i > 0 && hits < CUCKOO_NITEM;i--) { if (cuckoo_get(&key) != NULL) { hits++; } } ck_assert_msg(hits == CUCKOO_NITEM, "expected %d hits, got %d", CUCKOO_NITEM, hits); #undef NOW }
END_TEST START_TEST(test_fpn) { test_reset(); ck_assert(test_metrics->f.fpn == 0.0); INCR(test_metrics, f); ck_assert(test_metrics->f.fpn == 0.0); INCR_N(test_metrics, f, 2); ck_assert(test_metrics->f.fpn == 0.0); UPDATE_VAL(test_metrics, f, 2.1); ck_assert(test_metrics->f.fpn == 2.1); DECR(test_metrics, f); ck_assert(test_metrics->f.fpn == 2.1); DECR_N(test_metrics, f, 5); ck_assert(test_metrics->f.fpn == 2.1); }
END_TEST START_TEST(test_gauge) { test_reset(); ck_assert_int_eq(test_metrics->g.gauge, 0); INCR(test_metrics, g); ck_assert_int_eq(test_metrics->g.gauge, 1); INCR_N(test_metrics, g, 2); ck_assert_int_eq(test_metrics->g.gauge, 3); UPDATE_VAL(test_metrics, g, 2); ck_assert_int_eq(test_metrics->g.gauge, 2); DECR(test_metrics, g); ck_assert_int_eq(test_metrics->g.gauge, 1); DECR_N(test_metrics, g, 5); ck_assert_int_eq(test_metrics->g.gauge, -4); }
void test_cas(uint32_t policy) { #define KEY "key" #define VAL "value" #define VAL2 "value2" struct bstring key; struct val val; rstatus_i status; struct item *it; uint64_t cas1, cas2; test_reset(policy, true); key.data = KEY; key.len = sizeof(KEY) - 1; val.type = VAL_TYPE_STR; val.vstr.data = VAL; val.vstr.len = sizeof(VAL) - 1; time_update(); status = cuckoo_insert(&key, &val, UINT32_MAX - 1); ck_assert_msg(status == CC_OK, "cuckoo_insert not OK - return status %d", status); it = cuckoo_get(&key); cas1 = item_cas(it); ck_assert_uint_ne(cas1, 0); val.vstr.data = VAL2; val.vstr.len = sizeof(VAL2) - 1; status = cuckoo_update(it, &val, UINT32_MAX - 1); ck_assert_msg(status == CC_OK, "cuckoo_update not OK - return status %d", status); it = cuckoo_get(&key); cas2 = item_cas(it); ck_assert_uint_ne(cas2, 0); ck_assert_uint_ne(cas1, cas2); #undef KEY #undef VAL #undef VAL2 }
void run_test(void) { test_reset(); wait_for_task_started(); if (system_get_image_copy() == SYSTEM_IMAGE_RO) { RUN_TEST(test_single_key_press); RUN_TEST(test_disable_keystroke); RUN_TEST(test_typematic); RUN_TEST(test_scancode_set2); RUN_TEST(test_power_button); RUN_TEST(test_sysjump); } else { RUN_TEST(test_sysjump_cont); } test_print_result(); }
END_TEST START_TEST(test_bulk_string) { #define BULK "foo bar\r\n" #define SERIALIZED "$9\r\n" BULK "\r\n" #define EMPTY "$0\r\n\r\n" struct element el_c, el_p; int ret; int len = sizeof(SERIALIZED) - 1; test_reset(); /* compose */ el_c.type = ELEM_BULK; el_c.bstr = str2bstr(BULK); ret = compose_element(&buf, &el_c); ck_assert_msg(ret == len, "bytes expected: %d, returned: %d", len, ret); ck_assert_int_eq(cc_bcmp(buf->rpos, SERIALIZED, ret), 0); /* parse */ ck_assert_int_eq(parse_element(&el_p, buf), PARSE_OK); ck_assert(buf->rpos == buf->wpos); ck_assert(el_p.type == ELEM_BULK); ck_assert(el_p.bstr.len == sizeof(BULK) - 1); ck_assert(el_p.bstr.data + el_p.bstr.len == buf->rpos - CRLF_LEN); ck_assert(buf->rpos == buf->wpos); /* empty string */ buf_reset(buf); len = sizeof(EMPTY) - 1; el_c.bstr = null_bstring; ret = compose_element(&buf, &el_c); ck_assert_msg(ret == len, "bytes expected: %d, returned: %d", len, ret); ck_assert_int_eq(cc_bcmp(buf->rpos, EMPTY, ret), 0); ck_assert_int_eq(parse_element(&el_p, buf), PARSE_OK); ck_assert(el_p.bstr.len == 0); #undef EMPTY #undef SERIALIZED #undef BULK }
static void run_test_step1(void) { test_reset(); mock_wp = 0; RUN_TEST(test_read); RUN_TEST(test_is_erased); RUN_TEST(test_overwrite_current); RUN_TEST(test_overwrite_other); RUN_TEST(test_op_failure); RUN_TEST(test_flash_info); RUN_TEST(test_region_info); RUN_TEST(test_write_protect); if (test_get_error_count()) test_reboot_to_next_step(TEST_STATE_FAILED); else test_reboot_to_next_step(TEST_STATE_STEP_2); }
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){ if (packet_type != HCI_EVENT_PACKET) return; uint8_t event = hci_event_packet_get_type(packet); switch (event) { case BTSTACK_EVENT_STATE: // bt stack activated, get started if (btstack_event_state_get_state(packet) == HCI_STATE_WORKING){ printf("SDP Query for RFCOMM services on %s started\n", bd_addr_to_str(remote)); sdp_client_query_rfcomm_channel_and_name_for_uuid(&handle_query_rfcomm_event, remote, SDP_PublicBrowseGroup); } break; case RFCOMM_EVENT_CHANNEL_OPENED: // data: event(8), len(8), status (8), address (48), handle(16), server channel(8), rfcomm_cid(16), max frame size(16) if (packet[2]) { state = DONE; printf("RFCOMM channel open failed, status %u\n", packet[2]); } else { // data: event(8), len(8), status (8), address (48), handle (16), server channel(8), rfcomm_cid(16), max frame size(16) state = SENDING; rfcomm_cid = little_endian_read_16(packet, 12); mtu = little_endian_read_16(packet, 14); printf("RFCOMM channel open succeeded. New RFCOMM Channel ID %u, max frame size %u\n", rfcomm_cid, mtu); if ((test_data_len > mtu)) { test_data_len = mtu; } test_reset(); rfcomm_request_can_send_now_event(rfcomm_cid); break; } break; case RFCOMM_EVENT_CAN_SEND_NOW: send_packet(); break; case RFCOMM_EVENT_CHANNEL_CLOSED: if (state != DONE) { printf("RFCOMM_EVENT_CHANNEL_CLOSED received before all test data was sent\n"); state = DONE; } break; default: break; } }
void test_insert_collision(uint32_t policy, bool cas) { struct bstring key; struct val val; rstatus_i status; struct item *it; int hits = 0; char keystring[CC_UINTMAX_MAXLEN]; uint64_t i, testval; test_reset(policy, cas); time_update(); for (i = 0; i < CUCKOO_NITEM + 1; i++) { key.len = sprintf(keystring, "%"PRIu64, i); key.data = keystring; val.type = VAL_TYPE_INT; val.vint = i; status = cuckoo_insert(&key, &val, UINT32_MAX - 1); ck_assert_msg(status == CC_OK, "cuckoo_insert not OK - return status %d", status); } for (i = 0; i < CUCKOO_NITEM + 1; i++) { key.len = sprintf(keystring, "%"PRIu64, i); key.data = keystring; it = cuckoo_get(&key); if (it == NULL) { continue; } hits++; ck_assert_int_eq(it->klen, key.len); testval = item_value_int(it); ck_assert_int_eq(testval, i); } ck_assert_msg(hits > (double)CUCKOO_NITEM * 9 / 10, "hit rate is lower than expected when hash collision occurs"); ck_assert_msg(hits <= CUCKOO_NITEM, "hit rate is too high, expected more evicted values"); }
int main(int argc, char** argv) { unsigned long data; struct termios term; char data2; int hasdat; int fd; if (argc != 1) { usage: fprintf(stderr, "%s: a program to watch for stuff coming out over the console over jtag.\n", argv[0]); exit(1); } openport(); test_reset(); // returns us in reset state clockin(0, 0); // this leaves us in run-test/idle look_for_pxa(); // returns us in run-test/idle state set_instr(DBGTX); /* We do not do any of the high-level stuff here. Just wait for RR and read. */ while(1) { int lcount = 0; hasdat = 0; while (!hasdat) { hasdat = gettxword(&data); if (!hasdat) lcount++; if (lcount > 10) set_instr(DBGTX); } data2 = data & 0xFF; write(1, &data2, 1); } closeport(); return 0; }
END_TEST START_TEST(test_insert_replace_expired) { #define NOW 12345678 struct bstring key; struct val val; rstatus_i status; char keystring[30]; uint64_t i; metrics = (cuckoo_metrics_st) { CUCKOO_METRIC(METRIC_INIT) }; test_reset(CUCKOO_POLICY_EXPIRE, true); now = NOW; for (i = 0; metrics.item_curr.counter < CUCKOO_NITEM; i++) { key.len = sprintf(keystring, "%"PRIu64, i); key.data = keystring; val.type = VAL_TYPE_INT; val.vint = i; status = cuckoo_insert(&key, &val, now + 1); ck_assert_msg(status == CC_OK, "cuckoo_insert not OK - return status %d", status); } // dict is full, all items will expire in now + 1 now += 2; key.len = sprintf(keystring, "%"PRIu64, i); key.data = keystring; val.type = VAL_TYPE_INT; val.vint = i; status = cuckoo_insert(&key, &val, now + 1); ck_assert_msg(status == CC_OK, "cuckoo_insert not OK - return status %d", status); ck_assert_int_eq(metrics.item_expire.counter, 1); #undef NOW }
END_TEST START_TEST(test_array) { #define SERIALIZED "*2\r\n+foo\r\n$4\r\nbarr\r\n" #define NELEM 2 size_t len = sizeof(SERIALIZED) - 1; int64_t nelem; test_reset(); buf_write(buf, SERIALIZED, len); ck_assert(token_is_array(buf)); ck_assert_int_eq(token_array_nelem(&nelem, buf), PARSE_OK); ck_assert_int_eq(nelem, NELEM); #undef NELEM #undef SERIALIZED }
static void run_test_step1(void) { lid_open = 1; hook_notify(HOOK_LID_CHANGE); test_reset(); RUN_TEST(deghost_test); RUN_TEST(debounce_test); RUN_TEST(simulate_key_test); #ifdef EMU_BUILD RUN_TEST(runtime_key_test); #endif #ifdef CONFIG_LID_SWITCH RUN_TEST(lid_test); #endif if (test_get_error_count()) test_reboot_to_next_step(TEST_STATE_FAILED); else test_reboot_to_next_step(TEST_STATE_STEP_2); }
int main(int argc, char **argv) { test_create_dynamic() ; test_create_static() ; test_thread_create() ; test_yield() ; test_wait() ; test_broadcast() ; test_pc() ; test_pc_big() ; test_recursive() ; test_sem() ; test_lock() ; test_func_pointer() ; test_ready() ; test_kill() ; test_reset() ; return 0 ; }
void run_test(void) { test_reset(); RUN_TEST(test_no_ramp); RUN_TEST(test_full_ramp); RUN_TEST(test_vbus_dip); RUN_TEST(test_overcurrent); RUN_TEST(test_switch_outlet); RUN_TEST(test_fast_switch); RUN_TEST(test_overcurrent_after_switch_outlet); RUN_TEST(test_partial_load); RUN_TEST(test_charge_supplier_stable); RUN_TEST(test_charge_supplier_stable_ramp); RUN_TEST(test_charge_supplier_change); RUN_TEST(test_charge_port_change); RUN_TEST(test_vbus_shift); RUN_TEST(test_equal_priority_overcurrent); RUN_TEST(test_ramp_limit); test_print_result(); }
END_TEST START_TEST(test_nil_bulk) { #define NIL_BULK "$-1\r\n" size_t len = sizeof(NIL_BULK) - 1; struct element el_c, el_p; test_reset(); el_c.type = ELEM_NIL; ck_assert_int_eq(compose_element(&buf, &el_c), len); ck_assert_int_eq(buf_rsize(buf), len); ck_assert_int_eq(cc_bcmp(buf->rpos, NIL_BULK, len), 0); el_p.type = ELEM_UNKNOWN; ck_assert_int_eq(parse_element(&el_p, buf), PARSE_OK); ck_assert_int_eq(el_p.type, ELEM_NIL); #undef NIL_BULK }
/* * We don't explicitly create a new process, but because of init_process() * and init_dispatcher(), the main thread should be initialized as a process * and be added to the ready queue. * This also test print_all_processes() */ void test_create_process_1() { test_reset(); print_all_processes(kernel_window); //check if the boot process is initialized correctly. check_create_process(boot_name, 1, NULL, 0); if (test_result != 0) test_failed(test_result); check_num_of_pcb_entries(1); if (test_result != 0) test_failed(test_result); check_process(boot_name, STATE_READY, TRUE); if (test_result != 0) test_failed(test_result); check_num_proc_on_ready_queue(1); if (test_result != 0) test_failed(test_result); }
void test_delete_basic(uint32_t policy, bool cas) { #define KEY "key" #define VAL "value" struct bstring key; struct val val; rstatus_i status; struct item *it; bool deleted; test_reset(policy, cas); key.data = KEY; key.len = sizeof(KEY) - 1; val.type = VAL_TYPE_STR; val.vstr.data = VAL; val.vstr.len = sizeof(VAL) - 1; time_update(); status = cuckoo_insert(&key, &val, UINT32_MAX - 1); ck_assert_msg(status == CC_OK, "cuckoo_insert not OK - return status %d", status); it = cuckoo_get(&key); ck_assert_msg(it != NULL, "cuckoo_get returned NULL"); deleted = cuckoo_delete(&key); ck_assert_msg(deleted, "cuckoo_delete return false"); it = cuckoo_get(&key); ck_assert_msg(it == NULL, "cuckoo_get returned not NULL"); deleted = cuckoo_delete(&key); ck_assert_msg(!deleted, "cuckoo_delete return true"); #undef KEY #undef VAL }
/* * This test creates three processes with the same priority. * The execution sequence is as following: * 1. After the boot process resign(), process F (test_process_f)is executed. * 2. Process F resign, process E (test_process_e) is then executed. * 3. Process E remove itself from the ready queue and then resign, process D * (test_process_d) is then executed. * 4. Process D resign(), process F is then executed. * 5. Process F remove itself from ready queue and then resign. Process D is * the next to be executed since Process E is off ready queue. * 6. Process D resign, the next to be executed is still process D since both * process F and E are off ready queue. * * The execution sequence should be: boot -> F -> E -> D -> F -> D -> D */ void test_dispatcher_7() { test_reset(); create_process(test_dispatcher_7_process_f, 5, 0, "Test process F"); kprintf("Created process F\n"); create_process(test_dispatcher_7_process_e, 5, 0, "Test process E"); kprintf("Created process E\n"); create_process(test_dispatcher_7_process_d, 5, 0, "Test process D"); kprintf("Created process D\n"); kprintf("\n"); check_num_proc_on_ready_queue(4); if (test_result != 0) test_failed(test_result); check_sum = 0; resign(); if(check_sum == 0) test_failed(21); if (check_sum != 63) test_failed(25); }
void test_isr_3 () { test_reset(); check_sum = 0; int check_2 = 0; kprintf("=== test_isr_3 === \n"); kprintf("This test will take a while.\n\n"); init_interrupts(); create_process(isr_process, 5, 0, "ISR process"); resign(); int i; int j = 0; unsigned char* screen_base; screen_base = (unsigned char*) 0xb8000 + 7 * 80 * 2; kprintf("\n\nBoot process:\n"); kprintf("ABCDEF"); PROCESS isr_pro = find_process_by_name("ISR process"); for (i = 0; i < 600000; i++) { if (isr_pro->state == STATE_INTR_BLOCKED) check_2++; *(screen_base + j * 2) = *(screen_base + j * 2) + 1; j++; if (j == 6) j = 0; } if (check_2 == 0) test_failed(72); if (check_sum <= 1) test_failed(73); }
void test_isr_1() { MEM_ADDR screen_offset_for_boot_proc = 0xb8000 + 4 * 160 + 2 * 11; volatile int flag; test_reset(); check_sum = 0; init_interrupts(); DISABLE_INTR(flag); init_idt_entry(TIMER_IRQ, timer_isr); kprintf("=== test_isr_1 === \n"); kprintf("This test will take a while.\n\n"); kprintf("Timer ISR: A\n"); kprintf("Boot proc: Z\n"); ENABLE_INTR(flag); int i; for (i = 1; i < 700000; i++) poke_b(screen_offset_for_boot_proc, peek_b(screen_offset_for_boot_proc) + 1); if (check_sum == 0) test_failed(70); }
void test_expire_basic(uint32_t policy, bool cas) { #define KEY "key" #define VAL "value" #define NOW 12345678 struct bstring key; struct val val; rstatus_i status; struct item *it; test_reset(policy, cas); key.data = KEY; key.len = sizeof(KEY) - 1; val.type = VAL_TYPE_STR; val.vstr.data = VAL; val.vstr.len = sizeof(VAL) - 1; now = NOW; status = cuckoo_insert(&key, &val, NOW + 1); ck_assert_msg(status == CC_OK, "cuckoo_insert not OK - return status %d", status); it = cuckoo_get(&key); ck_assert_msg(it != NULL, "cuckoo_get returned NULL"); now += 2; it = cuckoo_get(&key); ck_assert_msg(it == NULL, "cuckoo_get returned not NULL after expiration"); #undef NOW #undef KEY #undef VAL }
static void test_case(enum resource_type rt) { rtems_status_code sc = RTEMS_SUCCESSFUL; printf("test case: %s\n", resource_type_desc [rt]); resource_type = rt; test_reset(); sc = rtems_timer_server_fire_after( timer [OBTAIN], T1 - T0, obtain_callback, NULL ); directive_failed(sc, "rtems_timer_server_fire_after"); sc = rtems_timer_fire_after( timer [INTERRUPT], T2 - T0, interrupt_callback, NULL ); directive_failed(sc, "rtems_timer_fire_after"); sc = rtems_timer_server_fire_after( timer [DELAYED], T3 - T0, delayed_callback, NULL ); directive_failed(sc, "rtems_timer_server_fire_after"); if (resource_type != REGION) { sc = rtems_timer_fire_after( timer [RELEASE], T4 - T0, release_callback, NULL ); directive_failed(sc, "rtems_timer_fire_after"); assert_time(T0); sc = rtems_task_wake_after(T6 - T0); directive_failed(sc, "task_wake_after"); } else { sc = rtems_task_wake_after(T4 - T0); directive_failed(sc, "task_wake_after"); assert_time(T4); rtems_test_assert( obtain_try && interrupt_happened && !delayed_happened && !interrupt_triggered_happened && !server_triggered_happened ); sc = rtems_region_return_segment(region, region_item); directive_failed(sc, "rtems_region_return_segment"); release_happened = true; sc = rtems_task_wake_after(T6 - T4); directive_failed(sc, "task_wake_after"); } assert_time(T6); rtems_test_assert( obtain_done && interrupt_happened && release_happened && delayed_happened && interrupt_triggered_happened && server_triggered_happened ); }
static void main_thread(void *pdata) { QueueSetHandle_t qs; QueueSetMemberHandle_t active; ASSERT((qs = xQueueCreateSet(SERIAL_RX_SIZE * 3))); serial_start(cli_serial, 115200, qs); serial_start(&Serial4, 57600, qs); serial_start(&Serial5, cfg.gps_baud_rate ? cfg.gps_baud_rate : 57600, qs); cli_set_output(cli_serial); log_start(cli_serial); cl_enabled = 1; load_eeprom(); cfg.flags &= ~FLAG_HOLDOVER_TEST; if (cfg.flags & FLAG_GPSEXT) { gps_serial = &Serial5; } else { gps_serial = &Serial4; } if (!cfg.holdover) { cfg.holdover = 60; } if (!cfg.loopstats_interval) { cfg.loopstats_interval = 60; } ppscapture_start(); vtimer_start(); tcpip_start(); test_reset(); cli_banner(); if (!(cfg.flags & FLAG_GPSEXT)) { ublox_configure(); if (HAS_FEATURE(PPSEN) && (cfg.flags & FLAG_PPSEN)) { GPIO_OFF(PPSEN); } } cl_enabled = 0; while (1) { watchdog_main = 5; active = xQueueSelectFromSet(qs, pdMS_TO_TICKS(1000)); if (active == cli_serial->rx_q) { int16_t val = serial_get(cli_serial, TIMEOUT_NOBLOCK); ASSERT(val >= 0); cli_feed(val); } else if (active == gps_serial->rx_q) { int16_t val = serial_get(gps_serial, TIMEOUT_NOBLOCK); ASSERT(val >= 0); gps_byte_received(val); if (cfg.flags & FLAG_GPSOUT) { char tmp = val; serial_write(&Serial5, &tmp, 1); } #if 0 } else if (active == Serial5.rx_q) { char tmp = serial_get(&Serial5, TIMEOUT_NOBLOCK); serial_write(&Serial4, &tmp, 1); #endif } } }