2007-06-21 16:34:08 +08:00
|
|
|
/*
|
2009-09-24 22:11:24 +08:00
|
|
|
* header file for hardware trace functions
|
2007-06-21 16:34:08 +08:00
|
|
|
*
|
2009-09-24 22:11:24 +08:00
|
|
|
* Copyright 2007-2008 Analog Devices Inc.
|
|
|
|
*
|
|
|
|
* Licensed under the GPL-2 or later.
|
2007-06-21 16:34:08 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _BLACKFIN_TRACE_
|
|
|
|
#define _BLACKFIN_TRACE_
|
|
|
|
|
2007-07-25 11:03:28 +08:00
|
|
|
/* 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
|
|
|
|
|
2007-06-21 16:34:08 +08:00
|
|
|
#ifndef __ASSEMBLY__
|
2007-07-25 11:03:28 +08:00
|
|
|
extern unsigned long trace_buff_offset;
|
|
|
|
extern unsigned long software_trace_buff[];
|
2010-03-12 03:26:38 +08:00
|
|
|
#if defined(CONFIG_DEBUG_VERBOSE)
|
2010-03-12 00:24:18 +08:00
|
|
|
extern void decode_address(char *buf, unsigned long address);
|
2010-03-16 01:42:07 +08:00
|
|
|
extern bool get_instruction(unsigned int *val, unsigned short *address);
|
2010-03-12 03:26:38 +08:00
|
|
|
#else
|
2010-03-16 01:42:07 +08:00
|
|
|
static inline void decode_address(char *buf, unsigned long address) { }
|
|
|
|
static inline bool get_instruction(unsigned int *val, unsigned short *address) { return false; }
|
2010-03-12 03:26:38 +08:00
|
|
|
#endif
|
2007-07-25 11:03:28 +08:00
|
|
|
|
2007-06-21 16:34:08 +08:00
|
|
|
/* Trace Macros for C files */
|
|
|
|
|
2007-07-25 11:03:28 +08:00
|
|
|
#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
|
|
|
|
|
2009-09-28 17:23:05 +08:00
|
|
|
#define trace_buffer_init() bfin_write_TBUFCTL(BFIN_TRACE_INIT)
|
|
|
|
|
2007-06-21 16:34:08 +08:00
|
|
|
#define trace_buffer_save(x) \
|
2007-07-25 11:03:28 +08:00
|
|
|
do { \
|
|
|
|
(x) = bfin_read_TBUFCTL(); \
|
|
|
|
bfin_write_TBUFCTL((x) & ~TBUFEN); \
|
|
|
|
} while (0)
|
2007-06-21 16:34:08 +08:00
|
|
|
|
|
|
|
#define trace_buffer_restore(x) \
|
2007-07-25 11:03:28 +08:00
|
|
|
do { \
|
|
|
|
bfin_write_TBUFCTL((x)); \
|
|
|
|
} while (0)
|
|
|
|
#else /* DEBUG_BFIN_HWTRACE_ON */
|
|
|
|
|
|
|
|
#define trace_buffer_save(x)
|
|
|
|
#define trace_buffer_restore(x)
|
|
|
|
#endif /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
|
2007-06-21 16:34:08 +08:00
|
|
|
|
|
|
|
#else
|
|
|
|
/* Trace Macros for Assembly files */
|
|
|
|
|
2007-07-25 11:03:28 +08:00
|
|
|
#ifdef CONFIG_DEBUG_BFIN_HWTRACE_ON
|
|
|
|
|
2007-06-21 16:34:08 +08:00
|
|
|
#define trace_buffer_stop(preg, dreg) \
|
|
|
|
preg.L = LO(TBUFCTL); \
|
|
|
|
preg.H = HI(TBUFCTL); \
|
|
|
|
dreg = 0x1; \
|
|
|
|
[preg] = dreg;
|
|
|
|
|
2007-07-25 11:03:28 +08:00
|
|
|
#define trace_buffer_init(preg, dreg) \
|
|
|
|
preg.L = LO(TBUFCTL); \
|
|
|
|
preg.H = HI(TBUFCTL); \
|
|
|
|
dreg = BFIN_TRACE_INIT; \
|
2007-06-21 16:34:08 +08:00
|
|
|
[preg] = dreg;
|
|
|
|
|
2008-02-02 15:47:24 +08:00
|
|
|
#define trace_buffer_save(preg, dreg) \
|
|
|
|
preg.L = LO(TBUFCTL); \
|
|
|
|
preg.H = HI(TBUFCTL); \
|
|
|
|
dreg = [preg]; \
|
2008-04-23 07:17:34 +08:00
|
|
|
[--sp] = dreg; \
|
2008-02-02 15:47:24 +08:00
|
|
|
dreg = 0x1; \
|
|
|
|
[preg] = dreg;
|
|
|
|
|
|
|
|
#define trace_buffer_restore(preg, dreg) \
|
|
|
|
preg.L = LO(TBUFCTL); \
|
|
|
|
preg.H = HI(TBUFCTL); \
|
2008-04-23 07:17:34 +08:00
|
|
|
dreg = [sp++]; \
|
2008-02-02 15:47:24 +08:00
|
|
|
[preg] = dreg;
|
|
|
|
|
2007-07-25 11:03:28 +08:00
|
|
|
#else /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
|
|
|
|
|
|
|
|
#define trace_buffer_stop(preg, dreg)
|
|
|
|
#define trace_buffer_init(preg, dreg)
|
2008-02-02 15:47:24 +08:00
|
|
|
#define trace_buffer_save(preg, dreg)
|
|
|
|
#define trace_buffer_restore(preg, dreg)
|
2007-07-25 11:03:28 +08:00
|
|
|
|
|
|
|
#endif /* CONFIG_DEBUG_BFIN_HWTRACE_ON */
|
|
|
|
|
2007-06-21 16:34:08 +08:00
|
|
|
#ifdef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE
|
2008-02-02 15:47:24 +08:00
|
|
|
# define DEBUG_HWTRACE_SAVE(preg, dreg) trace_buffer_save(preg, dreg)
|
|
|
|
# define DEBUG_HWTRACE_RESTORE(preg, dreg) trace_buffer_restore(preg, dreg)
|
2007-06-21 16:34:08 +08:00
|
|
|
#else
|
2008-02-02 15:47:24 +08:00
|
|
|
# define DEBUG_HWTRACE_SAVE(preg, dreg)
|
|
|
|
# define DEBUG_HWTRACE_RESTORE(preg, dreg)
|
2007-06-21 16:34:08 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __ASSEMBLY__ */
|
|
|
|
|
|
|
|
#endif /* _BLACKFIN_TRACE_ */
|