platform.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* Copyright 2018 Canaan Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #ifndef _BSP_PLATFORM_H
  16. #define _BSP_PLATFORM_H
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /* clang-format off */
  21. /* Register base address */
  22. /* Under Coreplex */
  23. #define CLINT_BASE_ADDR (0x02000000U)
  24. #define PLIC_BASE_ADDR (0x0C000000U)
  25. /* Under TileLink */
  26. #define UARTHS_BASE_ADDR (0x38000000U)
  27. #define GPIOHS_BASE_ADDR (0x38001000U)
  28. /* Under AXI 64 bit */
  29. #define RAM_BASE_ADDR (0x80000000U)
  30. #define RAM_SIZE (6 * 1024 * 1024U)
  31. #define IO_BASE_ADDR (0x40000000U)
  32. #define IO_SIZE (6 * 1024 * 1024U)
  33. #define AI_RAM_BASE_ADDR (0x80600000U)
  34. #define AI_RAM_SIZE (2 * 1024 * 1024U)
  35. #define AI_IO_BASE_ADDR (0x40600000U)
  36. #define AI_IO_SIZE (2 * 1024 * 1024U)
  37. #define AI_BASE_ADDR (0x40800000U)
  38. #define AI_SIZE (12 * 1024 * 1024U)
  39. #define FFT_BASE_ADDR (0x42000000U)
  40. #define FFT_SIZE (4 * 1024 * 1024U)
  41. #define ROM_BASE_ADDR (0x88000000U)
  42. #define ROM_SIZE (128 * 1024U)
  43. /* Under AHB 32 bit */
  44. #define DMAC_BASE_ADDR (0x50000000U)
  45. /* Under APB1 32 bit */
  46. #define GPIO_BASE_ADDR (0x50200000U)
  47. #define UART1_BASE_ADDR (0x50210000U)
  48. #define UART2_BASE_ADDR (0x50220000U)
  49. #define UART3_BASE_ADDR (0x50230000U)
  50. #define SPI_SLAVE_BASE_ADDR (0x50240000U)
  51. #define I2S0_BASE_ADDR (0x50250000U)
  52. #define I2S1_BASE_ADDR (0x50260000U)
  53. #define I2S2_BASE_ADDR (0x50270000U)
  54. #define I2C0_BASE_ADDR (0x50280000U)
  55. #define I2C1_BASE_ADDR (0x50290000U)
  56. #define I2C2_BASE_ADDR (0x502A0000U)
  57. #define FPIOA_BASE_ADDR (0x502B0000U)
  58. #define SHA256_BASE_ADDR (0x502C0000U)
  59. #define TIMER0_BASE_ADDR (0x502D0000U)
  60. #define TIMER1_BASE_ADDR (0x502E0000U)
  61. #define TIMER2_BASE_ADDR (0x502F0000U)
  62. /* Under APB2 32 bit */
  63. #define WDT0_BASE_ADDR (0x50400000U)
  64. #define WDT1_BASE_ADDR (0x50410000U)
  65. #define OTP_BASE_ADDR (0x50420000U)
  66. #define DVP_BASE_ADDR (0x50430000U)
  67. #define SYSCTL_BASE_ADDR (0x50440000U)
  68. #define AES_BASE_ADDR (0x50450000U)
  69. #define RTC_BASE_ADDR (0x50460000U)
  70. /* Under APB3 32 bit */
  71. #define SPI0_BASE_ADDR (0x52000000U)
  72. #define SPI1_BASE_ADDR (0x53000000U)
  73. #define SPI3_BASE_ADDR (0x54000000U)
  74. /* clang-format on */
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif /* _BSP_PLATFORM_H */