uint32 RTOS::waiFlag(uint16 rv_flg_id){ FLGPTN at_flg_pattern = 0; wai_flg(rv_flg_id, 0xFFFFFFFF, TWF_ORW, &at_flg_pattern); return static_cast<uint32>(at_flg_pattern); }
UINT32 WifiCmd_WaitFinish(FLGPTN waiptn) { FLGPTN uiFlag; DBG_IND("waiptn %x\r\n",waiptn); wai_flg(&uiFlag, FLG_ID_WIFICMD, waiptn, (TWF_ORW)); return g_result; }
//ethan_20110801_add ER Cal_SaveAWBGS(void) { ER ercode = 0; FLGPTN uiFlag = 0; HNVT_FILE *pFile; Cal_ClearOSD(_OSD_INDEX_TRANSPART); if(AAA_Adjust.AWB_Status == _AWB_Status) { AAA_Adjust.AWBGS_Status = _AWB_Status; AAA_Adjust.AWBGS.Rgain = AAA_Adjust.AWB.Rgain; AAA_Adjust.AWBGS.Bgain = AAA_Adjust.AWB.Bgain; sprintf(CalStringBuffer,"AWB GS: Rgain:%d Bgain:%d",AAA_Adjust.AWBGS.Rgain,AAA_Adjust.AWBGS.Bgain); Cal_ShowStringWithColor(CalStringBuffer,20, 100, 4); ercode = E_OK; } else ercode = E_SYS; sprintf(CalStringBuffer,"Press SHUTTER to return"); Cal_ShowStringWithColor(CalStringBuffer,20, 120, 4); if(ercode == E_OK) { FilesysWaitCmdFinish(FST_TIME_INFINITE); pFile = fs_fopen("A:\\AWBGS.txt","w"); if(pFile == NULL) { sprintf(CalStringBuffer, "create AWBGS.txt fail"); Cal_ShowStringWithColor(CalStringBuffer,20, 40, 4); TimerDelayMs(2000); } else { sprintf(CalStringBuffer, "%d %d",AAA_Adjust.AWBGS.Rgain,AAA_Adjust.AWBGS.Bgain); fs_fwrite(CalStringBuffer, 1, 7, pFile); fs_fclose(pFile); g_CalStringRect.uiLeft = 20; g_CalStringRect.uiTop = 200; g_CalStringRect.uiWidth = 300; g_CalStringRect.uiHeight = 30; sprintf(CalStringBuffer, "AWBGS.txt OK"); Cal_ShowStringWithColor(CalStringBuffer,20, 40, 4); TimerDelayMs(2000); } Cal_WriteCalData(PSTORE_SEC_SENSOR); } clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW | TWF_CLR); return ercode; }
void Cal_Test_1(void) { FLGPTN uiFlag = 0; RECT StringRect = {20, 100, 300, 30}; UI_ClearOSD(_OSD_INDEX_TRANSPART); // clear OSD Cal_ShowString("Press UP key to exit", &StringRect, TRUE); while (1) { wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_UP, TWF_ORW | TWF_CLR); break; } }
//ethan_20110801_add ER Cal_ShowCalRst(void) { ER ercode = 0; FLGPTN uiFlag = 0; ercode = Cal_ReadCalData(); if(ercode!=E_OK) { debug_err(("^R %s: read ps error\r\n",__func__)); return E_SYS;; } Cal_ClearOSD(_OSD_INDEX_TRANSPART); if((AAA_Adjust.DP_Status.Prv_White == _Prv_W_Status) && \ (AAA_Adjust.DP_Status.Prv_Black== _Prv_B_Status)) { sprintf(CalStringBuffer,"DP Pixel num: Prv:%d",(UINT)AAA_Adjust.DPC_Num[DPC_PRV]); Cal_ShowStringWithColor(CalStringBuffer,20, 20, 4); } if((AAA_Adjust.DP_Status.Cap_White == _Cap_W_Status) && \ (AAA_Adjust.DP_Status.Cap_Black == _Cap_B_Status)) { sprintf(CalStringBuffer,"DP Pixel num: Cap:%d",(UINT)AAA_Adjust.DPC_Num[DPC_CAP]); Cal_ShowStringWithColor(CalStringBuffer,20, 40, 4); } if(AAA_Adjust.ECS_Status == _ECS_Status) sprintf(CalStringBuffer,"ECS Rst: OK"); else sprintf(CalStringBuffer,"ECS Rst: NG"); Cal_ShowStringWithColor(CalStringBuffer,20, 60, 4); if(AAA_Adjust.AWB_Status == _AWB_Status) sprintf(CalStringBuffer,"AWB: Rgain:%d Bgain:%d",AAA_Adjust.AWB.Rgain,AAA_Adjust.AWB.Bgain); else sprintf(CalStringBuffer,"AWB: NG"); Cal_ShowStringWithColor(CalStringBuffer,20, 80, 4); if(AAA_Adjust.AWBGS_Status == _AWB_Status) sprintf(CalStringBuffer,"AWB GS: Rgain:%d Bgain:%d",AAA_Adjust.AWBGS.Rgain,AAA_Adjust.AWBGS.Bgain); else sprintf(CalStringBuffer,"AWBGS: NG"); Cal_ShowStringWithColor(CalStringBuffer,20, 100, 4); sprintf(CalStringBuffer,"Press SHUTTER to return"); Cal_ShowStringWithColor(CalStringBuffer,20, 120, 4); clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW | TWF_CLR); return E_OK; }
ER LensCtrl_WaitCmdFinish(UINT32 TimeOut) { FLGPTN nFlag; if (bLensCtrlOpened == FALSE) { return E_SYS; } if(TimeOut == LENSCTRL_WAIT_INFINITE) { wai_flg(&nFlag, FLG_ID_LENS, FLGLENS_IDLE, TWF_ORW); } return E_OK; }
void alarm1_handler(intptr_t exinf) { ER_UINT ercd; FLGPTN flgptn; check_point(40); ercd = wai_flg(FLG1, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_CTX); ercd = set_flg(FLG3, 0x01); check_ercd(ercd, E_OK); check_point(41); return; check_point(0); }
/** * EV3RT console button task */ void console_button_task(intptr_t unused) { ER ercd; FLGPTN flgptn; while((ercd = wai_flg(console_button_flag, (1 << TNUM_BRICK_BUTTON) - 1, TWF_ORW, &flgptn)) == E_OK) { for (int i = 0; i < TNUM_BRICK_BUTTON; ++i) if (flgptn & (1 << i)) { switch(i) { case BRICK_BUTTON_BACK: if (log_view_scroll_mode) { // Exit scroll mode log_view_refresh_ex(log_current_line); log_view_scroll_mode = false; } else { // Toggle ev3rt_console_set_visibility(!console_visible); } break; case BRICK_BUTTON_UP: // scroll up log_view_scroll(true); break; case BRICK_BUTTON_DOWN: // scroll down log_view_scroll(false); break; case BRICK_BUTTON_LEFT: console_menu_perform_action(CONSOLE_MENU_ACT_PREV); break; case BRICK_BUTTON_RIGHT: console_menu_perform_action(CONSOLE_MENU_ACT_NEXT); break; case BRICK_BUTTON_ENTER: console_menu_perform_action(CONSOLE_MENU_ACT_ENTER); clr_flg(console_button_flag, 0); break; } } } syslog(LOG_ERROR, "%s(): Fatal error, ercd: %d", __FUNCTION__, ercd); }
void task3(intptr_t exinf) { ER_UINT ercd; FLGPTN flgptn; check_point(26); ercd = wup_tsk(TASK2); check_ercd(ercd, E_OK); check_point(28); ercd = set_flg(FLG3, 0x02); check_ercd(ercd, E_OK); check_point(30); ercd = set_flg(FLG3, 0x03); check_ercd(ercd, E_OK); check_point(32); ercd = set_flg(FLG3, 0x03); check_ercd(ercd, E_OK); check_point(34); ercd = set_flg(FLG4, 0x03); check_ercd(ercd, E_OK); check_point(36); ercd = set_flg(FLG4, 0x01); check_ercd(ercd, E_OK); check_point(39); ercd = wai_flg(FLG3, 0x02, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_finish(44); check_point(0); }
static int __ui_wai_flg(struct pt_regs *regs) { UINT flgptn, waiptn, wfmode; ID flgid; ER err; flgid = __xn_reg_arg2(regs); waiptn = __xn_reg_arg3(regs); wfmode = __xn_reg_arg4(regs); err = wai_flg(&flgptn, flgid, waiptn, wfmode); if (err == E_OK) { if (__xn_safe_copy_to_user((void __user *)__xn_reg_arg1(regs), &flgptn, sizeof(flgptn))) return -EFAULT; } else if (err == E_RLWAI) { uitask_t *task = ui_current_task(); if (!xnthread_test_info(&task->threadbase, uITRON_TASK_RLWAIT)) err = -EINTR; } return err; }
void task1(intptr_t exinf) { ER_UINT ercd; T_RFLG rflg; FLGPTN flgptn; test_start(__FILE__); check_point(1); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x00); ercd = ref_flg(FLG2, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x01); check_point(2); ercd = loc_cpu(); check_ercd(ercd, E_OK); ercd = set_flg(FLG1, 0x01); check_ercd(ercd, E_CTX); ercd = wai_flg(FLG1, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_CTX); ercd = unl_cpu(); check_ercd(ercd, E_OK); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = wai_flg(FLG1, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_CTX); ercd = ena_dsp(); check_ercd(ercd, E_OK); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = wai_flg(FLG1, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_CTX); ercd = chg_ipm(TIPM_ENAALL); check_ercd(ercd, E_OK); ercd = set_flg(0, 0x01); check_ercd(ercd, E_ID); ercd = wai_flg(0, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_ID); ercd = set_flg(TNUM_FLGID+1, 0x01); check_ercd(ercd, E_ID); ercd = wai_flg(TNUM_FLGID+1, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_ID); ercd = wai_flg(FLG1, 0x00, TWF_ORW, &flgptn); check_ercd(ercd, E_PAR); ercd = wai_flg(FLG1, 0x01, 0U, &flgptn); check_ercd(ercd, E_PAR); ercd = wai_flg(FLG1, 0x01, (TWF_ORW|TWF_ANDW), &flgptn); check_ercd(ercd, E_PAR); ercd = set_flg(FLG1, 0x00); check_ercd(ercd, E_OK); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x00); ercd = set_flg(FLG1, 0x01); check_ercd(ercd, E_OK); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x01); ercd = set_flg(FLG1, 0x01); check_ercd(ercd, E_OK); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x01); ercd = set_flg(FLG1, 0x02); check_ercd(ercd, E_OK); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x03); ercd = clr_flg(FLG1, ~0x01); check_ercd(ercd, E_OK); ercd = set_flg(FLG1, 0x03); check_ercd(ercd, E_OK); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x03); check_point(3); ercd = act_tsk(TASK2); check_ercd(ercd, E_OK); check_point(6); ercd = set_flg(FLG1, 0x04); check_ercd(ercd, E_OK); check_point(9); ercd = dis_dsp(); check_ercd(ercd, E_OK); ercd = set_flg(FLG1, 0x08); check_ercd(ercd, E_OK); ercd = ref_flg(FLG1, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x0f); check_point(10); ercd = ena_dsp(); check_ercd(ercd, E_OK); check_point(13); ercd = chg_ipm(TMAX_INTPRI); check_ercd(ercd, E_OK); ercd = set_flg(FLG2, 0x04); check_ercd(ercd, E_OK); ercd = ref_flg(FLG2, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x00); check_point(14); ercd = chg_ipm(TIPM_ENAALL); check_ercd(ercd, E_OK); check_point(17); ercd = sus_tsk(TASK2); check_ercd(ercd, E_OK); ercd = set_flg(FLG2, 0x04); check_ercd(ercd, E_OK); ercd = ref_flg(FLG2, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x00); check_point(18); ercd = rsm_tsk(TASK2); check_ercd(ercd, E_OK); check_point(21); ercd = wai_flg(FLG2, 0x02, TWF_ORW, &flgptn); check_ercd(ercd, E_ILUSE); ercd = set_flg(FLG2, 0x02); check_ercd(ercd, E_OK); ercd = wai_flg(FLG2, 0x02, TWF_ORW, &flgptn); check_ercd(ercd, E_ILUSE); check_point(22); ercd = set_flg(FLG2, 0x01); check_ercd(ercd, E_OK); check_point(25); ercd = wai_flg(FLG3, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(31); ercd = wai_flg(FLG4, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(37); ercd = clr_flg(FLG3, 0); check_ercd(ercd, E_OK); ercd = sta_alm(ALM1, 2 * TEST_TIME_CP); check_ercd(ercd, E_OK); check_point(38); ercd = wai_flg(FLG3, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(42); ercd = set_flg(FLG3, 0x02); check_ercd(ercd, E_OK); check_point(43); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(0); }
/* * 計測タスク(中優先度) */ void task(intptr_t exinf) { FLGPTN flgptn; wai_flg(FLG1, 0x01U, TWF_ORW, &flgptn); }
void Cal_FormatPstoreSPI(void) { #define MAX_BLK_PER_SEC 512 #define MAX_SEC_NUM 64 //FLGPTN uiFlag; //UINT32 uiKeyAct, uiKeyCode; UINT32 err; IRECT Rect = {0, 0, 320, 240}; //PSTORE PStore; PSFMT gFmtStruct = {MAX_BLK_PER_SEC,MAX_SEC_NUM}; //#NT#2014/05/20#KS Hung -begin #if (_DUAL_CARD_FUNC_ == ENABLE) //FileSys_Close(FST_TIME_INFINITE); System_OnStrgInit_PS(); #endif //#NT#2014/05/20#KS Hung -end Cal_FillRect(&Rect, _OSD_INDEX_BLACK); Rect.x = 56; Rect.y = 80; Rect.w = 212; Rect.h = 24; Cal_ShowStringByColor("Formatting SPI...", &Rect, _OSD_INDEX_WHITE, _OSD_INDEX_BLACK); // format SPI //PStore.uiSignature = 0x55AA55AA; //PStore.uiPSVersion = 0x0001; //PStore.uiPStoreSize = SysInit_GetPStoreSize(); err = PStore_Format(&gFmtStruct); debug_err(("Format PS Done.\r\n")); if (err == E_OK) { //Cal_RstCalRst(); //spark CalLens_ResetCalData(); Cal_ShowStringByColor("Format OK!", &Rect, _OSD_INDEX_GREEN, _OSD_INDEX_BLACK); } else { Cal_ShowStringByColor("Format failed!", &Rect, _OSD_INDEX_RED, _OSD_INDEX_BLACK); } Rect.y = 112; Cal_ShowStringByColor("Press any key to return.", &Rect, _OSD_INDEX_WHITE, _OSD_INDEX_BLACK); //#NT#2013/07/17#KS Hung -begin #if (0)//(SDIO2_SPI_SHARE_PIN == ENABLE) //FileSys_Open(GxStrg_GetDevice(0),FST_TIME_INFINITE); #endif //#NT#2013/07/17#KS Hung -end #if 0 while (1) { wai_flg(&uiFlag, FLG_ID_KEY, 0xffffffff, TWF_ORW | TWF_CLR); uiKeyAct = uiFlag & FLGKEY_ACT_MASK; uiKeyCode = uiFlag & FLGKEY_KEY_MASK; // check key if (uiKeyCode && uiKeyAct == FLGKEY_PRESSED) { break; } } #endif }
void task1( unsigned int arg ) { ER ercd; int i; T_RSYS rsys; CYG_TEST_INFO( "Task 1 running" ); // check initial state ercd = ref_sys( &rsys ); CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" ); CYG_TEST_CHECK( TSS_TSK == rsys.sysstat, "system state not TSS_TSK" ); // disable intrs and check state ercd = loc_cpu(); CYG_TEST_CHECK( E_OK == ercd, "loc_cpu bad ercd" ); ercd = ref_sys( &rsys ); CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" ); CYG_TEST_CHECK( TSS_LOC == rsys.sysstat, "system state not TSS_LOC" ); #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS // try an illegal op ercd = dly_tsk( 10 ); CYG_TEST_CHECK( E_CTX == ercd, "dly_tsk bad ercd !E_CTX" ); #endif // CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS // enable intrs and check state and a legal sleep ercd = unl_cpu(); CYG_TEST_CHECK( E_OK == ercd, "unl_cpu bad ercd" ); ercd = ref_sys( &rsys ); CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" ); CYG_TEST_CHECK( TSS_TSK == rsys.sysstat, "system state not TSS_TSK" ); ercd = dly_tsk( 1 ); CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" ); // disable intrs and try scheduler illegal ops ercd = loc_cpu(); CYG_TEST_CHECK( E_OK == ercd, "loc_cpu bad ercd" ); ercd = ref_sys( &rsys ); CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" ); CYG_TEST_CHECK( TSS_LOC == rsys.sysstat, "system state not TSS_LOC" ); #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS ercd = dis_dsp(); CYG_TEST_CHECK( E_CTX == ercd, "dis_dsp bad ercd !E_CTX" ); ercd = ena_dsp(); CYG_TEST_CHECK( E_CTX == ercd, "ena_dsp bad ercd !E_CTX" ); #endif // CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS // enable again and check state ercd = unl_cpu(); CYG_TEST_CHECK( E_OK == ercd, "unl_cpu bad ercd" ); ercd = ref_sys( &rsys ); CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" ); CYG_TEST_CHECK( TSS_TSK == rsys.sysstat, "system state not TSS_TSK" ); // disable the scheduler and check state ercd = dis_dsp(); CYG_TEST_CHECK( E_OK == ercd, "dis_dsp bad ercd" ); ercd = ref_sys( &rsys ); CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" ); CYG_TEST_CHECK( TSS_DDSP == rsys.sysstat, "system state not TSS_DDSP" ); // disable intrs and check state ercd = loc_cpu(); CYG_TEST_CHECK( E_OK == ercd, "loc_cpu bad ercd" ); ercd = ref_sys( &rsys ); CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" ); CYG_TEST_CHECK( TSS_LOC == rsys.sysstat, "system state not TSS_LOC" ); // then unlock and check state ercd = unl_cpu(); CYG_TEST_CHECK( E_OK == ercd, "unl_cpu bad ercd" ); ercd = ref_sys( &rsys ); CYG_TEST_CHECK( E_OK == ercd, "ref_sys bad ercd" ); CYG_TEST_CHECK( TSS_TSK == rsys.sysstat, "system state not TSS_TSK" ); CYG_TEST_PASS( "Interrupt dis/enabling and interactions" ); // and now we can do the rest of the test #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS ercd = rel_wai( 2 ); CYG_TEST_CHECK( E_OBJ == ercd, "rel_wai bad ercd !E_OBJ" ); ercd = rel_wai( 1 ); CYG_TEST_CHECK( E_OBJ == ercd, "rel_wai(me) bad ercd !E_OBJ" ); ercd = rel_wai( -6 ); CYG_TEST_CHECK( E_ID == ercd, "rel_wai bad ercd !E_ID" ); ercd = rel_wai( 99 ); CYG_TEST_CHECK( E_ID == ercd, "rel_wai bad ercd !E_ID" ); #endif // we can test bad param error returns ercd = dis_dsp(); CYG_TEST_CHECK( E_OK == ercd, "dis_dsp bad ercd" ); ercd = sta_tsk( 2, 22222 ); CYG_TEST_CHECK( E_OK == ercd, "sta_tsk bad ercd" ); ercd = chg_pri( 2, 5 ); CYG_TEST_CHECK( E_OK == ercd, "chg_pri bad ercd" ); ercd = ena_dsp(); CYG_TEST_CHECK( E_OK == ercd, "ena_dsp bad ercd" ); #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS ercd = rel_wai( 2 ); CYG_TEST_CHECK( E_OBJ == ercd, "rel_wai bad ercd !E_OBJ" ); ercd = rel_wai( 1 ); CYG_TEST_CHECK( E_OBJ == ercd, "rel_wai(me) bad ercd !E_OBJ" ); #endif // we can test bad param error returns ercd = wai_sem( 1 ); CYG_TEST_CHECK( E_RLWAI == ercd, "wai_sem bad ercd !E_RLWAI" ); ercd = twai_sem( 1, 20 ); CYG_TEST_CHECK( E_RLWAI == ercd, "twai_sem bad ercd !E_RLWAI" ); ercd = wai_flg( &scratch, 1, 9999, 0 ); CYG_TEST_CHECK( E_RLWAI == ercd, "wai_flg bad ercd !E_RLWAI" ); ercd = twai_flg( &scratch, 1, 9999, 0, 10 ); CYG_TEST_CHECK( E_RLWAI == ercd, "twai_flg bad ercd !E_RLWAI" ); ercd = rcv_msg( &t_msg, 1 ); CYG_TEST_CHECK( E_RLWAI == ercd, "rcv_msg bad ercd !E_RLWAI" ); ercd = trcv_msg( &t_msg, 1, 10 ); CYG_TEST_CHECK( E_RLWAI == ercd, "trcv_msg bad ercd !E_RLWAI" ); // these are loops so as to consume the whole of the mempool // in order to wait at the end for ( i = 0; i < 10; i++ ) if ( E_OK != (ercd = get_blf( &vp, 3 ) ) ) break; CYG_TEST_CHECK( E_RLWAI == ercd, "get_blf bad ercd !E_RLWAI" ); for ( i = 0; i < 10; i++ ) if ( E_OK != (ercd = tget_blf( &vp, 3, 10 ) ) ) break; CYG_TEST_CHECK( E_RLWAI == ercd, "tget_blf bad ercd !E_RLWAI" ); for ( i = 0; i < 10; i++ ) if ( E_OK != (ercd = get_blk( &vp, 1, 1000 ) ) ) break; CYG_TEST_CHECK( E_RLWAI == ercd, "get_blk bad ercd !E_RLWAI" ); for ( i = 0; i < 10; i++ ) if ( E_OK != (ercd = tget_blk( &vp, 1, 1000, 10 ) ) ) break; CYG_TEST_CHECK( E_RLWAI == ercd, "tget_blk bad ercd !E_RLWAI" ); ercd = dly_tsk( 10 ); CYG_TEST_CHECK( E_RLWAI == ercd, "dly_tsk bad ercd !E_RLWAI" ); ercd = tslp_tsk( 10 ); CYG_TEST_CHECK( E_RLWAI == ercd, "tslp_tsk bad ercd !E_RLWAI" ); ercd = slp_tsk(); CYG_TEST_CHECK( E_RLWAI == ercd, "slp_tsk bad ercd !E_RLWAI" ); ercd = ter_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "ter_tsk bad ercd" ); ercd = dly_tsk( 10 ); CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" ); CYG_TEST_PASS("release wait: various waiting calls"); // all done CYG_TEST_EXIT( "All done" ); ext_tsk(); }
UINT32 ECS_Adjust(void) { CAL_ECS_PARAM ECSParam; UINT32 BufAddr; UINT32 ErrorCode = CAL_ERR_NULL; ER Error_check; UINT32 PrvMode = SENSOR_MODE_1280X960; CAL_AE_INFO AeSetting; UINT32 i; FLGPTN uiFlag = 0; Error_check = get_blk((void *)&(BufAddr), POOL_ID_ECS); if(Error_check != E_OK) { ; } else { rel_blk(POOL_ID_ECS, (VP)BufAddr); } debug_err(("POOL_ID_ECS Addr=0x%x\r\n",BufAddr)); //memset((void *)BufAddr, 0x10040100, POOL_SIZE_ECS); for(i=0;i<ECS_MAX;i++) *(UINT32 *)(BufAddr + i*4) = 0x10040100; Cal_ClearOSD(_OSD_INDEX_TRANSPART); Cal_ShowStringWithColor("Face Light and Press SHUTTER",20, 80, 3); clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW | TWF_CLR); Cal_ClearOSD(_OSD_INDEX_TRANSPART); AAA_Adjust.ECS_Status = 0; Cal_SetCalData(CAL_DATANUM_STATUS_ECS, (UINT*)&AAA_Adjust.ECS_Status); Cal_SetMode(IPL_MODE_OFF, 0); // Set IPP to preview Cal_SetMode(IPL_MODE_PREVIEW, PrvMode); // Lock 3A, FD and SD Cal_Lock3A(1); Photo_WaitPhotoIdle(TRUE, (PHOTO_1ST|PHOTO_2ND|PHOTO_3RD|PHOTO_AE|PHOTO_AWB)); // AE setting AeSetting.uiTarget = 150; AeSetting.uiLum = 0; AeSetting.uiAEType = AE_FIX_TIME; AeSetting.uiCAType = CAL_CASOURCE_SUBOUT; AeSetting.uiExpT = 4167; AeSetting.uiISO = 100; AeSetting.uiAdjStep = 1; AeSetting.uiTimeout = 300; AeSetting.uiResult = 0; Cal_WaitAeStable(&AeSetting); //AWBParam.uiBayAddr = Buffer; ECSParam.uiCalibMode = SENSOR_MODE_FULL; ECSParam.uiOBofs = 0x28; ECSParam.uiMsht = 31500; ECSParam.uiCmpRatio= 100; // don't over than 100(%) ECSParam.bSaveRaw = FALSE; ECSParam.uiTableAddr= BufAddr; ECSParam.uiExpT = (AeSetting.uiExpT * 2); //Preview binning 2x ECSParam.uiISO = AeSetting.uiISO; Cal_ECSAdjust(&ECSParam); AAA_Adjust.ECS_Status = _ECS_Status; AAA_Adjust.ECS_Addr[ECS_FOV1] = ECSParam.uiTableAddr; Cal_SetCalData(CAL_DATANUM_STATUS_ECS, (UINT*)&AAA_Adjust.ECS_Status); Cal_SetCalData(CAL_DATANUM_ECS_Addr, (UINT*)&AAA_Adjust.ECS_Addr[ECS_FOV1]); // Set IPP to preview Cal_SetMode(IPL_MODE_PREVIEW, PrvMode); ErrorCode = CAL_ERR_OK; if(ErrorCode == CAL_ERR_OK) { Cal_WriteCalData(PSTORE_SEC_SENSOR); Cal_WriteCalData(PSTORE_SEC_ECS); } sprintf(CalStringBuffer,"ECS ErrorCode %d",(UINT)ErrorCode); Cal_ShowStringWithColor(CalStringBuffer,20, 120, 4); sprintf(CalStringBuffer,"Press SHUTTER to return"); Cal_ShowStringWithColor(CalStringBuffer,20, 160, 4); clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW | TWF_CLR); return ErrorCode; }
UINT32 DP_Adjust(void) { UINT8 ErrorCode; UINT32 BufAddr; ER Error_check; FLGPTN uiFlag = 0; Cal_SetCalData(CAL_DATANUM_STATUS_PrvDP_W, 0); Cal_SetCalData(CAL_DATANUM_STATUS_PrvDP_B, 0); Cal_SetCalData(CAL_DATANUM_STATUS_CapDP_W, 0); Cal_SetCalData(CAL_DATANUM_STATUS_CapDP_B, 0); //get DP address & clear status Error_check = get_blk((void *)&(BufAddr), POOL_ID_DEFECT_PIXEL); if(Error_check != E_OK) { ; } else { rel_blk(POOL_ID_DEFECT_PIXEL, (VP)BufAddr); } memset((void *)BufAddr, 0x0, POOL_SIZE_DEFECT_PIXEL); Cal_ClearOSD(_OSD_INDEX_TRANSPART); Cal_ShowStringWithColor("Face Light and Press SHUTTER",20, 80, 3); clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW | TWF_CLR); Cal_ClearOSD(_OSD_INDEX_TRANSPART); Cal_ShowStringWithColor("Process...",20, 80, 3); AAA_Adjust.DPC_Addr[DPC_PRV] = BufAddr; AAA_Adjust.DPC_Addr[DPC_CAP] = BufAddr + (DP_Prv_MAX<<2); AAA_Adjust.DPC_Num[DPC_PRV] = 0; AAA_Adjust.DPC_Num[DPC_CAP] = 0; AAA_Adjust.DP_Status.Prv_White = AAA_Adjust.DP_Status.Prv_Black = 0; AAA_Adjust.DP_Status.Cap_White = AAA_Adjust.DP_Status.Cap_Black = 0; ErrorCode = DP_Adjust_White(); Cal_ClearOSD(_OSD_INDEX_TRANSPART); sprintf(CalStringBuffer,"Prv Dark pixel %d",(UINT)AAA_Adjust.DPC_Num[DPC_PRV]); Cal_ShowStringWithColor(CalStringBuffer,20, 20, 4); sprintf(CalStringBuffer,"Cap Dark pixel %d",(UINT)AAA_Adjust.DPC_Num[DPC_CAP]); Cal_ShowStringWithColor(CalStringBuffer,20, 60, 4); TimerDelayMs(1500); Cal_ClearOSD(_OSD_INDEX_TRANSPART); Cal_ShowStringWithColor("Cover Lens and Press SHUTTER",20, 80, 3); clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW | TWF_CLR); Cal_ClearOSD(_OSD_INDEX_TRANSPART); Cal_ShowStringWithColor("Process...",20, 80, 3); ErrorCode = DP_Adjust_Dark(); Cal_ClearOSD(_OSD_INDEX_TRANSPART); sprintf(CalStringBuffer,"Prv Total pixel %d",(UINT)AAA_Adjust.DPC_Num[DPC_PRV]); Cal_ShowStringWithColor(CalStringBuffer,20, 80, 4); sprintf(CalStringBuffer,"Cap Total pixel %d",(UINT)AAA_Adjust.DPC_Num[DPC_CAP]); Cal_ShowStringWithColor(CalStringBuffer,20, 100, 4); sprintf(CalStringBuffer,"DP ErrorCode %d",ErrorCode); Cal_ShowStringWithColor(CalStringBuffer,20, 120, 4); if(ErrorCode == CAL_ERR_OK) { Cal_WriteCalData(PSTORE_SEC_SENSOR); Cal_WriteCalData(PSTORE_SEC_DP); //Cal_ReadCalData(); } sprintf(CalStringBuffer,"Press SHUTTER to return"); Cal_ShowStringWithColor(CalStringBuffer,20, 160, 4); clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW | TWF_CLR); return ErrorCode; }
/* * Check command status * status = 0 on error and 1 on success. */ static unsigned int MMCSDCmdStatusGet(mmcsdCtrlInfo *ctrl) { unsigned int status = 0; #if DEBUG_PRINT volatile unsigned int timeOut2 = 5; #endif #if DEBUG_PRINT UARTprintf("%s()\r\n", __FUNCTION__); #endif #if DEBUG_PRINT /* Wait for these flags what will be modified by the MMCSDIsr() */ UARTprintf("0x%08x\r\n", intrStatus); while ((cmdCompFlag == 0) && (cmdTimeout == 0)) { UARTprintf("0x%08x\r\n", intrStatus); if(--timeOut2==0) { /* WARNING: This will clear the status register. No IRQs after this. */ intrStatus = MMCSDIntrStatusGetAndClr(ctrl->memBase); UARTprintf("0x%08x ACTUAL, GIVE UP\r\n", intrStatus); break; } delay(1000); } intrStatus = 0; #else FLGPTN flgptn, waiptn; ER ercd; /* Wait for these flags what will be modified by the MMCSDIsr() */ // while ((cmdCompFlag == 0) && (cmdTimeout == 0)) // continue; #if defined(DEBUG) && 0 syslog(LOG_ERROR, "%s(): wai_flg(MMCSD_ISR_FLGPTN_CMDCOMP | MMCSD_ISR_FLGPTN_CMDTIMEOUT)", __FUNCTION__); #endif waiptn = MMCSD_ISR_FLGPTN_CMDCOMP | MMCSD_ISR_FLGPTN_CMDTIMEOUT; ercd = wai_flg(MMCSD_ISR_FLG, waiptn, TWF_ORW, &flgptn); assert(ercd == E_OK); #if defined(DEBUG) && 0 syslog(LOG_ERROR, "%s(): clr_flg(MMCSD_ISR_FLG, ~0x%x)", __FUNCTION__, waiptn & flgptn); #endif ercd = clr_flg(MMCSD_ISR_FLG, ~(waiptn & flgptn)); assert(ercd == E_OK); #endif // if (cmdCompFlag) if (flgptn & MMCSD_ISR_FLGPTN_CMDCOMP) { status = 1; // cmdCompFlag = 0; } else // if (cmdTimeout) if (flgptn & MMCSD_ISR_FLGPTN_CMDTIMEOUT) { syslog(LOG_ERROR, "%s(): cmdTimeout!!", __FUNCTION__); status = 0; // cmdTimeout = 0; } #if DEBUG_PRINT UARTprintf("%s():status=%d\r\n", __FUNCTION__, status); #endif return(status); }
void PlaySoundTsk(void) { FLGPTN uiFlag; AUDIO_DEVICE_OBJ AudioDevice; AUDIO_BUF_QUEUE AudioBufQueue; //#NT#2010/01/20#JustinLee -begin //#Add wav header parsing before playing sound data WAV_FILEINFO WAVFileInfo; //#NT#2010/01/20#JustinLee -end while (1) { wai_flg(&uiFlag, FLG_ID_SOUND, FLGSOUND_STOP | FLGSOUND_PLAY, TWF_ORW | TWF_CLR); if (uiFlag & FLGSOUND_STOP) { if (g_uiPlaySoundStatus == PLAYSOUND_STS_PLAYING) { aud_stop(); aud_close(); g_uiPlaySoundStatus = PLAYSOUND_STS_STOPPED; set_flg(FLG_ID_SOUND, FLGSOUND_STOPPED); } } if (uiFlag & FLGSOUND_PLAY) { //#NT#2009/06/24#Chris Chung -begin //#NT#avoid re-entry to audio driver. if(aud_isBusy()) continue; //#NT#2009/06/24#Chris Chung -end g_uiPlaySoundStatus = PLAYSOUND_STS_PLAYING; clr_flg(FLG_ID_SOUND, FLGSOUND_STOPPED); // Open audio driver aud_getDeviceObject(&AudioDevice); AudioDevice.pEventHandler = PlaySound_AudioHdl; aud_open(&AudioDevice); switch (g_uiPlaySoundSound) { case PLAYSOUND_SOUND_STARTUP: case PLAYSOUND_SOUND_SHUTDOWN: // Parse header before playing if(PlaySound_ParseWAVHeader((UINT32)g_PowerOn_SoundKey.puiData, &WAVFileInfo) == TRUE) { // Set sampling rate and channel based on parameter aud_setSamplingRate(WAVFileInfo.AudioSamplingRate); aud_setChannel(WAVFileInfo.AudioChannel); // Set audio buffer queue addr and size AudioBufQueue.uiAddress = ((UINT32)g_PowerOn_SoundKey.puiData) + (sizeof(WAV_PCMHEADER)); AudioBufQueue.uiSize = WAVFileInfo.uiDataSize; } else { // Set sampling rate and channel manually aud_setSamplingRate(AUDIO_SR_32000); aud_setChannel(AUDIO_CH_LEFT); // Set audio buffer queue addr and size AudioBufQueue.uiAddress = (UINT32)g_PowerOn_SoundKey.puiData; AudioBufQueue.uiSize = g_PowerOn_SoundKey.uiSize; } break; case PLAYSOUND_SOUND_KEY_SHUTTER2: // Parse header before playing if(PlaySound_ParseWAVHeader((UINT32)g_Shutter_SoundKey.puiData, &WAVFileInfo) == TRUE) { // Set sampling rate and channel based on parameter aud_setSamplingRate(WAVFileInfo.AudioSamplingRate); aud_setChannel(WAVFileInfo.AudioChannel); // Set audio buffer queue addr and size AudioBufQueue.uiAddress = ((UINT32)g_Shutter_SoundKey.puiData) + (sizeof(WAV_PCMHEADER)); AudioBufQueue.uiSize = WAVFileInfo.uiDataSize; } else { // Set sampling rate and channel manually aud_setSamplingRate(AUDIO_SR_32000); aud_setChannel(AUDIO_CH_LEFT); // Set audio buffer queue addr and size AudioBufQueue.uiAddress = (UINT32)g_Shutter_SoundKey.puiData; AudioBufQueue.uiSize = g_Shutter_SoundKey.uiSize; } break; case PLAYSOUND_SOUND_KEY_OTHERS: // Parse header before playing if(PlaySound_ParseWAVHeader((UINT32)g_SoundKey.puiData, &WAVFileInfo) == TRUE) { // Set sampling rate and channel based on parameter aud_setSamplingRate(WAVFileInfo.AudioSamplingRate); aud_setChannel(WAVFileInfo.AudioChannel); // Set audio buffer queue addr and size AudioBufQueue.uiAddress = ((UINT32)g_SoundKey.puiData) + (sizeof(WAV_PCMHEADER)); AudioBufQueue.uiSize = WAVFileInfo.uiDataSize; } else { // Set sampling rate and channel manually aud_setSamplingRate(AUDIO_SR_32000); aud_setChannel(AUDIO_CH_LEFT); // Set audio buffer queue addr and size AudioBufQueue.uiAddress = (UINT32)g_SoundKey.puiData; AudioBufQueue.uiSize = g_SoundKey.uiSize; } break; default: aud_close(); continue; } // Set time code offset and first time code trigger value aud_setTimecodeOffset(0); aud_setTimecodeTrigger(AudioBufQueue.uiSize >> 1); // Reset audio buffer queue and add buffer to queue aud_resetBufferQueue(); aud_addBufferToQueue(&AudioBufQueue); // Start to play aud_playback(FALSE, TRUE); } } }
UINT32 CalLens_FocusStepMissTest(void) { UINT32 i; CHAR str[32]; extern UINT32 focusHomeDiff; extern UINT32 zoomHomeDiff; UINT32 StopFunc=0,StartFunc=0; /************************************************************/ debug_err(("\n\nRunning FocusMiss Test,Please wait..\r\n\n")); Cal_ClearOSD(_OSD_INDEX_TRANSPART); Cal_ShowStringWithColor("1. Run Focus Miss Test...",0,0,_OSD_INDEX_BLACK); Cal_ShowStringWithColor("2. Press shutter key",0,30,_OSD_INDEX_BLACK); #if 0 clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW|TWF_CLR); #else do { Delay_DelayMs(10); } while(DrvKey_DetNormalKey()!=FLGKEY_SHUTTER1); #endif Cal_ClearOSD(_OSD_INDEX_TRANSPART); /*************************************************************/ StopFunc |=UIAPP_PHOTO_AE; StopFunc |=UIAPP_PHOTO_AWB; StopFunc |=UIAPP_PHOTO_FD; StopFunc |=UIAPP_PHOTO_CAF; Ux_SendEvent(&CustomPhotoObjCtrl,NVTEVT_EXE_STOP_FUNC,2,StopFunc ,UIAPP_PHOTO_WAITIDLE); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_NULL); Input_SetKeyMask(KEY_RELEASE, FLGKEY_KEY_MASK_NULL); Input_SetKeyMask(KEY_CONTINUE, FLGKEY_KEY_MASK_NULL); Cal_ClearOSD(_OSD_INDEX_TRANSPART); Cal_ShowStringWithColor("1.Running Focus Miss Test...",0,0,_OSD_INDEX_BLACK); Lens_Zoom_SetPPS(300); Lens_Focus_SetPPS(500); Lens_Retract(0); Delay_DelayMs(500); Lens_Init(LENS_INIT_ZOOM_PART1); Lens_Init(LENS_INIT_ZOOM_PART2); for(i=0; i<2; i++) { lensDY5001A_test(); UILens_WaitZoomFinish(); Delay_DelayMs(500); } Lens_Retract(1); Delay_DelayMs(500); Lens_Init(LENS_INIT_ZOOM_PART1); Lens_Init(LENS_INIT_ZOOM_PART2); StartFunc = 0; StartFunc |=UIAPP_PHOTO_AE; StartFunc |=UIAPP_PHOTO_AWB; Ux_SendEvent(&CustomPhotoObjCtrl,NVTEVT_EXE_START_FUNC,2,StartFunc ,UIAPP_PHOTO_NOWAITIDLE); snprintf(str, 32, "2. Diff Zoom(%d),Focus(%d)", zoomHomeDiff, focusHomeDiff); Cal_ShowStringWithColor(str,0,30,_OSD_INDEX_BLACK); Cal_ShowStringWithColor("3. Press menu key to leave",0,60,_OSD_INDEX_BLACK); //CalLens_WaitKey(FLGKEY_MENU); do { Delay_DelayMs(10); } while(DrvKey_DetNormalKey()!=FLGKEY_MENU); do { Delay_DelayMs(10); } while(DrvKey_DetNormalKey()==FLGKEY_MENU); Delay_DelayMs(100); Ux_FlushEvent(); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_DEFAULT); Input_SetKeyMask(KEY_RELEASE, FLGKEY_KEY_MASK_DEFAULT); Input_SetKeyMask(KEY_CONTINUE, FLGKEY_KEY_MASK_DEFAULT); return 0; }
/** BurnIn main loop BurnIn main loop [CalBurnIn internal API] @param UINT32 uiOperation: Which operation you want to run BURNIN_OP_BURNIN (Burn In) BURNIN_OP_ZOOMAF (ZoomAF Lasting) BURNIN_OP_FLASH (Flash Lasting) BURNIN_OP_168H (168H) @return void */ static void Cal_BurnIn(UINT32 uiOperation) { UINT32 uiTimerID, uiFlag; UINT32 uiKeyFlagID, uiKeyEvent; // UINT32 uiOldPressConfig, uiOldReleaseConfig; UINT32 uiTotalIteration; UINT32 uiInterval; UINT32 uiEventCnt; PSIM_EVENT pSimEvent, pStartEvent; UINT8 uiKeyStatus, uiRepeatCnt; if(i2c_getLockStatus()) i2c_unlock(); // Open timer if (TIMEROpen((UINT *)&uiTimerID, Cal_BurnInTimerISR) != E_OK) { /* set_scankey_press_config(uiOldPressConfig); set_scankey_release_config(uiOldReleaseConfig); */ return; } switch (uiOperation) { case BURNIN_OP_BURNIN: //read cal status for check finish item ReadCalData(); FilesysFormat(Primary_GetStorageObj(PRIMARY_STGTYPE_NAND), TRUE); FilesysWaitCmdFinish(FST_TIME_INFINITE); FilesysFormat(Primary_GetStorageObj(PRIMARY_STGTYPE_NAND), TRUE); //if(Cal_CheckStatus()!= 0) // return ; uiTotalIteration = 40; //2hour //10 ; // 10*3 min = 30 mins pStartEvent = (PSIM_EVENT)&BurnInEvent; Primary_ChangeMode(PRIMARY_MODE_PHOTO); break; case BURNIN_OP_ZOOMAF: uiTotalIteration = 1000; pStartEvent = (PSIM_EVENT)&ZoomAFEvent; Primary_ChangeMode(PRIMARY_MODE_PHOTO); break; case BURNIN_OP_FLASH: FilesysWaitCmdFinish(FST_TIME_INFINITE); FilesysFormat(Primary_GetStorageObj(PRIMARY_STGTYPE_NAND), TRUE); uiTotalIteration = 8; //15 min * 8 = 2 hr pStartEvent = (PSIM_EVENT)&FlashEvent; Primary_ChangeMode(PRIMARY_MODE_PHOTO); SysSetFlag(FL_FLASH, FLASH_ON); break; case BURNIN_OP_168H: //read cal status for check finish item ReadCalData(); FilesysWaitCmdFinish(FST_TIME_INFINITE); FilesysFormat(Primary_GetStorageObj(PRIMARY_STGTYPE_NAND), TRUE); //if(Cal_CheckStatus()!= 0) // return ; uiTotalIteration = 0xFFFFFFFF; pStartEvent = (PSIM_EVENT)&BurnInEvent; Primary_ChangeMode(PRIMARY_MODE_PHOTO); break; case BURNIN_OP_10MIN: //read cal status for check finish item ReadCalData(); FilesysWaitCmdFinish(FST_TIME_INFINITE); FilesysFormat(Primary_GetStorageObj(PRIMARY_STGTYPE_NAND), TRUE); //if(Cal_CheckStatus()!= 0) // return ; uiTotalIteration = 10; // 3 min * 10 =30 mins pStartEvent = (PSIM_EVENT)&BurnInEvent; Primary_ChangeMode(PRIMARY_MODE_PHOTO); break; } // Init variable uiTimeoutValue = 0; // Enable timer and clear all flags clr_flg(FLG_ID_BURNIN, FLGBURNIN_ALL); TIMERSet(uiTimerID, TIMER_INTERVAL, _TIMER_CTRL_FREE_RUN | _TIMER_CTRL_INT_ENABLE, _TIMER_PLAY); for (uiIteration=1; uiIteration<=uiTotalIteration; uiIteration++) { debug_ind(("\n\r ***Loop = %ld,Event= %ld ***\r\n", uiIteration, uiEventCnt)); pSimEvent = pStartEvent; uiRepeatCnt = 0; uiInterval = 0; uiEventCnt = 0; if(uiOperation == BURNIN_OP_FLASH) { Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_EXE_SLIDE,1,SLIDE_5SEC); ImageInfoTable = FlashImageInfoTable; } else ImageInfoTable = BurnInImageInfoTable; Delay_DelayMs(2000); Cal_SetImageInfor_Value(uiRepeatCnt); while (1) { wai_flg((UINT *)&uiFlag, FLG_ID_BURNIN, FLGBURNIN_TIMER, TWF_ORW | TWF_CLR); uiInterval += TIMER_INTERVAL; //avoid display msg too much if(uiInterval%2000 == 0) Cal_BurnInShowLoop(uiIteration, uiEventCnt,uiRepeatCnt); //accumlate time until to interval;the post event if (uiInterval >= pSimEvent->uiInterval) { uiInterval = 0; #if 0 if((uiOperation == BURNIN_OP_BURNIN || uiOperation == BURNIN_OP_10MIN ) && (uiIteration == 4)) //about 10 min,run dark dp { Cal_BurnInLog(uiIteration,uiEventCnt,999); if(uiOperation == BURNIN_OP_10MIN) Cal_DPinBurnIn(FALSE); //not check dp status else Cal_DPinBurnIn(TRUE); // check dp status break; } #endif // End of event if (pSimEvent->uiKeyFlagID == SIM_END) { break; } // Wait for specific flag, or change mode else if (pSimEvent->uiKeyFlagID == FLG_ID_BURNIN) { if (pSimEvent->uiKeyEvent == FLGBURNIN_WAITING) { // Enable timeout uiTimeoutValue = pSimEvent->uiInterval; uiTimerCnt = 0; clr_flg(FLG_ID_BURNIN, FLGBURNIN_TIMEOUT); Cal_BurnInLog(uiIteration,uiEventCnt,uiRepeatCnt); wai_flg((UINT *)&uiFlag, FLG_ID_BURNIN, pSimEvent->uiKeyEvent | FLGBURNIN_TIMEOUT, TWF_ORW | TWF_CLR); if (uiFlag & FLGBURNIN_TIMEOUT) { debug_err(("Wait for specific flag timeout %d\r\n",pSimEvent->uiInterval)); } // Disable timeout uiTimeoutValue = 0; // Clear timer flag clr_flg(FLG_ID_BURNIN, FLGBURNIN_TIMER); uiRepeatCnt = 0; pSimEvent++; uiEventCnt++; debug_ind(("\n\rFLGBURNIN_WAITING ***Loop = %ld,Event= %ld ***\r\n", uiIteration, uiEventCnt)); continue; } } else // FLG_ID_KEY { //log current event Cal_BurnInLog(uiIteration,uiEventCnt,uiRepeatCnt); uiKeyFlagID = pSimEvent->uiKeyFlagID; uiKeyEvent = pSimEvent->uiKeyEvent; uiKeyStatus = pSimEvent->uiKeyStatus; // Set key event if (uiKeyFlagID != NULL && uiKeyEvent != NULL) { //change key event to post message if(uiKeyFlagID == FLG_ID_KEY) { /* NVTMSG msg; if(uiKeyStatus == KEY_STATUS_PRESS) SET_COMMAND(&msg, NVTEVT_KEY_PRESS); else SET_COMMAND(&msg, NVTEVT_KEY_RELEASE); debug_ind(("uiKeyEvent %x nvtcmd %x \r\n",uiKeyEvent ,Get_NVTCMD(uiKeyEvent))); SET_KEY_EVENT(&msg,Get_NVTCMD(uiKeyEvent)); PostMessage(&msg); */ if(uiKeyEvent & (Input_GetKeyMask(KEY_PRESS))) { debug_err(("Ux_PostEvent %d \r\n",uiKeyEvent)); Ux_PostEvent(Get_NVTCMD(uiKeyEvent), 1, Get_NVTCMD(uiKeyEvent)); } } else { set_flg(uiKeyFlagID, uiKeyEvent); } } } uiRepeatCnt++; // Move to next event if (uiRepeatCnt == pSimEvent->uiRepeatCnt) { uiRepeatCnt = 0; pSimEvent++; uiEventCnt++; debug_ind(("*****next event*Loop = %ld,Event= %ld ***************\r\n", uiIteration, uiEventCnt)); } if ((pSimEvent == pStartEvent)&&((uiOperation==BURNIN_OP_10MIN)||(uiOperation==BURNIN_OP_BURNIN) || (uiOperation==BURNIN_OP_168H) || (uiOperation==BURNIN_OP_FLASH)) ) { Delay_DelayMs(2000); //for set flash charg,so set capture index first Cal_SetImageInfor_Value(uiRepeatCnt); } } } } TIMERClose(uiTimerID); //tmp write to AAA for read cal data AAA_Adjust.ISO_Status = _ISO_Status; WriteCalData(); if(uiOperation == BURNIN_OP_FLASH) sprintf(LogStringBuf,"Flash O\r\n"); else sprintf(LogStringBuf,"BurnIn O\r\n"); Cal_ShowStringWithColor((INT8 *)LogStringBuf, 64,170, _OSD_INDEX_GREEN); #if 0 Menu_PowerOff(POWER_OFF); #endif while(1) ;; /* set_scankey_press_config(uiOldPressConfig); set_scankey_release_config(uiOldReleaseConfig); */ // Power off DSC after burn in done // Premier don't want to power off now (2005.10.16) /* if (uiOperation == BURNIN_OP_BURNIN) { PowerOffFlow(TRUE, FALSE); } */ }
UINT32 CalLens_NearFocusAdjust(void) { UINT32 i; UINT16 StartIdx, EndIdx; //UINT32 ErrorCode=ERRORCODE_OK; UINT32 AF_Step; UINT32 maxVA=0;//, minVA=0; UINT uiFlag=0; char str1[32]; BOOL bFocusNG = FALSE; IPL_OBJ IplObj; if(!CalLens_IsFarAdjust()) { //Cal_ShowStringWithColor("1. Adjust NG", 0, 0, CAL_COLOR_NG); //Cal_ShowStringWithColor("2. Please do AF Far first!", 0, 0, CAL_COLOR_NG); return 0; } ide_enable_video(IDE_VIDEOID_1); /************************************************************/ debug_err(("\n\nPlease let camera facing ISO chart. Then press shutter key\r\n\n")); //Cal_ClearScreen(); //Cal_ShowStringWithColor("1. Face ISO chart (near)", 0, 0, CAL_COLOR_MSG); //Cal_ShowStringWithColor("2. Press shutter key", 0, 30, CAL_COLOR_MSG); clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW|TWF_CLR); //Cal_ClearScreen(); /*************************************************************/ Photo_LockAE(1); Photo_LockAWB(1); Photo_LockFD(1); Photo_LockSD(1); Photo_WaitPhotoIdle(TRUE, (PHOTO_1ST|PHOTO_2ND|PHOTO_3RD)); sie_waitVD(1); KeyScan_Suspend(); for(i=0;i<Lens_Zoom_GetMaxSection();i++) { // Re-init lens { ide_disable_video(IDE_VIDEOID_1); IplObj.uiCmd = IPL_CMD_CHG_MODE; IplObj.Mode = IPL_MODE_OFF; IPL_SetCmd(&IplObj); Lens_Retract(0); TimerDelayMs(500); Lens_Init(LENS_INIT_ZOOM_PART1); Lens_Init(LENS_INIT_ZOOM_PART2); IplObj.uiCmd = IPL_CMD_CHG_MODE; IplObj.Mode = IPL_MODE_PREVIEW; IPL_SetCmd(&IplObj); ide_enable_video(IDE_VIDEOID_1); } Lens_Zoom_Goto(i+1); StartIdx = Lens_Focus_GetZoomTableValue(Lens_Zoom_GetSection(), 1); if(CalLens_IsFarAdjust()) EndIdx = gCalLens_Info.Far_Focus[i] - 3; else EndIdx = Lens_Focus_GetZoomTableValue(Lens_Zoom_GetSection(), 0); Lens_Focus_Goto(EndIdx); Photo_LockAE(1); ////WaitAeConverge2(120); if(i==0) AF_Step=5; else AF_Step=6; UILens_AFPrepare(TRUE); ////gCalLens_Info.Near_Focus[i]=AF_SearchFullRange7(StartIdx,EndIdx,AF_Step,&maxVA,&minVA,3,TRUE,FALSE); Lens_OnOff(MOTOR_POWER_OFF, 0); // turn off motor power UILens_AFPrepare(FALSE); //Cal_ClearScreen(); sprintf(str1, "S=%ld,Near=%ld,VA=%ld", i+1, gCalLens_Info.Near_Focus[i]-130, maxVA); //Cal_ShowStringWithColor(str1, 0, 10*(i/2), CAL_COLOR_MSG); if(CalLens_IsFarAdjust()) { if(gCalLens_Info.Far_Focus[i] < gCalLens_Info.Near_Focus[i]) bFocusNG = TRUE; } if(maxVA < 2500) { bFocusNG = TRUE; } } if(bFocusNG) gCalLens_Info.bNearAdjust = FALSE; else gCalLens_Info.bNearAdjust = TRUE; CalLens_WriteCalData(); KeyScan_Resume(); /************************************************************/ //Cal_ClearScreen(); //if(bFocusNG) // Cal_ShowStringWithColor("1. Adjust NG (near)", 0, 0, CAL_COLOR_NG); //else // Cal_ShowStringWithColor("1. Adjust done (near)", 0, 0, CAL_COLOR_OK); //Cal_ShowStringWithColor("2. Press left key to leave", 0, 30, CAL_COLOR_MSG); clr_flg(FLG_ID_KEY, FLGKEY_LEFT); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_LEFT, TWF_ORW|TWF_CLR); /*************************************************************/ if(bFocusNG) return CALLENS_STA_FAIL; else return CALLENS_STA_OK; }
void task1( unsigned int arg ) { ER ercd; int tests = 0; CYG_TEST_INFO( "Task 1 running" ); ercd = dis_dsp(); CYG_TEST_CHECK( E_OK == ercd, "dis_dsp bad ercd" ); ercd = sta_tsk( 2, 22222 ); CYG_TEST_CHECK( E_OK == ercd, "sta_tsk bad ercd" ); ercd = chg_pri( 2, 5 ); CYG_TEST_CHECK( E_OK == ercd, "chg_pri bad ercd" ); ercd = ena_dsp(); CYG_TEST_CHECK( E_OK == ercd, "ena_dsp bad ercd" ); ercd = dly_tsk( 10 ); CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" ); #ifdef CYGPKG_UITRON_SEMAS_CREATE_DELETE tests++; #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS ercd = del_sem( -6 ); CYG_TEST_CHECK( E_ID == ercd, "del_sem bad ercd !E_ID" ); ercd = del_sem( 99 ); CYG_TEST_CHECK( E_ID == ercd, "del_sem bad ercd !E_ID" ); ercd = cre_sem( -6, &t_csem ); CYG_TEST_CHECK( E_ID == ercd, "cre_sem bad ercd !E_ID" ); ercd = cre_sem( 99, &t_csem ); CYG_TEST_CHECK( E_ID == ercd, "cre_sem bad ercd !E_ID" ); #endif // we can test bad param error returns // try a pre-existing object ercd = cre_sem( 3, &t_csem ); CYG_TEST_CHECK( E_OBJ == ercd, "cre_sem bad ercd !E_OBJ" ); // delete it so we can play ercd = del_sem( 3 ); CYG_TEST_CHECK( E_OK == ercd, "del_sem bad ercd" ); // check it is deleted ercd = sig_sem( 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "sig_sem bad ercd !E_NOEXS" ); ercd = preq_sem( 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "preq_sem bad ercd !E_NOEXS" ); ercd = twai_sem( 3, 10 ); CYG_TEST_CHECK( E_NOEXS == ercd, "twai_sem bad ercd !E_NOEXS" ); ercd = wai_sem( 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "wai_sem bad ercd !E_NOEXS" ); ercd = ref_sem( &t_rsem, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "ref_sem bad ercd !E_NOEXS" ); #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS // now try creating it (badly) #ifndef CYGSEM_UITRON_PARAMS_NULL_IS_GOOD_PTR ercd = cre_sem( 3, NULL ); CYG_TEST_CHECK( E_PAR == ercd, "cre_sem bad ercd !E_PAR" ); #endif ercd = cre_sem( 3, NADR ); CYG_TEST_CHECK( E_PAR == ercd, "cre_sem bad ercd !E_PAR" ); t_csem.sematr = 0xfff; ercd = cre_sem( 3, &t_csem ); CYG_TEST_CHECK( E_RSATR == ercd, "cre_sem bad ercd !E_RSATR" ); t_csem.sematr = 0; #endif // we can test bad param error returns ercd = cre_sem( 3, &t_csem ); CYG_TEST_CHECK( E_OK == ercd, "cre_sem bad ercd" ); // and check we can use it ercd = sig_sem( 3 ); CYG_TEST_CHECK( E_OK == ercd, "sig_sem bad ercd" ); ercd = wai_sem( 3 ); CYG_TEST_CHECK( E_OK == ercd, "wai_sem bad ercd" ); ercd = preq_sem( 3 ); CYG_TEST_CHECK( E_TMOUT == ercd, "preq_sem bad ercd !E_TMOUT" ); ercd = twai_sem( 3, 2 ); CYG_TEST_CHECK( E_TMOUT == ercd, "twai_sem bad ercd !E_TMOUT" ); ercd = ref_sem( &t_rsem, 3 ); CYG_TEST_CHECK( E_OK == ercd, "ref_sem bad ercd" ); // now wait while task 2 deletes the wait objects ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = wai_sem( 1 ); CYG_TEST_CHECK( E_DLT == ercd, "wai_sem bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = twai_sem( 2, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "twai_sem bad ercd !E_DLT" ); // check they are deleted ercd = sig_sem( 1 ); CYG_TEST_CHECK( E_NOEXS == ercd, "sig_sem bad ercd !E_NOEXS" ); ercd = sig_sem( 2 ); CYG_TEST_CHECK( E_NOEXS == ercd, "sig_sem bad ercd !E_NOEXS" ); // re-create and do it again ercd = cre_sem( 1, &t_csem ); CYG_TEST_CHECK( E_OK == ercd, "cre_sem bad ercd" ); ercd = cre_sem( 2, &t_csem ); CYG_TEST_CHECK( E_OK == ercd, "cre_sem bad ercd" ); // now wait while task 2 deletes the wait objects again ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = wai_sem( 1 ); CYG_TEST_CHECK( E_DLT == ercd, "wai_sem bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = twai_sem( 2, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "twai_sem bad ercd !E_DLT" ); // check they are deleted ercd = sig_sem( 1 ); CYG_TEST_CHECK( E_NOEXS == ercd, "sig_sem bad ercd !E_NOEXS" ); ercd = sig_sem( 2 ); CYG_TEST_CHECK( E_NOEXS == ercd, "sig_sem bad ercd !E_NOEXS" ); CYG_TEST_PASS("create/delete semaphores"); #endif // CYGPKG_UITRON_SEMAS_CREATE_DELETE #ifdef CYGPKG_UITRON_FLAGS_CREATE_DELETE tests++; #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS ercd = del_flg( -6 ); CYG_TEST_CHECK( E_ID == ercd, "del_flg bad ercd !E_ID" ); ercd = del_flg( 99 ); CYG_TEST_CHECK( E_ID == ercd, "del_flg bad ercd !E_ID" ); ercd = cre_flg( -6, &t_cflg ); CYG_TEST_CHECK( E_ID == ercd, "cre_flg bad ercd !E_ID" ); ercd = cre_flg( 99, &t_cflg ); CYG_TEST_CHECK( E_ID == ercd, "cre_flg bad ercd !E_ID" ); #endif // we can test bad param error returns // try a pre-existing object ercd = cre_flg( 3, &t_cflg ); CYG_TEST_CHECK( E_OBJ == ercd, "cre_flg bad ercd !E_OBJ" ); // delete it so we can play ercd = del_flg( 3 ); CYG_TEST_CHECK( E_OK == ercd, "del_flg bad ercd" ); // check it is deleted ercd = set_flg( 3, 0x6789 ); CYG_TEST_CHECK( E_NOEXS == ercd, "set_flg bad ercd !E_NOEXS" ); ercd = clr_flg( 3, 0x9876 ); CYG_TEST_CHECK( E_NOEXS == ercd, "clr_flg bad ercd !E_NOEXS" ); ercd = pol_flg( &scratch, 3, 0xdddd, TWF_ANDW ); CYG_TEST_CHECK( E_NOEXS == ercd, "pol_flg bad ercd !E_NOEXS" ); ercd = twai_flg( &scratch, 3, 0x4444, TWF_ORW, 10 ); CYG_TEST_CHECK( E_NOEXS == ercd, "twai_flg bad ercd !E_NOEXS" ); ercd = wai_flg( &scratch, 3, 0xbbbb, TWF_ANDW | TWF_CLR ); CYG_TEST_CHECK( E_NOEXS == ercd, "wai_flg bad ercd !E_NOEXS" ); ercd = ref_flg( &t_rflg, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "ref_flg bad ercd !E_NOEXS" ); #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS // now try creating it (badly) #ifndef CYGSEM_UITRON_PARAMS_NULL_IS_GOOD_PTR ercd = cre_flg( 3, NULL ); CYG_TEST_CHECK( E_PAR == ercd, "cre_flg bad ercd !E_PAR" ); #endif ercd = cre_flg( 3, NADR ); CYG_TEST_CHECK( E_PAR == ercd, "cre_flg bad ercd !E_PAR" ); t_cflg.flgatr = 0xfff; ercd = cre_flg( 3, &t_cflg ); CYG_TEST_CHECK( E_RSATR == ercd, "cre_flg bad ercd !E_RSATR" ); #endif // we can test bad param error returns // now create it well t_cflg.flgatr = 0; t_cflg.iflgptn = 0; ercd = cre_flg( 3, &t_cflg ); CYG_TEST_CHECK( E_OK == ercd, "cre_flg bad ercd" ); // and check we can use it ercd = clr_flg( 3, 0x7256 ); CYG_TEST_CHECK( E_OK == ercd, "clr_flg bad ercd" ); ercd = set_flg( 3, 0xff ); CYG_TEST_CHECK( E_OK == ercd, "set_flg bad ercd" ); ercd = wai_flg( &scratch, 3, 0xaa, TWF_ANDW | TWF_CLR ); CYG_TEST_CHECK( E_OK == ercd, "wai_flg bad ercd" ); ercd = pol_flg( &scratch, 3, 0xaa, TWF_ANDW | TWF_CLR ); CYG_TEST_CHECK( E_TMOUT == ercd, "pol_flg bad ercd !E_TMOUT" ); ercd = twai_flg( &scratch, 3, 0xaa, TWF_ANDW | TWF_CLR, 2 ); CYG_TEST_CHECK( E_TMOUT == ercd, "twai_flg bad ercd !E_TMOUT" ); ercd = ref_flg( &t_rflg, 3 ); CYG_TEST_CHECK( E_OK == ercd, "ref_flg bad ercd" ); CYG_TEST_CHECK( 0 == t_rflg.flgptn, "ref_flg bad ercd" ); // now create it again with a preset pattern and check that we can // detect that pattern: ercd = del_flg( 3 ); CYG_TEST_CHECK( E_OK == ercd, "del_flg bad ercd" ); t_cflg.flgatr = 0; t_cflg.iflgptn = 0x1234; ercd = cre_flg( 3, &t_cflg ); CYG_TEST_CHECK( E_OK == ercd, "cre_flg bad ercd" ); // and check we can use it ercd = wai_flg( &scratch, 3, 0x1200, TWF_ANDW ); CYG_TEST_CHECK( E_OK == ercd, "wai_flg bad ercd" ); ercd = pol_flg( &scratch, 3, 0x0034, TWF_ANDW ); CYG_TEST_CHECK( E_OK == ercd, "pol_flg bad ercd" ); ercd = twai_flg( &scratch, 3, 0x1004, TWF_ANDW, 10 ); CYG_TEST_CHECK( E_OK == ercd, "twai_flg bad ercd" ); ercd = pol_flg( &scratch, 3, 0xffedcb, TWF_ORW ); CYG_TEST_CHECK( E_TMOUT == ercd, "pol_flg bad ercd !E_TMOUT" ); ercd = ref_flg( &t_rflg, 3 ); CYG_TEST_CHECK( E_OK == ercd, "ref_flg bad ercd" ); CYG_TEST_CHECK( 0x1234 == t_rflg.flgptn, "ref_flg bad ercd" ); ercd = clr_flg( 3, 0 ); ercd = ref_flg( &t_rflg, 3 ); CYG_TEST_CHECK( E_OK == ercd, "ref_flg bad ercd" ); CYG_TEST_CHECK( 0 == t_rflg.flgptn, "ref_flg bad ercd" ); // now wait while task 2 deletes the wait objects ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = wai_flg( &scratch, 1, 0xaa, TWF_ANDW ); CYG_TEST_CHECK( E_DLT == ercd, "wai_flg bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = twai_flg( &scratch, 2, 0x55, TWF_ANDW, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "twai_flg bad ercd !E_DLT" ); // check they are deleted ercd = set_flg( 1, 0x22 ); CYG_TEST_CHECK( E_NOEXS == ercd, "set_flg bad ercd !E_NOEXS" ); ercd = clr_flg( 2, 0xdd ); CYG_TEST_CHECK( E_NOEXS == ercd, "clr_flg bad ercd !E_NOEXS" ); // re-create and do it again t_cflg.iflgptn = 0x5555; ercd = cre_flg( 1, &t_cflg ); CYG_TEST_CHECK( E_OK == ercd, "cre_flg bad ercd" ); t_cflg.iflgptn = 0; ercd = cre_flg( 2, &t_cflg ); CYG_TEST_CHECK( E_OK == ercd, "cre_flg bad ercd" ); // now wait while task 2 deletes the wait objects again ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = wai_flg( &scratch, 1, 0xaaaa, TWF_ORW | TWF_CLR ); CYG_TEST_CHECK( E_DLT == ercd, "wai_flg bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = twai_flg( &scratch, 2, 0xffff, TWF_ORW, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "twai_flg bad ercd !E_DLT" ); // check they are deleted ercd = clr_flg( 1, 0xd00d ); CYG_TEST_CHECK( E_NOEXS == ercd, "clr_flg bad ercd !E_NOEXS" ); ercd = set_flg( 2, 0xfff00 ); CYG_TEST_CHECK( E_NOEXS == ercd, "set_flg bad ercd !E_NOEXS" ); CYG_TEST_PASS("create/delete flags"); #endif // CYGPKG_UITRON_FLAGS_CREATE_DELETE #ifdef CYGPKG_UITRON_MBOXES_CREATE_DELETE tests++; #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS ercd = del_mbx( -6 ); CYG_TEST_CHECK( E_ID == ercd, "del_mbx bad ercd !E_ID" ); ercd = del_mbx( 99 ); CYG_TEST_CHECK( E_ID == ercd, "del_mbx bad ercd !E_ID" ); ercd = cre_mbx( -6, &t_cmbx ); CYG_TEST_CHECK( E_ID == ercd, "cre_mbx bad ercd !E_ID" ); ercd = cre_mbx( 99, &t_cmbx ); CYG_TEST_CHECK( E_ID == ercd, "cre_mbx bad ercd !E_ID" ); #endif // we can test bad param error returns // try a pre-existing object ercd = cre_mbx( 3, &t_cmbx ); CYG_TEST_CHECK( E_OBJ == ercd, "cre_mbx bad ercd !E_OBJ" ); // delete it so we can play ercd = del_mbx( 3 ); CYG_TEST_CHECK( E_OK == ercd, "del_mbx bad ercd" ); // check it is deleted ercd = snd_msg( 3, t_msg ); CYG_TEST_CHECK( E_NOEXS == ercd, "snd_msg bad ercd !E_NOEXS" ); ercd = rcv_msg( &msg, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "rcv_msg bad ercd !E_NOEXS" ); ercd = trcv_msg( &msg, 3, 10 ); CYG_TEST_CHECK( E_NOEXS == ercd, "trcv_msg bad ercd !E_NOEXS" ); ercd = prcv_msg( &msg, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "prcv_msg bad ercd !E_NOEXS" ); ercd = ref_mbx( &t_rmbx, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "ref_mbx bad ercd !E_NOEXS" ); #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS // now try creating it (badly) #ifndef CYGSEM_UITRON_PARAMS_NULL_IS_GOOD_PTR ercd = cre_mbx( 3, NULL ); CYG_TEST_CHECK( E_PAR == ercd, "cre_mbx bad ercd !E_PAR" ); #endif ercd = cre_mbx( 3, NADR ); CYG_TEST_CHECK( E_PAR == ercd, "cre_mbx bad ercd !E_PAR" ); t_cmbx.mbxatr = 0xfff; ercd = cre_mbx( 3, &t_cmbx ); CYG_TEST_CHECK( E_RSATR == ercd, "cre_mbx bad ercd !E_RSATR" ); t_cmbx.mbxatr = 0; #endif // we can test bad param error returns ercd = cre_mbx( 3, &t_cmbx ); CYG_TEST_CHECK( E_OK == ercd, "cre_mbx bad ercd" ); // and check we can use it ercd = snd_msg( 3, t_msg ); CYG_TEST_CHECK( E_OK == ercd, "snd_msg bad ercd" ); ercd = rcv_msg( &msg, 3 ); CYG_TEST_CHECK( E_OK == ercd, "rcv_msg bad ercd" ); ercd = trcv_msg( &msg, 3, 2 ); CYG_TEST_CHECK( E_TMOUT == ercd, "trcv_msg bad ercd !E_TMOUT" ); ercd = prcv_msg( &msg, 3 ); CYG_TEST_CHECK( E_TMOUT == ercd, "prcv_msg bad ercd !E_TMOUT" ); ercd = ref_mbx( &t_rmbx, 3 ); CYG_TEST_CHECK( E_OK == ercd, "ref_mbx bad ercd" ); // now wait while task 2 deletes the wait objects ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = rcv_msg( &msg, 1 ); CYG_TEST_CHECK( E_DLT == ercd, "wai_mbx bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = trcv_msg( &msg, 2, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "twai_mbx bad ercd !E_DLT" ); // check they are deleted ercd = snd_msg( 1, t_msg ); CYG_TEST_CHECK( E_NOEXS == ercd, "snd_msg bad ercd !E_NOEXS" ); ercd = snd_msg( 2, t_msg ); CYG_TEST_CHECK( E_NOEXS == ercd, "snd_msg bad ercd !E_NOEXS" ); // re-create and do it again ercd = cre_mbx( 1, &t_cmbx ); CYG_TEST_CHECK( E_OK == ercd, "cre_mbx bad ercd" ); ercd = cre_mbx( 2, &t_cmbx ); CYG_TEST_CHECK( E_OK == ercd, "cre_mbx bad ercd" ); // now wait while task 2 deletes the wait objects again ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = rcv_msg( &msg, 1 ); CYG_TEST_CHECK( E_DLT == ercd, "wai_mbx bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = trcv_msg( &msg, 2, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "twai_mbx bad ercd !E_DLT" ); // check they are deleted ercd = snd_msg( 1, t_msg ); CYG_TEST_CHECK( E_NOEXS == ercd, "snd_msg bad ercd !E_NOEXS" ); ercd = snd_msg( 2, t_msg ); CYG_TEST_CHECK( E_NOEXS == ercd, "snd_msg bad ercd !E_NOEXS" ); CYG_TEST_PASS("create/delete mboxes"); #endif // CYGPKG_UITRON_MBOXES_CREATE_DELETE ercd = ter_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "ter_tsk bad ercd" ); ercd = dly_tsk( 5 ); CYG_TEST_CHECK( E_OK == ercd, "dly_tsk bad ercd" ); // all done if ( 0 == tests ) { CYG_TEST_NA( "No objects have create/delete enabled" ); } else { CYG_TEST_EXIT( "All done" ); } ext_tsk(); }
/* Returns 0 on error and 1 on success. */ static unsigned int MMCSDXferStatusGet(mmcsdCtrlInfo *ctrl) { unsigned int status = 0; /* Assume fail?????? */ // volatile unsigned int timeOut = 0xFFFF; volatile unsigned int timeOut = 1000; #if DEBUG_PRINT volatile unsigned int timeOut2 = 30; #endif #if DEBUG_PRINT // UARTprintf("%s():dmaEnable=%d,dmaIsRunning=%d\r\n", // __FUNCTION__, ctrl->dmaEnable, dmaIsRunning); syslog(LOG_ERROR, "%s():dmaEnable=%d,dmaIsRunning=%d", __FUNCTION__, ctrl->dmaEnable, dmaIsRunning); #endif #if DEBUG_PRINT /* Wait for these flags what will be modified by the MMCSDIsr() */ UARTprintf("0x%08x\r\n", intrStatus); while ((xferCompFlag == 0) && (dataTimeout == 0) && (dataCRCError==0)) { UARTprintf("0x%08x\r\n", intrStatus); if(--timeOut2==0) { /* WARNING: This will clear the status register. No IRQs after this. */ intrStatus = MMCSDIntrStatusGetAndClr(ctrl->memBase); UARTprintf("0x%08x ACTUAL, GIVE UP\r\n", intrStatus); break; } delay(1000); } intrStatus = MMCSDIntrStatusGetAndClr(ctrl->memBase); UARTprintf("intrStatus = 0x%08x\r\n", intrStatus); intrStatus = 0; #else FLGPTN flgptn, waiptn; ER ercd; /* Wait for these flags what will be modified by the MMCSDIsr() */ //while ((xferCompFlag == 0) && (dataTimeout == 0) && (dataCRCError==0)); #if defined(DEBUG) && 0 syslog(LOG_ERROR, "%s(): wai_flg(MMCSD_ISR_FLGPTN_XFERCOMP | MMCSD_ISR_FLGPTN_DATATIMEOUT | MMCSD_ISR_FLGPTN_DATACRCERR)", __FUNCTION__); #endif waiptn = MMCSD_ISR_FLGPTN_XFERCOMP | MMCSD_ISR_FLGPTN_DATATIMEOUT | MMCSD_ISR_FLGPTN_DATACRCERR; ercd = wai_flg(MMCSD_ISR_FLG, waiptn, TWF_ORW, &flgptn); assert(ercd == E_OK); #if defined(DEBUG) && 0 syslog(LOG_ERROR, "%s(): clr_flg(MMCSD_ISR_FLG, ~0x%x)", __FUNCTION__, waiptn & flgptn); #endif ercd = clr_flg(MMCSD_ISR_FLG, ~(waiptn & flgptn)); assert(ercd == E_OK); #endif //if (xferCompFlag) if (flgptn & MMCSD_ISR_FLGPTN_XFERCOMP) { status = 1; // xferCompFlag = 0; } //if (dataTimeout) if (flgptn & MMCSD_ISR_FLGPTN_DATATIMEOUT) { status = 0; // dataTimeout = 0; } //if (dataCRCError) if (flgptn & MMCSD_ISR_FLGPTN_DATACRCERR) { #if DEBUG_PRINT UARTprintf("%s():IGNORE CRC ERROR\r\n", __FUNCTION__); #endif status = 1; /* Ignore!! */ // dataCRCError = 0; assert(false); } /*TODO: How to stop DMA if timeout? Should I wait? */ /* Wait for DMA ISR to complete. Flag modified by DMA ISR callback() */ #if defined(DEBUG) && 0 syslog(LOG_ERROR, "%s(): wai_flg(MMCSD_ISR_FLGPTN_DMACOMP)", __FUNCTION__); #endif waiptn = MMCSD_ISR_FLGPTN_DMACOMP; ercd = twai_flg(MMCSD_ISR_FLG, waiptn, TWF_ORW, &flgptn, timeOut); assert(ercd == E_OK); if (ercd != E_OK) { // For debug syslog(LOG_ERROR, "Wait MMCSD_ISR_FLGPTN_DMACOMP failed."); while(1) { syslog(LOG_ERROR, "AINTC.SRSR1: 0x%08x", AINTC.SRSR1); syslog(LOG_ERROR, "AINTC.SECR1: 0x%08x", AINTC.SECR1); syslog(LOG_ERROR, "AINTC.ESR1: 0x%08x", AINTC.ESR1); syslog(LOG_ERROR, "EDMA3_CC0.IPR: 0x%08x", EDMA3_CC0.IPR); syslog(LOG_ERROR, "EDMA3_CC0.IER: 0x%08x", EDMA3_CC0.IER); syslog(LOG_ERROR, "EDMA3_CC0.IEVAL: 0x%08x", EDMA3_CC0.IEVAL); syslog(LOG_ERROR, "EDMA3_CC0.EEVAL: 0x%08x", EDMA3_CC0.EEVAL); syslog(LOG_ERROR, "EDMA3_CC0.CCERR: 0x%08x", EDMA3_CC0.CCERR); //syslog(LOG_ERROR, "EDMA3_TC0.ERRSTAT: 0x%08x", EDMA3_TC0.ERRSTAT); //syslog(LOG_ERROR, "EDMA3_TC1.ERRSTAT: 0x%08x", EDMA3_TC1.ERRSTAT); //syslog(LOG_ERROR, "EDMA3_TC2.ERRSTAT: 0x%08x", EDMA3_TC2.ERRSTAT); syslog(LOG_ERROR, "MMCST0: 0x%08x", MMCSDIntrStatusGetAndClr(ctrlInfo.memBase)); syslog(LOG_ERROR, "MMCST1: 0x%08x", MMCSD0.MMCST1); tslp_tsk(1000); } } #if defined(DEBUG) && 0 syslog(LOG_ERROR, "%s(): clr_flg(MMCSD_ISR_FLG, ~0x%x)", __FUNCTION__, waiptn & flgptn); #endif ercd = clr_flg(MMCSD_ISR_FLG, ~(waiptn & flgptn)); assert(ercd == E_OK); // while(dmaIsRunning) // { // if(--timeOut == 0) // { // assert(false); // TODO: DMA should never timeout! -- ertl-liyixiao // status = 0; // break; // } // } ctrl->dmaEnable = 0; #if DEBUG_PRINT // UARTprintf("%s():status=%d\r\n", __FUNCTION__, status); syslog(LOG_ERROR, "%s():return with status=%d\r\n", __FUNCTION__, status); #endif return(status); }
void task2(intptr_t exinf) { ER_UINT ercd; FLGPTN flgptn; T_RFLG rflg; check_point(4); ercd = wai_flg(FLG1, 0x05, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_assert(flgptn == 0x03); check_point(5); ercd = wai_flg(FLG1, 0x04, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(7); check_assert(flgptn == 0x07); ercd = wai_flg(FLG1, 0x03, TWF_ANDW, &flgptn); check_ercd(ercd, E_OK); check_assert(flgptn == 0x07); check_point(8); ercd = wai_flg(FLG1, 0x0c, TWF_ANDW, &flgptn); check_ercd(ercd, E_OK); check_point(11); check_assert(flgptn == 0x0f); ercd = wai_flg(FLG2, 0x05, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_assert(flgptn == 0x01); ercd = ref_flg(FLG2, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x00); ercd = set_flg(FLG2, 0x01); check_ercd(ercd, E_OK); check_point(12); ercd = wai_flg(FLG2, 0x04, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(15); check_assert(flgptn == 0x05); ercd = ref_flg(FLG2, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x00); ercd = set_flg(FLG2, 0x03); check_ercd(ercd, E_OK); ercd = wai_flg(FLG2, 0x03, TWF_ANDW, &flgptn); check_ercd(ercd, E_OK); check_assert(flgptn == 0x03); ercd = ref_flg(FLG2, &rflg); check_ercd(ercd, E_OK); check_assert(rflg.wtskid == TSK_NONE); check_assert(rflg.flgptn == 0x00); ercd = set_flg(FLG2, 0x03); check_ercd(ercd, E_OK); check_point(16); ercd = wai_flg(FLG2, 0x05, TWF_ANDW, &flgptn); check_ercd(ercd, E_OK); check_point(19); check_assert(flgptn == 0x07); check_point(20); ercd = wai_flg(FLG2, 0x01, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(23); check_assert(flgptn == 0x03); ercd = act_tsk(TASK3); check_ercd(ercd, E_OK); check_point(24); ercd = slp_tsk(); check_ercd(ercd, E_OK); check_point(27); ercd = wai_flg(FLG3, 0x02, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(29); ercd = wai_flg(FLG3, 0x02, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(33); ercd = wai_flg(FLG4, 0x02, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(35); ercd = wai_flg(FLG4, 0x02, TWF_ORW, &flgptn); check_ercd(ercd, E_OK); check_point(0); }
UINT32 AWB_Adjust(void) { CAL_AWB_PARAM AWBParam; UINT32 ErrorCode = CAL_ERR_OK; UINT32 GS_ercode = E_OK; CAL_AE_INFO AeSetting; UINT32 PrvMode = SENSOR_MODE_1280X960; FLGPTN uiFlag = 0; Cal_ClearOSD(_OSD_INDEX_TRANSPART); Cal_ShowStringWithColor("Face Light and Press SHUTTER",20, 80, 3); clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW | TWF_CLR); Cal_ClearOSD(_OSD_INDEX_TRANSPART); // Set IPP to OFF Cal_SetMode(IPL_MODE_OFF, 0); // Set IPP to preview Cal_SetMode(IPL_MODE_PREVIEW, PrvMode); // Lock 3A, FD and SD Cal_Lock3A(1); Photo_WaitPhotoIdle(TRUE, (PHOTO_1ST|PHOTO_2ND|PHOTO_3RD|PHOTO_AE|PHOTO_AWB)); // AE setting AeSetting.uiTarget = 120; AeSetting.uiLum = 0; AeSetting.uiAEType = AE_FIX_GAIN; AeSetting.uiCAType = CAL_CASOURCE_SUBOUT; AeSetting.uiExpT = 30000; AeSetting.uiISO = 100; AeSetting.uiAdjStep = 500; AeSetting.uiTimeout = 300; AeSetting.uiResult = 0; Cal_WaitAeStable(&AeSetting); //AWBParam.uiBayAddr = Buffer; AWBParam.uiAWBType = CAL_AWBTYPE_PREVIEW; AWBParam.uiOBofs = 0x28; AWBParam.uiMsht = 31500; AWBParam.bSaveRaw = FALSE; AWBParam.uiExpT = (AeSetting.uiExpT * 2); //Preview binning 2x AWBParam.uiISO = AeSetting.uiISO; Cal_AWBAdjust(&AWBParam); // Set IPP to preview Cal_SetMode(IPL_MODE_PREVIEW, PrvMode); debug_err(("R = %d G = %d B = %d\r\n", AWBParam.uiRGB[1], AWBParam.uiRGB[2], AWBParam.uiRGB[3])); AAA_Adjust.AWB.Rgain = AWBParam.uiRGB[2]*256/AWBParam.uiRGB[1]; AAA_Adjust.AWB.Bgain = AWBParam.uiRGB[2]*256/AWBParam.uiRGB[3]; AAA_Adjust.AWB_Status = _AWB_Status; GS_ercode = CheckAwbGS(); if(GS_ercode == E_OK) { sprintf(CalStringBuffer,"AWBGS: Rgain %d Bgain%d",AAA_Adjust.AWBGS.Rgain,AAA_Adjust.AWBGS.Bgain); Cal_ShowStringWithColor(CalStringBuffer,20, 40, 4); } else { sprintf(CalStringBuffer,"No AWBGS"); Cal_ShowStringWithColor(CalStringBuffer,20, 40, 4); } sprintf(CalStringBuffer,"AWB Rgain %d Bgain %d",(UINT)AAA_Adjust.AWB.Rgain,(UINT)AAA_Adjust.AWB.Bgain); Cal_ShowStringWithColor(CalStringBuffer,20, 60, 4); sprintf(CalStringBuffer,"AWB Adjust ErrorCode %d",(UINT)ErrorCode); Cal_ShowStringWithColor(CalStringBuffer,20, 80, 4); if (ErrorCode == CAL_ERR_OK) { Cal_WriteCalData(PSTORE_SEC_SENSOR); } sprintf(CalStringBuffer,"Press SHUTTER to return"); Cal_ShowStringWithColor(CalStringBuffer,20, 100, 4); clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW | TWF_CLR); return ErrorCode; }
/** Lens control task Lens control task to handle interrupt event. @param void @return void */ void LensCtrlTsk(void) { FLGPTN uiFlag; while (1) { set_flg(FLG_ID_LENS, FLGLENS_IDLE); wai_flg(&uiFlag, FLG_ID_LENS, FLGLENS_ZOOMFWD | FLGLENS_ZOOMREV | FLGLENS_ZOOMBRK | FLGLENS_ZOOMOFF | FLGLENS_ZOOMCHANGE | FLGLENS_FOCUSFWD | FLGLENS_FOCUSREV | FLGLENS_APERTUREMOVE | FLGLENS_SHUTTERMOVE | FLGLENS_POWEROFF , TWF_ORW | TWF_CLR); clr_flg(FLG_ID_LENS, FLGLENS_IDLE); if(gLensCtrlObj.pMotor == NULL) { LENS_ERR(("LENS_E: %s pMotor is null\r\n", __func__)); continue; } if(uiFlag & FLGLENS_ZOOMBRK) { gLensCtrlObj.pMotor->zoom_setState(MOTOR_ZOOM_BRAKE, 0); } if(uiFlag & FLGLENS_ZOOMFWD) { gLensCtrlObj.pMotor->zoom_setState(MOTOR_ZOOM_FWD, gLensCtrlParamObj.uiZoomStep); } if(uiFlag & FLGLENS_ZOOMREV) { gLensCtrlObj.pMotor->zoom_setState(MOTOR_ZOOM_BWD, gLensCtrlParamObj.uiZoomStep); } if(uiFlag & FLGLENS_ZOOMOFF) { gLensCtrlObj.pMotor->zoom_setState(MOTOR_ZOOM_OFF, 0); } if(uiFlag & FLGLENS_ZOOMCHANGE) { if(gLensCtrlObj.fpLensCB != NULL) { AlgMsgInfo AlgMsg; AlgMsg.OzoomIndex = gLensCtrlObj.pLens->zoom_getNextSection(); gLensCtrlObj.fpLensCB(ALGMSG_CHGOZOOMSTEP, &AlgMsg); } } if(uiFlag & FLGLENS_FOCUSFWD) { gLensCtrlObj.pMotor->focus_setState(MOTOR_FOCUS_FWD, gLensCtrlParamObj.uiFocusStep); } if(uiFlag & FLGLENS_FOCUSREV) { gLensCtrlObj.pMotor->focus_setState(MOTOR_FOCUS_BWD, gLensCtrlParamObj.uiFocusStep); } if(uiFlag & FLGLENS_APERTUREMOVE) { gLensCtrlObj.pMotor->aperture_setState(gLensCtrlParamObj.uiApertureState); } if(uiFlag & FLGLENS_SHUTTERMOVE) { gLensCtrlObj.pMotor->shutter_setState(gLensCtrlParamObj.uiShutterState); } if(uiFlag & FLGLENS_POWEROFF) { TimerDelayMs(LENS_MAX_WAIT_TIME); gLensCtrlObj.pMotor->changeMode(MOTOR_MODE_STANDBY); gLensCtrlObj.pMotor->power(MOTOR_POWER_OFF); } } }
UINT32 CalLens_FarFocusAdjust(void) { UINT32 i; UINT16 StartIdx, EndIdx; //UINT32 ErrorCode=ERRORCODE_OK; UINT32 AF_Step; UINT32 maxVA=0;//, minVA=0; UINT uiFlag=0; char str1[32]; BOOL bFocusNG = FALSE; IPL_OBJ IplObj; ide_enable_video(IDE_VIDEOID_1); /************************************************************/ debug_err(("\n\nPlease let camera facing ISO chart. Then press shutter key\r\n\n")); //Cal_ClearScreen(); //Cal_ShowStringWithColor("1. Face ISO chart (far)", 0, 0, CAL_COLOR_MSG); //Cal_ShowStringWithColor("2. Press shutter key", 0, 30, CAL_COLOR_MSG); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_RELEASE, 0x00); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_CONTINUE, 0x00); clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2 | FLGKEY_ACT_MASK); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW|TWF_CLR); //Cal_ClearScreen(); /*************************************************************/ Photo_LockAE(1); Photo_LockAWB(1); Photo_LockFD(1); Photo_LockSD(1); Photo_WaitPhotoIdle(TRUE, (PHOTO_1ST|PHOTO_2ND|PHOTO_3RD)); sie_waitVD(1); KeyScan_Suspend(); // Step1. Get zoom and focus BL. #if 1 { ide_disable_video(IDE_VIDEOID_1); sprintf(str1, "Please wait..."); //Cal_ShowStringWithColor(str1, 0, 0, CAL_COLOR_MSG); IplObj.uiCmd = IPL_CMD_CHG_MODE; IplObj.Mode = IPL_MODE_OFF; IPL_SetCmd(&IplObj); gCalLens_Info.uiLensZoomBL = CalLens_ZoomBLAdjust(); sprintf(str1, "zoomBL=%ld", gCalLens_Info.uiLensZoomBL); //Cal_ShowStringWithColor(str1, 0, 0, CAL_COLOR_MSG); Lens_Init(LENS_INIT_ZOOM_PART1); Lens_Init(LENS_INIT_ZOOM_PART2); IplObj.uiCmd = IPL_CMD_CHG_MODE; IplObj.Mode = IPL_MODE_PREVIEW; IPL_SetCmd(&IplObj); ide_enable_video(IDE_VIDEOID_1); } #endif for(i=0;i<Lens_Zoom_GetMaxSection();i++) { // Re-init lens { ide_disable_video(IDE_VIDEOID_1); IplObj.uiCmd = IPL_CMD_CHG_MODE; IplObj.Mode = IPL_MODE_OFF; IPL_SetCmd(&IplObj); Lens_Retract(0); TimerDelayMs(500); Lens_Init(LENS_INIT_ZOOM_PART1); Lens_Init(LENS_INIT_ZOOM_PART2); IplObj.uiCmd = IPL_CMD_CHG_MODE; IplObj.Mode = IPL_MODE_PREVIEW; IPL_SetCmd(&IplObj); ide_enable_video(IDE_VIDEOID_1); } Lens_Zoom_Goto(i+1); StartIdx = Lens_Focus_GetZoomTableValue(Lens_Zoom_GetSection(), 1); EndIdx = Lens_Focus_GetZoomTableValue(Lens_Zoom_GetSection(), 0); Lens_Focus_Goto(EndIdx); Photo_LockAE(1); ////WaitAeConverge2(120); if(i==0) AF_Step=5; else AF_Step=6; UILens_AFPrepare(TRUE); ////gCalLens_Info.Far_Focus[i]=AF_SearchFullRange7(StartIdx,EndIdx,AF_Step,&maxVA,&minVA,3,TRUE,FALSE); Lens_OnOff(MOTOR_POWER_OFF, 0); // turn off motor power UILens_AFPrepare(FALSE); //Cal_ClearScreen(); sprintf(str1, "S=%ld,Far=%ld,VA=%ld", i+1, gCalLens_Info.Far_Focus[i]-130, maxVA); //Cal_ShowStringWithColor(str1, 0, 10*(i/2), CAL_COLOR_MSG); if(maxVA < 2500 || gCalLens_Info.Far_Focus[i] > (845+130)) //#NT#2011/01/14#Chris Chung { debug_msg("bFocusNG: maxVA=%d, Far_Focus[%d]=%d\r\n", maxVA, gCalLens_Info.Far_Focus[i]); bFocusNG = TRUE; } } if(bFocusNG) gCalLens_Info.bFarAdjust = FALSE; else gCalLens_Info.bFarAdjust = TRUE; CalLens_WriteCalData(); KeyScan_Resume(); /************************************************************/ //Cal_ClearScreen(); //if(bFocusNG) // Cal_ShowStringWithColor("1. Adjust NG (far)", 0, 0, CAL_COLOR_NG); //else // Cal_ShowStringWithColor("1. Adjust done (far)", 0, 0, CAL_COLOR_OK); //Cal_ShowStringWithColor("2. Press left key to leave", 0, 30, CAL_COLOR_MSG); clr_flg(FLG_ID_KEY, FLGKEY_LEFT); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_LEFT, TWF_ORW|TWF_CLR); /*************************************************************/ if(bFocusNG) return CALLENS_STA_FAIL; else return CALLENS_STA_OK; }
void UI_UpdateCfgFile(void) { #if 0 UINT32 uiKeyAct, uiKeyCode; FLGPTN uiFlag; #endif char* str; FST_FILE pFile; UINT32 uiFileSize; UINT8 *BgBuf; char *fileName; URECT Rect = {0, 0, 320, 240}; BOOL Ret =TRUE ; ER erReturn; PSTORE_SECTION_HANDLE* pSecHdl; // to save the handle of PStore section fileName = "A:\\NTCONFIG.bin"; FileSys_WaitFinish(); pFile = FileSys_OpenFile(fileName, FST_OPEN_READ); if (pFile == NULL) { debug_err(("open file error\r\n")); Ret =FALSE; } uiFileSize = FileSys_GetFileLen(fileName); // for small page nand USE_MSG(("file size = %d\r\n",uiFileSize)); //if file is null if (uiFileSize == 0) { USE_MSG(("file size is 0\r\n")); Ret =FALSE; } if (uiFileSize > CFG_MAX_FILESIZE) { USE_MSG(("file size is bigger = %d\r\n",uiFileSize)); Ret =FALSE; } //get_blk((void *)&BgBuf, POOL_ID_SICD); //rel_blk(POOL_ID_SICD, BgBuf); //SysGetSICDAddr((UINT32*)&BgBuf); BgBuf = (UINT8 *)OS_GetMempoolAddr(POOL_ID_APP); if (FileSys_ReadFile(pFile,BgBuf,&uiFileSize,FST_FLAG_NONE,NULL)!=FST_STA_OK) { USE_MSG(("file read failed\r\n")); Ret =FALSE; } FileSys_CloseFile(pFile); *BgBuf = LO_BYTE(LO_WORD(uiFileSize)); *(BgBuf+1) = HI_BYTE(LO_WORD(uiFileSize)); *(BgBuf+2) = LO_BYTE(HI_WORD(uiFileSize)); *(BgBuf+3) = HI_BYTE(HI_WORD(uiFileSize)); //PStore_EnablePS(); pSecHdl = PStore_OpenSection(PS_BG_CFG, PS_RDWR | PS_CREATE); if (pSecHdl == E_PS_SECHDLER) { debug_err(("Section open fail\r\n")); PStore_CloseSection(pSecHdl); //PStore_DisablePS(); Ret =FALSE; } erReturn = PStore_WriteSection(BgBuf, 0, SYSPARAM_SYSFLAG_LEN, pSecHdl); PStore_CloseSection(pSecHdl); if (erReturn != E_PS_OK) { debug_err(("PStore program error\r\n")); Ret =FALSE; } Cal_FillRect(&Rect, _OSD_INDEX_BLACK); Rect.x = 56; Rect.y = 108; Rect.w = 212; Rect.h = 24; if (Ret == FALSE) { str = "Update Cfg file error"; Cal_ShowStringByColor(str, &Rect, _OSD_INDEX_YELLOW, _OSD_INDEX_BLACK); }else { str = "Update Cfg file ok"; Cal_ShowStringByColor(str, &Rect, _OSD_INDEX_YELLOW, _OSD_INDEX_BLACK); } Delay_DelayMs(1000); if (Ret) { System_PowerOff(SYS_POWEROFF_NORMAL); } #if 0 clr_flg(FLG_ID_CALIBRATION, 0xffffffff); while (1) { wai_flg(&uiFlag, FLG_ID_CALIBRATION, 0xffffffff, TWF_ORW | TWF_CLR); debug_msg("^GuiFlag:%x\r\n",uiFlag); if (uiFlag) break; } #else Delay_DelayMs(1500); #endif }
void Cal_BurnInMenu(void) { UINT32 i,uiFlag =0; UINT32 uiSelectNum =0; UINT32 g_CalBurninItemNum =1; INT8 StringBuffer[32]; while(1) { #if 0 if(uiSelectNum == 0) sprintf(StringBuffer, "Burnin 0.5H"); else sprintf(StringBuffer, "Burnin 2H"); Cal_ShowStringWithColor(StringBuffer,20, 50+i*30,_OSD_INDEX_RED); #else //draw mulit line menu for(i=0;i<=g_CalBurninItemNum;i++) { if(i ==uiSelectNum) Cal_ShowStringWithColor(g_BurnInItem[i].pItemName,20, 50+i*30,_OSD_INDEX_RED); else Cal_ShowStringWithColor(g_BurnInItem[i].pItemName,20, 50+i*30,_OSD_INDEX_GRAY); } #endif wai_flg((UINT *)&uiFlag, FLG_ID_KEY, (FLGKEY_UP | FLGKEY_DOWN | FLGKEY_SHUTTER2 |FLGKEY_LEFT), TWF_ORW | TWF_CLR); if (uiFlag & FLGKEY_UP) { if(uiSelectNum == 0) { uiSelectNum = g_CalBurninItemNum; } else { uiSelectNum--; } } // Next item if (uiFlag & FLGKEY_DOWN) { if(uiSelectNum == g_CalBurninItemNum) { uiSelectNum = 0; } else { uiSelectNum++; } } if (uiFlag & FLGKEY_SHUTTER2) { if(uiSelectNum == 0) Cal_BurnIn10min(); else Cal_BurnInBurnIn(); } if (uiFlag & FLGKEY_LEFT) { break; } } }
UINT8 CalLens_FarFocusCalibration(void) { INT16 maxIdx = 0; INT16 StartIdx,EndIdx; UINT AF_Step; char str1[32]; UINT32 maxVA; BOOL bFocusNG = FALSE; UINT32 StopFunc=0,StartFunc=0; UINT32 tempFrequency=0; UINT32 zoomSection; /************************************************************/ debug_err(("\n\nPlease let camera facing ISO chart. Then press shutter key\r\n\n")); Cal_ClearOSD(_OSD_INDEX_TRANSPART); Cal_ShowStringWithColor("1. Face ISO chart (far(3m))",0,0,_OSD_INDEX_BLACK); Cal_ShowStringWithColor("2. Press shutter key",0,30,_OSD_INDEX_BLACK); #if 0 clr_flg(FLG_ID_KEY, FLGKEY_SHUTTER2); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_SHUTTER2, TWF_ORW|TWF_CLR); #else do { Delay_DelayMs(10); } while(DrvKey_DetNormalKey()!=FLGKEY_SHUTTER1); #endif Cal_ClearOSD(_OSD_INDEX_TRANSPART); /*************************************************************/ //tempFrequency = IPL_AlgGetUIInfo(IPL_SEL_FREQUENCY); //IPL_AlgSetUIInfo(IPL_SEL_FREQUENCY,SEL_FREQUENCY_50HZ); #if 1 StartFunc=0; StartFunc |=UIAPP_PHOTO_AE; Ux_SendEvent(&CustomPhotoObjCtrl,NVTEVT_EXE_START_FUNC,2,StartFunc ,UIAPP_PHOTO_NOWAITIDLE); AE_reset(); IPC_WaitVD(TRUE,IPL_ID_1); IPC_WaitVD(TRUE,IPL_ID_1); IPC_WaitVD(TRUE,IPL_ID_1); IPC_WaitVD(TRUE,IPL_ID_1); IPC_WaitVD(TRUE,IPL_ID_1); AE_Wait_Stable(3,60); StopFunc |=UIAPP_PHOTO_AE; Ux_SendEvent(&CustomPhotoObjCtrl,NVTEVT_EXE_STOP_FUNC,2,StopFunc ,UIAPP_PHOTO_WAITIDLE); #endif StopFunc |=UIAPP_PHOTO_AE; StopFunc |=UIAPP_PHOTO_AWB; StopFunc |=UIAPP_PHOTO_FD; StopFunc |=UIAPP_PHOTO_CAF; Ux_SendEvent(&CustomPhotoObjCtrl,NVTEVT_EXE_STOP_FUNC,2,StopFunc ,UIAPP_PHOTO_WAITIDLE); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_NULL); Input_SetKeyMask(KEY_RELEASE, FLGKEY_KEY_MASK_NULL); Input_SetKeyMask(KEY_CONTINUE, FLGKEY_KEY_MASK_NULL); Lens_Zoom_SetPPS(300); Lens_Focus_SetPPS(500); Lens_Init(LENS_INIT_ZOOM_PART1); Lens_Init(LENS_INIT_ZOOM_PART2); if (gCalLens_Info.bFocusBLCal == FALSE) { gCalLens_Info.uiLensFocusBL = CalLens_FocusBLCalibration(); } UILens_AFPrepare(TRUE); AF_Step=4; for(zoomSection=Lens_Zoom_GetSection(ZOOM_MIN_SECTION); zoomSection<=Lens_Zoom_GetSection(ZOOM_MAX_SECTION); zoomSection++) { //Lens_Focus_GotoHome(); Lens_Zoom_GoSection(zoomSection); #if 0 StartFunc=0; StartFunc |=UIAPP_PHOTO_AE; Ux_SendEvent(&CustomPhotoObjCtrl,NVTEVT_EXE_START_FUNC,2,StartFunc ,UIAPP_PHOTO_NOWAITIDLE); AE_reset(); IPC_WaitVD(TRUE,IPL_ID_1); IPC_WaitVD(TRUE,IPL_ID_1); IPC_WaitVD(TRUE,IPL_ID_1); IPC_WaitVD(TRUE,IPL_ID_1); IPC_WaitVD(TRUE,IPL_ID_1); AE_Wait_Stable(3,60); StopFunc |=UIAPP_PHOTO_AE; Ux_SendEvent(&CustomPhotoObjCtrl,NVTEVT_EXE_STOP_FUNC,2,StopFunc ,UIAPP_PHOTO_WAITIDLE); #endif StartIdx = gCalLens_FocusRangeTable[zoomSection-1][0]; if(StartIdx > Lens_Focus_GetPosition(FOCUS_MAX_POSITION)) { StartIdx = Lens_Focus_GetPosition(FOCUS_MAX_POSITION); } Lens_Focus_Goto(StartIdx); if(CalLens_IsNearAdjust()) { EndIdx = CalLens_GetNearCalCompensation(zoomSection, FALSE); } else { EndIdx = gCalLens_FocusRangeTable[zoomSection-1][1]; } if(EndIdx < Lens_Focus_GetPosition(FOCUS_MIN_POSITION)) { EndIdx = Lens_Focus_GetPosition(FOCUS_MIN_POSITION); } if(AF_Step > 4) { maxIdx = AF_SearchFullRange(StartIdx, EndIdx, AF_Step, &maxVA, AF_VA_THRESHOLD_70PERCENTAGE); maxIdx = AF_SearchFullRange(maxIdx+AF_Step-4, maxIdx-AF_Step+4, 4, &maxVA, AF_VA_THRESHOLD_70PERCENTAGE); maxIdx = AF_SearchFullRange(maxIdx+3, maxIdx-3, 1, &maxVA, AF_VA_THRESHOLD_70PERCENTAGE); } else { maxIdx = AF_SearchFullRange(StartIdx, EndIdx, 4, &maxVA, AF_VA_THRESHOLD_70PERCENTAGE); maxIdx = AF_SearchFullRange(maxIdx+8, maxIdx-8, 1, &maxVA, AF_VA_THRESHOLD_70PERCENTAGE); } debug_msg("^G%s: Section = %d, maxIdx = %d\r\n", __func__, Lens_Zoom_GetSection(ZOOM_CUR_SECTION), maxIdx); gCalLens_Info.Far_Focus[zoomSection-1] = maxIdx; if(zoomSection==1) { snprintf(str1, 32, "S Step VA "); Cal_ShowStringWithColor(str1,0,16*(zoomSection/2),_OSD_INDEX_GREEN); Cal_ShowStringWithColor(str1,100,16*(zoomSection/2),_OSD_INDEX_GREEN); Cal_ShowStringWithColor(str1,200,16*(zoomSection/2),_OSD_INDEX_GREEN); snprintf(str1, 32, "%02d %03d %d", zoomSection, gCalLens_Info.Far_Focus[zoomSection-1], maxVA); } else snprintf(str1, 32, "%02d %03d %d", zoomSection, gCalLens_Info.Far_Focus[zoomSection-1], maxVA); if(maxVA > CALLENS_VA_WARNING) { if(zoomSection % 3 == 1) Cal_ShowStringWithColor(str1,0,16+16*((zoomSection-1)/3),_OSD_INDEX_BLACK); else if(zoomSection % 3 == 2) Cal_ShowStringWithColor(str1,100,16+16*((zoomSection-1)/3),_OSD_INDEX_RED); else Cal_ShowStringWithColor(str1,200,16+16*((zoomSection-1)/3),_OSD_INDEX_BLACK); } else { if(zoomSection % 3 == 1) Cal_ShowStringWithColor(str1,0,16+16*((zoomSection-1)/3),_OSD_INDEX_DARKGRAY); else if(zoomSection % 3 == 2) Cal_ShowStringWithColor(str1,100,16+16*((zoomSection-1)/3),_OSD_INDEX_DARKGRAY); else Cal_ShowStringWithColor(str1,200,16+16*((zoomSection-1)/3),_OSD_INDEX_DARKGRAY); if(maxVA < CALLENS_VA_NG) { bFocusNG =TRUE; Delay_DelayMs(2000); break; } } } for(zoomSection=Lens_Zoom_GetSection(ZOOM_MIN_SECTION); zoomSection<=Lens_Zoom_GetSection(ZOOM_MAX_SECTION); zoomSection++) { debug_msg("^G%s: gCalLens_Info.Far_Focus[%d] = %d\r\n", __func__,zoomSection-1 , gCalLens_Info.Far_Focus[zoomSection-1]); } gCalLens_Info.bFarAdjust = TRUE; if(CalLens_IsNearAdjust()) { for(zoomSection=1; zoomSection<=Lens_Zoom_GetSection(ZOOM_MAX_SECTION); zoomSection++) { if(CalLens_GetFarFocusCalStep(zoomSection) < CalLens_GetNearFocusCalStep(zoomSection)) bFocusNG = TRUE; if(bFocusNG) debug_msg("^RZoom=%2d FarFocusStep=%3d < NearFocusStep=%3d\r\n",zoomSection,CalLens_GetFarFocusCalStep(zoomSection),CalLens_GetNearFocusCalStep(zoomSection)); else debug_msg("^GZoom=%2d FarFocusStep=%3d > NearFocusStep=%3d\r\n",zoomSection,CalLens_GetFarFocusCalStep(zoomSection),CalLens_GetNearFocusCalStep(zoomSection)); } } if(bFocusNG) gCalLens_Info.bFarAdjust = FALSE; UILens_AFPrepare(FALSE); CalLens_WriteCalData(); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_DEFAULT); Input_SetKeyMask(KEY_RELEASE, FLGKEY_KEY_MASK_DEFAULT); Input_SetKeyMask(KEY_CONTINUE, FLGKEY_KEY_MASK_DEFAULT); IPL_AlgSetUIInfo(IPL_SEL_FREQUENCY,tempFrequency); StartFunc = 0; StartFunc |=UIAPP_PHOTO_AE; StartFunc |=UIAPP_PHOTO_AWB; Ux_SendEvent(&CustomPhotoObjCtrl,NVTEVT_EXE_START_FUNC,2,StartFunc ,UIAPP_PHOTO_NOWAITIDLE); Lens_Retract(0); Delay_DelayMs(1000); /************************************************************/ Cal_ClearOSD(_OSD_INDEX_TRANSPART); if(bFocusNG) Cal_ShowStringWithColor("1. Adjust NG (far(3m))",0,0,_OSD_INDEX_DARKGRAY); else Cal_ShowStringWithColor("1. Adjust done (far(3m))",0,0,_OSD_INDEX_BLACK); Cal_ShowStringWithColor("2. Press menu key to leave",0,30,_OSD_INDEX_BLACK); #if 0 clr_flg(FLG_ID_KEY, FLGKEY_ENTER); wai_flg(&uiFlag, FLG_ID_KEY, FLGKEY_ENTER, TWF_ORW|TWF_CLR); #else do { Delay_DelayMs(10); } while(DrvKey_DetNormalKey()!=FLGKEY_MENU); do { Delay_DelayMs(10); } while(DrvKey_DetNormalKey()==FLGKEY_MENU); Ux_FlushEvent(); #endif /*************************************************************/ return CALLENS_STA_OK; }