Commit 27e6198c authored by Federico Vaga's avatar Federico Vaga

sw:fw:ep style improvement

Signed-off-by: Federico Vaga's avatarFederico Vaga <federico.vaga@cern.ch>
parent c6aa871a
......@@ -72,17 +72,17 @@ void pr_message(struct trtl_fw_msg *msg)
pp_printf("%s: data[%d] = 0x%"PRIx32"\n\r", __func__, i , d[i]);
}
static inline void rmq_ep_out_writel( int slot, uint32_t data, uint32_t addr )
static inline void rmq_ep_out_writel(int slot, uint32_t data, uint32_t addr)
{
mq_writel( TRTL_RMQ, data, addr + TRTL_MQ_SLOT_ENDPOINT_CONFIG_START + TRTL_MQ_SLOT_OUT (slot) );
}
static inline void rmq_ep_in_writel( int slot, uint32_t data, uint32_t addr )
static inline void rmq_ep_in_writel(int slot, uint32_t data, uint32_t addr)
{
mq_writel( TRTL_RMQ, data, addr + TRTL_MQ_SLOT_ENDPOINT_CONFIG_START + TRTL_MQ_SLOT_IN (slot) );
}
static void rmq_ep_bind_in ( int slot, struct trtl_ep_address* addr )
static void rmq_ep_bind_in(int slot, struct trtl_ep_eth_address* addr)
{
uint32_t cfg = 0;
......@@ -136,8 +136,6 @@ static void rmq_ep_bind_out ( int slot, struct trtl_ep_address* addr )
rmq_ep_out_writel( slot, addr->dst_ip, TRTL_EP_OUT_DST_IP );
rmq_ep_out_writel( slot, addr->src_port, TRTL_EP_OUT_SRC_PORT );
rmq_ep_out_writel( slot, addr->dst_port, TRTL_EP_OUT_DST_PORT );
}
void mq_bind(enum trtl_mq_type type, int slot, int is_out, struct trtl_ep_address* addr)
......
......@@ -11,6 +11,7 @@
#ifndef __MOCKTURTLE_RT_H
#define __MOCKTURTLE_RT_H
#include <errno.h>
#include <stdint.h>
#include <stdarg.h>
#include <generated/autoconf.h>
......@@ -450,17 +451,18 @@ static inline void *mq_map_in_header(enum trtl_mq_type type, int slot)
* @copydoc TRTL_MQ_CMD_CLAIM
* @param[in] type MQ type to use
* @param[in] slot slot number
* @return 1 on success, 0 if queue busy/full
* @return 0 on success, -EBUSY if queue busy/full
*/
static inline int mq_claim(enum trtl_mq_type type, int slot)
{
uint32_t status = mq_readl(type, TRTL_MQ_SLOT_OUT(slot) + TRTL_MQ_SLOT_STATUS);
if( status & TRTL_MQ_SLOT_STATUS_FULL )
return 0;
return -EBUSY;
mq_writel(type, TRTL_MQ_CMD_CLAIM, TRTL_MQ_SLOT_OUT(slot) + TRTL_MQ_SLOT_COMMAND);
return 1;
mq_writel(type, TRTL_MQ_CMD_CLAIM,
TRTL_MQ_SLOT_OUT(slot) + TRTL_MQ_SLOT_COMMAND);
return 0;
}
/**
......@@ -487,13 +489,15 @@ static inline void mq_send(enum trtl_mq_type type, int slot)
}
/**
* Binds an RMQ slot to a particular IP configuration. Used when the Ethernet/UDP endpoint is enabled.
* Binds an RMQ slot to a particular IP configuration. Used when the Ethernet/UDP
* endpoint is enabled.
* @param[in] type MQ type to use
* @param[in] slot slot number
* @param[in] is_out non-zero if we're configuring an output slot
* @param[in] addr bind address
*/
void mq_bind(enum trtl_mq_type type, int slot, int is_out, struct trtl_ep_address* addr);
void mq_bind(enum trtl_mq_type type, int slot, int is_out,
struct trtl_ep_address* addr);
/**
......
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