/*
* Common header file for blackfin family of processors.
*
*/
#ifndef _BLACKFIN_TRACE_
#define _BLACKFIN_TRACE_
/* Normally, we use ON, but you can't turn on software expansion until
* interrupts subsystem is ready
#define BFIN_TRACE_INIT ((CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION << 4) | 0x03)
#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
#define BFIN_TRACE_ON (BFIN_TRACE_INIT | (CONFIG_DEBUG_BFIN_HWTRACE_EXPAND << 2))
#else
#define BFIN_TRACE_ON (BFIN_TRACE_INIT)
#endif
#ifndef __ASSEMBLY__
extern unsigned long trace_buff_offset;
extern unsigned long software_trace_buff[];
/* Trace Macros for C files */
#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
#define trace_buffer_save(x) \
do { \
(x) = bfin_read_TBUFCTL(); \
bfin_write_TBUFCTL((x) & ~TBUFEN); \
} while (0)
#define trace_buffer_restore(x) \
bfin_write_TBUFCTL((x)); \
#else /* DEBUG_BFIN_HWTRACE_ON */
#define trace_buffer_save(x)
#define trace_buffer_restore(x)
#endif /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
/* Trace Macros for Assembly files */
#define trace_buffer_stop(preg, dreg) \
preg.L = LO(TBUFCTL); \
preg.H = HI(TBUFCTL); \
dreg = 0x1; \
[preg] = dreg;
#define trace_buffer_init(preg, dreg) \
dreg = BFIN_TRACE_INIT; \
#define trace_buffer_save(preg, dreg) \
dreg = [preg]; \
[--sp] = dreg; \
#define trace_buffer_restore(preg, dreg) \
dreg = [sp++]; \
#else /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
#define trace_buffer_stop(preg, dreg)
#define trace_buffer_init(preg, dreg)
#define trace_buffer_save(preg, dreg)
#define trace_buffer_restore(preg, dreg)
#ifdef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
# define DEBUG_HWTRACE_SAVE(preg, dreg) trace_buffer_save(preg, dreg)
# define DEBUG_HWTRACE_RESTORE(preg, dreg) trace_buffer_restore(preg, dreg)
# define DEBUG_HWTRACE_SAVE(preg, dreg)
# define DEBUG_HWTRACE_RESTORE(preg, dreg)
#endif /* __ASSEMBLY__ */
#endif /* _BLACKFIN_TRACE_ */