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
47
Issues
47
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
bd326eef
Commit
bd326eef
authored
Dec 04, 2013
by
Pietro Fezzardi
Committed by
Alessandro Rubini
Mar 21, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
arch-sim: sim-startup.c init refactorization
parent
b07673a4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
sim-startup.c
arch-sim/sim-startup.c
+7
-9
No files found.
arch-sim/sim-startup.c
View file @
bd326eef
...
@@ -86,7 +86,6 @@ static int sim_ppi_init(struct pp_instance *ppi, int which_ppi)
...
@@ -86,7 +86,6 @@ static int sim_ppi_init(struct pp_instance *ppi, int which_ppi)
int
main
(
int
argc
,
char
**
argv
)
int
main
(
int
argc
,
char
**
argv
)
{
{
struct
pp_globals
*
ppg
;
struct
pp_globals
*
ppg
;
struct
pp_instance
*
ppi_master
,
*
ppi_slave
;
struct
pp_instance
*
ppi
;
struct
pp_instance
*
ppi
;
int
i
;
int
i
;
...
@@ -108,8 +107,6 @@ int main(int argc, char **argv)
...
@@ -108,8 +107,6 @@ int main(int argc, char **argv)
if
(
sim_ppi_init
(
ppi
,
i
))
if
(
sim_ppi_init
(
ppi
,
i
))
return
-
1
;
return
-
1
;
}
}
ppi_slave
=
&
ppg
->
pp_instances
[
SIM_SLAVE
];
ppi_master
=
&
ppg
->
pp_instances
[
SIM_MASTER
];
/*
/*
* Configure the master with standard configuration, only from default
* Configure the master with standard configuration, only from default
...
@@ -121,13 +118,13 @@ int main(int argc, char **argv)
...
@@ -121,13 +118,13 @@ int main(int argc, char **argv)
* master config later because the initial time for the master is needed
* master config later because the initial time for the master is needed
* to set the initial offset for the slave
* to set the initial offset for the slave
*/
*/
sim_set_global_DS
(
ppi_master
);
sim_set_global_DS
(
&
ppg
->
pp_instances
[
SIM_MASTER
]
);
pp_config_string
(
ppg
,
strdup
(
"port SIM_MASTER; iface MASTER;"
pp_config_string
(
ppg
,
strdup
(
"port SIM_MASTER; iface MASTER;"
"proto udp; role master;"
"proto udp; role master;"
"sim_init_master_time 10.0;"
));
"sim_init_master_time 10.0;"
));
/* parse commandline for configuration options */
/* parse commandline for configuration options */
sim_set_global_DS
(
ppi_slave
);
sim_set_global_DS
(
&
ppg
->
pp_instances
[
SIM_SLAVE
]
);
if
(
pp_parse_cmdline
(
ppg
,
argc
,
argv
)
!=
0
)
if
(
pp_parse_cmdline
(
ppg
,
argc
,
argv
)
!=
0
)
return
-
1
;
return
-
1
;
/* If no item has been parsed, provide default file or string */
/* If no item has been parsed, provide default file or string */
...
@@ -139,6 +136,7 @@ int main(int argc, char **argv)
...
@@ -139,6 +136,7 @@ int main(int argc, char **argv)
for
(
i
=
0
;
i
<
ppg
->
nlinks
;
i
++
)
{
for
(
i
=
0
;
i
<
ppg
->
nlinks
;
i
++
)
{
ppi
=
&
ppg
->
pp_instances
[
i
];
ppi
=
&
ppg
->
pp_instances
[
i
];
sim_set_global_DS
(
ppi
);
ppi
->
iface_name
=
ppi
->
cfg
.
iface_name
;
ppi
->
iface_name
=
ppi
->
cfg
.
iface_name
;
if
(
ppi
->
cfg
.
proto
==
PPSI_PROTO_RAW
)
if
(
ppi
->
cfg
.
proto
==
PPSI_PROTO_RAW
)
pp_printf
(
"Warning: simulator doesn't support raw "
pp_printf
(
"Warning: simulator doesn't support raw "
...
@@ -155,11 +153,11 @@ int main(int argc, char **argv)
...
@@ -155,11 +153,11 @@ int main(int argc, char **argv)
}
}
ppi
->
t_ops
=
&
DEFAULT_TIME_OPS
;
ppi
->
t_ops
=
&
DEFAULT_TIME_OPS
;
ppi
->
n_ops
=
&
DEFAULT_NET_OPS
;
ppi
->
n_ops
=
&
DEFAULT_NET_OPS
;
if
(
ppi
-
ppi
->
glbs
->
pp_instances
==
SIM_MASTER
)
pp_init_globals
(
ppg
,
&
sim_master_rt_opts
);
else
pp_init_globals
(
ppg
,
&
__pp_default_rt_opts
);
}
}
sim_set_global_DS
(
ppi_master
);
pp_init_globals
(
ppg
,
&
sim_master_rt_opts
);
sim_set_global_DS
(
ppi_slave
);
pp_init_globals
(
ppg
,
&
__pp_default_rt_opts
);
sim_main_loop
(
ppg
);
sim_main_loop
(
ppg
);
return
0
;
return
0
;
...
...
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