📄 adi_ssl_init.c
字号:
ADI_EBIU_TIMING_VALUE twrmin = {1,{7500, ADI_EBIU_TIMING_UNIT_PICOSEC}}; // set min TWR to 1 SCLK cycle + 7.5ns
ADI_EBIU_TIMING_VALUE refresh = {8192,{64, ADI_EBIU_TIMING_UNIT_MILLISEC}}; // set refresh period to 8192 cycles in 64ms
ADI_EBIU_TIME trasmin = {44, ADI_EBIU_TIMING_UNIT_NANOSEC}; // set min TRAS to 44ns
ADI_EBIU_TIME trpmin = {20, ADI_EBIU_TIMING_UNIT_NANOSEC}; // set min TRP to 20ns
ADI_EBIU_TIME trcdmin = {20, ADI_EBIU_TIMING_UNIT_NANOSEC}; // set min TRCD to 20ns
u32 cl_threshold = 100; // set cl threshold to 100 Mhz
ADI_EBIU_SDRAM_BANK_VALUE bank_size = {0, {size: ADI_EBIU_SDRAM_BANK_64MB }}; // set bank size to 64MB
ADI_EBIU_SDRAM_BANK_VALUE bank_width = {0, {width: ADI_EBIU_SDRAM_BANK_COL_10BIT}}; // set column address width to 10-Bit
ADI_EBIU_COMMAND_PAIR ezkit_ram[] = {
{ ADI_EBIU_CMD_SET_SDRAM_BANK_SIZE, (void*)&bank_size },
{ ADI_EBIU_CMD_SET_SDRAM_BANK_COL_WIDTH,(void*)&bank_width },
{ ADI_EBIU_CMD_SET_SDRAM_CL_THRESHOLD, (void*)cl_threshold },
{ ADI_EBIU_CMD_SET_SDRAM_TRASMIN, (void*)&trasmin },
{ ADI_EBIU_CMD_SET_SDRAM_TRPMIN, (void*)&trpmin },
{ ADI_EBIU_CMD_SET_SDRAM_TRCDMIN, (void*)&trcdmin },
{ ADI_EBIU_CMD_SET_SDRAM_TWRMIN, (void*)&twrmin },
{ ADI_EBIU_CMD_SET_SDRAM_REFRESH, (void*)&refresh },
/* Asynch Commands memory controller commands */
{ ADI_EBIU_CMD_SET_ASYNCH_CLKOUT_ENABLE, (void*)&clkout_enable },
{ ADI_EBIU_CMD_SET_ASYNCH_BANK_ENABLE, (void*)&banks_enable },
{ ADI_EBIU_CMD_SET_ASYNCH_BANK_TRANSITION_TIME, (void*)&asynch_bank_trans_time },
{ ADI_EBIU_CMD_SET_ASYNCH_BANK_READ_ACCESS_TIME, (void*)&asynch_bank_read_access_time },
{ ADI_EBIU_CMD_SET_ASYNCH_BANK_WRITE_ACCESS_TIME, (void*)&asynch_bank_write_access_time },
{ ADI_EBIU_CMD_SET_ASYNCH_BANK_SETUP_TIME, (void*)&asynch_bank_setup_time },
{ ADI_EBIU_CMD_SET_ASYNCH_BANK_HOLD_TIME, (void*)&asynch_bank_hold_time },
{ ADI_EBIU_CMD_SET_ASYNCH_BANK_ARDY_ENABLE, (void*)&asynch_bank_ardy_enable },
{ ADI_EBIU_CMD_SET_ASYNCH_BANK_ARDY_POLARITY, (void*)&asynch_bank_ardy_polarity },
{ ADI_EBIU_CMD_END, 0 }
};
#endif
/********************************************************************/
// initialize everything but exit upon the first error
do {
// initialize the interrupt manager, parameters are
// pointer to memory for interrupt manager to use
// memory size (in bytes)
// location where the number of secondary handlers that can be supported will be stored
// parameter for adi_int_EnterCriticalRegion (always NULL for VDK and standalone systems)
if ((Result = adi_int_Init(InterruptServiceData, sizeof(InterruptServiceData), &i, ADI_SSL_ENTER_CRITICAL)) != ADI_INT_RESULT_SUCCESS) {
break;
}
#if defined(__ADSP_TETON__) && defined( ADI_SSL_DUAL_CORE ) // BF561 EZKit
if( adi_core_id() == 0) // init EBIU on Core A only
{
#endif
// initialize the EBIU, parameters are
// address of table containing RAM parameters
// 0 - reserved field, always 0
// Ignores result, so it can keep going if it's already initialized
Result = adi_ebiu_Init(ezkit_ram, 0);
if ((Result != ADI_EBIU_RESULT_SUCCESS) && (Result != ADI_EBIU_RESULT_ALREADY_INITIALIZED)) {
break;
}
#if defined(__ADSP_TETON__) && defined( ADI_SSL_DUAL_CORE ) // BF561 EZKit
}
#endif
// initialize power, parameters are
// address of table containing processor information
// keep going if it's already initialized
Result = adi_pwr_Init(ezkit_power);
if ((Result != ADI_PWR_RESULT_SUCCESS) && (Result != ADI_PWR_RESULT_ALREADY_INITIALIZED)) {
break;
}
#if defined(__ADSP_BRAEMAR__) || defined(__ADSP_STIRLING__) || defined(__ADSP_MOAB__) || defined(__ADSP_KOOKABURRA__) || defined(__ADSP_MOCKINGBIRD__)
// initialize port control, parameters are
// parameter for adi_int_EnterCriticalRegion (always NULL for VDK and standalone systems)
if ((Result = adi_ports_Init(ADI_SSL_ENTER_CRITICAL)) != ADI_PORTS_RESULT_SUCCESS) {
break;
}
#endif
// initialize deferred callback service if needed, parameters are
// pointer to data
// size of data
// location where number of servers is stored
// parameter for adi_int_EnterCriticalRegion (always NULL for VDK and standalone systems)
#if (ADI_SSL_DCB_NUM_SERVERS != 0)
if ((Result = adi_dcb_Init(DeferredCallbackServiceData, sizeof(DeferredCallbackServiceData), &i, ADI_SSL_ENTER_CRITICAL)) != ADI_DCB_RESULT_SUCCESS) {
break;
}
#endif
// initialize the dma manager if needed, parameters are
// pointer to memory for the DMA manager to use
// memory size (in bytes)
// parameter for adi_int_EnterCriticalRegion (always NULL for VDK and standalone systems)
#if (ADI_SSL_DMA_NUM_CHANNELS != 0)
if ((Result = adi_dma_Init(DMAServiceData, sizeof(DMAServiceData), &i, &adi_dma_ManagerHandle, ADI_SSL_ENTER_CRITICAL)) != ADI_DMA_RESULT_SUCCESS) {
break;
}
#endif
// initialize the flag manager, parameters are
// pointer to memory for the flag service to use
// memory size (in bytes)
// location where the number of flag callbacks that can be supported will be stored
// parameter for adi_int_EnterCriticalRegion (always NULL for VDK and standalone systems)
if ((Result = adi_flag_Init(FlagServiceData, sizeof(FlagServiceData), &i, ADI_SSL_ENTER_CRITICAL)) != ADI_FLAG_RESULT_SUCCESS) {
break;
}
// initialize the timer manager, parameters are
// parameter for adi_int_EnterCriticalRegion (always NULL for VDK and standalone systems)
if ((Result = adi_tmr_Init(ADI_SSL_ENTER_CRITICAL)) != ADI_TMR_RESULT_SUCCESS) {
break;
}
#if !defined(ADI_SSL_RTC_NO_INIT) && !defined(__ADSP_TETON__)
// initialize the RTC service
// parameter for adi_int_EnterCriticalRegion (always NULL for VDK and standalone systems)
if ((Result = adi_rtc_Init(ADI_SSL_ENTER_CRITICAL)) != ADI_RTC_RESULT_SUCCESS) {
break;
}
#endif
// initialize the semaphore service if needed, parameters are
// pointer to memory for the semaphore service to use
// memory size (in bytes)
// parameter for adi_int_EnterCriticalRegion (always NULL for VDK and standalone systems)
#if (ADI_SSL_SEM_NUM_SEMAPHORES != 0)
if ((Result = adi_sem_Init(SemaphoreServiceData, sizeof(SemaphoreServiceData), &i, ADI_SSL_ENTER_CRITICAL)) != ADI_SEM_RESULT_SUCCESS) {
break;
}
#endif
// initialize the device manager if needed, parameters are
// pointer to data for the device manager to use
// size of the data in bytes
// location where the number of devices that can be managed will be stored
// location where the device manager handle will be stored
// parameter for adi_int_EnterCriticalRegion() function (always NULL for standalone and VDK)
#if (ADI_SSL_DEV_NUM_DEVICES != 0)
if ((Result = adi_dev_Init(DevMgrData, sizeof(DevMgrData), &i, &adi_dev_ManagerHandle, ADI_SSL_ENTER_CRITICAL)) != ADI_DEV_RESULT_SUCCESS) {
break;
}
#endif
// WHILE (no errors or 1 pass complete)
} while (0);
// return
return (Result);
}
/*********************************************************************
Function: adi_ssl_Terminate
Description: Terminates the system services and device manager
*********************************************************************/
u32 adi_ssl_Terminate(void) {
u32 Result;
// terminate everything but exit upon the first error
do {
// terminate the device manager if needed
#if (ADI_SSL_DEV_NUM_DEVICES != 0)
if ((Result = adi_dev_Terminate(adi_dev_ManagerHandle)) != ADI_DEV_RESULT_SUCCESS) {
break;
}
#endif
// terminate the semaphore service if needed
#if (ADI_SSL_SEM_NUM_SEMAPHORES != 0)
if ((Result = adi_sem_Terminate()) != ADI_SEM_RESULT_SUCCESS) {
break;
}
#endif
#if !defined(ADI_SSL_RTC_NO_INIT) && !defined(__ADSP_TETON__)
// terminate the RTC service
if ((Result = adi_rtc_Terminate()) != ADI_RTC_RESULT_SUCCESS) {
break;
}
#endif
// terminate the timer manager
if ((Result = adi_tmr_Terminate()) != ADI_TMR_RESULT_SUCCESS) {
break;
}
// terminate the flag manager
if ((Result = adi_flag_Terminate()) != ADI_FLAG_RESULT_SUCCESS) {
break;
}
// terminate the dma manager if needed
#if (ADI_SSL_DMA_NUM_CHANNELS != 0)
if ((Result = adi_dma_Terminate(adi_dma_ManagerHandle)) != ADI_DMA_RESULT_SUCCESS) {
break;
}
#endif
// terminate the deferred callback service if needed
#if (ADI_SSL_DCB_NUM_SERVERS != 0)
if ((Result = adi_dcb_Terminate()) != ADI_DCB_RESULT_SUCCESS) {
break;
}
#endif
#if defined(__ADSP_BRAEMAR__) || defined(__ADSP_STIRLING__) || defined(__ADSP_MOAB__) || defined(__ADSP_KOOKABURRA__) || defined(__ADSP_MOCKINGBIRD__)
// terminate port control
if ((Result = adi_ports_Terminate()) != ADI_PORTS_RESULT_SUCCESS) {
break;
}
#endif
// terminate power
if ((Result = adi_pwr_Terminate()) != ADI_PWR_RESULT_SUCCESS) {
break;
}
#if defined(__ADSP_TETON__) && defined( ADI_SSL_DUAL_CORE ) // BF561 EZKit
if( adi_core_id() == 0) // init EBIU on Core A only
{
#endif
// terminate the EBIU
if ((Result = adi_ebiu_Terminate()) != ADI_EBIU_RESULT_SUCCESS) {
break;
}
#if defined(__ADSP_TETON__) && defined( ADI_SSL_DUAL_CORE ) // BF561 EZKit
}
#endif
// terminate the interrupt manager
if ((Result = adi_int_Terminate()) != ADI_INT_RESULT_SUCCESS) {
break;
}
// WHILE (no errors or 1 pass complete)
} while (0);
// return
return (Result);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -