board.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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 "mmu.h"
  20. #ifdef RT_USING_SMART
  21. #include "ioremap.h"
  22. #endif
  23. #if defined(__CC_ARM)
  24. extern int Image$$RW_IRAM1$$ZI$$Limit;
  25. #define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
  26. #elif defined(__GNUC__)
  27. extern int __bss_end;
  28. #define HEAP_BEGIN ((void *)&__bss_end)
  29. #endif
  30. #ifdef RT_USING_SMART
  31. #define HEAP_END (rt_size_t)((rt_size_t)KERNEL_VADDR_START + 64 * 1024 * 1024)
  32. #define PAGE_START HEAP_END + 1 * 1024 * 1024
  33. #define PAGE_END (rt_size_t)((rt_size_t)KERNEL_VADDR_START + 128 * 1024 * 1024)
  34. #else
  35. #define HEAP_END (rt_size_t)(HEAP_BEGIN + 64*1024*1024)
  36. #define PAGE_POOL_SIZE (8ul << 20)
  37. #define PAGE_START (rt_size_t)(HEAP_END)
  38. #define PAGE_END (PAGE_START +PAGE_POOL_SIZE)
  39. #endif
  40. #ifdef RT_USING_PIN
  41. /* gpio pin_index handle */
  42. #define FGPIO_OPS_PIN_INDEX(ctrl, port, pin) SET_REG32_BITS(ctrl, 19, 12) | \
  43. SET_REG32_BITS(port, 11, 8) | \
  44. SET_REG32_BITS(pin, 7, 0)
  45. #define FGPIO_OPS_PIN_CTRL_ID(pin_idx) GET_REG32_BITS(pin_idx, 19, 12)
  46. #define FGPIO_OPS_PIN_PORT_ID(pin_idx) GET_REG32_BITS(pin_idx, 11, 8)
  47. #define FGPIO_OPS_PIN_ID(pin_idx) GET_REG32_BITS(pin_idx, 7, 0)
  48. #endif
  49. void rt_hw_board_init(void);
  50. #endif