system.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * Copyright (C) 2017 C-SKY Microsystems Co., Ltd. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /******************************************************************************
  17. * @file system_PHOBOS.c
  18. * @brief CSI Device System Source File for PHOBOS
  19. * @version V1.0
  20. * @date 02. June 2017
  21. ******************************************************************************/
  22. #include "soc.h"
  23. #include "csi_core.h"
  24. #include "config.h"
  25. /*----------------------------------------------------------------------------
  26. Define clocks
  27. *----------------------------------------------------------------------------*/
  28. /*----------------------------------------------------------------------------
  29. System Core Clock Variable
  30. *----------------------------------------------------------------------------*/
  31. int SystemCoreClock = SYSTEM_CLOCK; /* System Core Clock Frequency */
  32. extern int __Vectors;
  33. void SystemCoreClockUpdate(void)
  34. {
  35. SystemCoreClock = SYSTEM_CLOCK;
  36. }
  37. /**
  38. * @brief initialize the system
  39. * Initialize the psr and vbr.
  40. * @param None
  41. * @return None
  42. */
  43. void SystemInit(void)
  44. {
  45. /* Here we may setting exception vector, MGU, cache, and so on. */
  46. #ifdef CONFIG_SYSTEM_SECURE
  47. __set_PSR(0xc0000140);
  48. #else
  49. __set_PSR(0x80000140);
  50. #endif
  51. __set_VBR((uint32_t) & (__Vectors));
  52. drv_coret_config(200 * 1000, CORET_IRQn); //10ms
  53. drv_nvic_enable_irq(CORET_IRQn);
  54. SystemCoreClock = SYSTEM_CLOCK;
  55. }