Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
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
White Rabbit Switch - Software
Commits
1b8a71a0
Commit
1b8a71a0
authored
Mar 23, 2016
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace/libwr: use pr_* functions instead of printf
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
2866c22b
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
31 additions
and
26 deletions
+31
-26
dot-config.c
userspace/libwr/dot-config.c
+2
-1
hwiu.c
userspace/libwr/hwiu.c
+4
-2
i2c_fpga_reg.c
userspace/libwr/i2c_fpga_reg.c
+4
-3
i2c_io.c
userspace/libwr/i2c_io.c
+2
-2
i2c_sfp.c
userspace/libwr/i2c_sfp.c
+6
-7
ptpd_netif.c
userspace/libwr/ptpd_netif.c
+3
-2
rt_client.c
userspace/libwr/rt_client.c
+8
-8
util.c
userspace/libwr/util.c
+2
-1
No files found.
userspace/libwr/dot-config.c
View file @
1b8a71a0
...
...
@@ -5,6 +5,7 @@
#include <string.h>
#include <errno.h>
#include <stdarg.h>
#include <libwr/wrs-msg.h>
#include <libwr/config.h>
/* All strings here are strdup'd and then split; you can't free(3) them */
...
...
@@ -173,7 +174,7 @@ int libwr_cfg_read_verify_file(char *dotconfig, char *kconfig)
if
(
!
strcmp
(
c
->
name
,
kc
->
name
))
break
;
if
(
!
kc
)
{
fprintf
(
stderr
,
"Configuration
\"
%s
\"
not found
\n
"
,
pr_error
(
"Configuration
\"
%s
\"
not found
\n
"
,
c
->
name
);
errors
++
;
}
...
...
userspace/libwr/hwiu.c
View file @
1b8a71a0
...
...
@@ -3,6 +3,7 @@
#include <stddef.h>
#include <fpga_io.h>
#include <regs/hwiu-regs.h>
#include <libwr/wrs-msg.h>
#include <libwr/hwiu.h>
#define hwiu_write(reg, val) \
...
...
@@ -43,8 +44,9 @@ int shw_hwiu_gwver(struct gw_info *info)
s_data
=
(
struct
gw_info
*
)
data
;
*
info
=
*
s_data
;
if
(
info
->
nwords
!=
HWIU_INFO_WORDS
)
{
printf
(
"nwords: sw=%u, hw=%u, ver=%u, data=%x
\n
"
,
info
->
nwords
,
HWIU_INFO_WORDS
,
info
->
struct_ver
,
data
[
0
]);
pr_error
(
"nwords: sw=%u, hw=%u, ver=%u, data=%x
\n
"
,
info
->
nwords
,
HWIU_INFO_WORDS
,
info
->
struct_ver
,
data
[
0
]);
return
-
1
;
}
//now read info words
...
...
userspace/libwr/i2c_fpga_reg.c
View file @
1b8a71a0
...
...
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <string.h>
#include <libwr/util.h> //for shw_udelay();
#include <libwr/wrs-msg.h>
#include "i2c_fpga_reg.h"
...
...
@@ -18,11 +19,11 @@ int i2c_fpga_reg_init_bus(struct i2c_bus *bus)
i2c_fpga_reg_t
*
priv
;
if
(
!
bus
->
type_specific
)
{
pr
intf
(
"no type specific structure provided
\n
"
);
pr
_error
(
"no type specific structure provided
\n
"
);
return
-
1
;
}
if
(
bus
->
type
!=
I2C_BUS_TYPE_FPGA_REG
)
{
pr
intf
(
"type doesn't match I2C_BUS_TYPE_FPGA_REG(%d): %d
\n
"
,
pr
_error
(
"type doesn't match I2C_BUS_TYPE_FPGA_REG(%d): %d
\n
"
,
I2C_BUS_TYPE_FPGA_REG
,
bus
->
type
);
return
-
1
;
}
...
...
@@ -40,7 +41,7 @@ int i2c_fpga_reg_init_bus(struct i2c_bus *bus)
_fpga_writel
(
priv
->
base_address
+
FPGA_I2C_REG_CTR
,
CTR_EN
);
if
(
!
(
_fpga_readl
(
priv
->
base_address
+
FPGA_I2C_REG_CTR
)
&
CTR_EN
))
{
pr
intf
(
"failed to read from control register
\n
"
);
pr
_error
(
"failed to read from control register
\n
"
);
return
-
1
;
}
...
...
userspace/libwr/i2c_io.c
View file @
1b8a71a0
...
...
@@ -86,10 +86,10 @@ int shw_i2c_io_scan(uint8_t * dev_map)
return
-
1
;
detect
=
i2c_scan
(
&
i2c_io_bus
,
dev_map
);
pr
intf
(
"
\n
i2c_bus: %s: %d devices
\n
"
,
i2c_io_bus
.
name
,
detect
);
pr
_debug
(
"
\n
i2c_bus: %s: %d devices
\n
"
,
i2c_io_bus
.
name
,
detect
);
for
(
i
=
0
;
i
<
128
;
i
++
)
if
(
dev_map
[
i
/
8
]
&
(
1
<<
(
i
%
8
)))
pr
intf
(
"device at: 0x%02X
\n
"
,
i
);
pr
_debug
(
"device at: 0x%02X
\n
"
,
i
);
return
detect
;
}
...
...
userspace/libwr/i2c_sfp.c
View file @
1b8a71a0
...
...
@@ -215,10 +215,10 @@ int shw_sfp_bus_scan(int num, uint8_t * dev_map)
return
-
1
;
detect
=
i2c_scan
(
&
i2c_buses
[
num
],
dev_map
);
pr
intf
(
"
\n
i2c_bus: %s: %d devices
\n
"
,
i2c_buses
[
num
].
name
,
detect
);
pr
_debug
(
"
\n
i2c_bus: %s: %d devices
\n
"
,
i2c_buses
[
num
].
name
,
detect
);
for
(
i
=
0
;
i
<
128
;
i
++
)
if
(
dev_map
[
i
/
8
]
&
(
1
<<
(
i
%
8
)))
pr
intf
(
"device at: 0x%02X
\n
"
,
i
);
pr
_debug
(
"device at: 0x%02X
\n
"
,
i
);
return
detect
;
}
...
...
@@ -548,12 +548,12 @@ static struct shw_sfp_caldata *shw_sfp_cal_list = NULL;
/* local helper */
static
void
__err_msg
(
int
index
,
char
*
pname
,
char
*
pvalue
)
{
fprintf
(
stderr
,
"Config item
\"
SFP%02i_PARAMS
\"
: parameter
\"
%s
\"
"
,
index
,
pname
);
if
(
pvalue
)
fprintf
(
stderr
,
"is wrong (
\"
%s
\"
)
\n
"
,
pvalue
);
pr_error
(
"Config item
\"
SFP%02i_PARAMS
\"
: parameter
\"
%s
\"
"
"is wrong (
\"
%s
\"
)
\n
"
,
index
,
pname
,
pvalue
);
else
fprintf
(
stderr
,
"is not specified
\n
"
);
pr_error
(
"Config item
\"
SFP%02i_PARAMS
\"
: parameter
\"
%s
\"
"
"is not specified
\n
"
,
index
,
pname
);
}
int
shw_sfp_read_db
(
void
)
...
...
@@ -653,7 +653,6 @@ struct shw_sfp_caldata *shw_sfp_get_cal_data(int num,
t
=
shw_sfp_cal_list
;
/* In the first pass, look for serial number */
while
(
t
)
{
// printf("search1 %s %s\n", t->part_num, t->vendor_serial);
if
(
t
->
vendor_name
[
0
]
==
0
&&
strncmp
(
pn
,
t
->
part_num
,
16
)
==
0
&&
t
->
vendor_serial
[
0
]
==
0
)
...
...
userspace/libwr/ptpd_netif.c
View file @
1b8a71a0
...
...
@@ -27,6 +27,7 @@
#include <libwr/hal_shmem.h>
#include <libwr/hal_client.h>
#include <libwr/util.h>
#include <libwr/wrs-msg.h>
#include <net/ethernet.h>
#ifdef NETIF_VERBOSE
...
...
@@ -487,8 +488,8 @@ int ptpd_netif_adjust_counters(int64_t adjust_sec, int32_t adjust_nsec)
return
0
;
if
(
adjust_sec
&&
adjust_nsec
)
{
fprintf
(
stderr
,
" FATAL : trying to adjust both the SEC and the NS counters simultaneously.
\n
"
);
pr_error
(
" FATAL : trying to adjust both the SEC and the NS "
"counters simultaneously.
\n
"
);
exit
(
-
1
);
}
...
...
userspace/libwr/rt_client.c
View file @
1b8a71a0
...
...
@@ -43,16 +43,16 @@ int rts_get_state(struct rts_pll_state *state)
return
ret
;
#ifdef VERBOSE
pr
intf
(
"RTS State Dump:
\n
"
);
pr
intf
(
"CurrentRef: %d Mode: %d Flags: %x
\n
"
,
pr
_debug
(
"RTS State Dump:
\n
"
);
pr
_debug
(
"CurrentRef: %d Mode: %d Flags: %x
\n
"
,
state
->
current_ref
,
state
->
mode
,
state
->
flags
);
for
(
i
=
0
;
i
<
RTS_PLL_CHANNELS
;
i
++
)
pr
intf
(
"Ch%d: setpoint: %dps current: %dps "
"loopback: %dps flags: %x
\n
"
,
i
,
state
->
channels
[
i
].
phase_setpoint
,
state
->
channels
[
i
].
phase_current
,
state
->
channels
[
i
].
phase_loopback
,
state
->
channels
[
i
].
flags
);
pr
_debug
(
"Ch%d: setpoint: %dps current: %dps "
"loopback: %dps flags: %x
\n
"
,
i
,
state
->
channels
[
i
].
phase_setpoint
,
state
->
channels
[
i
].
phase_current
,
state
->
channels
[
i
].
phase_loopback
,
state
->
channels
[
i
].
flags
);
#endif
return
0
;
...
...
userspace/libwr/util.c
View file @
1b8a71a0
...
...
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <sys/time.h>
#include <libwr/wrs-msg.h>
#include <libwr/util.h>
static
int
loops_per_msec
=
-
1
;
...
...
@@ -26,7 +27,7 @@ void shw_udelay_init(void)
loops_per_msec
=
i
*
1000
/
min
;
if
(
0
)
pr
intf
(
"loops per msec %i
\n
"
,
loops_per_msec
);
pr
_debug
(
"loops per msec %i
\n
"
,
loops_per_msec
);
/*
* I get 39400 more or less; it makes sense at 197 bogomips.
* The loop is 6 instructions with 3 (cached) memory accesses
...
...
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