1 #ifndef RBCODECCONFIG_H_INCLUDED
2 #define RBCODECCONFIG_H_INCLUDED
8 /* NULL, offsetof, size_t */
11 /* ssize_t, off_t, open, close, read, lseek, SEEK_SET, SEEK_CUR, SEEK_END,
12 * O_RDONLY, O_WRONLY, O_CREAT, O_APPEND, MAX_PATH, filesize */
15 /* {,u}int{8,16,32,64}_t, , intptr_t, uintptr_t, bool, true, false, swap16,
16 * swap32, hto{be,le}{16,32}, {be,le}toh{16,32}, ROCKBOX_{BIG,LITTLE}_ENDIAN,
17 * {,U}INT{8,16,32,64}_{MIN,MAX} */
20 /* Structure to record some info during processing call */
21 struct dsp_loop_context
25 unsigned long old_macsr
;
29 static inline void dsp_process_start(struct dsp_loop_context
*ctx
)
31 /* At least perform one yield before starting */
32 ctx
->last_yield
= current_tick
;
34 #if defined(CPU_COLDFIRE)
35 /* set emac unit for dsp processing, and save old macsr, we're running in
36 codec thread context at this point, so can't clobber it */
37 ctx
->old_macsr
= coldfire_get_macsr();
38 coldfire_set_macsr(EMAC_FRACTIONAL
| EMAC_SATURATE
);
42 static inline void dsp_process_loop(struct dsp_loop_context
*ctx
)
44 /* Yield at least once each tick */
45 long tick
= current_tick
;
46 if (TIME_AFTER(tick
, ctx
->last_yield
))
48 ctx
->last_yield
= tick
;
53 static inline void dsp_process_end(struct dsp_loop_context
*ctx
)
55 #if defined(CPU_COLDFIRE)
56 /* set old macsr again */
57 coldfire_set_macsr(ctx
->old_macsr
);
62 #define DSP_PROCESS_START() \
63 struct dsp_loop_context __ctx; \
64 dsp_process_start(&__ctx)
66 #define DSP_PROCESS_LOOP() \
67 dsp_process_loop(&__ctx)
69 #define DSP_PROCESS_END() \
70 dsp_process_end(&__ctx)