@@ -49,7 +49,7 @@ int num_trace_classes;
4949int setup_trace_table (void )
5050{
5151 char buffer [2048 ];
52- char * trace = "sof/trace .h" ;
52+ char * trace = "uapi/logging .h" ;
5353 char * trace_filename = malloc (strlen (SOF_INC ) + strlen (trace ) + 2 );
5454 char * token ;
5555 int ret , i = 0 ;
@@ -143,47 +143,55 @@ static char *get_trace_class(uint32_t trace_class)
143143 return "value" ;
144144}
145145
146- #define META_SEQ_STEP_param_procD (i , _ ) META_CONCAT(param, i) %d
146+ #define META_SEQ_STEP_param_procU (i , _ ) META_CONCAT(param, i) %u
147147
148- #define HOST_TRACE_EVENT_NTH (postfix , vararg_count )\
149- META_FUNC_WITH_VARARGS(_trace_event, postfix, void,\
150- META_CONCAT(, uint32_t event),\
151- vararg_count, META_SEQ_STEP_param_uint32_t)
148+ #define HOST_TRACE_EVENT_NTH_PARAMS (id_count , param_count ) \
149+ uintptr_t event \
150+ META_SEQ_FROM_0_TO(id_count , META_SEQ_STEP_id_uint32_t) \
151+ META_SEQ_FROM_0_TO(param_count, META_SEQ_STEP_param_uint32_t)
152+
153+ #define HOST_TRACE_EVENT_NTH (postfix , param_count ) \
154+ META_FUNC_WITH_VARARGS( \
155+ _trace_event, META_CONCAT(postfix, param_count), \
156+ void, HOST_TRACE_EVENT_NTH_PARAMS(2, param_count) \
157+ )
152158
153159/* print trace event */
154- #define HOST_TRACE_EVENT_NTH_IMPL (arg_count )\
155- HOST_TRACE_EVENT_NTH(, arg_count)\
156- {\
157- char a, b, c;\
158- \
159- if (test_bench_trace > 0) {\
160- /* look up subsystem from trace class table */ \
160+ #define HOST_TRACE_EVENT_NTH_IMPL (arg_count ) \
161+ HOST_TRACE_EVENT_NTH(, arg_count) \
162+ { \
163+ char a, b, c; \
164+ \
165+ if (test_bench_trace > 0) { \
166+ /* look up subsystem from trace class table */ \
161167 char * trace_class = strdup (get_trace_class (event >> 24 ));\
162- \
163- a = event & 0xff ;\
164- b = (event >> 8 ) & 0xff ;\
165- c = (event >> 16 ) & 0xff ;\
166- \
167- /* print trace event stderr*/ \
168- if (!strcmp (trace_class , "value" ))\
169- fprintf (stderr ,\
170- "Trace value %d, " META_QUOTE (\
171- META_SEQ_FROM_0_TO (\
172- arg_count , META_SEQ_STEP_param_procD \
173- ))"\n" \
174- , event META_SEQ_FROM_0_TO (arg_count , META_SEQ_STEP_param ));\
175- else \
176- fprintf (stderr ,\
177- "Trace %s %c%c%c\n" \
178- , trace_class , c , b , a );\
179- if (trace_class )\
180- free (trace_class );\
181- }\
182- }\
183- HOST_TRACE_EVENT_NTH (_mbox_atomic , arg_count )\
184- {\
185- META_CONCAT (_trace_event , arg_count )\
186- (event META_SEQ_FROM_0_TO (arg_count ,META_SEQ_STEP_param ));\
168+ \
169+ a = event & 0xff ; \
170+ b = (event >> 8 ) & 0xff ; \
171+ c = (event >> 16 ) & 0xff ; \
172+ \
173+ /* print trace event stderr*/ \
174+ if (!strcmp (trace_class , "value" )) \
175+ fprintf (stderr , \
176+ "Trace value %lu, " META_QUOTE ( \
177+ META_SEQ_FROM_0_TO (arg_count , \
178+ META_SEQ_STEP_param_procU \
179+ ))"\n" \
180+ , event META_SEQ_FROM_0_TO (arg_count , \
181+ META_SEQ_STEP_param )); \
182+ else \
183+ fprintf (stderr , \
184+ "Trace %s %c%c%c\n" \
185+ , trace_class , c , b , a ); \
186+ if (trace_class ) \
187+ free (trace_class ); \
188+ } \
189+ } \
190+ HOST_TRACE_EVENT_NTH (_mbox_atomic , arg_count ) \
191+ { \
192+ META_CONCAT (_trace_event , arg_count ) \
193+ (event META_SEQ_FROM_0_TO (2 , META_SEQ_STEP_id ) \
194+ META_SEQ_FROM_0_TO (arg_count , META_SEQ_STEP_param )); \
187195}
188196
189197/* Implementation of
0 commit comments