12345678910111213141516171819202122232425262728293031323334353637 |
- #ifndef IRQ_H
- #define IRQ_H
- #include <stddef.h>
- #include "picorv32.h"
- typedef void (*irqhandler_t)(unsigned int vector, size_t pc);
- extern irqhandler_t __irq_handler_table[];
- #define IRQHANDLER(x) \
- void irqhandler_ ##x (unsigned int, size_t); \
- void irqhandler_ ##x (unsigned int vector __attribute__((unused)), \
- size_t pc __attribute__((unused)))
- static inline unsigned int mask_irq(unsigned int vector)
- {
- const unsigned int mask = 1U << vector;
- return p_maskirq(mask, ~mask);
- }
- static inline unsigned int unmask_irq(unsigned int vector)
- {
- const unsigned int mask = 1U << vector;
- return p_maskirq(0, ~mask);
- }
- static inline unsigned int irqmask(void)
- {
- return p_maskirq(0, ~0);
- }
- static inline unsigned int waitfor(unsigned int vector)
- {
- const unsigned int mask = 1U << vector;
- return p_waitirq(mask, 0);
- }
- #endif /* IRQ_H */
|