blob: 6313aace9d5915991aa55c438fa45914a561e809 [file] [log] [blame]
Robin Getz669b7922007-06-21 16:34:08 +08001/*
2 * Common header file for blackfin family of processors.
3 *
4 */
5
6#ifndef _BLACKFIN_TRACE_
7#define _BLACKFIN_TRACE_
8
Robin Getz518039b2007-07-25 11:03:28 +08009/* Normally, we use ON, but you can't turn on software expansion until
10 * interrupts subsystem is ready
11 */
12
13#define BFIN_TRACE_INIT ((CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION << 4) | 0x03)
14#ifdef CONFIG_DEBUG_BFIN_HWTRACE_EXPAND
15#define BFIN_TRACE_ON (BFIN_TRACE_INIT | (CONFIG_DEBUG_BFIN_HWTRACE_EXPAND << 2))
16#else
17#define BFIN_TRACE_ON (BFIN_TRACE_INIT)
18#endif
19
Robin Getz669b7922007-06-21 16:34:08 +080020#ifndef __ASSEMBLY__
Robin Getz518039b2007-07-25 11:03:28 +080021extern unsigned long trace_buff_offset;
22extern unsigned long software_trace_buff[];
23
Robin Getz669b7922007-06-21 16:34:08 +080024/* Trace Macros for C files */
25
Robin Getz518039b2007-07-25 11:03:28 +080026#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
27
Robin Getz669b7922007-06-21 16:34:08 +080028#define trace_buffer_save(x) \
Robin Getz518039b2007-07-25 11:03:28 +080029 do { \
30 (x) = bfin_read_TBUFCTL(); \
31 bfin_write_TBUFCTL((x) & ~TBUFEN); \
32 } while (0)
Robin Getz669b7922007-06-21 16:34:08 +080033
34#define trace_buffer_restore(x) \
Robin Getz518039b2007-07-25 11:03:28 +080035 do { \
36 bfin_write_TBUFCTL((x)); \
37 } while (0)
38#else /* DEBUG_BFIN_HWTRACE_ON */
39
40#define trace_buffer_save(x)
41#define trace_buffer_restore(x)
42#endif /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
Robin Getz669b7922007-06-21 16:34:08 +080043
44#else
45/* Trace Macros for Assembly files */
46
Robin Getz518039b2007-07-25 11:03:28 +080047#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
48
Robin Getz669b7922007-06-21 16:34:08 +080049#define TRACE_BUFFER_START(preg, dreg) trace_buffer_start(preg, dreg)
50#define TRACE_BUFFER_STOP(preg, dreg) trace_buffer_stop(preg, dreg)
51
52#define trace_buffer_stop(preg, dreg) \
53 preg.L = LO(TBUFCTL); \
54 preg.H = HI(TBUFCTL); \
55 dreg = 0x1; \
56 [preg] = dreg;
57
Robin Getz518039b2007-07-25 11:03:28 +080058#define trace_buffer_start(preg, dreg) \
Robin Getz669b7922007-06-21 16:34:08 +080059 preg.L = LO(TBUFCTL); \
60 preg.H = HI(TBUFCTL); \
Robin Getz518039b2007-07-25 11:03:28 +080061 dreg = BFIN_TRACE_ON; \
Robin Getz669b7922007-06-21 16:34:08 +080062 [preg] = dreg;
63
Robin Getz518039b2007-07-25 11:03:28 +080064#define trace_buffer_init(preg, dreg) \
65 preg.L = LO(TBUFCTL); \
66 preg.H = HI(TBUFCTL); \
67 dreg = BFIN_TRACE_INIT; \
68 [preg] = dreg;
69
70#else /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
71
72#define trace_buffer_stop(preg, dreg)
73#define trace_buffer_start(preg, dreg)
74#define trace_buffer_init(preg, dreg)
75
76#endif /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
77
Robin Getz669b7922007-06-21 16:34:08 +080078#ifdef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
79# define DEBUG_START_HWTRACE(preg, dreg) trace_buffer_start(preg, dreg)
80# define DEBUG_STOP_HWTRACE(preg, dreg) trace_buffer_stop(preg, dreg)
81
82#else
83# define DEBUG_START_HWTRACE(preg, dreg)
84# define DEBUG_STOP_HWTRACE(preg, dreg)
85#endif
86
87#endif /* __ASSEMBLY__ */
88
89#endif /* _BLACKFIN_TRACE_ */