Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
P
PPSi
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
50
Issues
50
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
PPSi
Commits
222d30ef
Commit
222d30ef
authored
Mar 07, 2013
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
diag.c: the functions used by diag-macros.h
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
bdf18817
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
1 deletion
+53
-1
Makefile
Makefile
+1
-1
diag.c
diag.c
+52
-0
No files found.
Makefile
View file @
222d30ef
...
@@ -35,7 +35,7 @@ CFLAGS = $(USER_CFLAGS)
...
@@ -35,7 +35,7 @@ CFLAGS = $(USER_CFLAGS)
CFLAGS
+=
-Wall
-O2
-ggdb
-Iinclude
CFLAGS
+=
-Wall
-O2
-ggdb
-Iinclude
# to avoid ifdef as much as possible, I use the kernel trick for OBJ variables
# to avoid ifdef as much as possible, I use the kernel trick for OBJ variables
OBJ-y
:=
fsm.o
OBJ-y
:=
fsm.o
diag.o
# include pp_printf code, by default the "full" version. Please
# include pp_printf code, by default the "full" version. Please
# set CONFIG_PRINTF_NONE or CONFIG_PRINTF_XINT if needed.
# set CONFIG_PRINTF_NONE or CONFIG_PRINTF_XINT if needed.
...
...
diag.c
0 → 100644
View file @
222d30ef
/*
* Alessandro Rubini for CERN, 2013 -- GNU LGPL v2.1 or later
*/
#include <stdarg.h>
#include <ppsi/ppsi.h>
static
char
*
thing_name
[]
=
{
[
pp_dt_fsm
]
=
"diag-fsm"
,
[
pp_dt_time
]
=
"diag-time"
,
[
pp_dt_frames
]
=
"diag-frames"
,
[
pp_dt_servo
]
=
"diag-servo"
,
[
pp_dt_bmc
]
=
"diag-bmc"
,
[
pp_dt_ext
]
=
"diag-extension"
,
};
void
__pp_diag
(
struct
pp_instance
*
ppi
,
enum
pp_diag_things
th
,
int
level
,
char
*
fmt
,
...)
{
va_list
args
;
if
(
!
__PP_DIAG_ALLOW
(
ppi
,
th
,
level
))
return
;
pp_printf
(
"%s-%i-%s: "
,
thing_name
[
th
],
level
,
OPTS
(
ppi
)
->
iface_name
);
va_start
(
args
,
fmt
);
pp_vprintf
(
fmt
,
args
);
va_end
(
args
);
}
unsigned
long
pp_diag_parse
(
char
*
diaglevel
)
{
unsigned
long
res
=
0
;
int
i
=
28
;
#ifdef VERB_LOG_MSGS
/* compatible with older way: this enables all */
return
~
0xf
;
#endif
while
(
*
diaglevel
&&
i
>=
4
)
{
if
(
*
diaglevel
<
'0'
||
*
diaglevel
>
'3'
)
break
;
res
|=
((
*
diaglevel
-
'0'
)
<<
i
);
i
-=
4
;
diaglevel
++
;
}
if
(
*
diaglevel
)
pp_printf
(
"%s: error parsing
\"
%s
\"\n
"
,
__func__
,
diaglevel
);
pp_printf
(
"diag level: %08lx
\n
"
,
res
);
return
res
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment