board.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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. /* DIST and CPU */
  35. #define GIC_PL390_DISTRIBUTOR_PPTR 0x08000000
  36. #define GIC_PL390_CONTROLLER_PPTR 0x08010000
  37. #define MAX_HANDLERS 96
  38. #define GIC_IRQ_START 0
  39. /* number of interrupts on board */
  40. #define ARM_GIC_NR_IRQS 96
  41. /* only one GIC available */
  42. #define ARM_GIC_MAX_NR 1
  43. #define IRQ_ARM_VTIMER 27
  44. /* the basic constants and interfaces needed by gic */
  45. rt_inline rt_uint32_t platform_get_gic_dist_base(void)
  46. {
  47. return GIC_PL390_DISTRIBUTOR_PPTR;
  48. }
  49. rt_inline rt_uint32_t platform_get_gic_cpu_base(void)
  50. {
  51. return GIC_PL390_CONTROLLER_PPTR;
  52. }
  53. void rt_hw_board_init(void);
  54. #endif