56 mc->ECCD.U |= (1 << IFX_MC_ECCD_TRC_OFF);
62 uint8 isEndInitEnabled = 0;
95 if (isEndInitEnabled == 1)
140 uint32 memSize = dataSize + eccSize;
148 for (mem = 0; mem < numBlocks; ++mem)
152 for (i = 0; i < memSize; ++i)
154 if ((i == eccInvPos0) || (i == eccInvPos1))
156 data |= (1 << bitPos);
163 mc->RDBFL[wordIx++].U = data;
173 mc->RDBFL[wordIx].U = data;
178 uint16 mcontrolMask = 0x4000;
179 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DINIT_OFF) | (1 << IFX_MC_MCONTROL_START_OFF);
180 mc->MCONTROL.U = mcontrolMask | (0 << IFX_MC_MCONTROL_DINIT_OFF) | (1 << IFX_MC_MCONTROL_DINIT_OFF);
186 volatile uint32 *mtuMemtest = (
volatile uint32 *)((
uint32)&MTU_MEMTEST0 + 4 * (mbistSel >> 5));
187 uint32 mask = 1 << (mbistSel & 0x1f);
188 *mtuMemtest &= ~mask;
198 mc->ECCS.U &= ~(1 << IFX_MC_ECCS_TRE_OFF);
202 mc->ECCS.U |= (1 << IFX_MC_ECCS_TRE_OFF);
209 volatile uint32 *mtuMemtest = (
volatile uint32 *)((
uint32)&MTU_MEMTEST0 + 4 * (mbistSel >> 5));
210 uint32 mask = 1 << (mbistSel & 0x1f);
217 uint32 sramAddress = trackedSramAddress.B.ADDR;
218 uint32 mbi = trackedSramAddress.B.MBI;
224 systemAddress = 0x70100000 | ((sramAddress << 3) | ((mbi & 1) << 2));
228 systemAddress = 0x70000000 | ((sramAddress << 4) | ((mbi & 3) << 2));
232 systemAddress = 0x60100000 | ((sramAddress << 4) | ((mbi & 1) << 3));
236 systemAddress = 0x60000000 | ((sramAddress << 5) | ((mbi & 3) << 2));
240 systemAddress = 0x60000000 | ((sramAddress << 5) | (1 << 4) | ((mbi & 3) << 2));
244 systemAddress = 0x50100000 | ((sramAddress << 4) | ((mbi & 1) << 3));
248 systemAddress = 0x50000000 | ((sramAddress << 5) | ((mbi & 3) << 2));
252 systemAddress = 0x50000000 | ((sramAddress << 5) | (1 << 4) | ((mbi & 3) << 2));
256 systemAddress = 0xb0000000 | (sramAddress << 3);
260 systemAddress = 0xf0012000 | ((sramAddress << 5) | ((mbi & 3) << 3));
267 return systemAddress;
274 uint8 validFlags = (mc->ECCD.U >> IFX_MC_ECCD_VAL_OFF) & IFX_MC_ECCD_VAL_MSK;
275 uint8 numTrackedAddresses = 0;
278 #if IFX_MC_ECCD_VAL_LEN > IFXMTU_MAX_TRACKED_ADDRESSES
279 # error "Unexpected size of VAL mask"
284 if (validFlags & (1 << i))
286 trackedSramAddresses[numTrackedAddresses].U = mc->ETRR[i].U;
287 ++numTrackedAddresses;
291 return numTrackedAddresses;
297 volatile uint32 *mtuMemstat = (
volatile uint32 *)((
uint32)&MTU_MEMSTAT0 + 4 * (mbistSel >> 5));
298 uint32 mask = 1 << (mbistSel & 0x1f);
299 return (*mtuMemstat & mask) != 0;
322 status = mc->MSTATUS.U;
323 return (
boolean)(status & 0x01);
332 uint16 mcontrolMask = 0x4000;
333 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DIR_OFF);
334 mc->CONFIG0.U = (1 << IFX_MC_CONFIG0_NUMACCS_OFF) | (1 << IFX_MC_CONFIG0_ACCSTYPE_OFF);
338 mc->RANGE.U = sramAddress;
341 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DIR_OFF) | (1 << IFX_MC_MCONTROL_START_OFF);
342 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DIR_OFF);
345 IfxMtu_waitForMbistDone(256, 1, mbistSel);
360 uint32 configCheckerBoardSequence[4] = {
369 uint8 isEndInitEnabled = 0;
377 isEndInitEnabled = 1;
388 mc->RANGE.U = (rangeSel << 15) | (rangeAddrUp << 7) | (rangeAddrLow << 0);
391 for (testStep = 0; testStep < 4; ++testStep)
393 mc->CONFIG0.U = configCheckerBoardSequence[testStep] & 0x0000FFFF;
394 mc->CONFIG1.U = (configCheckerBoardSequence[testStep] & 0xFFFF0000) >> 16;
395 mc->MCONTROL.U = numberRedundancyLines ? 0x30c9 : 0x00c9;
396 mc->MCONTROL.U = numberRedundancyLines ? 0x30c8 : 0x00c8;
402 IfxMtu_waitForMbistDone(
IfxMtu_sramTable[mbistSel].mbistDelay, 4, mbistSel);
414 if (mc->MSTATUS.B.FAIL)
420 *errorAddr = mc->ETRR[0].U;
434 if (isEndInitEnabled == 1)
450 uint32 configMarchUSequence[6] = {
461 uint8 isEndInitEnabled = 0;
469 isEndInitEnabled = 1;
480 mc->RANGE.U = (rangeSel << 15) | (rangeAddrUp << 7) | (rangeAddrLow << 0);
483 for (testStep = 0; testStep < 6; ++testStep)
485 mc->CONFIG0.U = configMarchUSequence[testStep] & 0x0000FFFF;
486 mc->CONFIG1.U = (configMarchUSequence[testStep] & 0xFFFF0000) >> 16;
487 mc->MCONTROL.U = 0x0209;
488 mc->MCONTROL.B.START = 0;
494 IfxMtu_waitForMbistDone(
IfxMtu_sramTable[mbistSel].mbistDelay, 4, mbistSel);
506 if (mc->MSTATUS.B.FAIL)
512 *errorAddr = mc->ETRR[0].U;
527 if (isEndInitEnabled == 1)
545 uint8 isEndInitEnabled = 0;
553 isEndInitEnabled = 1;
564 mc->CONFIG0.U = 0x4005;
565 mc->CONFIG1.U = 0x5000;
567 mc->RANGE.U = (rangeSel << 15) | (rangeAddrUp << 7) | (rangeAddrLow << 0);
569 mc->MCONTROL.U = 0xF201;
570 mc->MCONTROL.B.START = 0;
575 IfxMtu_waitForMbistDone(
IfxMtu_sramTable[mbistSel].mbistDelay, 4, mbistSel);
587 if (mc->MSTATUS.B.FAIL)
593 *errorAddr = mc->ETRR[0].U;
606 if (isEndInitEnabled == 1)
618 uint32 waitFact = (SCU_CCUCON0.B.SPBDIV / SCU_CCUCON0.B.SRIDIV) * numInstructions;
629 waitFact = waitFact * SCU_CCUCON1.B.GTMDIV;
632 waitFact = waitFact * SCU_CCUCON1.B.GTMDIV;
638 waitFact = waitFact * SCU_CCUCON0.B.BAUD1DIV;
697 waitFact = waitFact * SCU_CCUCON2.B.BBBDIV;
703 if (numInstructions == 4)
705 waitTime = (towerDepth * waitFact) + 30;
709 waitTime = ((towerDepth / 4) * waitFact) + 30;
712 waitTime = waitTime / 3;
724 uint8 isEndInitEnabled = 0;
733 isEndInitEnabled = 1;
737 uint16 mcontrolMask = 0x4000;
738 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DIR_OFF);
739 mc->CONFIG0.U = (1 << IFX_MC_CONFIG0_NUMACCS_OFF) | (0 << IFX_MC_CONFIG0_ACCSTYPE_OFF);
743 mc->RANGE.U = sramAddress;
746 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DIR_OFF) | (1 << IFX_MC_MCONTROL_START_OFF);
747 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DIR_OFF);
749 if (isEndInitEnabled == 1)
756 IfxMtu_waitForMbistDone(
IfxMtu_sramTable[mbistSel].mbistDelay, 1, mbistSel);