embedded.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. recommended to add platform specific include(s) here
  14. */
  15. #ifndef PTHREAD_STACK_MIN
  16. #define PTHREAD_STACK_MIN 256
  17. #endif
  18. #define STREAM_THREAD_STACK_SIZE 8 * 1024
  19. #define DECODE_THREAD_STACK_SIZE 20 * 1024
  20. #define OUTPUT_THREAD_STACK_SIZE 8 * 1024
  21. #define IR_THREAD_STACK_SIZE 8 * 1024
  22. //#define BASE_CAP "Model=squeezelite,AccuratePlayPoints=0,HasDigitalOut=1,HasPolarityInversion=1,Firmware=" VERSION
  23. typedef int16_t s16_t;
  24. typedef int32_t s32_t;
  25. typedef int64_t s64_t;
  26. typedef unsigned long long u64_t;
  27. // all exit() calls are made from main thread (or a function called in main thread)
  28. #define exit(code) { int ret = code; pthread_exit(&ret); }
  29. #define gettime_ms _gettime_ms_
  30. #define mutex_create_p(m) mutex_create(m)
  31. uint32_t _gettime_ms_(void);
  32. int pthread_create_name(pthread_t *thread, _CONST pthread_attr_t *attr,
  33. void *(*start_routine)( void * ), void *arg, char *name);
  34. void register_other(void);
  35. #endif // EMBEDDED_H