Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
DIOT Igloo2-based radiation-tolerant System Board
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
7
Issues
7
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Projects
DIOT Igloo2-based radiation-tolerant System Board
Commits
1b2ac7f7
Commit
1b2ac7f7
authored
Sep 27, 2022
by
Tristan Gingold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfip_urv: use command index, add traces and comments
parent
f34fa95c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
42 deletions
+56
-42
mfip_urv.c
sw/mfip_urv/mfip_urv.c
+56
-42
No files found.
sw/mfip_urv/mfip_urv.c
View file @
1b2ac7f7
...
...
@@ -102,6 +102,7 @@ struct ftb_dev {
unsigned
nbr_cmds
;
unsigned
idx_cmd
;
unsigned
waitrep
;
unsigned
char
idx
;
}
*
ftb
;
static
uint8_t
crc8_byte
(
uint8_t
data
)
...
...
@@ -202,6 +203,8 @@ static int read_cons_vars(void)
if
(
ftb
->
waitrep
==
0
)
;
else
if
(
ftb
->
waitrep
==
5
)
{
if
(
flag_trace
)
fprintf
(
stderr
,
"Timeout
\n
"
);
fprintf
(
out
,
"# Timeout
\n
"
);
fflush
(
stdout
);
ftb
->
waitrep
=
0
;
...
...
@@ -210,8 +213,14 @@ static int read_cons_vars(void)
else
ftb
->
waitrep
++
;
}
else
/* if (pvar->buffer[1] != 0) */
else
{
/* if (pvar->buffer[1] != 0) */
if
(
flag_trace
)
fprintf
(
stderr
,
"Unexpected sequence cmd/id recv:%u/%u, expect:%u/%u
\n
"
,
pvar
->
buffer
[
0
],
pvar
->
buffer
[
1
],
cmd
->
cmd
,
cmd
->
id
);
fprintf
(
out
,
"Unexpected packet
\n
"
);
}
}
return
0
;
...
...
@@ -284,7 +293,7 @@ static int update_prod_vars(void)
/* Send next command. */
struct
urv_cmd
*
cmd
=
&
ftb
->
cmds
[
ftb
->
idx_cmd
];
cmd
->
id
=
ftb
->
idx
_cmd
+
0x20
;
cmd
->
id
=
ftb
->
idx
++
;
pvar
->
bsz
=
PROD_VAR_LENGTH
;
pvar
->
buffer
[
0
]
=
cmd
->
cmd
;
...
...
@@ -380,7 +389,10 @@ static int ftb_create_per_var(struct ftb_ba *ba)
var_cfg
.
max_bsz
=
PROD_VAR_LENGTH
;
var_cfg
.
id
=
(
VAR1_ID
<<
8
)
|
agent_idx
;
var_cfg
.
flags
=
MSTRFIP_DATA_FLAGS_PROD
;
var_cfg
.
mstrfip_data_handler
=
mstrfip_prod_var_handler
;
if
(
flag_trace
>
1
)
var_cfg
.
mstrfip_data_handler
=
mstrfip_prod_var_handler
;
else
var_cfg
.
mstrfip_data_handler
=
NULL
;
pvar
=
mstrfip_var_create
(
ba
->
mc
,
&
var_cfg
);
if
(
pvar
==
NULL
)
return
-
1
;
...
...
@@ -420,41 +432,6 @@ static int ftb_create_per_var(struct ftb_ba *ba)
return
0
;
}
static
int
ftb_ba_start
(
struct
ftb_dev
*
ftb
)
{
int
res
;
int
agt_addr
;
if
(
mstrfip_ba_reset
(
ftb
->
dev
)
<
0
)
{
fprintf
(
stderr
,
"Reset BA failed: %s
\n
"
,
mstrfip_strerror
(
errno
));
return
-
1
;
}
if
(
mstrfip_ba_load
(
ftb
->
dev
,
ftb
->
ba
.
mc
)
<
0
)
{
fprintf
(
stderr
,
"Loading macrocycle failed: %s
\n
"
,
mstrfip_strerror
(
errno
));
return
-
1
;
}
/* get turn around time of each agents */
agt_addr
=
agent_idx
;
res
=
mstrfip_hw_response_time_get
(
ftb
->
dev
,
1
,
&
agt_addr
,
&
ftb
->
tr_nstime
);
if
(
res
)
{
fprintf
(
stderr
,
"Read turn around time failed: %s
\n
"
,
mstrfip_strerror
(
errno
));
}
if
(
mstrfip_ba_start
(
ftb
->
dev
)
<
0
)
{
fprintf
(
stderr
,
"Start BA failed: %s
\n
"
,
mstrfip_strerror
(
errno
));
return
-
1
;
}
return
0
;
}
static
int
ftb_define_macrocycle
(
struct
ftb_ba
*
ba
)
{
struct
mstrfip_per_var_wind_cfg
pwind_cfg
=
{
0
};
...
...
@@ -465,17 +442,18 @@ static int ftb_define_macrocycle(struct ftb_ba *ba)
if
(
mstrfip_per_var_wind_append
(
ba
->
mc
,
&
pwind_cfg
)
<
0
)
return
-
1
;
/* append a wait window without padding (silent) */
/* append a wait window without padding (silent)
(absolute time).
*/
if
(
mstrfip_wait_wind_append
(
ba
->
mc
,
1
,
ftb
->
cycle_uslength
/
2
)
<
0
)
return
-
1
;
/* append a periodic window for consumed var
a
iables */
/* append a periodic window for consumed variables */
pwind_cfg
.
varlist
=
ba
->
cons_varlist
;
pwind_cfg
.
var_count
=
1
;
if
(
mstrfip_per_var_wind_append
(
ba
->
mc
,
&
pwind_cfg
)
<
0
)
return
-
1
;
/* append a wait window without padding (silent) */
/* append a wait window without padding (silent).
As the time is absolute, this defines the cycle length. */
if
(
mstrfip_wait_wind_append
(
ba
->
mc
,
1
,
ftb
->
cycle_uslength
)
<
0
)
return
-
1
;
...
...
@@ -521,6 +499,41 @@ static int cycle_config(struct mstrfip_hw_cfg *hw_cfg, struct mstrfip_sw_cfg *sw
return
0
;
}
static
int
ftb_ba_start
(
struct
ftb_dev
*
ftb
)
{
int
res
;
int
agt_addr
;
if
(
mstrfip_ba_reset
(
ftb
->
dev
)
<
0
)
{
fprintf
(
stderr
,
"Reset BA failed: %s
\n
"
,
mstrfip_strerror
(
errno
));
return
-
1
;
}
if
(
mstrfip_ba_load
(
ftb
->
dev
,
ftb
->
ba
.
mc
)
<
0
)
{
fprintf
(
stderr
,
"Loading macrocycle failed: %s
\n
"
,
mstrfip_strerror
(
errno
));
return
-
1
;
}
/* get turn around time of each agents */
agt_addr
=
agent_idx
;
res
=
mstrfip_hw_response_time_get
(
ftb
->
dev
,
1
,
&
agt_addr
,
&
ftb
->
tr_nstime
);
if
(
res
)
{
fprintf
(
stderr
,
"Read turn around time failed: %s
\n
"
,
mstrfip_strerror
(
errno
));
}
if
(
mstrfip_ba_start
(
ftb
->
dev
)
<
0
)
{
fprintf
(
stderr
,
"Start BA failed: %s
\n
"
,
mstrfip_strerror
(
errno
));
return
-
1
;
}
return
0
;
}
static
int
append_command
(
struct
ftb_dev
*
dev
,
const
struct
urv_cmd
*
cmd
)
{
if
(
dev
->
nbr_cmds
>=
MAX_CMDS
)
...
...
@@ -3901,10 +3914,11 @@ int main(int argc, char *argv[])
ftb
->
reset
=
1
;
ftb
->
nbr_errors
=
0
;
ftb
->
cycle_uslength
=
1
000
;
/* For 124B: 5000, for 16B: 1000 */
ftb
->
cycle_uslength
=
2
000
;
/* For 124B: 5000, for 16B: 1000 */
ftb
->
nbr_cmds
=
0
;
ftb
->
idx_cmd
=
0
;
ftb
->
waitrep
=
0
;
ftb
->
idx
=
0x22
;
/* Skip progname. */
argc
--
;
...
...
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