boot.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:2k
- #include <stddef.h>
- #include <gendef.h>
- #include "stdevice.h"
- #include "stboot.h"
- #include "stsys.h"
- #include "stcommon.h"
- ST_DeviceName_t BOOT_DeviceName = "BOOT";
- STBOOT_DCache_Area_t g_KBBOOTDCacheMap[2] = {
- {(U32 *) 0xC0800000, (U32 *) 0xFFFFFFFF}, /* 32MB Cache */
- {NULL, NULL}
- };
- #define DCAC_Region1TopEnable 0x02C
- #define ICAC_Region1TopEnable 0x02C
- ST_ErrorCode_t KB_BOOTSetup(void)
- {
- ST_ErrorCode_t ST_ErrorCode;
- STBOOT_InitParams_t STBOOT_InitParams;
- STBOOT_InitParams.SDRAMFrequency = SDRAM_FREQUENCY;
- STBOOT_InitParams.CacheBaseAddress = (U32 *)CACHE_BASE_ADDRESS;
- STBOOT_InitParams.MemorySize = STBOOT_DRAM_MEMORY_SIZE_0;
- STBOOT_InitParams.BackendType.DeviceType = STBOOT_DEVICE_5105;
- STBOOT_InitParams.BackendType.MajorRevision = STBOOT_REVISION_UNKNOWN;
- STBOOT_InitParams.BackendType.MinorRevision = STBOOT_REVISION_UNKNOWN;
- #ifdef DISABLE_DCACHE
- Print("nDCache Disabled");
- STBOOT_InitParams.DCacheMap = NULL;
- #else
- Print("nDCache Enabled");
- STBOOT_InitParams.DCacheMap = g_KBBOOTDCacheMap;
- #endif
- #ifdef DISABLE_ICACHE
- Print("nICache Disabled");
- STBOOT_InitParams.ICacheEnabled = FALSE;
- #else
- Print("nICache Enabled");
- STBOOT_InitParams.ICacheEnabled = TRUE;
- #endif
- //STBOOT_InitParams.DCacheMap = NULL;
- //STBOOT_InitParams.ICacheEnabled = TRUE;
-
- #ifdef REPORT_TO_CONSOLE
- Print("BOOT: data cache range 0x%08x->0x%08xn", (U32)g_KBBOOTDCacheMap[0].StartAddress, (U32)g_KBBOOTDCacheMap[0].EndAddress );
- Print("BOOT: Cache Base Addr:0x%08xn", (U32)CACHE_BASE_ADDRESS);
- Print("BOOT: SDRAM_FREQ:%dn", (U32)SDRAM_FREQUENCY);
- Print("BOOT: STBOOT_DRAM_MEMORY_SIZE_0:%dn", (U32)STBOOT_DRAM_MEMORY_SIZE_0);
- Print("BOOT: EXTERNAL_BASE:%08x EXTERNAL_SIZE:%dn", EXTERNAL_BASE, EXTERNAL_SIZE);
- #endif
- ST_ErrorCode = STBOOT_Init(BOOT_DeviceName, &STBOOT_InitParams);
- STSYS_WriteRegDev16LE((ST5105_DCACHE_BASE_ADDRESS+DCAC_Region1TopEnable), 0xFFFF);
- STSYS_WriteRegDev16LE(ST5105_ICACHE_BASE_ADDRESS+ICAC_Region1TopEnable, 0xFFFF);
- if(ST_ErrorCode!=ST_NO_ERROR)
- Print("nSTBOOT_Init Error,Code=%d",ST_ErrorCode);
- else
- Print("KB_BOOTSetup finishedn");
- return( ST_ErrorCode );
- }
- /* EOF */