cpu.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * File : cpu.c
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006, RT-Thread Develop Team
  5. *
  6. * The license and distribution terms for this file may be
  7. * found in the file LICENSE in this distribution or at
  8. * http://openlab.rt-thread.com/license/LICENSE
  9. *
  10. * Change Logs:
  11. * Date Author Notes
  12. * 2006-09-06 XuXinming first version
  13. */
  14. #include <rtthread.h>
  15. #include "s3c44b0.h"
  16. /**
  17. * @addtogroup S3C44B0
  18. */
  19. /*@{*/
  20. /**
  21. * This function will enable I-Cache of CPU
  22. *
  23. */
  24. void rt_hw_cpu_icache_enable()
  25. {
  26. rt_base_t reg;
  27. volatile int i;
  28. /* flush cycle */
  29. for(i = 0x10002000; i < 0x10004800; i+=16)
  30. {
  31. *((int *)i)=0x0;
  32. }
  33. /*
  34. * Init cache
  35. * Non-cacheable area (everything outside RAM)
  36. * 0x0000:0000 - 0x0C00:0000
  37. */
  38. NCACHBE0 = 0xC0000000;
  39. NCACHBE1 = 0x00000000;
  40. /*
  41. Enable chache
  42. */
  43. reg = SYSCFG;
  44. reg |= 0x00000006; /* 8kB */
  45. SYSCFG = reg;
  46. }
  47. /**
  48. * This function will disable I-Cache of CPU
  49. *
  50. */
  51. void rt_hw_cpu_icache_disable()
  52. {
  53. rt_base_t reg;
  54. reg = SYSCFG;
  55. reg &= ~0x00000006; /* 8kB */
  56. SYSCFG = reg;
  57. }
  58. /**
  59. * this function will get the status of I-Cache
  60. *
  61. */
  62. rt_base_t rt_hw_cpu_icache_status()
  63. {
  64. return 0;
  65. }
  66. /**
  67. * this function will enable D-Cache of CPU
  68. *
  69. */
  70. void rt_hw_cpu_dcache_enable()
  71. {
  72. rt_hw_cpu_icache_enable();
  73. }
  74. /**
  75. * this function will disable D-Cache of CPU
  76. *
  77. */
  78. void rt_hw_cpu_dcache_disable()
  79. {
  80. rt_hw_cpu_icache_disable();
  81. }
  82. /**
  83. * this function will get the status of D-Cache
  84. *
  85. */
  86. rt_base_t rt_hw_cpu_dcache_status()
  87. {
  88. return rt_hw_cpu_icache_status();
  89. }
  90. /**
  91. * this function will reset CPU
  92. *
  93. */
  94. void rt_hw_cpu_reset()
  95. {
  96. }
  97. /**
  98. * this function will shutdown CPU
  99. *
  100. */
  101. void rt_hw_cpu_shutdown()
  102. {
  103. rt_kprintf("shutdown...\n");
  104. while (1);
  105. }
  106. /*@}*/