📄 main.c
字号:
}
else if (ST_ErrorCode == STPOD_ERROR_EVT)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Init()=%s",
"STPOD_ERROR_EVT"));
}
else
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Init(%s)=%s",
"STPOD_Init", GetErrorText(ST_ErrorCode)));
}
}
else
{
STTBX_Report((STTBX_REPORT_LEVEL_INFO, "STPOD_Init(%s)=OK",
PODDeviceName, GetErrorText(ST_ErrorCode)));
}
if (ST_ErrorCode == ST_NO_ERROR)
{
ST_ErrorCode = STPOD_Open(PODDeviceName,&STPOD_OpenParams,&STPODHandle);
if (ST_ErrorCode != ST_NO_ERROR)
{
if (ST_ErrorCode == ST_ERROR_BAD_PARAMETER)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"ST_ERROR_BAD_PARAMETER"));
}
else if (ST_ErrorCode == STPOD_ERROR_FPGA)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_ERROR_FPGA"));
}
else if (ST_ErrorCode == STPOD_ERROR_EVENT_REGISTER)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_ERROR_EVENT_REGISTER"));
}
else if (ST_ErrorCode == STPOD_ERROR_READ_NO_DATA)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_ERROR_READ_NO_DATA"));
}
else if (ST_ErrorCode == STPOD_ERROR_NO_MODULE)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_ERROR_NO_MODULE"));
}
else if (ST_ErrorCode == STPOD_ERROR_MODULE_BUSY)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_ERROR_MODULE_BUSY"));
}
else if (ST_ErrorCode == STPOD_ERROR_WRITE)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_ERROR_WRITE"));
}
else if (ST_ErrorCode == STPOD_ERROR_READ)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_ERROR_READ"));
}
else if (ST_ErrorCode == STPOD_CIS_ERROR)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_CIS_ERROR"));
}
else if (ST_ErrorCode == STPOD_ERROR_RESET)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_ERROR_RESET"));
}
else if (ST_ErrorCode == STPOD_INTERNAL_ERROR)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_INTERNAL_ERROR"));
}
else if (ST_ErrorCode == STPOD_ERROR_IIR_SET)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_ERROR_IIR_SET"));
}
else if (ST_ErrorCode == STPOD_ERROR_BAD_DRIVER)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD DEVICE NOT PRESENT"));
}
else if (ST_ErrorCode == STPOD_ERROR_EVENT_UNREGISTER)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_ERROR_EVENT_UNREGISTER"));
}
else if (ST_ErrorCode == STPOD_ERROR_EVT)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open()=%s",
"STPOD_ERROR_EVT"));
}
else
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Open(%s)=%s",
"STPOD_Open", GetErrorText(ST_ErrorCode)));
}
STPOD_TermParams.ForceTerminate = TRUE;
ST_ErrorCode = STPOD_Term(PODDeviceName,&STPOD_TermParams);
if (ST_ErrorCode != ST_NO_ERROR)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Term(%s)=%s",
"STPOD_Term", GetErrorText(ST_ErrorCode)));
}
else
{
STTBX_Report((STTBX_REPORT_LEVEL_INFO, "STPOD_Term(%s)=OK",
PODDeviceName, GetErrorText(ST_ErrorCode)));
}
return (ST_ErrorCode);
}
else
{
STTBX_Report((STTBX_REPORT_LEVEL_INFO, "STPOD_Open(%s)=OK",
PODDeviceName, GetErrorText(ST_ErrorCode)));
}
ST_ErrorCode = STPOD_Close(STPODHandle);
if (ST_ErrorCode != ST_NO_ERROR)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Close(%s)=%s",
"STPOD_Close", GetErrorText(ST_ErrorCode)));
}
else
{
STTBX_Report((STTBX_REPORT_LEVEL_INFO, "STPOD_Close(%s)=OK",
PODDeviceName, GetErrorText(ST_ErrorCode)));
}
STPOD_TermParams.ForceTerminate = TRUE;
ST_ErrorCode = STPOD_Term(PODDeviceName,&STPOD_TermParams);
if (ST_ErrorCode != ST_NO_ERROR)
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR, "STPOD_Term(%s)=%s",
"STPOD_Term", GetErrorText(ST_ErrorCode)));
}
else
{
STTBX_Report((STTBX_REPORT_LEVEL_INFO, "STPOD_Term(%s)=OK",
PODDeviceName, GetErrorText(ST_ErrorCode)));
}
}
return ST_ErrorCode;
} /* Stpod_Test () */
/*------------------------------------------------------------------------
* Function : BasicInfraStructure_Init
* Initialise basic drivers
* Input : None
* Output :
* Return : Error code
* ----------------------------------------------------------------------*/
ST_ErrorCode_t BasicInfraStructure_Init(void)
{
ST_ErrorCode_t ST_ErrorCode;
STEVT_OpenParams_t STEVT_OpenParams;
BOOL IsDCacheOn;
PIO_DeviceId_t index;
ST_ErrorCode = SECTIONS_Setup(); /* memory partition initialisation */
if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
ST_ErrorCode = BOOT_Init(); /* OS initialisation */
if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
/* Get clock info structure - for global use */
(void) ST_GetClockInfo(&ST_ClockInfo);
/* clean global channel info list */
memset((U8*)ChannelInfo, 0, MAX_PAT_DATA_SIZE*sizeof(LISTS_Channel_t));
memset((U8*)&CurrentChannelInfo, 0, sizeof(LISTS_Channel_t));
/* Init all PIO available */
for (index=PIO_0; (NUM_PIO_PORTS > index); index++ )
{
ST_ErrorCode = PIO_Init( index );
if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
}
ST_ErrorCode = UART_Setup(); /* UART Needs PIO */
if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
/* --- No Calls to STTBX I/O functions before here --- */
#ifdef STTBX_PRINT
ST_ErrorCode = TBX_Setup(); /* Needs UART if DVD_IO set to UART */
if (ST_ErrorCode != ST_NO_ERROR)
{
STTBX_Print (("Error Code returned by TBX\n"));
return(ST_ErrorCode);
}
#endif
#if defined(TESTTOOL)
if ( ST_ErrorCode == ST_NO_ERROR )
{
ST_ErrorCode = TST_Init (); /* Init Testtool */
if (ST_ErrorCode != ST_NO_ERROR)
{
/* Keep compatibility with older version */
return 3;
}
}
#endif
memset(&STEVT_OpenParams, 0, sizeof(STEVT_OpenParams));
ST_ErrorCode = EVT_Init( EVT_BACK );
if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
ST_ErrorCode = STEVT_Open(EVT_GET_DEVICENAME(EVT_BACK), &STEVT_OpenParams, &EVT_GET_HANDLE(EVT_BACK,0) );
if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
LOCAL_PRINT(("EVT_Open(EVT_BACK)=%s\n",GetErrorText(ST_ErrorCode)));
ST_ErrorCode = I2C_Init((I2C_DeviceId_t)I2C_BACK);
if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
ST_ErrorCode = I2C_Init((I2C_DeviceId_t)I2C_FRONT);
if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
ST_ErrorCode = FDMA_Init();
if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
ST_ErrorCode = AVMEM_Init();
if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
#ifdef ENABLE_TRACE
if (TraceInit())
{
/* Just display an error, but carry on - it is not that serious */
STTBX_Print(("TraceInit failed\n"));
}
#endif
#ifdef DCACHE_ENABLE
IsDCacheOn = !( DCacheMap[0].StartAddress==NULL && DCacheMap[0].EndAddress==NULL );
#else
IsDCacheOn = FALSE;
#endif
STTBX_Print(("\n==============================================\n"));
STTBX_Print((" OS20/ST-Lite: %s\n", kernel_version() ));
STTBX_Print((" Processor: %s\n", device_name(device_id()) ));
#ifdef ICACHE_ENABLE
STTBX_Print((" ICache = ON DCache = %s\n", IsDCacheOn ? "ON":"OFF"));
#else
STTBX_Print((" ICache = OFF DCache = %s\n", IsDCacheOn ? "ON":"OFF"));
#endif
STTBX_Print((" CPU Speed: %d\n", ST_ClockInfo.C2 ));
STTBX_Print((" STPTI support: "));
#if defined(STPTI_DVB_SUPPORT)
STTBX_Print(("DVB "));
#endif
#if defined(STPTI_DTV_SUPPORT)
STTBX_Print(("DirecTV "));
#endif
#if !defined(STPTI_DTV_SUPPORT) && !defined(STPTI_DVB_SUPPORT)
STTBX_Print(("none "));
#endif
STTBX_Print(("\n Service: "));
#if defined(SERVICE_DVB)
STTBX_Print(("DVB "));
#endif
#if defined(SERVICE_DIRECTV)
STTBX_Print(("DirecTV "));
#endif
#if !defined(SERVICE_DVB) && !defined(SERVICE_DIRECTV)
STTBX_Print(("none "));
#endif
STTBX_Print(("\n Build Date: %s at %s\n", __DATE__, __TIME__ ));
STTBX_Print(("==============================================\n\n"));
GetStapiRevisions();
return( ST_ErrorCode );
}
/*----------------------------------------------------------------------------
* Function : main
* Main entry point
* Input : command line arguments
* Output :
* Return : ST_ErrorCode
* -------------------------------------------------------------------------- */
int main(void)
{
ST_ErrorCode_t ST_ErrorCode = ST_NO_ERROR;
ST_ErrorCode = BasicInfraStructure_Init();
if (ST_ErrorCode != ST_NO_ERROR) return ST_ErrorCode;
/* Set ReferencePath value for test-file database from DVD_REF define */
if ( SetRefPath() )
return 4; /* Error */
(void) task_priority_set(NULL, MIN_USER_PRIORITY); /* don't block anything else */
#if 0
/* Basic API tests for drivers not tested in tree testapps. */
/* Call them after root task becomes min priority, otherwise tasks may fail */
Statapi_Test(); /* simple API test */
Stpccrd_Test(); /* simple API test */
Stsmart_Test(); /* simple API test */
Stpod_Test(); /* simple API test */
#endif
/* TS settings for normal TSIN.
Remove following settings for DVB-CI, it has its own settings. */
#ifdef EPLD_STEM /* required for STEMs */
STSYS_WriteRegDev32LE(0x41800000, 0x00080008); /* set EPLD mode for STEMs*/
#else
STSYS_WriteRegDev32LE(0x41800000, 0x00000000); /* set EPLD mode for NIMs*/
#endif
if (ST_ErrorCode == ST_NO_ERROR) /* run test application if all went well */
{
#ifdef TESTTOOL
/* Start Testtool */
ST_ErrorCode = Start_Testtool ();
if (ST_ErrorCode != ST_NO_ERROR) return(ST_ErrorCode);
/* Testtool has finished, its time to terminate */
if ( STTST_Term() )
{
STTBX_Report((STTBX_REPORT_LEVEL_ERROR,
"STTST_Term() failed !"));
}
#else
STTBX_Print(("\n-------- Application started -----------\n\n"));
ST_ErrorCode = TestApplication();
#endif
}
return (ST_ErrorCode);
}
#endif
/* EOF main.c */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -