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_stop(preg, dreg) \ |
| 50 | preg.L = LO(TBUFCTL); \ |
| 51 | preg.H = HI(TBUFCTL); \ |
| 52 | dreg = 0x1; \ |
| 53 | [preg] = dreg; |
| 54 | |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 55 | #define trace_buffer_init(preg, dreg) \ |
| 56 | preg.L = LO(TBUFCTL); \ |
| 57 | preg.H = HI(TBUFCTL); \ |
| 58 | dreg = BFIN_TRACE_INIT; \ |
| 59 | [preg] = dreg; |
| 60 | |
Mike Frysinger | 80f31c8 | 2008-02-02 15:47:24 +0800 | [diff] [blame] | 61 | #define trace_buffer_save(preg, dreg) \ |
| 62 | preg.L = LO(TBUFCTL); \ |
| 63 | preg.H = HI(TBUFCTL); \ |
| 64 | dreg = [preg]; \ |
Bernd Schmidt | 2a0c4fd | 2008-04-23 07:17:34 +0800 | [diff] [blame] | 65 | [--sp] = dreg; \ |
Mike Frysinger | 80f31c8 | 2008-02-02 15:47:24 +0800 | [diff] [blame] | 66 | dreg = 0x1; \ |
| 67 | [preg] = dreg; |
| 68 | |
| 69 | #define trace_buffer_restore(preg, dreg) \ |
| 70 | preg.L = LO(TBUFCTL); \ |
| 71 | preg.H = HI(TBUFCTL); \ |
Bernd Schmidt | 2a0c4fd | 2008-04-23 07:17:34 +0800 | [diff] [blame] | 72 | dreg = [sp++]; \ |
Mike Frysinger | 80f31c8 | 2008-02-02 15:47:24 +0800 | [diff] [blame] | 73 | [preg] = dreg; |
| 74 | |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 75 | #else /* CONFIG_DEBUG_BFIN_HWTRACE_ON */ |
| 76 | |
| 77 | #define trace_buffer_stop(preg, dreg) |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 78 | #define trace_buffer_init(preg, dreg) |
Mike Frysinger | 80f31c8 | 2008-02-02 15:47:24 +0800 | [diff] [blame] | 79 | #define trace_buffer_save(preg, dreg) |
| 80 | #define trace_buffer_restore(preg, dreg) |
Robin Getz | 518039b | 2007-07-25 11:03:28 +0800 | [diff] [blame] | 81 | |
| 82 | #endif /* CONFIG_DEBUG_BFIN_HWTRACE_ON */ |
| 83 | |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 84 | #ifdef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE |
Mike Frysinger | 80f31c8 | 2008-02-02 15:47:24 +0800 | [diff] [blame] | 85 | # define DEBUG_HWTRACE_SAVE(preg, dreg) trace_buffer_save(preg, dreg) |
| 86 | # define DEBUG_HWTRACE_RESTORE(preg, dreg) trace_buffer_restore(preg, dreg) |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 87 | #else |
Mike Frysinger | 80f31c8 | 2008-02-02 15:47:24 +0800 | [diff] [blame] | 88 | # define DEBUG_HWTRACE_SAVE(preg, dreg) |
| 89 | # define DEBUG_HWTRACE_RESTORE(preg, dreg) |
Robin Getz | 669b792 | 2007-06-21 16:34:08 +0800 | [diff] [blame] | 90 | #endif |
| 91 | |
| 92 | #endif /* __ASSEMBLY__ */ |
| 93 | |
| 94 | #endif /* _BLACKFIN_TRACE_ */ |