📄 bbu_dd_post.c
字号:
QDMA_config(qdmaConfig);
while (EDMA_intStatus(EDMA_TCC_QDMA) == 0);
EDMA_intClear(EDMA_TCC_QDMA);
if (POST_blockTest((Uint32*)L2MEM_BITR_BLOCK_ADD, \
(Uint32*)L2MEM_IMAGE_BLOCK_ADD, \
(Uint32)L2MEM_BLOCK_SIZE, \
(Uint32*)&l2memErrPosition)== POST_ERROR)
{
postTestResult.errorCode = POST_L2MEM_ERR;
postTestResult.l2memPosition = L2MEM_TEST_START_ADD + (i * L2MEM_BLOCK_SIZE) \
+ (l2memErrPosition - L2MEM_IMAGE_BLOCK_ADD);
return POST_ERROR;
}
blockPointer += (Uint32)(L2MEM_BLOCK_SIZE >> 2);
}
return POST_OK;
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: POST_emifaDpramTest *
* 函数描述: EMIFA DPRAM Test *
* 相关文档: *
* 参数描述: 无 *
* *
* 返回值: 0 -- POST_OK, -1 -- POST_ERROR *
* 说明: *
*******************************************************************************/
CSLAPI Sint32 POST_emifaDpramTest(void)
{
EDMA_DpramConfig config;
Uint32 *blockPointer;
Uint32 dpramErrPosition;
Sint32 result;
Uint32 i;
result = POST_OK;
blockPointer = (Uint32*)EMIFA_DPRAM_TEST_START_ADD;
for(i=0;i<(EMIFA_DPRAM_SIZE >> 2);i++)
{
blockPointer[i] = i;
}
POST_blockBitR((Uint32*)L2MEM_BITR_BLOCK_ADD, (Uint32)L2MEM_BLOCK_SIZE);
config.eleCount0 = (Uint32)(L2MEM_BLOCK_SIZE >> 2);
config.sour1Add = (Uint32)0xFFFFFFFF;
config.dest1Add = (Uint32)0xFFFFFFFF;
config.eleCount1 = 0;
config.sour2Add = (Uint32)0xFFFFFFFF;
config.dest2Add = (Uint32)0xFFFFFFFF;
config.eleCount2 = 0;
config.chainStage = 0;
for (i=0;i<EMIFA_DPRAM_MAX_BLOCK_NUM;i++)
{
/* Read data from DPRAM to backup block */
emifaDpramIntFlag = 0;
config.hCEdma1 = edmaEmifaRDpramCHandle1;
config.hCEdma2 = edmaEmifaRDpramCHandle2;
config.sour0Add = (Uint32)blockPointer;
config.dest0Add = (Uint32)L2MEM_BACKUP_BLOCK_ADD;
config.priority = (Uint32)EDMA_EMIFA_READ_DPRAM_PRI;
EMIFA_startEdmaDpram(edmaEmifaRDpramHandle,&config);
while(emifaDpramIntFlag == 0);
/* Write bit reserve block to DPRAM block */
emifaDpramIntFlag = 0;
config.hCEdma1 = edmaEmifaWDpramCHandle1;
config.hCEdma2 = edmaEmifaWDpramCHandle2;
config.sour0Add = (Uint32)L2MEM_BITR_BLOCK_ADD;
config.dest0Add = (Uint32)blockPointer;
config.priority = (Uint32)EDMA_EMIFA_WRITE_DPRAM_PRI;
EMIFA_startEdmaDpram(edmaEmifaWDpramHandle,&config);
while(emifaDpramIntFlag == 0);
/* Read data from DPRAM to image block */
emifaDpramIntFlag = 0;
config.hCEdma1 = edmaEmifaRDpramCHandle1;
config.hCEdma2 = edmaEmifaRDpramCHandle2;
config.sour0Add = (Uint32)blockPointer;
config.dest0Add = (Uint32)L2MEM_IMAGE_BLOCK_ADD;
config.priority = (Uint32)EDMA_EMIFA_READ_DPRAM_PRI;
EMIFA_startEdmaDpram(edmaEmifaRDpramHandle,&config);
while(emifaDpramIntFlag == 0);
/* write backup data to DPRAM */
emifaDpramIntFlag = 0;
config.hCEdma1 = edmaEmifaWDpramCHandle1;
config.hCEdma2 = edmaEmifaWDpramCHandle2;
config.sour0Add = (Uint32)L2MEM_BACKUP_BLOCK_ADD;
config.dest0Add = (Uint32)blockPointer;
config.priority = (Uint32)EDMA_EMIFA_WRITE_DPRAM_PRI;
EMIFA_startEdmaDpram(edmaEmifaWDpramHandle,&config);
while(emifaDpramIntFlag == 0);
if (POST_blockTest((Uint32*)L2MEM_BITR_BLOCK_ADD, \
(Uint32*)L2MEM_IMAGE_BLOCK_ADD, \
(Uint32)L2MEM_BLOCK_SIZE, \
(Uint32*)&dpramErrPosition)== POST_ERROR)
{
postTestResult.errorCode = POST_EMIFA_DPRAM_ERR;
postTestResult.dpramPosition = EMIFA_DPRAM_TEST_START_ADD + (i * L2MEM_BLOCK_SIZE) \
+ (dpramErrPosition - L2MEM_IMAGE_BLOCK_ADD);
result = POST_ERROR;
break;
}
blockPointer += (Uint32)(L2MEM_BLOCK_SIZE >> 2);
}
EDMA_close(edmaEmifaWDpramHandle);
EDMA_close(edmaEmifaWDpramCHandle1);
EDMA_close(edmaEmifaWDpramCHandle2);
EDMA_close(edmaEmifaRDpramHandle);
EDMA_close(edmaEmifaRDpramCHandle1);
EDMA_close(edmaEmifaRDpramCHandle2);
blockPointer = (Uint32*)EMIFA_DPRAM_TEST_START_ADD;
if(result == POST_OK)
{
for(i=0;i<(EMIFA_DPRAM_SIZE >> 2);i++)
{
if(blockPointer[i] != i)
{
postTestResult.errorCode = POST_EMIFA_DPRAM_ERR;
postTestResult.dpramPosition = (Uint32)(&blockPointer[i]);
return POST_ERROR;
}
}
return POST_OK;
}
else
{
return POST_ERROR;
}
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: POST_emifaSdramTest *
* 函数描述: EMIFA SDRAM Test *
* 相关文档: *
* 参数描述: 无 *
* *
* 返回值: 0 -- POST_OK, -1 -- POST_ERROR *
* 说明: *
*******************************************************************************/
CSLAPI Sint32 POST_emifaSdramTest(void)
{
EDMA_SdramConfig config;
Uint32 *blockPointer;
Uint32 sdramErrPosition;
Sint32 result;
Uint32 i;
result = POST_OK;
blockPointer = (Uint32*)EMIFA_SDRAM_TEST_START_ADD;
for(i=0;i<(EMIFA_SDRAM_SIZE >> 2);i++)
{
blockPointer[i] = i;
}
POST_blockBitR((Uint32*)L2MEM_BITR_BLOCK_ADD, (Uint32)L2MEM_BLOCK_SIZE);
config.eleCount = (Uint32)(L2MEM_BLOCK_SIZE >> 2);
for (i=0;i<EMIFA_SDRAM_MAX_BLOCK_NUM;i++)
{
/* Read data from SDRAM to backup block */
emifaSdramIntFlag = 0;
config.sourAdd = (Uint32)blockPointer;
config.destAdd = (Uint32)L2MEM_BACKUP_BLOCK_ADD;
config.priority = (Uint32)EDMA_EMIFA_READ_SDRAM_PRI;
EMIFA_startEdmaSdram(edmaEmifaRSdramHandle,&config);
while(emifaSdramIntFlag == 0);
/* Write bit reserve block to SDRAM block */
emifaSdramIntFlag = 0;
config.sourAdd = (Uint32)L2MEM_BITR_BLOCK_ADD;
config.destAdd = (Uint32)blockPointer;
config.priority = (Uint32)EDMA_EMIFA_WRITE_SDRAM_PRI;
EMIFA_startEdmaSdram(edmaEmifaWSdramHandle,&config);
while(emifaSdramIntFlag == 0);
/* Read data from SDRAM to image block */
emifaSdramIntFlag = 0;
config.sourAdd = (Uint32)blockPointer;
config.destAdd = (Uint32)L2MEM_IMAGE_BLOCK_ADD;
config.priority = (Uint32)EDMA_EMIFA_READ_SDRAM_PRI;
EMIFA_startEdmaSdram(edmaEmifaRSdramHandle,&config);
while(emifaSdramIntFlag == 0);
/* write backup data to SDRAM */
emifaSdramIntFlag = 0;
config.sourAdd = (Uint32)L2MEM_BACKUP_BLOCK_ADD;
config.destAdd = (Uint32)blockPointer;
config.priority = (Uint32)EDMA_EMIFA_WRITE_SDRAM_PRI;
EMIFA_startEdmaSdram(edmaEmifaWSdramHandle,&config);
while(emifaSdramIntFlag == 0);
if (POST_blockTest((Uint32*)L2MEM_BITR_BLOCK_ADD, \
(Uint32*)L2MEM_IMAGE_BLOCK_ADD, \
(Uint32)L2MEM_BLOCK_SIZE, \
(Uint32*)&sdramErrPosition)== POST_ERROR)
{
postTestResult.errorCode = POST_EMIFA_SDRAM_ERR;
postTestResult.sdramPosition = EMIFA_SDRAM_TEST_START_ADD + (i * L2MEM_BLOCK_SIZE) \
+ (sdramErrPosition - L2MEM_IMAGE_BLOCK_ADD);
result = POST_ERROR;
break;
}
blockPointer += (Uint32)(L2MEM_BLOCK_SIZE >> 2);
}
EDMA_close(edmaEmifaWSdramHandle);
EDMA_close(edmaEmifaRSdramHandle);
blockPointer = (Uint32*)EMIFA_SDRAM_TEST_START_ADD;
if(result == POST_OK)
{
for(i=0;i<(EMIFA_SDRAM_SIZE >> 2);i++)
{
if(blockPointer[i] != i)
{
postTestResult.errorCode = POST_EMIFA_SDRAM_ERR;
postTestResult.sdramPosition = (Uint32)(&blockPointer[i]);
return POST_ERROR;
}
}
return POST_OK;
}
else
{
return POST_ERROR;
}
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: POST_blockBitR *
* 函数描述: Fill a block with a bit reserve algorithm *
* 相关文档: *
* 参数描述: *
* 参数名 类型 输入/输出 描述 *
* -------- ---- --------- ----------- *
* buffer Uint32* in Buffer pointer *
* bufLength Uint32 in Buffer length(Bytes) *
* *
* 返回值: 无 *
* 说明: *
*******************************************************************************/
CSLAPI void POST_blockBitR(Uint32 *buffer, Uint32 bufLength)
{
Uint32 i;
Uint32 inter[4];
for(i=0; i<(bufLength>>2); i+=4)
{
inter[0] = (Uint32)(&buffer[i]);
inter[1] = ~inter[0];
inter[2] = _bitr(inter[0]);
inter[3] = ~inter[2];
buffer[i] = inter[0];
buffer[i+1] = inter[1];
buffer[i+2] = inter[2];
buffer[i+3] = inter[3];
}
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: POST_blockTest *
* 函数描述: Compare a block with its bitr image *
* 相关文档: *
* 参数描述: *
* 参数名 类型 输入/输出 描述 *
* -------- ---- --------- ----------- *
* buffer1 Uint32* in Buffer1 pointer *
* buffer2 Uint32* in Buffer2 pointer *
* bufLength Uint32 in Buffer length(Bytes) *
* memErrPosition Uint32* out pointer to memory error position *
* *
* 返回值: 0 -- POST_OK, -1 -- POST_ERROR *
* 说明: *
*******************************************************************************/
CSLAPI Sint32 POST_blockTest(Uint32 *buffer1, Uint32 *buffer2, Uint32 bufLength, Uint32 *memErrPosition)
{
Sint32 result;
Uint32 i;
Uint32 inter[4];
*memErrPosition = 0;
result = POST_OK;
/* Check the whole block data memory */
for(i=0; i<(bufLength>>2); i+=4)
{
inter[0] = (Uint32)(&buffer1[i]);
inter[1] = ~inter[0];
inter[2] = _bitr(inter[0]);
inter[3] = ~inter[2];
if (buffer2[i] != inter[0])
{
result = POST_ERROR;
*memErrPosition = (Uint32)(&buffer2[i]);
break;
}
if (buffer2[i+1] != inter[1])
{
result = POST_ERROR;
*memErrPosition = (Uint32)(&buffer2[i+1]);
break;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -