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
0f120a43
Commit
0f120a43
authored
Nov 11, 2014
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
arch-wrs: allow building without WR
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
9c71d3f2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
19 deletions
+31
-19
Makefile
arch-wrs/Makefile
+0
-1
ppsi-wrs.h
arch-wrs/include/ppsi-wrs.h
+6
-0
main-loop.c
arch-wrs/main-loop.c
+2
-1
wrs-ipcserver.c
arch-wrs/wrs-ipcserver.c
+7
-5
wrs-startup.c
arch-wrs/wrs-startup.c
+16
-12
No files found.
arch-wrs/Makefile
View file @
0f120a43
...
...
@@ -18,7 +18,6 @@ OBJ-y += $A/wrs-startup.o \
# The user can set TIME=, but wrs is default
TIME
?=
wrs
PROTO_EXT
=
whiterabbit
include
time-$(TIME)/Makefile
...
...
arch-wrs/include/ppsi-wrs.h
View file @
0f120a43
...
...
@@ -4,6 +4,12 @@
*
* Released to the public domain
*/
#ifdef CONFIG_EXT_WRS
# define BUILT_WITH_WHITERABBIT 1
#else
# define BUILT_WITH_WHITERABBIT 0
#endif
/*
* These are the functions provided by the various wrs files
...
...
arch-wrs/main-loop.c
View file @
0f120a43
...
...
@@ -52,7 +52,8 @@ static int run_all_state_machines(struct pp_globals *ppg)
ppi
->
n_ops
->
exit
(
ppi
);
ppi
->
frgn_rec_num
=
0
;
ppi
->
frgn_rec_best
=
-
1
;
if
(
ppg
->
ebest_idx
==
ppi
->
port_idx
)
if
(
BUILT_WITH_WHITERABBIT
&&
ppg
->
ebest_idx
==
ppi
->
port_idx
)
wr_servo_reset
();
}
}
...
...
arch-wrs/wrs-ipcserver.c
View file @
0f120a43
...
...
@@ -39,7 +39,7 @@ static struct minipc_pd __rpcdef_cmd = {
/* Fill struct ptpdexp_sync_state_t with current servo state */
static
int
wrsipc_get_sync_state
(
ptpdexp_sync_state_t
*
state
)
{
if
(
servo_state_valid
)
{
if
(
BUILT_WITH_WHITERABBIT
&&
servo_state_valid
)
{
memcpy
(
state
,
&
cur_servo_state
,
sizeof
(
ptpdexp_sync_state_t
));
state
->
valid
=
1
;
}
else
...
...
@@ -51,11 +51,13 @@ static int wrsipc_get_sync_state(ptpdexp_sync_state_t *state)
/* Execute command coming ipc */
static
int
wrsipc_cmd
(
int
cmd
,
int
value
)
{
if
(
cmd
==
PTPDEXP_COMMAND_TRACKING
)
wr_servo_enable_tracking
(
value
);
if
(
BUILT_WITH_WHITERABBIT
)
{
if
(
cmd
==
PTPDEXP_COMMAND_TRACKING
)
wr_servo_enable_tracking
(
value
);
if
(
cmd
==
PTPDEXP_COMMAND_MAN_ADJUST_PHASE
)
wr_servo_man_adjust_phase
(
value
);
if
(
cmd
==
PTPDEXP_COMMAND_MAN_ADJUST_PHASE
)
wr_servo_man_adjust_phase
(
value
);
}
return
0
;
}
...
...
arch-wrs/wrs-startup.c
View file @
0f120a43
...
...
@@ -25,7 +25,12 @@
#include <ppsi/ppsi.h>
#include <ppsi-wrs.h>
#define WRSW_HAL_RETRIES 1000
#if BUILT_WITH_WHITERABBIT
# define WRSW_HAL_RETRIES 1000
#else
# define WRSW_HAL_RETRIES 0
#endif
#define WRSW_HAL_TIMEOUT 2000000
/* us */
static
struct
wr_operations
wrs_wr_operations
=
{
...
...
@@ -75,15 +80,12 @@ int main(int argc, char **argv)
/* try connecting to HAL multiple times in case it's still not ready */
hal_retries
=
WRSW_HAL_RETRIES
;
for
(;;)
{
while
(
hal_retries
)
{
/* may be never, if built without WR extension */
hal_ch
=
minipc_client_create
(
WRSW_HAL_SERVER_ADDR
,
MINIPC_FLAG_VERBOSE
);
if
(
!
hal_ch
)
hal_retries
--
;
if
(
hal_ch
||
!
hal_retries
)
if
(
hal_ch
)
break
;
hal_retries
--
;
usleep
(
WRSW_HAL_TIMEOUT
);
}
...
...
@@ -92,12 +94,14 @@ int main(int argc, char **argv)
exit
(
__LINE__
);
}
ppsi_ch
=
minipc_server_create
(
"ptpd"
,
0
);
if
(
!
ppsi_ch
)
{
/* FIXME should we retry with minipc_server_create? */
pp_printf
(
"Fatal: could not create minipc server"
);
exit
(
__LINE__
);
if
(
BUILT_WITH_WHITERABBIT
)
{
ppsi_ch
=
minipc_server_create
(
"ptpd"
,
0
);
if
(
!
ppsi_ch
)
{
/* FIXME should we retry ? */
pp_printf
(
"Fatal: could not create minipc server"
);
exit
(
__LINE__
);
}
wrs_init_ipcserver
(
ppsi_ch
);
}
wrs_init_ipcserver
(
ppsi_ch
);
ppg
=
&
ppg_static
;
ppg
->
defaultDS
=
&
defaultDS
;
...
...
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