gic_pl400.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * Copyright (c) 2006-2018, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2013-07-20 Bernard first version
  9. */
  10. #ifndef __GIC_PL400_H__
  11. #define __GIC_PL400_H__
  12. #include <rthw.h>
  13. #include <board.h>
  14. #define __REG32(x) (*((volatile unsigned int*)((rt_uint64_t)x)))
  15. #define GIC_CPU_CTRL(hw_base) __REG32((hw_base) + 0x00)
  16. #define GIC_CPU_PRIMASK(hw_base) __REG32((hw_base) + 0x04)
  17. #define GIC_CPU_BINPOINT(hw_base) __REG32((hw_base) + 0x08)
  18. #define GIC_CPU_INTACK(hw_base) __REG32((hw_base) + 0x0c)
  19. #define GIC_CPU_EOI(hw_base) __REG32((hw_base) + 0x10)
  20. #define GIC_CPU_RUNNINGPRI(hw_base) __REG32((hw_base) + 0x14)
  21. #define GIC_CPU_HIGHPRI(hw_base) __REG32((hw_base) + 0x18)
  22. #define GIC_DIST_CTRL(hw_base) __REG32((hw_base) + 0x000)
  23. #define GIC_DIST_TYPE(hw_base) __REG32((hw_base) + 0x004)
  24. #define GIC_DIST_IGROUP(hw_base, n) __REG32((hw_base) + 0x080 + ((n)/32) * 4)
  25. #define GIC_DIST_ENABLE_SET(hw_base, n) __REG32((hw_base) + 0x100 + ((n)/32) * 4)
  26. #define GIC_DIST_ENABLE_CLEAR(hw_base, n) __REG32((hw_base) + 0x180 + ((n)/32) * 4)
  27. #define GIC_DIST_PENDING_SET(hw_base, n) __REG32((hw_base) + 0x200 + ((n)/32) * 4)
  28. #define GIC_DIST_PENDING_CLEAR(hw_base, n) __REG32((hw_base) + 0x280 + ((n)/32) * 4)
  29. #define GIC_DIST_ACTIVE_SET(hw_base, n) __REG32((hw_base) + 0x300 + ((n)/32) * 4)
  30. #define GIC_DIST_ACTIVE_CLEAR(hw_base, n) __REG32((hw_base) + 0x380 + ((n)/32) * 4)
  31. #define GIC_DIST_PRI(hw_base, n) __REG32((hw_base) + 0x400 + ((n)/4) * 4)
  32. #define GIC_DIST_TARGET(hw_base, n) __REG32((hw_base) + 0x800 + ((n)/4) * 4)
  33. #define GIC_DIST_CONFIG(hw_base, n) __REG32((hw_base) + 0xc00 + ((n)/16) * 4)
  34. #define GIC_DIST_SOFTINT(hw_base) __REG32((hw_base) + 0xf00)
  35. #define GIC_DIST_CPENDSGI(hw_base, n) __REG32((hw_base) + 0xf10 + ((n)/4) * 4)
  36. #define GIC_DIST_ICPIDR2(hw_base) __REG32((hw_base) + 0xfe8)
  37. int arm_gic_dist_init(rt_uint32_t index, rt_uint32_t dist_base, int irq_start);
  38. int arm_gic_cpu_init(rt_uint32_t index, rt_uint32_t cpu_base);
  39. void arm_gic_mask(rt_uint32_t index, int irq);
  40. void arm_gic_umask(rt_uint32_t index, int irq);
  41. void arm_gic_set_cpu(rt_uint32_t index, int irq, unsigned int cpumask);
  42. void arm_gic_set_group(rt_uint32_t index, int vector, int group);
  43. int arm_gic_get_active_irq(rt_uint32_t index);
  44. void arm_gic_ack(rt_uint32_t index, int irq);
  45. void arm_gic_clear_active(rt_uint32_t index, int irq);
  46. void arm_gic_clear_pending(rt_uint32_t index, int irq);
  47. void arm_gic_dump_type(rt_uint32_t index);
  48. void arm_gic_dump(rt_uint32_t index);
  49. #endif