int main(){ int monte = 1; printf("%d/%d valid messages in test_gps\n",test_gps(monte),monte); printf("%d/%d valid messages in test_control\n",test_control(monte),monte); printf("%d/%d valid messages in test_command\n",test_command(monte),monte); printf("%d/%d valid messages in test_pid\n",test_pid(monte),monte); // weirdness uint8_t msg[] = {0x7F,0x53,0x01,0xC0,0xAE,0x93,0xC6,0xC0,0x3D,0x40,0x12,0xEC,0x51,0x20,0x41,0x87}; int32_t lon=0,lat=0; float t=0; if (esp_unpack_gps(msg,&lon,&lat,&t) > 0){ printf("Hardcoded msg: lon = %ld, lat = %ld, t=%f\n",lon,lat,t); } printf("%ld\n",0xC0); printf("%ld\n",0xAE<<8); printf("%ld\n",0x93<<16); printf("%ld\n",0xC6<<24); printf("%ld",(0xC0) + (0xAE << 8) + (0x93<<16) + (0xC6 << 24)); return 0; }
void test_entry() { int selection, depth; int i, j; unsigned char readout; selection = -1; depth = -1; while (1) { sendtocom0("****************\n"); sendtocom0("SYSTEM TEST MENU\n"); sendtocom0("****************\n\n"); for (i=0; i<3; i++) sendtocom0(" "); sendtocom0("[01] GPS TEST\n"); for (i=0; i<3; i++) sendtocom0(" "); sendtocom0("[02] IMU TEST\n"); for (i=0; i<3; i++) sendtocom0(" "); sendtocom0("[03] CAN TEST\n"); for (i=0; i<3; i++) sendtocom0(" "); sendtocom0("[04] RS422 TEST\n"); for (i=0; i<3; i++) sendtocom0(" "); sendtocom0("[05] EMV TEST\n"); sendtocom0("\n"); depth = *((unsigned char*)DBGADDR+0x10); for (j=0; j<10; j++) ; if (depth > 0) { for (i=0; i<depth; i++) { readout = *((unsigned char*)DBGADDR); for (j=0; j<10; j++) ; } } sendtocom0("Please Enter Your Choice:\n\n"); for (j=0; j<20000000; j++) ; do { depth = *((unsigned char*)DBGADDR+0x10); for (j=0; j<10; j++) ; if (depth > 0) { selection = *((unsigned char*)DBGADDR); for (j=0; j<10; j++) ; break; } } while (selection == 0 || depth == 0); for (j=0; j<20000000; j++) ; switch (selection) { case 1: test_gps(); break; case 2: test_im(); break; case 3: test_can(); break; case 4: test_com(); break; case 5: test_EMV(); break; } } }
static void * case_thread(DirectThread *thread, void *arg) { int ret; case_t *caseP = arg; bool passflg = false; FILE *fp = NULL; char command[100]; struct stat st; bool iio_enable; iio_enable = is_iio_enable(); printf("iio_enable = %d\n", iio_enable); if(caseP->type == 0) { switch(caseP->index) { //mem case mem: sprintf(command, "memtester %s 1 2 > /memerr.log 1> /dev/null", caseP->nod_path); // printf("command = %s\n", command); ret = system(command); // printf("mem ret = %d\n", ret); if(!ret && stat("/memerr.log", &st) >= 0) //获取文件信息 { if(st.st_size == 0) { passflg = true; } } break; case ddrsize: passflg = test_ddrsize(caseP); break; //flash case flash:; passflg = test_flash(caseP); break; //wifi case wifi: passflg = test_wifi(caseP); break; case bt: passflg = test_bt(caseP); break; //gsensor case gsensor: if(!iio_enable) passflg = test_gsensor(caseP); else passflg = test_iio(caseP, info); break; case gyro: if(!iio_enable) passflg = false; else passflg = test_iio(caseP, info + 1); break; case comp: if(!iio_enable) passflg = false; else passflg = test_iio(caseP, info + 2); break; case lightsensor: passflg = test_lightsensor(caseP); break; //camera // case camera: // passflg = wait_dev_plugin(caseP->nod_path); // break; //rtc case rtc: passflg = test_rtc(caseP); break; case gps: passflg = test_gps(caseP); break; case uart: passflg = test_uart(caseP); break; case ethernet: passflg = test_ethernet(caseP); break; } } else if(caseP->type == 1) { switch(caseP->index) { //sdcard case 0: passflg = test_mmc(caseP); break; //usb case 1: passflg = test_usb(caseP); break; case 2: passflg = test_pc(caseP); break; //hdmi case 3: wait_nod_state(caseP, &hdmi_flg); //test_hdmi(caseP, &hdmi_flg); break; //headphone case 4: wait_nod_state(caseP, &headphone_flg); break; //key case 5: passflg = test_key(caseP); break; //onoff case 6: passflg = test_key_onff(caseP); break; //charege case 7: passflg = test_charge(caseP); break; //mtv case 8: passflg = test_mtv(caseP); break; } } draw_result(caseP, passflg); }