Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Common header file for blackfin family of processors. |
| 3 | * |
| 4 | */ |
| 5 | |
| 6 | #ifndef _BLACKFIN_TRACE_ |
| 7 | #define _BLACKFIN_TRACE_ |
| 8 | |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame^] | 9 | /* 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 Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 20 | #ifndef __ASSEMBLY__ |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame^] | 21 | extern unsigned long trace_buff_offset; |
| 22 | extern unsigned long software_trace_buff[]; |
| 23 | |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 24 | /* Trace Macros for C files */ |
| 25 | |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame^] | 26 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON |
| 27 | |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 28 | #define trace_buffer_save(x) \ |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame^] | 29 | do { \ |
| 30 | (x) = bfin_read_TBUFCTL(); \ |
| 31 | bfin_write_TBUFCTL((x) & ~TBUFEN); \ |
| 32 | } while (0) |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 33 | |
| 34 | #define trace_buffer_restore(x) \ |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame^] | 35 | 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 Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 43 | |
| 44 | #else |
| 45 | /* Trace Macros for Assembly files */ |
| 46 | |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame^] | 47 | #ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON |
| 48 | |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 49 | #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 Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame^] | 58 | #define trace_buffer_start(preg, dreg) \ |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 59 | preg.L = LO(TBUFCTL); \ |
| 60 | preg.H = HI(TBUFCTL); \ |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame^] | 61 | dreg = BFIN_TRACE_ON; \ |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 62 | [preg] = dreg; |
| 63 | |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame^] | 64 | #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 Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 78 | #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_ */ |