Commit 2d145ffe authored by Federico Vaga's avatar Federico Vaga

sw:rt: group together low-level API functions

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent b4eabe73
......@@ -56,97 +56,102 @@ static inline void mq_writel(enum trtl_mq_type type, uint32_t val, uint32_t reg)
/**
* @copydoc TRTL_MQ_CMD_CLAIM
* It gets the output slot data field pointer
* @param[in] type MQ type to use
* @param[in] slot slot number
* @return pointer to the input buffer
*/
static inline void mq_claim(enum trtl_mq_type type, int slot)
static inline void *mq_map_out_buffer(enum trtl_mq_type type, int slot)
{
mq_writel(type, TRTL_MQ_CMD_CLAIM, TRTL_MQ_SLOT_OUT(slot) + TRTL_MQ_SLOT_COMMAND);
return (void *) (trtl_mq_base_address(type) +
TRTL_MQ_SLOT_OUT (slot) + TRTL_MQ_SLOT_DATA_START);
}
/**
* @copydoc TRTL_MQ_CMD_PURGE
* It gets the input slot data field pointer
* @param[in] type MQ type to use
* @param[in] slot slot number
* @return pointer to the input buffer
*/
static inline void mq_purge(enum trtl_mq_type type, int slot)
static inline void *mq_map_in_buffer(enum trtl_mq_type type, int slot)
{
mq_writel(type, TRTL_MQ_CMD_PURGE, TRTL_MQ_SLOT_OUT(slot) + TRTL_MQ_SLOT_COMMAND);
mq_writel(type, TRTL_MQ_CMD_PURGE, TRTL_MQ_SLOT_IN(slot) + TRTL_MQ_SLOT_COMMAND);
return (void *) (trtl_mq_base_address(type) +
TRTL_MQ_SLOT_IN (slot) + TRTL_MQ_SLOT_DATA_START);
}
/**
* @copydoc TRTL_MQ_CMD_READY
* It gets the output slot header field pointer
* @param[in] type MQ type to use
* @param[in] slot slot number
* @return pointer to the output header
*/
static inline void mq_send(enum trtl_mq_type type, int slot)
static inline void *mq_map_out_header(enum trtl_mq_type type, int slot)
{
mq_writel(type, TRTL_MQ_CMD_READY, TRTL_MQ_SLOT_OUT(slot) + TRTL_MQ_SLOT_COMMAND);
return (void *) (trtl_mq_base_address(type) +
TRTL_MQ_SLOT_OUT (slot) + TRTL_MQ_SLOT_HEADER_START);
}
/**
* @copydoc TRTL_MQ_CMD_DISCARD
* It gets the input slot header field pointer
* @param[in] type MQ type to use
* @param[in] slot slot number
* @return pointer to the input header
*/
static inline void mq_discard(enum trtl_mq_type type, int slot)
static inline void *mq_map_in_header(enum trtl_mq_type type, int slot)
{
mq_writel(type, TRTL_MQ_CMD_DISCARD, TRTL_MQ_SLOT_IN(slot));
return (void *) (trtl_mq_base_address(type) +
TRTL_MQ_SLOT_IN (slot) + TRTL_MQ_SLOT_HEADER_START);
}
/**
* It gets the output slot data field pointer
* @copydoc TRTL_MQ_CMD_CLAIM
* @param[in] type MQ type to use
* @param[in] slot slot number
*/
static inline void *mq_map_out_buffer(enum trtl_mq_type type, int slot)
static inline void mq_claim(enum trtl_mq_type type, int slot)
{
return (void *) (trtl_mq_base_address(type) +
TRTL_MQ_SLOT_OUT (slot) + TRTL_MQ_SLOT_DATA_START);
mq_writel(type, TRTL_MQ_CMD_CLAIM, TRTL_MQ_SLOT_OUT(slot) + TRTL_MQ_SLOT_COMMAND);
}
/**
* It gets the input slot data field pointer
* @copydoc TRTL_MQ_CMD_PURGE
* @param[in] type MQ type to use
* @param[in] slot slot number
*/
static inline void *mq_map_in_buffer(enum trtl_mq_type type, int slot)
static inline void mq_purge(enum trtl_mq_type type, int slot)
{
return (void *) (trtl_mq_base_address(type) +
TRTL_MQ_SLOT_IN (slot) + TRTL_MQ_SLOT_DATA_START);
mq_writel(type, TRTL_MQ_CMD_PURGE, TRTL_MQ_SLOT_OUT(slot) + TRTL_MQ_SLOT_COMMAND);
mq_writel(type, TRTL_MQ_CMD_PURGE, TRTL_MQ_SLOT_IN(slot) + TRTL_MQ_SLOT_COMMAND);
}
/**
* It gets the output slot header field pointer
* @copydoc TRTL_MQ_CMD_READY
* @param[in] type MQ type to use
* @param[in] slot slot number
*/
static inline void *mq_map_out_header(enum trtl_mq_type type, int slot)
static inline void mq_send(enum trtl_mq_type type, int slot)
{
return (void *) (trtl_mq_base_address(type) +
TRTL_MQ_SLOT_OUT (slot) + TRTL_MQ_SLOT_HEADER_START);
mq_writel(type, TRTL_MQ_CMD_READY, TRTL_MQ_SLOT_OUT(slot) + TRTL_MQ_SLOT_COMMAND);
}
/**
* It gets the input slot header field pointer
* @copydoc TRTL_MQ_CMD_DISCARD
* @param[in] type MQ type to use
* @param[in] slot slot number
*/
static inline void *mq_map_in_header(enum trtl_mq_type type, int slot)
static inline void mq_discard(enum trtl_mq_type type, int slot)
{
return (void *) (trtl_mq_base_address(type) +
TRTL_MQ_SLOT_IN (slot) + TRTL_MQ_SLOT_HEADER_START);
mq_writel(type, TRTL_MQ_CMD_DISCARD, TRTL_MQ_SLOT_IN(slot));
}
/**
* It maps a given MQ for outcoming messages
* @param[in] type MQ type to use
......@@ -161,6 +166,7 @@ static inline void mq_map_out_message(enum trtl_mq_type type,
msg->payload = mq_map_out_buffer(type, idx_mq);
}
/**
* It maps a given MQ for incoming messages
* @param[in] type MQ type to use
......@@ -175,7 +181,6 @@ static inline void mq_map_in_message(enum trtl_mq_type type,
msg->payload = mq_map_in_buffer(type, idx_mq);
}
/**
* It gets the current MQ input status
* @return message queues input status bitmask
......
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