hal_interrupt.h 984 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef SUNXI_HAL_INTERRUPT_H
  2. #define SUNXI_HAL_INTERRUPT_H
  3. #ifdef __cplusplus
  4. extern "C"
  5. {
  6. #endif
  7. #include <stdint.h>
  8. #include <stddef.h>
  9. #include <interrupt.h>
  10. typedef enum hal_irqreturn {
  11. HAL_IRQ_OK = (0 << 0),
  12. HAL_IRQ_ERR = (1 << 0),
  13. } hal_irqreturn_t;
  14. #ifdef CONFIG_KERNEL_FREERTOS
  15. enum irqreturn
  16. {
  17. IRQ_NONE = (0 << 0),
  18. IRQ_HANDLED = (1 << 0),
  19. IRQ_WAKE_THREAD = (1 << 1),
  20. };
  21. typedef enum irqreturn irqreturn_t;
  22. typedef irqreturn_t (*irq_handler_t)(int, void *);
  23. int request_irq(unsigned int irq, irq_handler_t handler,
  24. unsigned long flags, const char *name, void *dev);
  25. void *free_irq(unsigned int irq, void *data);
  26. void enable_irq(unsigned int irq);
  27. void disable_irq(unsigned int irq);
  28. #endif
  29. void hal_interrupt_enable(void);
  30. void hal_interrupt_disable(void);
  31. uint32_t hal_interrupt_save(void);
  32. void hal_interrupt_restore(uint32_t flag);
  33. uint32_t hal_interrupt_get_nest(void);
  34. #ifdef __cplusplus
  35. }
  36. #endif
  37. #endif