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
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Mock Turtle
Commits
8a15f83f
Commit
8a15f83f
authored
May 03, 2018
by
Federico Vaga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sw:fw: add poll with timeout
Signed-off-by:
Federico Vaga
<
federico.vaga@cern.ch
>
parent
9890d36d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
0 deletions
+49
-0
mockturtle-rt.h
software/firmware/lib/mockturtle-rt.h
+49
-0
No files found.
software/firmware/lib/mockturtle-rt.h
View file @
8a15f83f
...
...
@@ -543,6 +543,55 @@ static inline uint32_t mq_poll_out(enum trtl_mq_type type, uint32_t mask)
return
poll
;
}
/**
* It gets the current MQ input status
* @param[in] type MQ type to use
* @param[in] mask bitmask to set the bit of interest
* @param[in] us_timeout timeout in micro-seconds
* @return message queues input status bitmask, 0 on timeout
*/
static
inline
uint32_t
mq_poll_in_wait
(
enum
trtl_mq_type
type
,
uint32_t
mask
,
unsigned
int
us_timeout
)
{
const
struct
trtl_config_rom
*
cfg
=
trtl_config_rom_get
();
uint32_t
p
;
us_timeout
*=
cfg
->
clock_freq
/
1000000
;
lr_writel
(
us_timeout
,
MT_CPU_LR_REG_DELAY_CNT
);
do
{
p
=
mq_poll_in
(
type
,
mask
);
}
while
(
!
p
&&
(
us_timeout
==
0
||
lr_readl
(
MT_CPU_LR_REG_DELAY_CNT
)));
return
p
;
}
/**
* It gets the current MQ input status
* @param[in] type MQ type to use
* @param[in] mask bitmask to set the bit of interest
* @param[in] us_timeout timeout in micro-seconds
* @return message queues input status bitmask, 0 on timeout
*/
static
inline
uint32_t
mq_poll_out_wait
(
enum
trtl_mq_type
type
,
uint32_t
mask
,
unsigned
int
us_timeout
)
{
const
struct
trtl_config_rom
*
cfg
=
trtl_config_rom_get
();
uint32_t
p
;
us_timeout
*=
cfg
->
clock_freq
/
1000000
;
lr_writel
(
us_timeout
,
MT_CPU_LR_REG_DELAY_CNT
);
do
{
p
=
mq_poll_out
(
type
,
mask
);
}
while
(
!
p
&&
(
us_timeout
==
0
||
lr_readl
(
MT_CPU_LR_REG_DELAY_CNT
)));
return
p
;
}
/**
* Shared Memory Size
*/
...
...
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