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 << 4) | ((mbi & 3) << 2));
240 systemAddress = 0x50100000 | ((sramAddress << 4) | ((mbi & 1) << 3));
244 systemAddress = 0x50000000 | ((sramAddress << 4) | ((mbi & 3) << 2));
248 systemAddress = 0xb0000000 | (sramAddress << 3);
252 systemAddress = 0xf0012000 | ((sramAddress << 5) | ((mbi & 3) << 3));
259 return systemAddress;
266 uint8 validFlags = (mc->ECCD.U >> IFX_MC_ECCD_VAL_OFF) & IFX_MC_ECCD_VAL_MSK;
267 uint8 numTrackedAddresses = 0;
270 #if IFX_MC_ECCD_VAL_LEN > IFXMTU_MAX_TRACKED_ADDRESSES
271 # error "Unexpected size of VAL mask"
276 if (validFlags & (1 << i))
278 trackedSramAddresses[numTrackedAddresses].U = mc->ETRR[i].U;
279 ++numTrackedAddresses;
283 return numTrackedAddresses;
289 volatile uint32 *mtuMemstat = (
volatile uint32 *)((
uint32)&MTU_MEMSTAT0 + 4 * (mbistSel >> 5));
290 uint32 mask = 1 << (mbistSel & 0x1f);
291 return (*mtuMemstat & mask) != 0;
314 status = mc->MSTATUS.U;
315 return (
boolean)(status & 0x01);
324 uint16 mcontrolMask = 0x4000;
325 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DIR_OFF);
326 mc->CONFIG0.U = (1 << IFX_MC_CONFIG0_NUMACCS_OFF) | (1 << IFX_MC_CONFIG0_ACCSTYPE_OFF);
330 mc->RANGE.U = sramAddress;
333 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DIR_OFF) | (1 << IFX_MC_MCONTROL_START_OFF);
334 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DIR_OFF);
337 IfxMtu_waitForMbistDone(256, 1, mbistSel);
352 uint32 configCheckerBoardSequence[4] = {
361 uint8 isEndInitEnabled = 0;
369 isEndInitEnabled = 1;
380 mc->RANGE.U = (rangeSel << 15) | (rangeAddrUp << 7) | (rangeAddrLow << 0);
383 for (testStep = 0; testStep < 4; ++testStep)
385 mc->CONFIG0.U = configCheckerBoardSequence[testStep] & 0x0000FFFF;
386 mc->CONFIG1.U = (configCheckerBoardSequence[testStep] & 0xFFFF0000) >> 16;
387 mc->MCONTROL.U = numberRedundancyLines ? 0x30c9 : 0x00c9;
388 mc->MCONTROL.U = numberRedundancyLines ? 0x30c8 : 0x00c8;
394 IfxMtu_waitForMbistDone(
IfxMtu_sramTable[mbistSel].mbistDelay, 4, mbistSel);
406 if (mc->MSTATUS.B.FAIL)
412 *errorAddr = mc->ETRR[0].U;
426 if (isEndInitEnabled == 1)
442 uint32 configMarchUSequence[6] = {
453 uint8 isEndInitEnabled = 0;
461 isEndInitEnabled = 1;
472 mc->RANGE.U = (rangeSel << 15) | (rangeAddrUp << 7) | (rangeAddrLow << 0);
475 for (testStep = 0; testStep < 6; ++testStep)
477 mc->CONFIG0.U = configMarchUSequence[testStep] & 0x0000FFFF;
478 mc->CONFIG1.U = (configMarchUSequence[testStep] & 0xFFFF0000) >> 16;
479 mc->MCONTROL.U = 0x0209;
480 mc->MCONTROL.B.START = 0;
486 IfxMtu_waitForMbistDone(
IfxMtu_sramTable[mbistSel].mbistDelay, 4, mbistSel);
498 if (mc->MSTATUS.B.FAIL)
504 *errorAddr = mc->ETRR[0].U;
519 if (isEndInitEnabled == 1)
537 uint8 isEndInitEnabled = 0;
545 isEndInitEnabled = 1;
556 mc->CONFIG0.U = 0x4005;
557 mc->CONFIG1.U = 0x5000;
559 mc->RANGE.U = (rangeSel << 15) | (rangeAddrUp << 7) | (rangeAddrLow << 0);
561 mc->MCONTROL.U = 0xF201;
562 mc->MCONTROL.B.START = 0;
567 IfxMtu_waitForMbistDone(
IfxMtu_sramTable[mbistSel].mbistDelay, 4, mbistSel);
579 if (mc->MSTATUS.B.FAIL)
585 *errorAddr = mc->ETRR[0].U;
598 if (isEndInitEnabled == 1)
610 uint32 waitFact = (SCU_CCUCON0.B.SPBDIV / SCU_CCUCON0.B.SRIDIV) * numInstructions;
621 waitFact = waitFact * SCU_CCUCON1.B.GTMDIV;
624 waitFact = waitFact * SCU_CCUCON1.B.GTMDIV;
629 waitFact = waitFact * SCU_CCUCON0.B.BAUD1DIV;
661 waitFact = waitFact * SCU_CCUCON2.B.BBBDIV;
667 if (numInstructions == 4)
669 waitTime = (towerDepth * waitFact) + 30;
673 waitTime = ((towerDepth / 4) * waitFact) + 30;
676 waitTime = waitTime / 3;
688 uint8 isEndInitEnabled = 0;
697 isEndInitEnabled = 1;
701 uint16 mcontrolMask = 0x4000;
702 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DIR_OFF);
703 mc->CONFIG0.U = (1 << IFX_MC_CONFIG0_NUMACCS_OFF) | (0 << IFX_MC_CONFIG0_ACCSTYPE_OFF);
707 mc->RANGE.U = sramAddress;
710 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DIR_OFF) | (1 << IFX_MC_MCONTROL_START_OFF);
711 mc->MCONTROL.U = mcontrolMask | (1 << IFX_MC_MCONTROL_DIR_OFF);
713 if (isEndInitEnabled == 1)
720 IfxMtu_waitForMbistDone(
IfxMtu_sramTable[mbistSel].mbistDelay, 1, mbistSel);