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
1e86e653
Commit
1e86e653
authored
Jan 05, 2023
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sim and unix: tentatively fix build issues
parent
328aa418
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
29 additions
and
22 deletions
+29
-22
Makefile
arch-sim/Makefile
+5
-2
main-loop.c
arch-sim/main-loop.c
+4
-1
ppsi-sim.h
arch-sim/ppsi-sim.h
+1
-1
sim-startup.c
arch-sim/sim-startup.c
+12
-11
main-loop.c
arch-unix/main-loop.c
+1
-1
unix-startup.c
arch-unix/unix-startup.c
+1
-3
sim-time.c
time-sim/sim-time.c
+3
-1
unix-socket.c
time-unix/unix-socket.c
+2
-2
No files found.
arch-sim/Makefile
View file @
1e86e653
# All files are under A (short for ARCH): I'm lazy
A
:=
arch-
$(ARCH)
CFLAGS
+=
-Itools
-Iproto-standard
# needed for --gc-sections option of ld
PPSI_O_LDFLAGS
=
--entry
=
main
OBJ-y
+=
$A
/sim-startup.o
\
$A
/main-loop.o
\
$A
/sim-io.o
\
...
...
@@ -13,7 +15,8 @@ OBJ-y += $A/sim-startup.o \
lib/dump-funcs.o
\
lib/libc-functions.o
\
lib/assert.o
\
lib/div64.o
lib/div64.o
\
lib/time-arith.o
# Support only "sim" time operations
TIME
:=
sim
...
...
arch-sim/main-loop.c
View file @
1e86e653
...
...
@@ -64,15 +64,18 @@ void sim_main_loop(struct pp_globals *ppg)
* would affect port state again
*/
if
(
ppg
->
ebest_updated
)
{
bmc_calculate_ebest
(
ppg
);
#if 0
for (j = 0; j < ppg->nlinks; j++) {
int new_state;
struct pp_instance *ppi = INST(ppg ,j);
new_state
=
bmc
(
pp
i
);
new_state = bmc(pp
g
);
if (new_state != ppi->state) {
ppi->state = new_state;
ppi->is_new_state = 1;
}
}
#endif
ppg
->
ebest_updated
=
0
;
}
...
...
arch-sim/ppsi-sim.h
View file @
1e86e653
...
...
@@ -90,7 +90,7 @@ struct sim_ppi_arch_data {
/* Data sets */
defaultDS_t
*
defaultDS
;
currentDS_t
*
currentDS
;
[
parentDS_t
*
parentDS
;
parentDS_t
*
parentDS
;
timePropertiesDS_t
*
timePropertiesDS
;
/* other pp_instance, used in net ops */
struct
pp_instance
*
other_ppi
;
...
...
arch-sim/sim-startup.c
View file @
1e86e653
...
...
@@ -11,30 +11,32 @@
#include "ppsi-sim.h"
static
struct
pp_runtime_opts
sim_master_rt_opts
=
{
.
clock_quality
=
{
/*
.clock_quality = {
.clockClass = PP_PTP_CLASS_GM_LOCKED,
.clockAccuracy = PP_ACCURACY_DEFAULT,
.offsetScaledLogVariance = PP_VARIANCE_DEFAULT,
},
.
flags
=
PP_DEFAULT_FLAGS
,
*/
.
flags
=
PP_DEFAULT_FLAGS
,
.
ap
=
PP_DEFAULT_AP
,
.
ai
=
PP_DEFAULT_AI
,
.
s
=
PP_DEFAULT_DELAY_S
,
.
logAnnounceInterval
=
PP_DEFAULT_ANNOUNCE_INTERVAL
,
/*
.logAnnounceInterval = PP_DEFAULT_ANNOUNCE_INTERVAL,
.logSyncInterval = PP_DEFAULT_SYNC_INTERVAL,
*/
.
priority1
=
PP_DEFAULT_PRIORITY1
,
.
priority2
=
PP_DEFAULT_PRIORITY2
,
.
domainNumber
=
PP_DEFAULT_DOMAIN_NUMBER
,
.
ttl
=
PP_DEFAULT_TTL
,
};
extern
struct
pp_ext_hooks
pp_hooks
;
extern
struct
pp_ext_hooks
const
pp_hooks
;
/*
* In arch-sim we use two pp_instaces in the same pp_globals to represent
* In arch-sim we use two pp_insta
n
ces in the same pp_globals to represent
* two different machines. This means *completely differnt* machines, with
* their own Data Sets. Given we can't put more all the different Data Sets
* in the same ppg, we stored them in the ppi->arch_data of every istance.
* in the same ppg, we stored them in the ppi->arch_data of every i
n
stance.
* This function is used to set the inner Data Sets pointer of the ppg to
* point to the Data Sets related to the pp_instange passed as argument
*/
...
...
@@ -46,7 +48,7 @@ int sim_set_global_DS(struct pp_instance *ppi)
ppi
->
glbs
->
currentDS
=
data
->
currentDS
;
ppi
->
glbs
->
parentDS
=
data
->
parentDS
;
ppi
->
glbs
->
timePropertiesDS
=
data
->
timePropertiesDS
;
ppi
->
glbs
->
servo
=
data
->
servo
;
//
ppi->glbs->servo = data->servo;
ppi
->
glbs
->
rt_opts
=
data
->
rt_opts
;
return
0
;
...
...
@@ -67,8 +69,7 @@ static int sim_ppi_init(struct pp_instance *ppi, int which_ppi)
data
->
defaultDS
=
calloc
(
1
,
sizeof
(
*
data
->
defaultDS
));
data
->
currentDS
=
calloc
(
1
,
sizeof
(
*
data
->
currentDS
));
data
->
parentDS
=
calloc
(
1
,
sizeof
(
*
data
->
parentDS
));
data
->
timePropertiesDS
=
calloc
(
1
,
sizeof
(
*
data
->
timePropertiesDS
));
data
->
timePropertiesDS
=
calloc
(
1
,
sizeof
(
*
data
->
timePropertiesDS
));
data
->
servo
=
calloc
(
1
,
sizeof
(
*
data
->
servo
));
if
((
!
data
->
defaultDS
)
||
(
!
data
->
currentDS
)
||
...
...
@@ -122,7 +123,7 @@ int main(int argc, char **argv)
*/
sim_set_global_DS
(
pp_sim_get_master
(
ppg
));
pp_config_string
(
ppg
,
strdup
(
"port SIM_MASTER; iface MASTER;"
"proto udp;
role master;
"
"proto udp;"
"sim_iter_max 10000;"
"sim_init_master_time .9;"
));
...
...
@@ -135,7 +136,7 @@ int main(int argc, char **argv)
pp_config_file
(
ppg
,
0
,
PP_DEFAULT_CONFIGFILE
);
if
(
ppg
->
cfg
.
cfg_items
==
0
)
pp_config_string
(
ppg
,
strdup
(
"port SIM_SLAVE; iface SLAVE;"
"proto udp;
role slave;
"
));
"proto udp;"
));
for
(
i
=
0
;
i
<
ppg
->
nlinks
;
i
++
)
{
ppi
=
INST
(
ppg
,
i
);
...
...
arch-unix/main-loop.c
View file @
1e86e653
...
...
@@ -73,7 +73,7 @@ void unix_main_loop(struct pp_globals *ppg)
for
(
j
=
0
;
j
<
ppg
->
nlinks
;
j
++
)
{
int
new_state
;
struct
pp_instance
*
ppi
=
INST
(
ppg
,
j
);
new_state
=
bmc
(
pp
i
);
new_state
=
bmc
(
pp
g
);
if
(
new_state
!=
ppi
->
state
)
{
ppi
->
state
=
new_state
;
ppi
->
is_new_state
=
1
;
...
...
arch-unix/unix-startup.c
View file @
1e86e653
...
...
@@ -50,7 +50,6 @@ int main(int argc, char **argv)
ppg
->
currentDS
=
&
currentDS
;
ppg
->
parentDS
=
&
parentDS
;
ppg
->
timePropertiesDS
=
&
timePropertiesDS
;
ppg
->
servo
=
&
servo
;
ppg
->
rt_opts
=
&
__pp_default_rt_opts
;
/* We are hosted, so we can allocate */
...
...
@@ -67,7 +66,6 @@ int main(int argc, char **argv)
for
(
i
=
0
;
i
<
ppg
->
max_links
;
i
++
)
{
ppi
=
INST
(
ppg
,
i
);
ppi
->
proto
=
PP_DEFAULT_PROTO
;
ppi
->
role
=
PP_DEFAULT_ROLE
;
ppi
->
delayMechanism
=
MECH_E2E
;
}
...
...
@@ -89,7 +87,7 @@ int main(int argc, char **argv)
ppi
=
INST
(
ppg
,
i
);
ppi
->
ch
[
PP_NP_EVT
].
fd
=
-
1
;
ppi
->
ch
[
PP_NP_GEN
].
fd
=
-
1
;
ppi
->
servo
=
&
servo
;
ppi
->
glbs
=
ppg
;
ppi
->
vlans_array_len
=
CONFIG_VLAN_ARRAY_SIZE
,
ppi
->
iface_name
=
ppi
->
cfg
.
iface_name
;
...
...
time-sim/sim-time.c
View file @
1e86e653
...
...
@@ -70,11 +70,13 @@ static int sim_time_set_utc_offset(struct pp_instance *ppi, int offset, int leap
return
-
1
;
}
#if 0
static int sim_time_get_servo_state(struct pp_instance *ppi, int *state)
{
*state = PP_SERVO_UNKNOWN;
return 0;
}
#endif
static
int
sim_time_get
(
struct
pp_instance
*
ppi
,
struct
pp_time
*
t
)
{
...
...
@@ -146,7 +148,7 @@ const struct pp_time_operations sim_time_ops = {
.
get_utc_time
=
sim_time_get_utc_time
,
.
get_utc_offset
=
sim_time_get_utc_offset
,
.
set_utc_offset
=
sim_time_set_utc_offset
,
.
get_servo_state
=
sim_time_get_servo_state
,
//
.get_servo_state = sim_time_get_servo_state,
.
get
=
sim_time_get
,
.
set
=
sim_time_set
,
.
adjust
=
sim_time_adjust
,
...
...
time-unix/unix-socket.c
View file @
1e86e653
...
...
@@ -417,7 +417,7 @@ static int unix_open_ch_udp(struct pp_instance *ppi, char *ifname, int chtype)
goto
err_out
;
/* Init General multicast IP address */
memcpy
(
addr_str
,
PP_DEFAULT_DOMAIN_ADDRESS
,
INET_ADDRSTRLEN
);
strcpy
(
addr_str
,
PP_DEFAULT_DOMAIN_ADDRESS
);
context
=
addr_str
;
errno
=
EINVAL
;
if
(
!
inet_aton
(
addr_str
,
&
net_addr
))
...
...
@@ -440,7 +440,7 @@ static int unix_open_ch_udp(struct pp_instance *ppi, char *ifname, int chtype)
goto
err_out
;
/* Init Peer multicast IP address */
memcpy
(
addr_str
,
PP_PDELAY_DOMAIN_ADDRESS
,
INET_ADDRSTRLEN
);
strcpy
(
addr_str
,
PP_PDELAY_DOMAIN_ADDRESS
);
context
=
addr_str
;
errno
=
EINVAL
;
...
...
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