1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- #ifndef FW_H
- #define FW_H
- #include <stdarg.h>
- #include <stddef.h>
- #include <stdint.h>
- #include <stdbool.h>
- #include "picorv32.h"
- #define likely(x) __builtin_expect(!!(x), 1)
- #define unlikely(x) __builtin_expect(!!(x), 0)
- extern void __attribute__((noreturn)) _die(void);
- extern void __attribute__((noreturn)) exit(int);
- extern void __attribute__((noreturn)) _exit(int);
- extern const uint8_t _end[];
- extern void *_sbrk(size_t);
- extern int disk_init(void);
- #define IRQ_VECTORS 32
- typedef void (*irq_handler_t)(unsigned int vector);
- extern irq_handler_t
- register_irq(unsigned int vector, irq_handler_t handler, bool enable);
- extern void null_irq_handler(unsigned int vector);
- static inline unsigned int mask_irq(unsigned int vector)
- {
- const uint32_t mask = 1U << vector;
- return p_maskirq(mask, ~mask);
- }
- static inline unsigned int unmask_irq(unsigned int vector)
- {
- const uint32_t mask = 1U << vector;
- return p_maskirq(0, ~mask);
- }
- static inline unsigned int irqmask(void)
- {
- return p_maskirq(0, ~0);
- }
- #endif /* FW_H */
|