📄 bbu_dd_post.c
字号:
postTestResult.errorCode = POST_5MSFRAME_ERR;
GPIO_setLedOn(hCpbGpio,led1PinMask);
return POST_ERROR;
}
GPIO_setLedOff(hCpbGpio,led1PinMask);
return POST_OK;
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: POST_10msSlotReadyTest *
* 函数描述: 10ms frame/slot/dataReady input signal Test *
* 相关文档: *
* 参数描述: 无 *
* *
* 返回值: 0 -- POST_OK, -1 -- POST_ERROR *
* 说明: *
*******************************************************************************/
CSLAPI Sint32 POST_10msSlotReadyTest(void)
{
TIMER_Handle *hTimer;
Uint32 flag1;
flag1 = 0;
timerIntCount[TIMER_DEV0] = 0;
/* initilizing the TIMER device */
hTimer = (TIMER_Handle *)TIMER_init(TIMER_DEV0);
if (hTimer == TIMER_HINV)
{
postTestResult.errorCode = POST_TIMER0_INIT_ERR;
return POST_ERROR;
}
/* start the Timer Device */
TIMER_start(hTimer);
gpio10msSlotReadyCount = 0;
IRQ_enable(IRQ_EVT_EXTINT7); /* enable 10ms frame/slot/dataReady interrupt */
do{
if(timerIntCount[TIMER_DEV0] > 1000) /* 5 seconds */
{
break;
}
if((((Uint32)(timerIntCount[TIMER_DEV0]/50) % 2) == 0) && (flag1 == 0))
{
GPIO_setLedOn(hCpbGpio,led2PinMask);
flag1 = 1;
}
if((((Uint32)(timerIntCount[TIMER_DEV0]/50) % 2) == 1) && (flag1 == 1))
{
GPIO_setLedOff(hCpbGpio,led2PinMask);
flag1 = 0;
}
}while(1);
/* close the TIMER Device */
TIMER_close(hTimer);
IRQ_disable(IRQ_EVT_EXTINT7); /* disable 10ms frame/slot/dataReady interrupt */
switch(postTestResult.dspId)
{
case CCDSP_ID: gpio10msSlotReadyCount = gpio10msSlotReadyCount * 2; /*10ms frame */
break;
case TXDSP_ID: gpio10msSlotReadyCount = (Uint32)(gpio10msSlotReadyCount / 8); /* 8 slots */
break;
}
if((gpio10msSlotReadyCount > (timerIntCount[TIMER_DEV0] + 3)) || \
(gpio10msSlotReadyCount < (timerIntCount[TIMER_DEV0] - 3)))
{
postTestResult.errorCode = POST_10MSSLOTREADY_ERR;
GPIO_setLedOn(hCpbGpio,led2PinMask);
return POST_ERROR;
}
GPIO_setLedOff(hCpbGpio,led2PinMask);
return POST_OK;
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: POST_errorHandle *
* 函数描述: POST Error handling *
* 相关文档: *
* 参数描述: 无 *
* *
* 返回值: 无 *
* 说明: *
*******************************************************************************/
CSLAPI void POST_errorHandle(void)
{
EDMA_resetAll();
GPIO_resetAll(hCpbGpio);
GPIO_close(hCpbGpio);
if (POST_hpiReport() == POST_OK)
{
#if 1
puts("MPC8260 ACK to DSP is Correct\n");
#endif
}
else
{
#if 1
puts("MPC8260 ACK to DSP is Uncorrect\n");
#endif
}
IRQ_resetAll();
}
/*----------------------------------------------------------------------------*/
/*******************************************************************************
* 函数名称: POST_hpiReport *
* 函数描述: POST testing result is report to MPC8260 through the HPI port *
* 相关文档: *
* 参数描述: 无 *
* *
* 返回值: 无 *
* 说明: *
*******************************************************************************/
CSLAPI Sint32 POST_hpiReport(void)
{
hpiDspIntFlag = 0;
HPI_init((Uint32)&postTestResult);
while (HPI_getHint() != HPI_HPIC_HINT_0); /* wait HINT bit in HPIC become 0 */
HPI_setHint(HPI_HPIC_HINT_1); /* DSP Assert a HPI interrupt to MPC8260 */
while (hpiDspIntFlag != 1);
IRQ_disable(IRQ_EVT_DSPINT);
if ((mpc8260Ack.length != (sizeof(HOST_Ack)/4 - 1)) || \
(mpc8260Ack.dspId != postTestResult.dspId))
{
return POST_ERROR;
}
else
{
return POST_OK;
}
}
/*----------------------------------------------------------------------------*/
void main(void)
{
Sint32 result;
/* DSP CORE Testing */
if ((result = POST_coreTest()) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("DSP CORE test is passed\n");
#endif
IRQ_init();
EDMA_init();
EMIFA_init();
#if 1
puts("Chip Initilization finished\n");
#endif
/* DSP GPIO Testing */
if ((result = POST_gpioTest()) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("DSP GPIO test is passed\n");
#endif
/* DSP internal L2 SRAM Testing */
if ((result = POST_l2memTest()) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("L2MEM test is passed\n");
#endif
/* EMIFA DPRAM Testing */
#if POST_TEST_MODE /* for CPB */
if ((result = POST_emifaDpramTest()) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("EMIFA DPRAM test is passed\n");
#endif
#endif
/* EMIFA SDRAM Testing */
#if POST_TEST_MODE /* for CPB */
if(postTestResult.dspId == CCDSP_ID)
{
if ((result = POST_emifaSdramTest()) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("EMIFA SDRAM test is passed\n");
#endif
}
#else /* for DSK */
if ((result = POST_emifaSdramTest()) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("EMIFA SDRAM test is passed\n");
#endif
#endif
/* McBSP Port0 Testing */
if ((result = POST_mcbspTest(MCBSP_PORT0)) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("McBSP0 test is passed\n");
#endif
/* McBSP Port1 Testing */
if ((result = POST_mcbspTest(MCBSP_PORT1)) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("McBSP1 test is passed\n");
#endif
/* McBSP Port2 Testing */
if ((result = POST_mcbspTest(MCBSP_PORT2)) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("McBSP2 test is passed\n");
#endif
/* Timer0 Testing */
if ((result = POST_timerTest(TIMER_DEV0)) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("TIMER0 test is passed\n");
#endif
/* Timer1 Testing */
if ((result = POST_timerTest(TIMER_DEV1)) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("TIMER1 test is passed\n");
#endif
/* Timer2 Testing */
if ((result = POST_timerTest(TIMER_DEV2)) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("TIMER2 test is passed\n");
#endif
/* 5ms frame Testing */
if ((result = POST_5msFrameTest()) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("5ms Frame test is passed\n");
#endif
/* 10ms frame/slot/dataReady Testing */
if ((result = POST_10msSlotReadyTest()) == POST_ERROR)
{
POST_errorHandle();
return;
}
#if 1
puts("10ms frame/slot/dataReady test is passed\n");
#endif
POST_errorHandle();
#if 1
puts("CPB Power On Self Test is finished\n");
#endif
}
/******************************************************************************\
* End of BBU_DD_Post.c
\******************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -