system_ARMCA9.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. /******************************************************************************
  2. * @file system_ARMCA9.c
  3. * @brief CMSIS Device System Source File for Arm Cortex-A9 Device Series
  4. * @version V1.0.1
  5. * @date 13. February 2019
  6. *
  7. * @note
  8. *
  9. ******************************************************************************/
  10. /*
  11. * Copyright (c) 2009-2019 Arm Limited. All rights reserved.
  12. *
  13. * SPDX-License-Identifier: Apache-2.0
  14. *
  15. * Licensed under the Apache License, Version 2.0 (the License); you may
  16. * not use this file except in compliance with the License.
  17. * You may obtain a copy of the License at
  18. *
  19. * www.apache.org/licenses/LICENSE-2.0
  20. *
  21. * Unless required by applicable law or agreed to in writing, software
  22. * distributed under the License is distributed on an AS IS BASIS, WITHOUT
  23. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  24. * See the License for the specific language governing permissions and
  25. * limitations under the License.
  26. */
  27. #include "RTE_Components.h"
  28. #include CMSIS_device_header
  29. #include "irq_ctrl.h"
  30. #define SYSTEM_CLOCK 12000000U
  31. /*----------------------------------------------------------------------------
  32. System Core Clock Variable
  33. *----------------------------------------------------------------------------*/
  34. uint32_t SystemCoreClock = SYSTEM_CLOCK;
  35. /*----------------------------------------------------------------------------
  36. System Core Clock update function
  37. *----------------------------------------------------------------------------*/
  38. void SystemCoreClockUpdate (void)
  39. {
  40. SystemCoreClock = SYSTEM_CLOCK;
  41. }
  42. /*----------------------------------------------------------------------------
  43. System Initialization
  44. *----------------------------------------------------------------------------*/
  45. void SystemInit (void)
  46. {
  47. /* do not use global variables because this function is called before
  48. reaching pre-main. RW section may be overwritten afterwards. */
  49. // Invalidate entire Unified TLB
  50. __set_TLBIALL(0);
  51. // Invalidate entire branch predictor array
  52. __set_BPIALL(0);
  53. __DSB();
  54. __ISB();
  55. // Invalidate instruction cache and flush branch target cache
  56. __set_ICIALLU(0);
  57. __DSB();
  58. __ISB();
  59. // Invalidate data cache
  60. L1C_InvalidateDCacheAll();
  61. #if ((__FPU_PRESENT == 1) && (__FPU_USED == 1))
  62. // Enable FPU
  63. __FPU_Enable();
  64. #endif
  65. // Create Translation Table
  66. MMU_CreateTranslationTable();
  67. // Enable MMU
  68. MMU_Enable();
  69. // Enable Caches
  70. L1C_EnableCaches();
  71. L1C_EnableBTAC();
  72. #if (__L2C_PRESENT == 1)
  73. // Enable GIC
  74. L2C_Enable();
  75. #endif
  76. // IRQ Initialize
  77. IRQ_Initialize();
  78. }