2 * header file for hardware trace functions
4 * Copyright 2007-2008 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
9 #ifndef _BLACKFIN_TRACE_
10 #define _BLACKFIN_TRACE_
12 /* Normally, we use ON, but you can't turn on software expansion until
13 * interrupts subsystem is ready
16 #define BFIN_TRACE_INIT ((CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION << 4) | 0x03)
17 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
18 #define BFIN_TRACE_ON (BFIN_TRACE_INIT | (CONFIG_DEBUG_BFIN_HWTRACE_EXPAND << 2))
20 #define BFIN_TRACE_ON (BFIN_TRACE_INIT)
24 extern unsigned long trace_buff_offset
;
25 extern unsigned long software_trace_buff
[];
27 /* Trace Macros for C files */
29 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
31 #define trace_buffer_save(x) \
33 (x) = bfin_read_TBUFCTL(); \
34 bfin_write_TBUFCTL((x) & ~TBUFEN); \
37 #define trace_buffer_restore(x) \
39 bfin_write_TBUFCTL((x)); \
41 #else /* DEBUG_BFIN_HWTRACE_ON */
43 #define trace_buffer_save(x)
44 #define trace_buffer_restore(x)
45 #endif /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
48 /* Trace Macros for Assembly files */
50 #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
52 #define trace_buffer_stop(preg, dreg) \
53 preg.L = LO(TBUFCTL); \
54 preg.H = HI(TBUFCTL); \
58 #define trace_buffer_init(preg, dreg) \
59 preg.L = LO(TBUFCTL); \
60 preg.H = HI(TBUFCTL); \
61 dreg = BFIN_TRACE_INIT; \
64 #define trace_buffer_save(preg, dreg) \
65 preg.L = LO(TBUFCTL); \
66 preg.H = HI(TBUFCTL); \
72 #define trace_buffer_restore(preg, dreg) \
73 preg.L = LO(TBUFCTL); \
74 preg.H = HI(TBUFCTL); \
78 #else /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
80 #define trace_buffer_stop(preg, dreg)
81 #define trace_buffer_init(preg, dreg)
82 #define trace_buffer_save(preg, dreg)
83 #define trace_buffer_restore(preg, dreg)
85 #endif /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
87 #ifdef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
88 # define DEBUG_HWTRACE_SAVE(preg, dreg) trace_buffer_save(preg, dreg)
89 # define DEBUG_HWTRACE_RESTORE(preg, dreg) trace_buffer_restore(preg, dreg)
91 # define DEBUG_HWTRACE_SAVE(preg, dreg)
92 # define DEBUG_HWTRACE_RESTORE(preg, dreg)
95 #endif /* __ASSEMBLY__ */
97 #endif /* _BLACKFIN_TRACE_ */