Commit 9890d36d authored by Federico Vaga's avatar Federico Vaga

sw:fw: include the polling mask in the API

This is super-common operation so let's do it in the library
Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent 1d099591
......@@ -349,7 +349,7 @@ int trtl_fw_mq_action_dispatch(enum trtl_mq_type type, unsigned int idx_mq)
return -EPERM; /* not supported yet */
/* Check if we have a pending message */
if (!(mq_poll_in(type) & (1 << idx_mq)))
if (!(mq_poll_in(type, 1 << idx_mq)))
return -EAGAIN;
/* Map the message */
......
......@@ -510,28 +510,37 @@ static inline void mq_map_in_message(enum trtl_mq_type type,
/**
* It gets the current MQ input status
* @param[in] type MQ type to use
* @param[in] mask bitmask to set the bit of interest
* @return message queues input status bitmask
*/
static inline uint32_t mq_poll_in(enum trtl_mq_type type)
static inline uint32_t mq_poll_in(enum trtl_mq_type type, uint32_t mask)
{
uint32_t poll = lr_readl(MT_CPU_LR_REG_HMQ_STAT + (type * 4));
/* HMQ and RMQ have the same format -> use the same mask */
return ((poll & MT_CPU_LR_HMQ_STAT_IN_MASK) >> MT_CPU_LR_HMQ_STAT_IN_SHIFT);
poll &= poll & MT_CPU_LR_HMQ_STAT_IN_MASK;
poll >>= MT_CPU_LR_HMQ_STAT_IN_SHIFT;
poll &= mask;
return poll;
}
/**
* It gets the current MQ output status
* @param[in] type MQ type to use
* @param[in] mask bitmask to set the bit of interest
* @return message queues output status bitmask
*/
static inline uint32_t mq_poll_out(enum trtl_mq_type type)
static inline uint32_t mq_poll_out(enum trtl_mq_type type, uint32_t mask)
{
uint32_t poll = lr_readl(MT_CPU_LR_REG_HMQ_STAT + (type * 4));
/* HMQ and RMQ have the same format -> use the same mask */
return ((poll & MT_CPU_LR_HMQ_STAT_OUT_MASK) >> MT_CPU_LR_HMQ_STAT_OUT_SHIFT);
poll &= poll & MT_CPU_LR_HMQ_STAT_OUT_MASK;
poll >>= MT_CPU_LR_HMQ_STAT_OUT_SHIFT;
poll &= mask;
return poll;
}
/**
......
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