Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
mock-turtle
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
hdl-core-lib
mock-turtle
Commits
4024a23b
Commit
4024a23b
authored
May 03, 2018
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test:fw: fix according to the new poll API
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
8a15f83f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
40 deletions
+30
-40
byte-addressing.c
tests/firmware/cpu-byte-addressing/byte-addressing.c
+7
-11
hmq-async-send.c
tests/firmware/hmq-async-send/hmq-async-send.c
+7
-11
hmq-purge.c
tests/firmware/hmq-purge/hmq-purge.c
+5
-5
hmq-sync.c
tests/firmware/hmq-sync/hmq-sync.c
+7
-9
sim-verif.c
tests/firmware/sim-verif/sim-verif.c
+4
-4
No files found.
tests/firmware/cpu-byte-addressing/byte-addressing.c
View file @
4024a23b
...
...
@@ -94,8 +94,8 @@ static int byte_addressing_test_mq(enum trtl_mq_type type,
unsigned
int
cpu
,
unsigned
int
hmq
)
{
const
struct
trtl_config_rom
*
cfg
=
trtl_config_rom_get
();
uint32_t
size
;
int
err
,
g_err
=
0
,
max_wait_cycle
,
wait
,
i
;
uint32_t
size
,
status
;
int
err
,
g_err
=
0
,
i
;
char
c
=
(
type
==
TRTL_HMQ
?
'H'
:
'R'
);
...
...
@@ -118,16 +118,12 @@ static int byte_addressing_test_mq(enum trtl_mq_type type,
goto
out
;
/* can't check input for RMQ */
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
func
);
++
i
)
{
wait
=
(
1
<<
hmq
);
max_wait_cycle
=
0xFFFFFF
;
while
((
mq_poll_in
(
type
)
&
wait
)
!=
wait
)
{
if
(
--
max_wait_cycle
==
0
)
{
pr_error
(
"
\t
NO MESSAGE PENDING %cMQ[%d
\r\n
"
,
c
,
hmq
);
return
-
1
;
}
status
=
mq_poll_in_wait
(
type
,
1
<<
hmq
,
1000
);
if
(
!
status
)
{
pr_error
(
"
\t
NO MESSAGE PENDING %cMQ%d
\r\n
"
,
c
,
hmq
);
return
-
1
;
}
break
;
/* FIXME do not test input - somehting wrong with the test */
err
=
func
[
i
](
mq_map_in_header
(
type
,
hmq
),
size
);
g_err
|=
err
;
...
...
tests/firmware/hmq-async-send/hmq-async-send.c
View file @
4024a23b
...
...
@@ -9,31 +9,27 @@ struct payload {
int
main
()
{
int
cpu
,
hmq
;
int
cpu
,
hmq
,
count
;
const
struct
trtl_config_rom
*
cfgrom
=
trtl_config_rom_get
();
int
wait
=
0
,
max_wait_cycle
,
count
;
struct
trtl_fw_msg
msg
;
struct
payload
*
p
;
uint32_t
status
;
pr_debug
(
"ASYNC MESSAGES SEND
\r\n
"
);
cpu
=
trtl_get_core_id
();
for
(
hmq
=
0
;
hmq
<
cfgrom
->
n_hmq
[
cpu
];
++
hmq
)
{
wait
=
(
1
<<
hmq
);
mq_map_in_message
(
TRTL_HMQ
,
hmq
,
&
msg
);
p
=
msg
.
payload
;
count
=
1
;
max_wait_cycle
=
0xFFFF
;
while
(
1
)
{
/* Wait incoming message */
while
((
mq_poll_in
(
TRTL_HMQ
)
&
wait
)
!=
wait
)
{
if
(
--
max_wait_cycle
==
0
)
{
pr_error
(
"
\t
NO MESSAGE PENDING h:%d, cnt:0x%x
\r\n
"
,
hmq
,
count
);
return
-
1
;
}
status
=
mq_poll_in_wait
(
TRTL_HMQ
,
1
<<
hmq
,
1000
);
if
(
!
status
)
{
pr_error
(
"
\t
NO MESSAGE PENDING h:%d, cnt:0x%x
\r\n
"
,
hmq
,
count
);
return
-
1
;
}
pr_debug
(
"
\t
h: %d, l:%d, {idx:0x%lx, max:0x%lx}, cnt:0x%x
\r\n
"
,
...
...
tests/firmware/hmq-purge/hmq-purge.c
View file @
4024a23b
...
...
@@ -12,8 +12,8 @@ int main()
mdelay
(
100
);
cpu
=
trtl_get_core_id
();
for
(
hmq
=
0
;
hmq
<
cfgrom
->
n_hmq
[
cpu
];
++
hmq
)
{
val
=
mq_poll_in
(
TRTL_HMQ
);
if
(
(
val
&
(
1
<<
hmq
))
!=
(
1
<<
hmq
)
)
{
val
=
mq_poll_in
(
TRTL_HMQ
,
1
<<
hmq
);
if
(
!
val
)
{
pr_error
(
"CPU-%d HMQ-%d after poll (1): 0x%"
PRIx32
"
\r\n
"
,
cpu
,
hmq
,
val
);
return
-
1
;
...
...
@@ -21,15 +21,15 @@ int main()
mq_purge
(
TRTL_HMQ
,
hmq
);
val
=
mq_poll_in
(
TRTL_HMQ
);
if
(
(
val
&
(
1
<<
hmq
))
==
(
1
<<
hmq
)
)
{
val
=
mq_poll_in
(
TRTL_HMQ
,
1
<<
hmq
);
if
(
val
)
{
pr_error
(
"CPU-%d HMQ-%d after poll (2): 0x%"
PRIx32
"
\r\n
"
,
cpu
,
hmq
,
val
);
return
-
1
;
}
}
val
=
mq_poll_in
(
TRTL_HMQ
);
val
=
mq_poll_in
(
TRTL_HMQ
,
~
0
);
if
(
val
!=
0
)
{
pr_error
(
"CPU-%d END poll: 0x%"
PRIx32
"
\r\n
"
,
cpu
,
val
);
...
...
tests/firmware/hmq-sync/hmq-sync.c
View file @
4024a23b
...
...
@@ -2,10 +2,11 @@
int
main
()
{
int
cpu
,
hmq
,
wait
=
0
,
max_wait_cycle
,
count
;
int
cpu
,
hmq
,
count
;
const
struct
trtl_config_rom
*
cfgrom
=
trtl_config_rom_get
();
volatile
uint32_t
*
msg_r
,
*
msg_s
;
volatile
struct
trtl_hmq_header
*
hdr_r
,
*
hdr_s
;
uint32_t
status
;
pr_debug
(
"SYNC MESSAGES
\r\n
"
);
cpu
=
trtl_get_core_id
();
...
...
@@ -13,22 +14,19 @@ int main()
mq_purge
(
TRTL_HMQ
,
hmq
);
for
(
hmq
=
0
;
hmq
<
cfgrom
->
n_hmq
[
cpu
];
++
hmq
)
{
wait
=
(
1
<<
hmq
);
hdr_r
=
mq_map_in_header
(
TRTL_HMQ
,
hmq
);
msg_r
=
mq_map_in_buffer
(
TRTL_HMQ
,
hmq
);
hdr_s
=
mq_map_out_header
(
TRTL_HMQ
,
hmq
);
msg_s
=
mq_map_out_buffer
(
TRTL_HMQ
,
hmq
);
count
=
1
;
max_wait_cycle
=
0xFFFFFFFF
;
while
(
1
)
{
/* Wait incoming message */
while
((
mq_poll_in
(
TRTL_HMQ
)
&
wait
)
!=
wait
)
{
if
(
--
max_wait_cycle
==
0
)
{
pr_error
(
"
\t
NO MESSAGE PENDING h:%d, cnt:0x%x
\r\n
"
,
hmq
,
count
);
return
-
1
;
}
status
=
mq_poll_in_wait
(
TRTL_HMQ
,
1
<<
hmq
,
1000
);
if
(
!
status
)
{
pr_error
(
"
\t
NO MESSAGE PENDING h:%d, cnt:0x%x
\r\n
"
,
hmq
,
count
);
return
-
1
;
}
/* validate message */
...
...
tests/firmware/sim-verif/sim-verif.c
View file @
4024a23b
...
...
@@ -65,7 +65,7 @@ test_hmq(void)
mq_send
(
TRTL_HMQ
,
0
);
// Wait for answer
while
(
(
mq_poll_in
(
TRTL_HMQ
)
&
1
)
==
0
)
while
(
mq_poll_in
(
TRTL_HMQ
,
1
)
==
0
)
;
if
(
counts
[
cpu
]
!=
v
+
1
)
failed
(
'H'
);
...
...
@@ -80,7 +80,7 @@ test_hmq(void)
failed
(
'K'
);
mq_discard
(
TRTL_HMQ
,
0
);
if
(
(
mq_poll_in
(
TRTL_HMQ
)
&
1
)
!=
0
)
if
(
mq_poll_in
(
TRTL_HMQ
,
1
)
!=
0
)
failed
(
'k'
);
}
...
...
@@ -103,7 +103,7 @@ test_rmq(void)
mq_send
(
TRTL_RMQ
,
0
);
// Wait for answer
while
(
(
mq_poll_in
(
TRTL_RMQ
)
&
1
)
==
0
)
while
(
mq_poll_in
(
TRTL_RMQ
,
1
)
==
0
)
;
// Read answer
...
...
@@ -116,7 +116,7 @@ test_rmq(void)
failed
(
'r'
);
mq_discard
(
TRTL_RMQ
,
0
);
if
(
(
mq_poll_in
(
TRTL_RMQ
)
&
1
)
!=
0
)
if
(
mq_poll_in
(
TRTL_RMQ
,
1
)
!=
0
)
failed
(
's'
);
}
...
...
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