diff options
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/system.h | 12 | ||||
-rw-r--r-- | firmware/export/thread.h | 11 |
2 files changed, 19 insertions, 4 deletions
diff --git a/firmware/export/system.h b/firmware/export/system.h index cba4b81631..b973b57fd9 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h @@ -243,16 +243,18 @@ static inline uint32_t swap_odd_even32(uint32_t value) #define CACHEALIGN_DOWN(x) \ ((typeof (x))ALIGN_DOWN_P2((uintptr_t)(x), CACHEALIGN_BITS)) /* Aligns at least to the greater of size x or CACHEALIGN_SIZE */ -#define CACHEALIGN_AT_LEAST_ATTR(x) __attribute__((aligned(CACHEALIGN_UP(x)))) +#define CACHEALIGN_AT_LEAST_ATTR(x) \ + __attribute__((aligned(CACHEALIGN_UP(x)))) /* Aligns a buffer pointer and size to proper boundaries */ #define CACHEALIGN_BUFFER(start, size) \ - ({ align_buffer((start), (size), CACHEALIGN_SIZE); }) + ({ align_buffer(PUN_PTR(void **, (start)), (size), CACHEALIGN_SIZE); }) #else /* ndef PROC_NEEDS_CACHEALIGN */ /* Cache alignment attributes and sizes are not enabled */ #define CACHEALIGN_ATTR -#define CACHEALIGN_AT_LEAST_ATTR(x) __attribute__((aligned(x))) +#define CACHEALIGN_AT_LEAST_ATTR(x) \ + __attribute__((aligned(x))) #define CACHEALIGN_UP(x) (x) #define CACHEALIGN_DOWN(x) (x) /* Make no adjustments */ @@ -261,4 +263,8 @@ static inline uint32_t swap_odd_even32(uint32_t value) #endif /* PROC_NEEDS_CACHEALIGN */ +/* Double-cast to avoid 'dereferencing type-punned pointer will + * break strict aliasing rules' B.S. */ +#define PUN_PTR(type, p) ((type)(intptr_t)(p)) + #endif /* __SYSTEM_H__ */ diff --git a/firmware/export/thread.h b/firmware/export/thread.h index df18f7b095..0b1500cd99 100644 --- a/firmware/export/thread.h +++ b/firmware/export/thread.h @@ -42,11 +42,20 @@ #define PRIORITY_SYSTEM 6 /* All other firmware threads */ #define PRIORITY_BACKGROUND 8 /* Normal application threads */ +/* TODO: Only a minor tweak to create_thread would be needed to let + * thread slots be caller allocated - no essential threading functionality + * depends upon an array */ #if CONFIG_CODEC == SWCODEC + +#ifdef HAVE_RECORDING +#define MAXTHREADS 18 +#else #define MAXTHREADS 17 +#endif + #else #define MAXTHREADS 11 -#endif +#endif /* CONFIG_CODE == * */ #define DEFAULT_STACK_SIZE 0x400 /* Bytes */ |