comparison src/cs/drivers/drv_app/lcc/lcc_trace.c @ 0:92470e5d0b9e

src: partial import from FC Selenite
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 15 May 2020 01:28:16 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:92470e5d0b9e
1 /******************************************************************************
2 * PWR task (pwr)
3 * Adapted from FFS by Svend Kristian Lindholm, skl@ti.com
4 * Idea, design and coding by Mads Meisner-Jensen, mmj@ti.com
5 *
6 * pwr tracing
7 *
8 * $Id: pwr_trace.c 1.1 Wed, 20 Aug 2003 10:22:37 +0200 skl $
9 *
10 ******************************************************************************/
11
12 #include "lcc/lcc_trace.h"
13
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <stdarg.h>
17
18 #include "rvf/rvf_api.h"
19 #include "rv/rv_general.h"
20 #include "rvm/rvm_use_id_list.h"
21 #include "rv/rv_defined_swe.h"
22
23 /******************************************************************************
24 * Target Tracing
25 *****************************************************************************/
26
27 static unsigned int pwr_mask = TTrFatal | TTrWarning;
28
29 void pwr_ttr_init(unsigned int mask)
30 {
31 pwr_mask = mask | TTrFatal | TTrWarning;
32 }
33
34 void pwr_ttr(unsigned int mask, char *format, ...)
35 {
36 va_list args;
37 static char buf[256];
38
39 if (pwr_mask & mask)
40 {
41 // build string ala tr() then call str()
42 va_start(args, format);
43 vsprintf(buf, format, args);
44 str(mask, buf);
45 va_end(args);
46 }
47 }
48
49 void pwr_str(unsigned mask, char *string)
50 {
51 if (pwr_mask & mask) {
52 #if (_RVF == 1)
53 rvf_send_trace(string, strlen(string), NULL_PARAM,
54 RV_TRACE_LEVEL_WARNING, LCC_USE_ID);
55 rvf_delay(5);
56 #endif
57 }
58 }
59
60 /******************************************************************************
61 ** Common Tracing and logging
62 *****************************************************************************/
63
64 int pwr_tr_query(int mask)
65 {
66 return (pwr_mask & mask);
67 }