//ethan_20110801_readAllCalibrationData,for Systeminit only ER Cal_ReadCalData(void) { ER ercode; UINT tmpDataArea,ECSDataArea; ercode = get_blk((void *)&(tmpDataArea), POOL_ID_DEFECT_PIXEL); if(ercode != E_OK) { debug_err(("Get dpfect pixel buffer error!!\r\n")); } else { rel_blk(POOL_ID_DEFECT_PIXEL, (VP)tmpDataArea); memset((void *)tmpDataArea,0,POOL_SIZE_DEFECT_PIXEL); } ercode = get_blk((void *)&(ECSDataArea), POOL_ID_ECS); if(ercode != E_OK) { debug_err(("Get ECS buffer error!!\r\n")); } else { rel_blk(POOL_ID_ECS, (VP)ECSDataArea); memset((void *)ECSDataArea,0,POOL_SIZE_ECS); } ercode = Cal_ReadData(NULL); #if (_CALIBRATION_MODE_ == ENABLE) Cal_PassAdjustData(); #endif return ercode; }
/** Open Calibration task Open Calibration task @param PCAL_APPOBJ pCalObj: Calibration task object, specify memory available in calibration task. @return ER E_SYS: Task is already opened E_PAR: Parameter error (memory address or size is invalid) E_OK : Task opened correctly */ ER Cal_Open(void) { #if 0 UINT32 uiPoolAddr; CAL_APPOBJ CalAppObj; if (g_bCalbirationOpened == TRUE) { return E_SYS; } g_bCalbirationOpened = TRUE; //Get memory for calibartion task get_blk((VP *)&uiPoolAddr, POOL_ID_FB); rel_blk(POOL_ID_FB, (VP)uiPoolAddr); CalAppObj.uiMemoryAddr = uiPoolAddr; CalAppObj.uiMemorySize = END_MEM - uiPoolAddr - POOL_SIZE_RAM_DISK; CalAppObj.pCalApi = Cal_GetCalApi(); Cal_Init(&CalAppObj); #endif return E_OK; }
UINT8* UserPS_InitUniFontData(void) { PPSTORE_SECTION_HANDLE pSection; UINT32 uiReadSize; UINT8 *pMemPool; get_blk((void *)&pMemPool, POOL_ID_CAPTURE); rel_blk(POOL_ID_CAPTURE, pMemPool); // Read Unicode font data from PStore to this memory pool pMemPool = (pMemPool + POOL_SIZE_CAPTURE - POOL_SIZE_UNIFONT); //PStore_EnablePS(); if((pSection = PStore_OpenSection(PS_UNIFONT_DATA, PS_RDONLY)) != E_PS_SECHDLER) { // Get Unicode font data size first (leading 4 bytes) if(PStore_ReadSection(pMemPool, 0, 4, pSection) != E_PS_OK) { debug_err(("UserPS: PStore read Unicode font data size fail\r\n")); return NULL; } uiReadSize = MAKE_LONG(MAKE_WORD(pMemPool[0], pMemPool[1]), MAKE_WORD(pMemPool[2], pMemPool[3])); debug_err(("UserPS: Gotta read Unicode font data size = %ld\r\n", uiReadSize)); if(uiReadSize > POOL_SIZE_UNIFONT) { debug_err(("UserPS: Font data size too large!\r\n")); return NULL; } // Get Unicode font data if(PStore_ReadSection(pMemPool, 4, uiReadSize, pSection) != E_PS_OK) { debug_err(("UserPS: PStore read Unicode font data fail\r\n")); return NULL; } PStore_CloseSection(pSection); //PStore_DisablePS(); #if 0 //Just verify the data integrity FilesysReadWriteByName2(FST_CMD_WRITE_BY_NAME, "A:\\VFONT.BIN", (UINT8 *)(pMemPool), &uiReadSize, 0, FST_TIME_INFINITE); #endif } else { debug_err(("UserPS: PStore open section fail\r\n")); //PStore_DisablePS(); return NULL; } return pMemPool; }
void MsdcNvtCb_LcdGetFreeMem(void* pData) { tMSDCEXT_LCD_DRV_MEM_POOL_GET* pDesc = BEGIN_MSDC_NVT_CB(tMSDCEXT_LCD_DRV_MEM_POOL_GET,pData); if(pDesc==NULL) { debug_err(("MsdcNvtCb_LcdGetFreeMem(): is failed!\r\n")); return; } get_blk((void *)&pDesc->PoolAddr, POOL_ID_CAPTURE); rel_blk(POOL_ID_CAPTURE, (VP)pDesc->PoolAddr); pDesc->PoolSize = POOL_SIZE_CAPTURE; pDesc->tParent.bOK = TRUE; }
/* * Return variable size memory block */ SYSCALL ER _tk_rel_mpl( ID mplid, void *blk ) { MPLCB *mplcb; ER ercd = E_OK; CHECK_MPLID(mplid); CHECK_DISPATCH(); mplcb = get_mplcb(mplid); BEGIN_CRITICAL_SECTION; if ( mplcb->mplid == 0 ) { ercd = E_NOEXS; goto error_exit; } #if CHK_PAR if ( (B*)blk < (B*)mplcb->areaque.next || (B*)blk > (B*)mplcb->areaque.prev ) { ercd = E_PAR; goto error_exit; } #endif /* Free memory block */ ercd = rel_blk(mplcb, blk); if ( ercd < E_OK ) { goto error_exit; } /* Assign memory block to waiting task */ mpl_wakeup(mplcb); error_exit: END_CRITICAL_SECTION; return ercd; }
/** Initialize application for Photo mode Initialize application for Photo mode. @param void @return void */ void AppInit_ModePhoto(void) { UINT32 uiPoolAddr; PHOTO_APPOBJ PhotoObj; CAPTURE_APPOBJ CaptureObj; PHOTODISPLAY_APPOBJ PhotoDisplayObj; //#NT#2010/10/27#Connie Yu -begin //#NT#movie DIS update PHOTODIS_APPOBJ PhotoDisObj = {0}; //#NT#2010/10/27#Connie Yu -end #if(_WAVSTUDIO_MODE_ == ENABLE) WAVSTUDIO_APPOBJ WavObj; WAVSTUDIO_FMT WavFormat; #endif // Get memory for Capture task get_blk((VP *)&uiPoolAddr, POOL_ID_CAPTURE); rel_blk(POOL_ID_CAPTURE, (VP)uiPoolAddr); CaptureObj.uiMemoryAddr = uiPoolAddr; CaptureObj.uiMemorySize = POOL_SIZE_CAPTURE - POOL_SIZE_WAV; CaptureObj.CallBackFunc = (FPALGCALLBACK)FlowPhoto_ImageCB; //#NT#2009/07/30#Niven Cho -begin //#NT#Added., for MSDCExt with NVT #if (_MSDCVENDOR_== _MSDCVENDOR_NVT_) CaptureObj.CallBackFunc = MsdcNvt_HookImageCb(CaptureObj.CallBackFunc); #endif //#NT#2009/07/30#Niven Cho -end // Open Capture task if (ImgCapture_Open(&CaptureObj) == E_NOMEM) { debug_err(("Not enough memory for capture task\r\n")); } #if(_WAVSTUDIO_MODE_ == ENABLE) //#NT#2008/04/28#Chris Hsu -begin //#NT#Add sample code for bits per sample and user data WavFormat.AudioChannel = AUDIO_CH_RIGHT; WavFormat.AudioSamplingRate = AUDIO_SR_11025; #if (_VM_FORMAT_ == _VM_FORMAT_PCM8_) // PCM 8 bits WavFormat.AudioCodec = AUDIOCODEC_PCM; WavFormat.uiBitsPerSample = WAV_BITS_PER_SAM_PCM_8; #elif (_VM_FORMAT_ == _VM_FORMAT_PCM16_) // PCM 16 bits WavFormat.AudioCodec = AUDIOCODEC_PCM; WavFormat.uiBitsPerSample = WAV_BITS_PER_SAM_PCM_16; #elif (_VM_FORMAT_ == _VM_FORMAT_ADPCM_) // ADPCM WavFormat.AudioCodec = AUDIOCODEC_IMA_ADPCM; WavFormat.uiBitsPerSample = WAV_BITS_PER_SAM_ADPCM; #elif (_VM_FORMAT_ == _VM_FORMAT_ASFPCM_) // ASF PCM #if (WAVFILE_ASF_ENABLE == ENABLE) WavFormat.AudioCodec = AUDIOCODEC_PCM; WavFormat.FileFormat = WAVFILE_ASF; #endif #endif WavStudio_SetFormat(&WavFormat); // Set maximum recording time WavStudio_SetMaxRecTime(10); // Set user data #if (_WAV_SINGLE_USERDATA_ == ENABLE) WavStudio_SetUserData((UINT32)&g_uiWAVHeaderUserData, (UINT32)sizeof(g_uiWAVHeaderUserData)); #else WavStudio_SetUserData(0, 0); #endif // Set WAV application object WavObj.uiMemoryAddr = uiPoolAddr + POOL_SIZE_CAPTURE - POOL_SIZE_WAV; WavObj.uiMemorySize = POOL_SIZE_WAV; WavObj.WavStudioCB = (WAVSTUDIO_CB)FlowCommon_WAVStudioCB; //#NT#2008/04/28#Chris Hsu -end // Open Wav studio task if (WavStudio_Open(&WavObj) == E_NOMEM) { debug_err(("Not enough memory for wav studio task\r\n")); } #endif // Get memory for Photo task get_blk((VP *)&uiPoolAddr, POOL_ID_IQ); rel_blk(POOL_ID_IQ, (VP)uiPoolAddr); memset(&PhotoObj,0x00,sizeof(PhotoObj)); PhotoObj.uiMemoryAddr = uiPoolAddr; PhotoObj.uiMemorySize = POOL_SIZE_IQ; PhotoObj.uiDisplayFBWidth = g_LCDSize.uiWidth; PhotoObj.uiDisplayFBHeight = g_LCDSize.uiHeight; PhotoObj.CallBackFunc = (FPALGCALLBACK)FlowPhoto_ImageCB; //#NT#2009/07/30#Niven Cho -begin //#NT#Added., for MSDCExt with NVT #if (_MSDCVENDOR_== _MSDCVENDOR_NVT_) PhotoObj.CallBackFunc = MsdcNvt_HookImageCb(PhotoObj.CallBackFunc); #endif //#NT#2009/07/30#Niven Cho -end /* if (KeyScan_IsTVPlugIn() == TRUE) { PhotoObj.uiDisplayFBWidth = g_LCDSize.uiWidth >> 1; PhotoObj.uiDisplayFBHeight = g_LCDSize.uiHeight >> 1; } else { PhotoObj.uiDisplayFBWidth = g_LCDSize.uiWidth; PhotoObj.uiDisplayFBHeight = g_LCDSize.uiHeight; } */ // Open Photo task if (Photo_Open(&PhotoObj) == E_NOMEM) { debug_err(("Not enough memory for photo task\r\n")); } PhotoDisplayObj.uiDisplayFBWidth = g_LCDSize.uiWidth; PhotoDisplayObj.uiDisplayFBHeight = g_LCDSize.uiHeight; PhotoDisplayObj.uiDisplayOutWidth = g_LCDSize.uiWinWidth; PhotoDisplayObj.uiDisplayOutHeight = g_LCDSize.uiWinHeight; // Open PhotoDisplay task if (PhotoDisplay_Open(&PhotoDisplayObj) == E_NOMEM) { debug_err(("Not enough memory for photo display task\r\n")); } // Register AE/AWB/FD/SD function pointer Photo_RegisterAE((FPPHOTOAE)aaa_AEprocess); Photo_RegisterAWB((FPPHOTOAWB)aaa_AWBprocess); #if (_FD_FUNCTION_ == ENABLE) Photo_RegisterFD((FPPHOTOFD)fd_FDprocess); #endif #if (_SD_FUNCTION_ == ENABLE) Photo_RegisterSD((FPPHOTOSD)sd_SmileDetectionProcess); #endif // Open Photo DIS task //#NT#2010/10/27#Connie Yu -begin //#NT#movie DIS update PhotoDisObj.uiDisplayFBWidth = g_LCDSize.uiWidth; PhotoDisObj.uiDisplayFBHeight = g_LCDSize.uiHeight; PhotoDisObj.uiDisplayOutWidth = g_LCDSize.uiWinWidth; PhotoDisObj.uiDisplayOutHeight = g_LCDSize.uiWinHeight; if (PhotoDis_Open(&PhotoDisObj) == E_NOMEM) { debug_err(("Not enough memory for photo DIS task\r\n")); } //#NT#2010/10/27#Connie Yu -end PhotoDis_registerDIS((FPPHOTODIS)dis_accumUpdateProcess); }
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; }
//ethan_20110801_chg to read only specific section ER Cal_ReadData(UINT32 uisection) { UINT tmpDataArea,ECSDataArea; PPSTORE_SECTION_HANDLE pSectionHdl; ER Error_check; CPUCleanInvalidateDCacheBlock((UINT32)&AAA_Adjust, (UINT32)&AAA_Adjust + sizeof(AAA_Adjust)); CPUDrainWriteBuffer(); Error_check = get_blk((void *)&(tmpDataArea), POOL_ID_DEFECT_PIXEL); if(Error_check != E_OK) { debug_err(("Get dpfect pixel buffer error!!\r\n")); } else rel_blk(POOL_ID_DEFECT_PIXEL, (VP)tmpDataArea); //memset((void *)tmpDataArea,0,POOL_SIZE_DEFECT_PIXEL);//ethan_20110804_avoid to reset dp coordinate Error_check = get_blk((void *)&(ECSDataArea), POOL_ID_ECS); if(Error_check != E_OK) { debug_err(("Get ECS buffer error!!\r\n")); } else rel_blk(POOL_ID_ECS, (VP)ECSDataArea); //memset((void *)ECSDataArea,0,POOL_SIZE_ECS); // Enable PStore //PStore_EnablePS(); switch(uisection) { case PSTORE_SEC_SENSOR: if ((pSectionHdl = PStore_OpenSection(PS_CAL_HEAD, PS_RDWR)) != E_PS_SECHDLER) { PStore_ReadSection((UINT8 *)&AAA_Adjust, 0, sizeof(AAA_Adjust), pSectionHdl); PStore_CloseSection(pSectionHdl); } else debug_err(("Pstore open to read FAIL\r\n")); break; case PSTORE_SEC_DP: if ((pSectionHdl = PStore_OpenSection(PS_CAL_DATA, PS_RDWR)) != E_PS_SECHDLER) { AAA_Adjust.DPC_Addr[DPC_PRV] = tmpDataArea; PStore_ReadSection((UINT8 *)AAA_Adjust.DPC_Addr[DPC_PRV], sizeof(AAA_Adjust), (sizeof(UW)*(DP_Prv_MAX+DP_Cap_MAX)), pSectionHdl); PStore_CloseSection(pSectionHdl); } else debug_err(("Pstore open to read FAIL\r\n")); break; case PSTORE_SEC_ECS: if ((pSectionHdl = PStore_OpenSection(PS_CAL_DATA2, PS_RDWR)) != E_PS_SECHDLER) { AAA_Adjust.ECS_Addr[ECS_FOV1] = ECSDataArea; PStore_ReadSection((UINT8 *)AAA_Adjust.ECS_Addr[ECS_FOV1], sizeof(AAA_Adjust)+(sizeof(UW)*(DP_Prv_MAX+DP_Cap_MAX)), (sizeof(UW)*(ECS_MAX)), pSectionHdl); PStore_CloseSection(pSectionHdl); } else debug_err(("Pstore open to read FAIL\r\n")); break; default://read all section Cal_ReadData(PSTORE_SEC_SENSOR); Cal_ReadData(PSTORE_SEC_DP); Cal_ReadData(PSTORE_SEC_ECS); break; } // disable PStore // PStore_DisablePS(); #if (_CALIBRATION_MODE_ == ENABLE) Cal_PassAdjustData(); #endif return E_OK; }
/** Initialize application for USB PCC mode Initialize application for USB PCC mode. @param void @return void */ void AppInit_ModeUSBPCC(void) { USB_PCC_INFO PCCInfo = {0}; UINT32 uiPoolAddr; PHOTO_APPOBJ PhotoObj = {0}; //memset((void*)&PCCInfo, 0, sizeof(USB_PCC_INFO)); // Get memory for Photo task get_blk((VP *)&uiPoolAddr, POOL_ID_FB); rel_blk(POOL_ID_FB, (VP)uiPoolAddr); PhotoObj.uiMemoryAddr = uiPoolAddr; #if (_PCC_720P_FUNC_ == ENABLE) // SIE*2 IME(YUV422)*3 CA PhotoObj.uiMemorySize = (1280*960*2) + (1280*960*2*3) + 1280*960/4; PhotoObj.uiDisplayFBWidth = 1280; PhotoObj.uiDisplayFBHeight = 960; #else PhotoObj.uiMemorySize = POOL_SIZE_FB; PhotoObj.uiDisplayFBWidth = 640; PhotoObj.uiDisplayFBHeight = 480; #endif PhotoObj.CallBackFunc = (FPALGCALLBACK)FlowPhoto_ImageCB; // Register AE & AWB function pointer Photo_RegisterAE((FPPHOTOAE)AE_Process); Photo_RegisterAWB((FPPHOTOAWB)AWB_Process); // Register (disable) FD/SD function pointer Photo_RegisterFD(NULL); Photo_RegisterSD(NULL); // Open Photo task for AE & AWB if (Photo_Open(&PhotoObj) == E_NOMEM) { debug_err(("Not enough memory for photo task\r\n")); } //#NT#20100126#ethanlau -begin //add for Image pipeline from pcc 2 capture { CAPTURE_APPOBJ CaptureObj; // Get memory for Capture task get_blk((VP *)&uiPoolAddr, POOL_ID_CAPTURE); rel_blk(POOL_ID_CAPTURE, (VP)uiPoolAddr); CaptureObj.uiMemoryAddr = uiPoolAddr; CaptureObj.uiMemorySize = POOL_SIZE_CAPTURE - POOL_SIZE_WAV+POOL_SIZE_FB; CaptureObj.CallBackFunc = (FPALGCALLBACK)FlowPhoto_ImageCB; // Open Capture task if (ImgCapture_Open(&CaptureObj) == E_NOMEM) { debug_err(("Not enough memory for capture task\r\n")); } } //#NT#20100126#ethanlau -end //#NT#20100126#ethanlau -begin //remove this , agc is not setted by imgslicetsk anymore /* // Open ImgSliceTsk for set AGC, Modify by Iyen 20070702 ImgSliceOpen(); */ //#NT#20100126#ethanlau -end // Reserved capture buffer for image capturing and PCC use SICD buffer // Get memory for PCC task #if (_PCC_720P_FUNC_ == ENABLE) PCCInfo.UsbPccMemAdr = END_MEM - POOL_SIZE_PCC_HD; PCCInfo.UsbPccMemSize = POOL_SIZE_PCC_HD; PCCInfo.PccMaxSize = PCC_MAX_SIZE_HD; #else PCCInfo.UsbPccMemAdr = END_MEM - POOL_SIZE_PCC_VGA; PCCInfo.UsbPccMemSize = POOL_SIZE_PCC_VGA; PCCInfo.PccMaxSize = PCC_MAX_SIZE_VGA; #endif PCCInfo.BurnIn = NULL; PCCInfo.FlashRead = NULL; PCCInfo.IsFinish = NULL; //#NT#2009/07/13#Chris Chung -begin //#NT#add to control PCC vendor function PCCInfo.bEnableVendorFunc = g_bAppInitUSBPCCVendorFunc; //#NT#2009/07/13#Chris Chung -end //PCCInfo.VendorProcess = NULL; PCCInfo.VendorProcess = UsbCustomVerdorCmdCB; USBMakerInit_UPCC(&PCCInfo); if(UPccRegisterVendorCmd(0x80, 0xFF) != E_OK) { debug_err(("Register vendor command failed ! \r\n")); } if (UPccOpen(&PCCInfo) != E_OK) { debug_err(("Error open USB PCC task\r\n")); } }
void UI_BeginDisplay(UINT8 iDD, BOOL bClear) { RESULT r; LAYER_INIT LayerInit; UINT32 w = OSD_W;//g_LCDSize.uiWinWidth; UINT32 h = OSD_H;//g_LCDSize.uiWinHeight; UINT32 uiBufBlk; UINT32 uiBufAddr; switch(iDD) { case DD_OSD: uiBufBlk = POOL_ID_OSD1; get_blk((void *)&uiBufAddr, uiBufBlk); rel_blk((ID)uiBufBlk, (VP)uiBufAddr); LayerInit.uiType = TYPE_FB; #if (_OSD_COLOR_ == _OSD_COLOR_INDEX8_) LayerInit.uiPxlfmt = PXLFMT_INDEX8; #else LayerInit.uiPxlfmt = PXLFMT_INDEX4; #endif if (FWRotate_GetStatus()==TRUE) { LayerInit.uiWidth = h;//w; LayerInit.uiHeight = w;//h; } else { LayerInit.uiWidth = w; LayerInit.uiHeight = h; } if (FWRotate_GetStatus()==TRUE) { LayerInit.uiBufCount = 0; LayerInit.uiSwapEffect = SWAPEFFECT_DISCARD; } else { #ifdef OSD_USE_DOUBLE_BUFFER LayerInit.uiBufCount = 1; LayerInit.uiSwapEffect = SWAPEFFECT_COPY; #else LayerInit.uiBufCount = 0; LayerInit.uiSwapEffect = SWAPEFFECT_DISCARD; #endif } switch(LayerInit.uiPxlfmt) { case PXLFMT_INDEX1: LayerInit.uiBufSize = (w*h)>>3;break; case PXLFMT_INDEX2: LayerInit.uiBufSize = (w*h)>>2;break; case PXLFMT_INDEX4: LayerInit.uiBufSize = (w*h)>>1;break; case PXLFMT_INDEX8: LayerInit.uiBufSize = (w*h)>>0;break; } LayerInit.pBufAddr[0] = uiBufAddr; if (FWRotate_GetStatus()==TRUE) { LayerInit.pBufAddr[1] = 0; } else { #ifdef OSD_USE_DOUBLE_BUFFER LayerInit.pBufAddr[1] = uiBufAddr + LayerInit.uiBufSize; #else LayerInit.pBufAddr[1] = 0; #endif } if (FWRotate_GetStatus()==TRUE) LayerInit.pBufAddr[2] = uiBufAddr + (LayerInit.uiBufSize); else LayerInit.pBufAddr[2] = 0; LayerInit.win.x= 0; LayerInit.win.y = 0; if (FWRotate_GetStatus()==TRUE) { LayerInit.win.w = g_LCDSize.uiWinHeight;//g_LCDSize.uiWinWidth; LayerInit.win.h = g_LCDSize.uiWinWidth;//g_LCDSize.uiWinHeight; } else { LayerInit.win.w = g_LCDSize.uiWinWidth; LayerInit.win.h = g_LCDSize.uiWinHeight; } LayerInit.uiWinAttr = 0; //GxDisplay_InitScale(g_LCDSize.uiWinWidth, g_LCDSize.uiWinHeight); r = GxDisplay_InitLayer(LAYER_OSD1, &LayerInit, bClear); GxDisplay_WaitVD(); memset(&LocalDC, 0, sizeof(DC)); GxGfx_AttachDC(&LocalDC, TYPE_FB, PXLFMT_INDEX8, w, h, w, (UINT8*)(LayerInit.pBufAddr[2]), 0, 0); //initial DC palette #if (_OSD_COLOR_ == _OSD_COLOR_INDEX8_) //GxDisplay_SetPalette(LAYER_OSD1,0,256,gDemo_Palette_Palette); GxDisplay_SetPalette(LAYER_OSD1,0,256,gDemoKit_Palette_Palette); #else //GxDisplay_SetPalette(LAYER_OSD1,0,16,gDemo_Palette_Palette); GxDisplay_SetPalette(LAYER_OSD1,0,16,gDemoKit_Palette_Palette); #endif GxDisplay_Set(LAYER_OSD1, LAYER_STATE_ENABLE, 1); GxDisplay_Flush(LAYER_OSD1); break; case DD_VDO: uiBufBlk = POOL_ID_FB; get_blk((void *)&uiBufAddr, uiBufBlk); rel_blk((ID)uiBufBlk, (VP)uiBufAddr); LayerInit.uiType = TYPE_FB; LayerInit.uiPxlfmt = PXLFMT_YUV422; LayerInit.uiWidth = w; LayerInit.uiHeight = h; #ifdef VDO_USE_DOUBLE_BUFFER LayerInit.uiBufCount = 1; LayerInit.uiSwapEffect = SWAPEFFECT_COPY; #else LayerInit.uiBufCount = 0; LayerInit.uiSwapEffect = SWAPEFFECT_DISCARD; #endif switch(LayerInit.uiPxlfmt) { case PXLFMT_YUV422: LayerInit.uiBufSize = (w*h)*2;break; } LayerInit.pBufAddr[0] = uiBufAddr; #ifdef VDO_USE_DOUBLE_BUFFER LayerInit.pBufAddr[1] = uiBufAddr + LayerInit.uiBufSize; #else LayerInit.pBufAddr[1] = 0; #endif LayerInit.pBufAddr[2] = 0; LayerInit.win.x= 0; LayerInit.win.y = 0; LayerInit.win.w = w; LayerInit.win.h = h; r = GxDisplay_InitLayer(LAYER_VDO1, &LayerInit, FALSE); GxDisplay_WaitVD(); GxDisplay_Set(LAYER_VDO1, LAYER_STATE_ENABLE, 1); GxDisplay_Flush(LAYER_VDO1); #if 0 //initial DC temp buffer for JPEG decode uiBufBlk = POOL_ID_CAPTURE; get_blk((void *)&uiBufAddr, uiBufBlk); rel_blk((ID)uiBufBlk, (VP)uiBufAddr); GxGfx_AssignTempPool((UINT8*)uiBufAddr, POOL_SIZE_CAPTURE); #endif break; } //set default Pen ,text, image Strok,Pen Color GxGfx_SetAllDefault(); GxGfx_SetTextColor(CLRID_IDX_BLACK, CLRID_IDX_WHITE, TEXTFORECOLOR3_DEFAULT); GxGfx_SetImageStroke(ROP_KEY,IMAGEPARAM_DEFAULT); GxGfx_SetImageColor(CLRID_IDX_TRANSPART,IMAGEPARAM_DEFAULT); //initial general BR state GxGfx_SetImageTable((const IMAGE_TABLE*)&gDemoKit_Image); GxGfx_SetTextStroke((const FONT*)&gDemoKit_Font, FONTSTYLE_NORMAL, SCALE_1X); UIFontTable[FONT_TABLE_0] = (FONT*)(&gDemoKit_Font); UIFontTable[FONT_TABLE_1]= NULL; //mp3 font size is very large, only assigned whenever entering mp3 mode Ux_SetFontTable(UIFontTable); colorTable[0]=IMAGEMAPPING_DEFAULT; colorTable[1]=ColorMap1; colorTable[2]=ColorMap2; colorTable[3]=ColorMap3; colorTable[4]=ColorMap4; Ux_SetColorMapTable(colorTable); GxGfx_SetStringTable((const STRING_TABLE*)Get_LanguageValue(SysGetFlag(FL_LANGUAGE))); }
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_MEMPOOLFIXED_CREATE_DELETE tests++; #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS ercd = del_mpf( -6 ); CYG_TEST_CHECK( E_ID == ercd, "del_mpf bad ercd !E_ID" ); ercd = del_mpf( 99 ); CYG_TEST_CHECK( E_ID == ercd, "del_mpf bad ercd !E_ID" ); ercd = cre_mpf( -6, &t_cmpf ); CYG_TEST_CHECK( E_ID == ercd, "cre_mpf bad ercd !E_ID" ); ercd = cre_mpf( 99, &t_cmpf ); CYG_TEST_CHECK( E_ID == ercd, "cre_mpf bad ercd !E_ID" ); #endif // we can test bad param error returns // try a pre-existing object // [first get a valid block from it for the freeing test later] ercd = pget_blf( &vp, 3 ); CYG_TEST_CHECK( E_OK == ercd, "pget_blf bad ercd" ); ercd = cre_mpf( 3, &t_cmpf ); CYG_TEST_CHECK( E_OBJ == ercd, "cre_mpf bad ercd !E_OBJ" ); // delete it so we can play ercd = del_mpf( 3 ); CYG_TEST_CHECK( E_OK == ercd, "del_mpf bad ercd" ); // check it is deleted ercd = rel_blf( 3, vp ); // vp did come from this pool CYG_TEST_CHECK( E_NOEXS == ercd, "rel_blf bad ercd !E_NOEXS" ); ercd = pget_blf( &vp, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blf bad ercd !E_NOEXS" ); ercd = tget_blf( &vp, 3, 10 ); CYG_TEST_CHECK( E_NOEXS == ercd, "tget_blf bad ercd !E_NOEXS" ); ercd = get_blf( &vp, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "get_blf bad ercd !E_NOEXS" ); ercd = ref_mpf( &t_rmpf, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "ref_mpf 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_mpf( 3, NULL ); CYG_TEST_CHECK( E_PAR == ercd, "cre_mpf bad ercd !E_PAR" ); #endif ercd = cre_mpf( 3, NADR ); CYG_TEST_CHECK( E_PAR == ercd, "cre_mpf bad ercd !E_PAR" ); t_cmpf.mpfatr = 0xfff; ercd = cre_mpf( 3, &t_cmpf ); CYG_TEST_CHECK( E_RSATR == ercd, "cre_mpf bad ercd !E_RSATR" ); #endif // we can test bad param error returns t_cmpf.mpfatr = 0; t_cmpf.mpfcnt = 10000; t_cmpf.blfsz = 100; ercd = cre_mpf( 3, &t_cmpf ); CYG_TEST_CHECK( E_NOMEM == ercd, "cre_mpf bad ercd" ); t_cmpf.mpfcnt = 100; t_cmpf.blfsz = 100000; ercd = cre_mpf( 3, &t_cmpf ); CYG_TEST_CHECK( E_NOMEM == ercd, "cre_mpf bad ercd" ); // now create it well t_cmpf.mpfatr = 0; t_cmpf.mpfcnt = 10; t_cmpf.blfsz = 100; ercd = cre_mpf( 3, &t_cmpf ); CYG_TEST_CHECK( E_OK == ercd, "cre_mpf bad ercd" ); // and check we can use it ercd = pget_blf( &vp, 3 ); CYG_TEST_CHECK( E_OK == ercd, "pget_blf bad ercd" ); ercd = tget_blf( &vp, 3, 10 ); CYG_TEST_CHECK( E_OK == ercd, "tget_blf bad ercd" ); ercd = get_blf( &vp, 3 ); CYG_TEST_CHECK( E_OK == ercd, "get_blf bad ercd" ); ercd = rel_blf( 3, vp ); // vp did come from new pool CYG_TEST_CHECK( E_OK == ercd, "rel_blf bad ercd" ); ercd = rel_blf( 3, vp ); // vp already freed CYG_TEST_CHECK( E_PAR == ercd, "rel_blf bad ercd !E_PAR" ); ercd = ref_mpf( &t_rmpf, 3 ); CYG_TEST_CHECK( E_OK == ercd, "ref_mpf bad ercd" ); // In order to wait on the pools, we must first consume all they have: while ( E_OK == (ercd = pget_blf( &vp, 1 )) ) /* nothing */; CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blf bad ercd !E_TMOUT" ); while ( E_OK == (ercd = tget_blf( &vp, 2, 1 )) ) /* nothing */; CYG_TEST_CHECK( E_TMOUT == ercd, "tget_blf bad ercd !E_TMOUT" ); // now wait while task 2 deletes the wait objects ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = get_blf( &vp, 1 ); CYG_TEST_CHECK( E_DLT == ercd, "get_blf bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = tget_blf( &vp, 2, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "tget_blf bad ercd !E_DLT" ); // check they are deleted ercd = get_blf( &vp, 1 ); CYG_TEST_CHECK( E_NOEXS == ercd, "get_blf bad ercd !E_NOEXS" ); ercd = pget_blf( &vp, 2 ); CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blf bad ercd !E_NOEXS" ); // re-create and do it again t_cmpf.mpfcnt = 90; t_cmpf.blfsz = 20; ercd = cre_mpf( 1, &t_cmpf ); CYG_TEST_CHECK( E_OK == ercd, "cre_mpf bad ercd" ); t_cmpf.mpfcnt = 5; t_cmpf.blfsz = 200; ercd = cre_mpf( 2, &t_cmpf ); CYG_TEST_CHECK( E_OK == ercd, "cre_mpf bad ercd" ); // In order to wait on the pools, we must first consume all they have: while ( E_OK == (ercd = pget_blf( &vp, 1 )) ) /* nothing */; CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blf bad ercd !E_TMOUT" ); while ( E_OK == (ercd = tget_blf( &vp, 2, 1 )) ) /* nothing */; CYG_TEST_CHECK( E_TMOUT == ercd, "tget_blf bad ercd !E_TMOUT" ); // now wait while task 2 deletes the wait objects ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = get_blf( &vp, 1 ); CYG_TEST_CHECK( E_DLT == ercd, "get_blf bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = tget_blf( &vp, 2, 10 ); CYG_TEST_CHECK( E_DLT == ercd, "tget_blf bad ercd !E_DLT" ); // check they are deleted ercd = tget_blf( &vp, 1, 1 ); CYG_TEST_CHECK( E_NOEXS == ercd, "get_blf bad ercd !E_NOEXS" ); ercd = get_blf( &vp, 2 ); CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blf bad ercd !E_NOEXS" ); CYG_TEST_PASS("create/delete fixed mempools"); #endif // CYGPKG_UITRON_MEMPOOLFIXED_CREATE_DELETE #ifdef CYGPKG_UITRON_MEMPOOLVAR_CREATE_DELETE tests++; #ifdef CYGSEM_UITRON_BAD_PARAMS_RETURN_ERRORS ercd = del_mpl( -6 ); CYG_TEST_CHECK( E_ID == ercd, "del_mpl bad ercd !E_ID" ); ercd = del_mpl( 99 ); CYG_TEST_CHECK( E_ID == ercd, "del_mpl bad ercd !E_ID" ); ercd = cre_mpl( -6, &t_cmpl ); CYG_TEST_CHECK( E_ID == ercd, "cre_mpl bad ercd !E_ID" ); ercd = cre_mpl( 99, &t_cmpl ); CYG_TEST_CHECK( E_ID == ercd, "cre_mpl bad ercd !E_ID" ); #endif // we can test bad param error returns // try a pre-existing object // [first get a valid block from it for the freeing test later] ercd = pget_blk( &vp, 3, 100 ); CYG_TEST_CHECK( E_OK == ercd, "pget_blk bad ercd" ); ercd = cre_mpl( 3, &t_cmpl ); CYG_TEST_CHECK( E_OBJ == ercd, "cre_mpl bad ercd !E_OBJ" ); // delete it so we can play ercd = del_mpl( 3 ); CYG_TEST_CHECK( E_OK == ercd, "del_mpl bad ercd" ); // check it is deleted ercd = rel_blk( 3, vp ); // vp did come from this pool CYG_TEST_CHECK( E_NOEXS == ercd, "rel_blk bad ercd !E_NOEXS" ); ercd = pget_blk( &vp, 3, 100 ); CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blk bad ercd !E_NOEXS" ); ercd = tget_blk( &vp, 3, 100, 10 ); CYG_TEST_CHECK( E_NOEXS == ercd, "tget_blk bad ercd !E_NOEXS" ); ercd = get_blk( &vp, 3, 100 ); CYG_TEST_CHECK( E_NOEXS == ercd, "get_blk bad ercd !E_NOEXS" ); ercd = ref_mpl( &t_rmpl, 3 ); CYG_TEST_CHECK( E_NOEXS == ercd, "ref_mpl 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_mpl( 3, NULL ); CYG_TEST_CHECK( E_PAR == ercd, "cre_mpl bad ercd !E_PAR" ); #endif ercd = cre_mpl( 3, NADR ); CYG_TEST_CHECK( E_PAR == ercd, "cre_mpl bad ercd !E_PAR" ); t_cmpl.mplatr = 0xfff; ercd = cre_mpl( 3, &t_cmpl ); CYG_TEST_CHECK( E_RSATR == ercd, "cre_mpl bad ercd !E_RSATR" ); #endif // we can test bad param error returns t_cmpl.mplatr = 0; t_cmpl.mplsz = 100000000; ercd = cre_mpl( 3, &t_cmpl ); CYG_TEST_CHECK( E_NOMEM == ercd, "cre_mpl bad ercd" ); // now create it well t_cmpl.mplatr = 0; t_cmpl.mplsz = 1000; ercd = cre_mpl( 3, &t_cmpl ); CYG_TEST_CHECK( E_OK == ercd, "cre_mpl bad ercd" ); // and check we can use it ercd = pget_blk( &vp, 3, 100 ); CYG_TEST_CHECK( E_OK == ercd, "pget_blk bad ercd" ); ercd = pget_blk( &vp, 3, 100000000 ); // way too large CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blk bad ercd !E_TMOUT" ); ercd = tget_blk( &vp, 3, 100, 10 ); CYG_TEST_CHECK( E_OK == ercd, "tget_blk bad ercd" ); ercd = get_blk( &vp, 3, 100 ); CYG_TEST_CHECK( E_OK == ercd, "get_blk bad ercd" ); ercd = rel_blk( 3, vp ); // vp did come from new pool CYG_TEST_CHECK( E_OK == ercd, "rel_blk bad ercd" ); ercd = rel_blk( 3, vp ); // vp already freed CYG_TEST_CHECK( E_PAR == ercd, "rel_blk bad ercd !E_PAR" ); ercd = ref_mpl( &t_rmpl, 3 ); CYG_TEST_CHECK( E_OK == ercd, "ref_mpl bad ercd" ); // In order to wait on the pools, we must first consume all they have: while ( E_OK == (ercd = pget_blk( &vp, 1, 100 )) ) /* nothing */; CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blk bad ercd !E_TMOUT" ); while ( E_OK == (ercd = tget_blk( &vp, 2, 100, 1 )) ) /* nothing */; CYG_TEST_CHECK( E_TMOUT == ercd, "tget_blk bad ercd !E_TMOUT" ); // now wait while task 2 deletes the wait objects ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = get_blk( &vp, 1, 200 ); CYG_TEST_CHECK( E_DLT == ercd, "get_blk bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = tget_blk( &vp, 2, 100, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "tget_blk bad ercd !E_DLT" ); // check they are deleted ercd = get_blk( &vp, 1, 200 ); CYG_TEST_CHECK( E_NOEXS == ercd, "get_blk bad ercd !E_NOEXS" ); ercd = pget_blk( &vp, 2, 20 ); CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blk bad ercd !E_NOEXS" ); // re-create and do it again ercd = cre_mpl( 1, &t_cmpl ); CYG_TEST_CHECK( E_OK == ercd, "cre_mpl bad ercd" ); ercd = cre_mpl( 2, &t_cmpl ); CYG_TEST_CHECK( E_OK == ercd, "cre_mpl bad ercd" ); // In order to wait on the pools, we must first consume all they have: while ( E_OK == (ercd = pget_blk( &vp, 1, 20 )) ) /* nothing */; CYG_TEST_CHECK( E_TMOUT == ercd, "pget_blk bad ercd !E_TMOUT" ); while ( E_OK == (ercd = tget_blk( &vp, 2, 400, 1 )) ) /* nothing */; CYG_TEST_CHECK( E_TMOUT == ercd, "tget_blk bad ercd !E_TMOUT" ); // now wait while task 2 deletes the wait objects ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = get_blk( &vp, 1, 200 ); CYG_TEST_CHECK( E_DLT == ercd, "get_blk bad ercd !E_DLT" ); ercd = wup_tsk( 2 ); CYG_TEST_CHECK( E_OK == ercd, "wup_tsk bad ercd" ); ercd = tget_blk( &vp, 2, 500, 20 ); CYG_TEST_CHECK( E_DLT == ercd, "tget_blk bad ercd !E_DLT" ); // check they are deleted ercd = tget_blk( &vp, 1, 200, 1 ); CYG_TEST_CHECK( E_NOEXS == ercd, "get_blk bad ercd !E_NOEXS" ); ercd = get_blk( &vp, 2, 20 ); CYG_TEST_CHECK( E_NOEXS == ercd, "pget_blk bad ercd !E_NOEXS" ); CYG_TEST_PASS("create/delete variable mempools"); #endif // CYGPKG_UITRON_MEMPOOLVAR_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(); }
UINT32 UserPS_WriteUniFontFile(CHAR *pFilename) { PPSTORE_SECTION_HANDLE pSection; HNVT_FILE *pFile; UINT32 uiFileSize, uiWriteSize; UINT8 *pMemPool; FilesysWaitInitFinish(FST_TIME_INFINITE); FilesysWaitCmdFinish(FST_TIME_INFINITE); pFile = Filesys_fopen((char *)pFilename, "R"); if(pFile == NULL) { debug_err(("UserPS: Error opening %s\r\n", pFilename)); return E_USERPS_FILE; } uiFileSize = pFile->fileSize; uiWriteSize = uiFileSize; debug_err(("UserPS: File size = %ld\r\n", uiFileSize)); FilesysCloseActFile(); if(uiFileSize > POOL_SIZE_UNIFONT) { debug_err(("UserPS: File size too large!\r\n")); return E_USERPS_FILE; } get_blk((void *)&pMemPool, POOL_ID_CAPTURE); rel_blk(POOL_ID_CAPTURE, pMemPool); pMemPool = (pMemPool + POOL_SIZE_CAPTURE - POOL_SIZE_UNIFONT); FilesysReadWriteByName2(FST_CMD_READ_BY_NAME, pFilename, (UINT8 *)(pMemPool+4), &uiWriteSize, 0, FST_TIME_INFINITE); FilesysWaitCmdFinish(FST_TIME_INFINITE); debug_err(("UserPS: Gotta write file size = %ld\r\n", uiWriteSize)); *pMemPool = LO_BYTE(LO_WORD(uiWriteSize)); *(pMemPool+1) = HI_BYTE(LO_WORD(uiWriteSize)); *(pMemPool+2) = LO_BYTE(HI_WORD(uiWriteSize)); *(pMemPool+3) = HI_BYTE(HI_WORD(uiWriteSize)); //PStore_EnablePS(); if((pSection = PStore_OpenSection(PS_UNIFONT_DATA, PS_RDWR | PS_CREATE)) != E_PS_SECHDLER) { if(PStore_WriteSection(pMemPool, 0, (uiWriteSize+4), pSection) != E_PS_OK) { debug_err(("UserPS: PStore write Unicode font data fail\r\n")); } PStore_CloseSection(pSection); //PStore_DisablePS(); } else { debug_err(("UserPS: PStore open section fail\r\n")); //PStore_DisablePS(); return E_USERPS_PSECTION; } return E_USERPS_OK; }