On Mon, 2018-03-26 at 15:01 +0100, Liam Girdwood wrote:
On Mon, 2018-03-26 at 06:56 -0700, Ranjani Sridharan wrote:
On Mon, 2018-03-26 at 09:10 +0100, Liam Girdwood wrote:
On Mon, 2018-03-26 at 15:59 +0800, Yan Wang wrote:
On 3/26/2018 3:44 PM, Liam Girdwood wrote:
On Sun, 2018-03-25 at 17:34 -0700, Ranjani Sridharan wrote:
This patch adds a macro that can be used to enable sending all trace to mbox.
Does this also keep sending data to DMA trace too ? It needs to send data to both like trace_error()
IMHO, if TRACEM is enabled, it should only send trace data to mbox and not send to DMA trace local buffer?
It needs to do both, as it's a debug option to use when DMA trace fails or is being debugged.
Yes, it does send the trace to both the local buffer and the mbox at the moment.
ok, great, I wan't sure as two new functions had been added. I thought you would have reused the existing functions used for errors ?
The function used for errors had the name error in them and I thought it would be confusing to use the same function. But I agree there is a lot of repeated code in trace.c. I can work on cleaning it up to reuse code. I will send out a v2 soon.
Liam
Liam
Liam
Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.i ntel .com>
Tested with Minnowboard Turbot with RT5651 Kernel: https://github.com/plbossart/sound.git branch: topic/sof-v4.14 SOF: https://github.com/ranj063/sof.git branch: debug/trace_test SOFT: 1.1-stable
src/include/reef/trace.h | 12 ++++++++- src/lib/trace.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-)
diff --git a/src/include/reef/trace.h b/src/include/reef/trace.h index 7afbd23..f3f4dff 100644 --- a/src/include/reef/trace.h +++ b/src/include/reef/trace.h @@ -100,22 +100,32 @@ #define TRACE 1 #define TRACEV 0 #define TRACEE 1 +#define TRACEM 0 /* send all trace messages to mbox */
void _trace_event(uint32_t event); +void _trace_event_mbox(uint32_t event); void _trace_error(uint32_t event); void _trace_error_value(uint32_t event); void _trace_event_atomic(uint32_t event); +void _trace_event_mbox_atomic(uint32_t event); void _trace_error_atomic(uint32_t event); void trace_off(void); void trace_init(struct reef * reef);
#if TRACE
+/* send all trace to mbox */ +#if TRACEM +#define trace_event(__c, __e) \
- _trace_event_mbox(__c | (__e[0] << 16) | (__e[1]
<< 8) > __e[2])
+#define trace_event_atomic(__c, __e) \
- _trace_event_mbox_atomic(__c | (__e[0] << 16) |
(__e[1] << 8) | __e[2]) +#else #define trace_event(__c, __e) \ _trace_event(__c | (__e[0] << 16) | (__e[1] <<8) | __e[2]) #define trace_event_atomic(__c, __e) \ _trace_event_atomic(__c | (__e[0] << 16) | (__e[1] <<8) | __e[2])
+#endif #define trace_value(x) _trace_event(x) #define trace_value_atomic(x) _trace_event_atomic( x)
diff --git a/src/lib/trace.c b/src/lib/trace.c index de99a4e..bd0d376 100644 --- a/src/lib/trace.c +++ b/src/lib/trace.c @@ -136,6 +136,71 @@ void _trace_event_atomic(uint32_t event) dtrace_event_atomic((const char*)dt, sizeof(uint64_t)
- 2); }
+void _trace_event_mbox(uint32_t event) +{
- unsigned long flags;
- uint64_t dt[2];
- uint64_t time;
- volatile uint64_t *t;
- if (!trace.enable)
return;
- time = platform_timer_get(platform_timer);
- dt[0] = time;
- dt[1] = event;
- dtrace_event((const char *)dt, sizeof(uint64_t) *
2);
- /* send event by mail box too. */
- spin_lock_irq(&trace.lock, flags);
- /* write timestamp and event to trace buffer */
- t = (volatile uint64_t *)(MAILBOX_TRACE_BASE +
trace.pos);
- trace.pos += (sizeof(uint64_t) << 1);
- if (trace.pos > MAILBOX_TRACE_SIZE -
sizeof(uint64_t)
trace.pos = 0;
- spin_unlock_irq(&trace.lock, flags);
- t[0] = time;
- t[1] = event;
- /* writeback trace data */
- dcache_writeback_region((void *)t,
sizeof(uint64_t) * 2); +}
+void _trace_event_mbox_atomic(uint32_t event) +{
- volatile uint64_t *t;
- uint64_t dt[2];
- uint64_t time;
- if (!trace.enable)
return;
- time = platform_timer_get(platform_timer);
- dt[0] = time;
- dt[1] = event;
- dtrace_event_atomic((const char *)dt,
sizeof(uint64_t)
- 2);
- /* write timestamp and event to trace buffer */
- t = (volatile uint64_t *)(MAILBOX_TRACE_BASE +
trace.pos);
- trace.pos += (sizeof(uint64_t) << 1);
- if (trace.pos > MAILBOX_TRACE_SIZE -
sizeof(uint64_t)
trace.pos = 0;
- t[0] = time;
- t[1] = event;
- /* writeback trace data */
- dcache_writeback_region((void *)t,
sizeof(uint64_t) * 2); +}
- void trace_off(void) { trace.enable = 0;
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-f irmw are
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-fir mwar e
Sound-open-firmware mailing list Sound-open-firmware@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmwar e