pic-gic-common.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-01-30 GuEe-GUI first version
  9. */
  10. #ifndef __IRQ_GIC_COMMON_H__
  11. #define __IRQ_GIC_COMMON_H__
  12. #include <rtdef.h>
  13. #include <drivers/ofw.h>
  14. #define GIC_SGI_NR 16
  15. #define GICD_INT_DEF_PRI 0xa0
  16. #define GICD_INT_DEF_PRI_X4 \
  17. ( \
  18. (GICD_INT_DEF_PRI << 24) | \
  19. (GICD_INT_DEF_PRI << 16) | \
  20. (GICD_INT_DEF_PRI << 8) | \
  21. GICD_INT_DEF_PRI \
  22. )
  23. struct gic_quirk
  24. {
  25. const char *desc;
  26. const char *compatible;
  27. rt_err_t (*init)(void *data);
  28. rt_uint32_t iidr;
  29. rt_uint32_t iidr_mask;
  30. };
  31. void gic_common_init_quirk_ofw(const struct rt_ofw_node *ic_np, const struct gic_quirk *quirks, void *data);
  32. void gic_common_init_quirk_hw(rt_uint32_t iidr, const struct gic_quirk *quirks, void *data);
  33. void gic_common_sgi_config(void *base, void *data, int irq_base);
  34. rt_err_t gic_common_configure_irq(void *base, int irq, rt_uint32_t mode, void (*sync_access)(void *), void *data);
  35. void gic_common_dist_config(void *base, int max_irqs, void (*sync_access)(void *), void *data);
  36. void gic_common_cpu_config(void *base, int nr, void (*sync_access)(void *), void *data);
  37. #ifdef RT_PIC_ARM_GIC_V2M
  38. rt_err_t gicv2m_ofw_probe(struct rt_ofw_node *ic_np, const struct rt_ofw_node_id *id);
  39. #endif
  40. #ifdef RT_PIC_ARM_GIC_V3_ITS
  41. rt_err_t gicv3_its_ofw_probe(struct rt_ofw_node *ic_np, const struct rt_ofw_node_id *id);
  42. #endif
  43. #endif /* __IRQ_GIC_COMMON_H__ */