board.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Email: opensource_embedded@phytium.com.cn
  7. *
  8. * Change Logs:
  9. * Date Author Notes
  10. * 2022-10-26 huanghe first commit
  11. * 2022-04-13 zhugengyu support RT-Smart
  12. * 2023-07-27 liqiaozhong add gpio pin definition
  13. *
  14. */
  15. #ifndef __BOARD_H__
  16. #define __BOARD_H__
  17. #include "fparameters.h"
  18. #include "phytium_cpu.h"
  19. #include "fkernel.h"
  20. #include "mmu.h"
  21. #ifdef RT_USING_SMART
  22. #include "ioremap.h"
  23. #endif
  24. #if defined(__CC_ARM)
  25. extern int Image$$RW_IRAM1$$ZI$$Limit;
  26. #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
  27. #elif defined(__GNUC__)
  28. extern int __bss_end;
  29. #define HEAP_BEGIN ((void *)&__bss_end)
  30. #endif
  31. #ifdef RT_USING_SMART
  32. #define HEAP_END (rt_size_t)((rt_size_t)KERNEL_VADDR_START + 64 * 1024 * 1024)
  33. #define PAGE_START HEAP_END + 1 * 1024 * 1024
  34. #define PAGE_END (rt_size_t)((rt_size_t)KERNEL_VADDR_START + 128 * 1024 * 1024)
  35. #else
  36. #define HEAP_END (rt_size_t)(HEAP_BEGIN + 64*1024*1024)
  37. #define KERNEL_VADDR_START (rt_size_t)0x80000000
  38. #define DDR_END_ADDRESS (KERNEL_VADDR_START + 1024*1024*1024 - 1 )
  39. #define PAGE_POOL_SIZE (8ul << 20)
  40. #define PAGE_START (rt_size_t)(HEAP_END)
  41. #define PAGE_END (PAGE_START +PAGE_POOL_SIZE)
  42. #endif
  43. #ifdef RT_USING_PIN
  44. /* gpio pin_index handle */
  45. #define FGPIO_OPS_PIN_INDEX(ctrl, port, pin) SET_REG32_BITS(ctrl, 19, 12) | \
  46. SET_REG32_BITS(port, 11, 8) | \
  47. SET_REG32_BITS(pin, 7, 0)
  48. #define FGPIO_OPS_PIN_CTRL_ID(pin_idx) GET_REG32_BITS(pin_idx, 19, 12)
  49. #define FGPIO_OPS_PIN_PORT_ID(pin_idx) GET_REG32_BITS(pin_idx, 11, 8)
  50. #define FGPIO_OPS_PIN_ID(pin_idx) GET_REG32_BITS(pin_idx, 7, 0)
  51. #endif
  52. void rt_hw_board_init(void);
  53. #endif