embedded.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #ifndef EMBEDDED_H
  2. #define EMBEDDED_H
  3. #include <inttypes.h>
  4. /* must provide
  5. - mutex_create_p
  6. - pthread_create_name
  7. - stack size
  8. - s16_t, s32_t, s64_t and u64_t
  9. can overload (use #define)
  10. - exit
  11. - gettime_ms
  12. - BASE_CAP
  13. - EXT_BSS
  14. recommended to add platform specific include(s) here
  15. */
  16. #ifndef PTHREAD_STACK_MIN
  17. #define PTHREAD_STACK_MIN 256
  18. #endif
  19. #define STREAM_THREAD_STACK_SIZE 6 * 1024
  20. #define DECODE_THREAD_STACK_SIZE 16 * 1024
  21. #define OUTPUT_THREAD_STACK_SIZE 6 * 1024
  22. #define IR_THREAD_STACK_SIZE 6 * 1024
  23. //#define BASE_CAP "Model=squeezelite,AccuratePlayPoints=0,HasDigitalOut=1,HasPolarityInversion=1,Firmware=" VERSION
  24. #define EXT_BSS __attribute__((section(".ext_ram.bss")))
  25. typedef int16_t s16_t;
  26. typedef int32_t s32_t;
  27. typedef int64_t s64_t;
  28. typedef unsigned long long u64_t;
  29. // all exit() calls are made from main thread (or a function called in main thread)
  30. #define exit(code) { int ret = code; pthread_exit(&ret); }
  31. #define gettime_ms _gettime_ms_
  32. #define mutex_create_p(m) mutex_create(m)
  33. uint32_t _gettime_ms_(void);
  34. int pthread_create_name(pthread_t *thread, _CONST pthread_attr_t *attr,
  35. void *(*start_routine)( void * ), void *arg, char *name);
  36. void register_external(void);
  37. void deregister_external(void);
  38. #endif // EMBEDDED_H