boot.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:2k
源码类别:

DVD

开发平台:

C/C++

  1. #include <stddef.h>
  2. #include <gendef.h>
  3. #include "stdevice.h"
  4. #include "stboot.h"
  5. #include "stsys.h"
  6. #include "stcommon.h"
  7. ST_DeviceName_t BOOT_DeviceName = "BOOT";
  8. STBOOT_DCache_Area_t g_KBBOOTDCacheMap[2] = {
  9.     {(U32 *) 0xC0800000, (U32 *) 0xFFFFFFFF},  /* 32MB Cache */
  10.     {NULL, NULL}
  11. };
  12. #define DCAC_Region1TopEnable    0x02C
  13. #define ICAC_Region1TopEnable     0x02C
  14. ST_ErrorCode_t KB_BOOTSetup(void)
  15. {
  16.     ST_ErrorCode_t ST_ErrorCode;
  17.     STBOOT_InitParams_t STBOOT_InitParams;
  18.     STBOOT_InitParams.SDRAMFrequency            = SDRAM_FREQUENCY;
  19.     STBOOT_InitParams.CacheBaseAddress          = (U32 *)CACHE_BASE_ADDRESS;
  20.     STBOOT_InitParams.MemorySize                = STBOOT_DRAM_MEMORY_SIZE_0;
  21.     STBOOT_InitParams.BackendType.DeviceType    = STBOOT_DEVICE_5105;
  22.     STBOOT_InitParams.BackendType.MajorRevision = STBOOT_REVISION_UNKNOWN;
  23.     STBOOT_InitParams.BackendType.MinorRevision = STBOOT_REVISION_UNKNOWN;
  24.     #ifdef DISABLE_DCACHE
  25. Print("nDCache Disabled");
  26.         STBOOT_InitParams.DCacheMap                 = NULL;
  27.     #else
  28. Print("nDCache Enabled");
  29.         STBOOT_InitParams.DCacheMap                 = g_KBBOOTDCacheMap;
  30.     #endif
  31.     #ifdef DISABLE_ICACHE
  32. Print("nICache Disabled");
  33.         STBOOT_InitParams.ICacheEnabled             = FALSE;
  34.     #else
  35. Print("nICache Enabled");
  36.         STBOOT_InitParams.ICacheEnabled             = TRUE;
  37.     #endif
  38.     //STBOOT_InitParams.DCacheMap                 = NULL;
  39.     //STBOOT_InitParams.ICacheEnabled             = TRUE;
  40.     
  41.     #ifdef REPORT_TO_CONSOLE
  42.         Print("BOOT: data cache range 0x%08x->0x%08xn", (U32)g_KBBOOTDCacheMap[0].StartAddress, (U32)g_KBBOOTDCacheMap[0].EndAddress );
  43.         Print("BOOT: Cache Base Addr:0x%08xn", (U32)CACHE_BASE_ADDRESS);
  44.         Print("BOOT: SDRAM_FREQ:%dn", (U32)SDRAM_FREQUENCY);
  45.         Print("BOOT: STBOOT_DRAM_MEMORY_SIZE_0:%dn", (U32)STBOOT_DRAM_MEMORY_SIZE_0);
  46.         Print("BOOT: EXTERNAL_BASE:%08x EXTERNAL_SIZE:%dn", EXTERNAL_BASE, EXTERNAL_SIZE);
  47.     #endif
  48.     ST_ErrorCode = STBOOT_Init(BOOT_DeviceName, &STBOOT_InitParams);
  49. STSYS_WriteRegDev16LE((ST5105_DCACHE_BASE_ADDRESS+DCAC_Region1TopEnable), 0xFFFF);
  50. STSYS_WriteRegDev16LE(ST5105_ICACHE_BASE_ADDRESS+ICAC_Region1TopEnable, 0xFFFF);
  51. if(ST_ErrorCode!=ST_NO_ERROR)
  52. Print("nSTBOOT_Init Error,Code=%d",ST_ErrorCode);
  53. else
  54. Print("KB_BOOTSetup finishedn");
  55.     return( ST_ErrorCode );
  56. }
  57. /* EOF */