sdram_init.c
来自「适合KS8695X」· C语言 代码 · 共 1,974 行 · 第 1/5 页
C
1,974 行
dimmInfo->differentialClockInput =
(data[i] & BIT5) >> 5;
dimmInfo->redundantRowAddressing =
(data[i] & BIT6) >> 6;
#ifdef DEBUG
if (dimmInfo->bufferedAddrAndControlInputs == 1)
DP (printf
(" - Buffered Address/Control Input: Yes \n"));
else
DP (printf
(" - Buffered Address/Control Input: No \n"));
if (dimmInfo->registeredAddrAndControlInputs == 1)
DP (printf
(" - Registered Address/Control Input: Yes \n"));
else
DP (printf
(" - Registered Address/Control Input: No \n"));
if (dimmInfo->onCardPLL == 1)
DP (printf
(" - On-Card PLL (clock): Yes \n"));
else
DP (printf
(" - On-Card PLL (clock): No \n"));
if (dimmInfo->bufferedDQMBinputs == 1)
DP (printf
(" - Bufferd DQMB Inputs: Yes \n"));
else
DP (printf
(" - Bufferd DQMB Inputs: No \n"));
if (dimmInfo->registeredDQMBinputs == 1)
DP (printf
(" - Registered DQMB Inputs: Yes \n"));
else
DP (printf
(" - Registered DQMB Inputs: No \n"));
if (dimmInfo->differentialClockInput == 1)
DP (printf
(" - Differential Clock Input: Yes \n"));
else
DP (printf
(" - Differential Clock Input: No \n"));
if (dimmInfo->redundantRowAddressing == 1)
DP (printf
(" - redundant Row Addressing: Yes \n"));
else
DP (printf
(" - redundant Row Addressing: No \n"));
#endif
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 22: /* Suported AutoPreCharge */
DP (printf ("\nModul Attributes (SPD Byte 22): \n"));
dimmInfo->suportedEarlyRasPreCharge = data[i] & BIT0;
dimmInfo->suportedAutoPreCharge =
(data[i] & BIT1) >> 1;
dimmInfo->suportedPreChargeAll =
(data[i] & BIT2) >> 2;
dimmInfo->suportedWrite1ReadBurst =
(data[i] & BIT3) >> 3;
dimmInfo->suported5PercentLowVCC =
(data[i] & BIT4) >> 4;
dimmInfo->suported5PercentUpperVCC =
(data[i] & BIT5) >> 5;
#ifdef DEBUG
if (dimmInfo->suportedEarlyRasPreCharge == 1)
DP (printf
(" - Early Ras Precharge: Yes \n"));
else
DP (printf
(" - Early Ras Precharge: No \n"));
if (dimmInfo->suportedAutoPreCharge == 1)
DP (printf
(" - AutoPreCharge: Yes \n"));
else
DP (printf
(" - AutoPreCharge: No \n"));
if (dimmInfo->suportedPreChargeAll == 1)
DP (printf
(" - Precharge All: Yes \n"));
else
DP (printf
(" - Precharge All: No \n"));
if (dimmInfo->suportedWrite1ReadBurst == 1)
DP (printf
(" - Write 1/ReadBurst: Yes \n"));
else
DP (printf
(" - Write 1/ReadBurst: No \n"));
if (dimmInfo->suported5PercentLowVCC == 1)
DP (printf
(" - lower VCC tolerance: 5 Percent \n"));
else
DP (printf
(" - lower VCC tolerance: 10 Percent \n"));
if (dimmInfo->suported5PercentUpperVCC == 1)
DP (printf
(" - upper VCC tolerance: 5 Percent \n"));
else
DP (printf
(" - upper VCC tolerance: 10 Percent \n"));
#endif
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 23: /* Minimum Cycle Time At Maximum Cas Latancy Minus 1 (2nd highest CL) */
shift = (dimmInfo->memoryType == DDR) ? 4 : 2;
mult = (dimmInfo->memoryType == DDR) ? 10 : 25;
maskLeftOfPoint =
(dimmInfo->memoryType == DDR) ? 0xf0 : 0xfc;
maskRightOfPoint =
(dimmInfo->memoryType == DDR) ? 0xf : 0x03;
leftOfPoint = (data[i] & maskLeftOfPoint) >> shift;
rightOfPoint = (data[i] & maskRightOfPoint) * mult;
dimmInfo->minimumCycleTimeAtMaxCasLatancyMinus1_LoP =
leftOfPoint;
dimmInfo->minimumCycleTimeAtMaxCasLatancyMinus1_RoP =
rightOfPoint;
DP (printf ("Minimum Cycle Time At 2nd highest CasLatancy (0 = Not supported): %d.%d [ns]\n", leftOfPoint, rightOfPoint)); /*dimmInfo->minimumCycleTimeAtMaxCasLatancy */
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 24: /* Clock To Data Out 2nd highest Cas Latency Value */
div = (dimmInfo->memoryType == DDR) ? 100 : 10;
time_tmp =
(((data[i] & 0xf0) >> 4) * 10) +
((data[i] & 0x0f));
leftOfPoint = time_tmp / div;
rightOfPoint = time_tmp % div;
dimmInfo->clockToDataOutMinus1_LoP = leftOfPoint;
dimmInfo->clockToDataOutMinus1_RoP = rightOfPoint;
DP (printf
("Clock To Data Out (2nd CL value): %d.%2d [ns]\n",
leftOfPoint, rightOfPoint));
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 25: /* Minimum Cycle Time At Maximum Cas Latancy Minus 2 (3rd highest CL) */
shift = (dimmInfo->memoryType == DDR) ? 4 : 2;
mult = (dimmInfo->memoryType == DDR) ? 10 : 25;
maskLeftOfPoint =
(dimmInfo->memoryType == DDR) ? 0xf0 : 0xfc;
maskRightOfPoint =
(dimmInfo->memoryType == DDR) ? 0xf : 0x03;
leftOfPoint = (data[i] & maskLeftOfPoint) >> shift;
rightOfPoint = (data[i] & maskRightOfPoint) * mult;
dimmInfo->minimumCycleTimeAtMaxCasLatancyMinus2_LoP =
leftOfPoint;
dimmInfo->minimumCycleTimeAtMaxCasLatancyMinus2_RoP =
rightOfPoint;
DP (printf ("Minimum Cycle Time At 3rd highest CasLatancy (0 = Not supported): %d.%d [ns]\n", leftOfPoint, rightOfPoint)); /*dimmInfo->minimumCycleTimeAtMaxCasLatancy */
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 26: /* Clock To Data Out 3rd highest Cas Latency Value */
div = (dimmInfo->memoryType == DDR) ? 100 : 10;
time_tmp =
(((data[i] & 0xf0) >> 4) * 10) +
((data[i] & 0x0f));
leftOfPoint = time_tmp / div;
rightOfPoint = time_tmp % div;
dimmInfo->clockToDataOutMinus2_LoP = leftOfPoint;
dimmInfo->clockToDataOutMinus2_RoP = rightOfPoint;
DP (printf
("Clock To Data Out (3rd CL value): %d.%2d [ns]\n",
leftOfPoint, rightOfPoint));
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 27: /* Minimum Row Precharge Time */
shift = (dimmInfo->memoryType == DDR) ? 2 : 0;
maskLeftOfPoint =
(dimmInfo->memoryType == DDR) ? 0xfc : 0xff;
maskRightOfPoint =
(dimmInfo->memoryType == DDR) ? 0x03 : 0x00;
leftOfPoint = ((data[i] & maskLeftOfPoint) >> shift);
rightOfPoint = (data[i] & maskRightOfPoint) * 25;
dimmInfo->minRowPrechargeTime = ((leftOfPoint * 100) + rightOfPoint); /* measured in n times 10ps Intervals */
trp_clocks =
(dimmInfo->minRowPrechargeTime +
(tmemclk - 1)) / tmemclk;
DP (printf
("*** 1 clock cycle = %ld 10ps intervalls = %ld.%ld ns****\n",
tmemclk, tmemclk / 100, tmemclk % 100));
DP (printf
("Minimum Row Precharge Time [ns]: %d.%2d = in Clk cycles %d\n",
leftOfPoint, rightOfPoint, trp_clocks));
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 28: /* Minimum Row Active to Row Active Time */
shift = (dimmInfo->memoryType == DDR) ? 2 : 0;
maskLeftOfPoint =
(dimmInfo->memoryType == DDR) ? 0xfc : 0xff;
maskRightOfPoint =
(dimmInfo->memoryType == DDR) ? 0x03 : 0x00;
leftOfPoint = ((data[i] & maskLeftOfPoint) >> shift);
rightOfPoint = (data[i] & maskRightOfPoint) * 25;
dimmInfo->minRowActiveRowActiveDelay = ((leftOfPoint * 100) + rightOfPoint); /* measured in 100ns Intervals */
trrd_clocks =
(dimmInfo->minRowActiveRowActiveDelay +
(tmemclk - 1)) / tmemclk;
DP (printf
("Minimum Row Active -To- Row Active Delay [ns]: %d.%2d = in Clk cycles %d\n",
leftOfPoint, rightOfPoint, trp_clocks));
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 29: /* Minimum Ras-To-Cas Delay */
shift = (dimmInfo->memoryType == DDR) ? 2 : 0;
maskLeftOfPoint =
(dimmInfo->memoryType == DDR) ? 0xfc : 0xff;
maskRightOfPoint =
(dimmInfo->memoryType == DDR) ? 0x03 : 0x00;
leftOfPoint = ((data[i] & maskLeftOfPoint) >> shift);
rightOfPoint = (data[i] & maskRightOfPoint) * 25;
dimmInfo->minRowActiveRowActiveDelay = ((leftOfPoint * 100) + rightOfPoint); /* measured in 100ns Intervals */
trcd_clocks =
(dimmInfo->minRowActiveRowActiveDelay +
(tmemclk - 1)) / tmemclk;
DP (printf
("Minimum Ras-To-Cas Delay [ns]: %d.%2d = in Clk cycles %d\n",
leftOfPoint, rightOfPoint, trp_clocks));
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 30: /* Minimum Ras Pulse Width */
dimmInfo->minRasPulseWidth = data[i];
tras_clocks =
(NSto10PS (data[i]) +
(tmemclk - 1)) / tmemclk;
DP (printf
("Minimum Ras Pulse Width [ns]: %d = in Clk cycles %d\n",
dimmInfo->minRasPulseWidth, tras_clocks));
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 31: /* Module Bank Density */
dimmInfo->moduleBankDensity = data[i];
DP (printf
("Module Bank Density: %d\n",
dimmInfo->moduleBankDensity));
#ifdef DEBUG
DP (printf
("*** Offered Densities (more than 1 = Multisize-Module): "));
{
if (dimmInfo->moduleBankDensity & 1)
DP (printf ("4MB, "));
if (dimmInfo->moduleBankDensity & 2)
DP (printf ("8MB, "));
if (dimmInfo->moduleBankDensity & 4)
DP (printf ("16MB, "));
if (dimmInfo->moduleBankDensity & 8)
DP (printf ("32MB, "));
if (dimmInfo->moduleBankDensity & 16)
DP (printf ("64MB, "));
if (dimmInfo->moduleBankDensity & 32)
DP (printf ("128MB, "));
if ((dimmInfo->moduleBankDensity & 64)
|| (dimmInfo->moduleBankDensity & 128)) {
DP (printf ("ERROR, "));
hang ();
}
}
DP (printf ("\n"));
#endif
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 32: /* Address And Command Setup Time (measured in ns/1000) */
sign = 1;
switch (dimmInfo->memoryType) {
case DDR:
time_tmp =
(((data[i] & 0xf0) >> 4) * 10) +
((data[i] & 0x0f));
leftOfPoint = time_tmp / 100;
rightOfPoint = time_tmp % 100;
break;
case SDRAM:
leftOfPoint = (data[i] & 0xf0) >> 4;
if (leftOfPoint > 7) {
leftOfPoint = data[i] & 0x70 >> 4;
sign = -1;
}
rightOfPoint = (data[i] & 0x0f);
break;
}
dimmInfo->addrAndCommandSetupTime =
(leftOfPoint * 100 + rightOfPoint) * sign;
DP (printf
("Address And Command Setup Time [ns]: %d.%d\n",
sign * leftOfPoint, rightOfPoint));
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 33: /* Address And Command Hold Time */
sign = 1;
switch (dimmInfo->memoryType) {
case DDR:
time_tmp =
(((data[i] & 0xf0) >> 4) * 10) +
((data[i] & 0x0f));
leftOfPoint = time_tmp / 100;
rightOfPoint = time_tmp % 100;
break;
case SDRAM:
leftOfPoint = (data[i] & 0xf0) >> 4;
if (leftOfPoint > 7) {
leftOfPoint = data[i] & 0x70 >> 4;
sign = -1;
}
rightOfPoint = (data[i] & 0x0f);
break;
}
dimmInfo->addrAndCommandHoldTime =
(leftOfPoint * 100 + rightOfPoint) * sign;
DP (printf
("Address And Command Hold Time [ns]: %d.%d\n",
sign * leftOfPoint, rightOfPoint));
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 34: /* Data Input Setup Time */
sign = 1;
switch (dimmInfo->memoryType) {
case DDR:
time_tmp =
(((data[i] & 0xf0) >> 4) * 10) +
((data[i] & 0x0f));
leftOfPoint = time_tmp / 100;
rightOfPoint = time_tmp % 100;
break;
case SDRAM:
leftOfPoint = (data[i] & 0xf0) >> 4;
if (leftOfPoint > 7) {
leftOfPoint = data[i] & 0x70 >> 4;
sign = -1;
}
rightOfPoint = (data[i] & 0x0f);
break;
}
dimmInfo->dataInputSetupTime =
(leftOfPoint * 100 + rightOfPoint) * sign;
DP (printf
("Data Input Setup Time [ns]: %d.%d\n",
sign * leftOfPoint, rightOfPoint));
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
case 35: /* Data Input Hold Time */
sign = 1;
switch (dimmInfo->memoryType) {
case DDR:
time_tmp =
(((data[i] & 0xf0) >> 4) * 10) +
((data[i] & 0x0f));
leftOfPoint = time_tmp / 100;
rightOfPoint = time_tmp % 100;
break;
case SDRAM:
leftOfPoint = (data[i] & 0xf0) >> 4;
if (leftOfPoint > 7) {
leftOfPoint = data[i] & 0x70 >> 4;
sign = -1;
}
rightOfPoint = (data[i] & 0x0f);
break;
}
dimmInfo->dataInputHoldTime =
(leftOfPoint * 100 + rightOfPoint) * sign;
DP (printf
("Data Input Hold Time [ns]: %d.%d\n\n",
sign * leftOfPoint, rightOfPoint));
break;
/*------------------------------------------------------------------------------------------------------------------------------*/
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?