soc.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /*
  2. * Copyright (C) 2017-2019 Alibaba Group Holding Limited
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-08-20 zx.chen CSI Core Peripheral Access Layer Header File for
  9. * CSKYSOC Device Series
  10. */
  11. #ifndef _SOC_H_
  12. #define _SOC_H_
  13. #include <stdint.h>
  14. #include <csi_core.h>
  15. #include <sys_freq.h>
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #ifndef IHS_VALUE
  20. #define IHS_VALUE (20000000)
  21. #endif
  22. #ifndef EHS_VALUE
  23. #define EHS_VALUE (20000000)
  24. #endif
  25. /* ------------------------- Interrupt Number Definition ------------------------ */
  26. typedef enum IRQn {
  27. NMI_EXPn = -2, /* NMI Exception */
  28. /* ---------------------- SmartL Specific Interrupt Numbers --------------------- */
  29. Machine_Software_IRQn = 3, /* Machine software interrupt */
  30. User_Timer_IRQn = 4, /* User timer interrupt */
  31. Supervisor_Timer_IRQn = 5, /* Supervisor timer interrupt */
  32. CORET_IRQn = 7, /* core Timer Interrupt */
  33. Machine_External_IRQn = 11, /* Machine external interrupt */
  34. UART_IRQn = 16, /* uart Interrupt */
  35. TIM0_IRQn = 18, /* timer0 Interrupt */
  36. TIM1_IRQn = 19, /* timer1 Interrupt */
  37. TIM2_IRQn = 20, /* timer2 Interrupt */
  38. TIM3_IRQn = 21, /* timer3 Interrupt */
  39. GPIO0_IRQn = 23, /* gpio0 Interrupt */
  40. GPIO1_IRQn = 24, /* gpio1 Interrupt */
  41. GPIO2_IRQn = 25, /* gpio2 Interrupt */
  42. GPIO3_IRQn = 26, /* gpio3 Interrupt */
  43. GPIO4_IRQn = 27, /* gpio4 Interrupt */
  44. GPIO5_IRQn = 28, /* gpio5 Interrupt */
  45. GPIO6_IRQn = 29, /* gpio6 Interrupt */
  46. GPIO7_IRQn = 30, /* gpio7 Interrupt */
  47. STIM0_IRQn = 31, /* stimer0 Interrupt */
  48. STIM1_IRQn = 32, /* stimer1 Interrupt */
  49. STIM2_IRQn = 33, /* stimer2 Interrupt */
  50. STIM3_IRQn = 34, /* stimer3 Interrupt */
  51. PAD_IRQn = 35, /* pad Interrupt */
  52. TIM6_IRQn = 36, /* timer6 Interrupt */
  53. TIM7_IRQn = 37, /* timer7 Interrupt */
  54. TIM8_IRQn = 38, /* timer8 Interrupt */
  55. TIM9_IRQn = 39, /* timer9 Interrupt */
  56. TIM10_IRQn = 40, /* timer10 Interrupt */
  57. TIM11_IRQn = 41, /* timer11 Interrupt */
  58. }
  59. IRQn_Type;
  60. /* ================================================================================ */
  61. /* ================ Device Specific Peripheral Section ================ */
  62. /* ================================================================================ */
  63. #define CONFIG_TIMER_NUM 12
  64. #define CONFIG_USART_NUM 1
  65. #define CONFIG_GPIO_NUM 8
  66. #define CONFIG_GPIO_PIN_NUM 8
  67. /* ================================================================================ */
  68. /* ================ Peripheral memory map ================ */
  69. /* ================================================================================ */
  70. /* -------------------------- CPU FPGA memory map ------------------------------- */
  71. #define CSKY_SRAM_BASE (0x20000000UL)
  72. #define CSKY_UART_BASE (0x40015000UL)
  73. #define CSKY_PMU_BASE (0x40016000UL)
  74. #define CSKY_TIMER0_BASE (0x40011000UL)
  75. #define CSKY_TIMER1_BASE (0x40011014UL)
  76. #define CSKY_TIMER2_BASE (0x40011028UL)
  77. #define CSKY_TIMER3_BASE (0x4001103cUL)
  78. #define CSKY_TIMER4_BASE (0x40021000UL)
  79. #define CSKY_TIMER5_BASE (0x40021014UL)
  80. #define CSKY_TIMER6_BASE (0x40021028UL)
  81. #define CSKY_TIMER7_BASE (0x4002103cUL)
  82. #define CSKY_TIMER8_BASE (0x40031000UL)
  83. #define CSKY_TIMER9_BASE (0x40031014UL)
  84. #define CSKY_TIMER10_BASE (0x40031028UL)
  85. #define CSKY_TIMER11_BASE (0x4003103cUL)
  86. #define CSKY_TIMER_CONTROL_BASE (0x400110a0UL)
  87. #define CSKY_CLK_GEN_BASE (0x40017000UL)
  88. #define CSKY_STIMER0_BASE (0x40018000UL)
  89. #define CSKY_STIMER1_BASE (0x40018014UL)
  90. #define CSKY_STIMER2_BASE (0x40018028UL)
  91. #define CSKY_STIMER3_BASE (0x4001803cUL)
  92. #define CSKY_STIMER_CONTROL_BASE (0x400110a0UL)
  93. #define CSKY_GPIOA_BASE (0x40019000UL)
  94. #define CSKY_GPIOA_CONTROL_BASE (0x40019030UL)
  95. #define CSKY_SMPU_BASE (0x4001a000UL)
  96. /* ================================================================================ */
  97. /* ================ Peripheral declaration ================ */
  98. /* ================================================================================ */
  99. #define CSKY_UART (( CSKY_UART_TypeDef *) CSKY_UART_BASE)
  100. #ifdef __cplusplus
  101. }
  102. #endif
  103. #endif /* _SOC_H_ */