void Ovc_SetBlock(uint8 whichBlock, uint8 redirectionSelect, uint32 ramBaseAddr,uint32 flashBaseAddr, OVC_overlayMemSize size) { // Ifx_CPU * core; Ifx_OVC_BLK_OTAR otar; /* Target Base Address(Flash) */ Ifx_OVC_BLK_OMASK omask; /* Overlay Block Size */ Ifx_OVC_BLK_RABR rabr; /* Redirection Base Address(also called Overlay Memory, in RAM) */ otar.U = 0u; // otar.B.TBASE = flashBaseAddr; //20200330. maybe no need to do bit shift. otar.B.TBASE = flashBaseAddr >>5; //20200330. seems must do bit shift. omask.U = 0u; omask.B.OMASK = size; rabr.U = 0; rabr.B.OMEM = redirectionSelect; /*Select redirect memory*/ rabr.B.OBASE = ramBaseAddr>>5; /*Select overlay block base address*/ MODULE_OVC0.BLK[whichBlock].RABR.U = rabr.U; MODULE_OVC0.BLK[whichBlock].OTAR.U = otar.U; MODULE_OVC0.BLK[whichBlock].OMASK.U = omask.U; }
void Ovc_EnableCore(uint8 core_id) { Ifx_SCU_OVCCON ovccon; Ifx_SCU_OVCENABLE ovcenable; uint16 password = IfxScuWdt_getCpuWatchdogPassword(); /*Disable overlay in SCU*/ IfxScuWdt_clearSafetyEndinit(password); ovccon.U = MODULE_SCU.OVCCON.U; ovcenable.U = MODULE_SCU.OVCENABLE.U; ovccon.B.DCINVAL = 1; //add switch case if needed. ovcenable.B.OVEN0 = 1; ovccon.B.CSEL0 = 1; //Ifx_Ssw_DSYNC(); MODULE_SCU.OVCCON.U = ovccon.U; MODULE_SCU.OVCENABLE.U = ovcenable.U; IfxScuWdt_setSafetyEndinit(password); }
Ovc_EnableCore(0u); Ovc_DisableBlock(0u, 0u); // Ovc_SetBlockTestCase0(Redirect_To_LMU, LMURAM_OVERLAY_START_ADDR, CAL_PFLS0_NC_START_ADDR); Ovc_SetBlockTestCase0(Redirect_To_LMU, CAL_LMURAM_NC_START_ADDR, CAL_PFLS0_NC_START_ADDR, Ovc_OverlayMemSize_16KB); Ovc_EnableBlock(0u);