board.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2017-5-30 Bernard the first version
  9. * 2021-07-31 GuEe-GUI add ARM GIC definitions
  10. * 2021-09-11 GuEe-GUI rename right macros for gic
  11. */
  12. #ifndef BOARD_H__
  13. #define BOARD_H__
  14. #include <rthw.h>
  15. #include <rtdef.h>
  16. #include <stdint.h>
  17. extern unsigned char __bss_start;
  18. extern unsigned char __bss_end;
  19. #define RT_HW_HEAP_BEGIN (void*)&__bss_end
  20. #define RT_HW_HEAP_END (void*)(RT_HW_HEAP_BEGIN + 1 * 1024 * 1024)
  21. #define __REG32(x) (*((volatile unsigned int *)(x)))
  22. #define VIRTIO_SPI_IRQ_BASE 32
  23. /* Virtio BLK */
  24. #define VIRTIO_MMIO_BLK0_BASE 0x0a000000
  25. #define VIRTIO_MMIO_BLK0_SIZE 0x00000200
  26. #define VIRTIO_MMIO_BLK0_IRQ (VIRTIO_SPI_IRQ_BASE + 0x10)
  27. /* UART */
  28. #define PL011_UARTDR 0x000
  29. #define PL011_UARTFR 0x018
  30. #define PL011_UARTFR_TXFF_BIT 5
  31. #define PL011_UART0_BASE 0x09000000
  32. #define PL011_UART0_SIZE 0x00001000
  33. #define PL011_UART0_IRQNUM (VIRTIO_SPI_IRQ_BASE + 1)
  34. /* RTC */
  35. #define PL031_RTC_BASE 0x9010000
  36. #define PL031_RTC_SIZE 0x00001000
  37. #define PL031_RTC_IRQNUM (VIRTIO_SPI_IRQ_BASE + 2)
  38. /* DIST and CPU */
  39. #define GIC_PL390_DISTRIBUTOR_PPTR 0x08000000
  40. #define GIC_PL390_CONTROLLER_PPTR 0x08010000
  41. #define MAX_HANDLERS 96
  42. #define GIC_IRQ_START 0
  43. /* number of interrupts on board */
  44. #define ARM_GIC_NR_IRQS 96
  45. /* only one GIC available */
  46. #define ARM_GIC_MAX_NR 1
  47. /* ipi interrupt number */
  48. #define IRQ_ARM_IPI_KICK 0
  49. #define IRQ_ARM_IPI_CALL 1
  50. #define IRQ_ARM_VTIMER 27
  51. /* the basic constants and interfaces needed by gic */
  52. rt_inline rt_uint32_t platform_get_gic_dist_base(void)
  53. {
  54. return GIC_PL390_DISTRIBUTOR_PPTR;
  55. }
  56. rt_inline rt_uint32_t platform_get_gic_cpu_base(void)
  57. {
  58. return GIC_PL390_CONTROLLER_PPTR;
  59. }
  60. void rt_hw_board_init(void);
  61. #endif