25 #define HUBDATA __attribute__((section(".hub")))
36 #define HUBTEXT __attribute__((section(".hubtext")))
72 #define CLKFREQ _CLKFREQ
75 #define CLKMODE _CLKMODE
89 #define clkset(mode, frequency) \
91 _CLKFREQ = (frequency); \
93 __builtin_propeller_clkset(mode); \
102 #define cogid() __builtin_propeller_cogid()
126 #define coginit(id, code, param) __builtin_propeller_coginit( \
127 (((uint32_t)(param) << 16) & 0xfffc0000) \
128 |(((uint32_t)(code) << 2) & 0x0003fff0) \
129 |(((id) ) & 0x0000000f) )
147 #define cognew(code, param) coginit(0x8, (code), (param))
153 #define cogstop(a) __builtin_propeller_cogstop((a))
171 int cogstart(
void (*func)(
void *),
void *par,
void *stack,
size_t stacksize);
177 #define locknew() __builtin_propeller_locknew()
183 #define lockret(lockid) __builtin_propeller_lockret((lockid))
190 #define lockset(lockid) __builtin_propeller_lockset((lockid))
196 #define lockclr(lockid) __builtin_propeller_lockclr((lockid))
202 #define waitcnt(a) __builtin_propeller_waitcnt((a),0)
209 #define waitcnt2(a,b) __builtin_propeller_waitcnt((a),(b))
216 #define waitpeq(state, mask) __builtin_propeller_waitpeq((state), (mask))
223 #define waitpne(state, mask) __builtin_propeller_waitpne((state), (mask))
231 #define waitvid(colors, pixels) __builtin_propeller_waitvid((colors), (pixels))
236 #if defined(__PROPELLER_USE_XMM__)
256 static __inline__
void copy_from_xmm(uint32_t *dst, uint32_t *src,
int count)
258 memcpy(dst, src, count*4);
266 static __inline__ uint32_t rdlong_xmm(uint32_t *addr)
270 "xmmio rdlong,%[_value],%[_addr]"
272 [_value]
"=r" (value)
285 static __inline__
void wrlong_xmm(uint32_t *addr, uint32_t value)
288 "xmmio wrlong,%[_value],%[_addr]"
301 void kernel_use_lock(uint32_t lockId);
305 #if defined(__PROPELLER_USE_XMM__)
311 #define use_cog_driver(id) extern uint32_t binary_##id##_dat_start[], binary_##id##_dat_end[]
317 #define get_cog_driver(id) \
318 get_cog_driver_xmm( \
319 binary_##id##_dat_start, \
320 binary_##id##_dat_end - binary_##id##_dat_start)
328 #define load_cog_driver(id, param) \
329 load_cog_driver_xmm( \
330 binary_##id##_dat_start, \
331 binary_##id##_dat_end - binary_##id##_dat_start, \
334 uint32_t *get_cog_driver_xmm(uint32_t *code, uint32_t codelen);
335 int load_cog_driver_xmm(uint32_t *code, uint32_t codelen, uint32_t *params);
343 #define use_cog_driver(id) extern uint32_t binary_##id##_dat_start[]
349 #define get_cog_driver(id) (binary_##id##_dat_start) \
357 #define load_cog_driver(id, param) cognew(binary_##id##_dat_start, (uint32_t *)(param))