fw.h 1017 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef FW_H
  2. #define FW_H
  3. #include <stdarg.h>
  4. #include <stddef.h>
  5. #include <stdint.h>
  6. #include <stdbool.h>
  7. #include "picorv32.h"
  8. #include "irq.h"
  9. /* Use builtin memcpy and memset optimizations */
  10. #define memset(s,c,n) __builtin_memset(s,c,n)
  11. #define memcpy(d,s,n) __builtin_memcpy(d,s,n)
  12. #define memmove(d,s,n) __builtin_memmove(d,s,n)
  13. #define likely(x) __builtin_expect(!!(x), 1)
  14. #define unlikely(x) __builtin_expect(!!(x), 0)
  15. /* Handy composite pointer types */
  16. typedef union xptr {
  17. uint32_t *l;
  18. uint16_t *w;
  19. uint8_t *b;
  20. void *v;
  21. size_t a;
  22. } xptr_t;
  23. typedef union xcptr {
  24. const uint32_t *l;
  25. const uint16_t *w;
  26. const uint8_t *b;
  27. const void *v;
  28. size_t a;
  29. } xcptr_t;
  30. extern void __attribute__((noreturn)) _die(void);
  31. extern void __attribute__((noreturn)) exit(int);
  32. extern void __attribute__((noreturn)) _exit(int);
  33. extern const uint8_t _end[];
  34. extern void *_sbrk(size_t);
  35. extern int disk_init(void);
  36. extern void read_rtc(void);
  37. #endif /* FW_H */