Commit 8a15f83f authored by Federico Vaga's avatar Federico Vaga

sw:fw: add poll with timeout

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 9890d36d
......@@ -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
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment