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
a2fef783
Commit
a2fef783
authored
Dec 17, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
userspace: hal: use timing mode from Kconfig
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
c580d405
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
23 deletions
+17
-23
hal_timing.c
userspace/wrsw_hal/hal_timing.c
+17
-23
No files found.
userspace/wrsw_hal/hal_timing.c
View file @
a2fef783
...
...
@@ -7,6 +7,7 @@
#include <unistd.h>
#include <libwr/switch_hw.h>
#include <libwr/config.h>
#include "wrsw_hal.h"
#include "timeout.h"
...
...
@@ -20,8 +21,16 @@ static int timing_mode;
int
hal_init_timing
()
{
char
str
[
128
];
timeout_t
lock_tmo
;
static
struct
{
char
*
cfgname
;
int
modevalue
;
}
*
m
,
modes
[]
=
{
{
"TIME_GM"
,
HAL_TIMING_MODE_GRAND_MASTER
},
{
"TIME_FM"
,
HAL_TIMING_MODE_FREE_MASTER
},
{
"TIME_BC"
,
HAL_TIMING_MODE_BC
},
{
NULL
,
HAL_TIMING_MODE_BC
/* default */
},
};
if
(
rts_connect
()
<
0
)
{
TRACE
(
TRACE_ERROR
,
...
...
@@ -29,29 +38,14 @@ int hal_init_timing()
return
-
1
;
}
if
(
hal_config_get_string
(
"timing.mode"
,
str
,
sizeof
(
str
))
<
0
)
{
TRACE
(
TRACE_INFO
,
"Not timing mode specified in the config file. "
"Defaulting to Boundary Clock."
);
timing_mode
=
HAL_TIMING_MODE_BC
;
strcpy
(
str
,
"BoundaryClock"
);
}
else
{
if
(
!
strcasecmp
(
str
,
"GrandMaster"
)
||
!
strcasecmp
(
str
,
"GM"
))
timing_mode
=
HAL_TIMING_MODE_GRAND_MASTER
;
else
if
(
!
strcasecmp
(
str
,
"FreeMaster"
)
||
!
strcasecmp
(
str
,
"FM"
))
timing_mode
=
HAL_TIMING_MODE_FREE_MASTER
;
else
if
(
!
strcasecmp
(
str
,
"BoundaryClock"
)
||
!
strcasecmp
(
str
,
"BC"
))
timing_mode
=
HAL_TIMING_MODE_BC
;
else
{
TRACE
(
TRACE_ERROR
,
"Unrecognized timing mode '%s'"
,
str
);
return
-
1
;
}
}
for
(
m
=
modes
;
m
->
cfgname
;
m
++
)
if
(
libwr_cfg_get
(
m
->
cfgname
))
break
;
timing_mode
=
m
->
modevalue
;
TRACE
(
TRACE_INFO
,
"Timing mode: %s"
,
str
);
if
(
!
m
->
cfgname
)
fprintf
(
stderr
,
"%s: no config variable set, defaults used
\n
"
,
__func__
);
/* initialize the RT Subsys */
switch
(
timing_mode
)
{
...
...
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