Commit 32333315 authored by Tristan Gingold's avatar Tristan Gingold Committed by Dimitris Lampridis

sw/fw: constify

parent 13dd5dcc
...@@ -73,13 +73,13 @@ void pr_message(struct trtl_fw_msg *msg) ...@@ -73,13 +73,13 @@ void pr_message(struct trtl_fw_msg *msg)
} }
static inline uint32_t ep_eth_build_mac_hi(struct trtl_ep_eth_address* addr) static inline uint32_t ep_eth_build_mac_hi(const struct trtl_ep_eth_address* addr)
{ {
return ((uint32_t)addr->dst_mac[0] << 8 ) | return ((uint32_t)addr->dst_mac[0] << 8 ) |
((uint32_t)addr->dst_mac[1] << 0); ((uint32_t)addr->dst_mac[1] << 0);
} }
static inline uint32_t ep_eth_build_mac_lo(struct trtl_ep_eth_address* addr) static inline uint32_t ep_eth_build_mac_lo(const struct trtl_ep_eth_address* addr)
{ {
return ((uint32_t)addr->dst_mac[2] << 24) | return ((uint32_t)addr->dst_mac[2] << 24) |
((uint32_t)addr->dst_mac[3] << 16) | ((uint32_t)addr->dst_mac[3] << 16) |
...@@ -99,9 +99,9 @@ static inline void rmq_ep_in_writel(int slot, uint32_t data, uint32_t addr) ...@@ -99,9 +99,9 @@ static inline void rmq_ep_in_writel(int slot, uint32_t data, uint32_t addr)
mq_writel(TRTL_RMQ, data, addr); mq_writel(TRTL_RMQ, data, addr);
} }
static int rmq_ep_eth_bind_in(unsigned int slot, void *arg) static int rmq_ep_eth_bind_in(unsigned int slot, const void *arg)
{ {
struct trtl_ep_eth_address *addr = arg; const struct trtl_ep_eth_address *addr = arg;
uint32_t cfg = 0, tmp; uint32_t cfg = 0, tmp;
switch(addr->type) switch(addr->type)
...@@ -128,9 +128,9 @@ static int rmq_ep_eth_bind_in(unsigned int slot, void *arg) ...@@ -128,9 +128,9 @@ static int rmq_ep_eth_bind_in(unsigned int slot, void *arg)
return 0; return 0;
} }
static int rmq_ep_eth_bind_out(unsigned int slot, void *arg) static int rmq_ep_eth_bind_out(unsigned int slot, const void *arg)
{ {
struct trtl_ep_eth_address *addr = arg; const struct trtl_ep_eth_address *addr = arg;
uint32_t tmp; uint32_t tmp;
tmp = addr->type == TRTL_EP_FRAME_UDP ? 1 : 0; tmp = addr->type == TRTL_EP_FRAME_UDP ? 1 : 0;
...@@ -150,7 +150,7 @@ static int rmq_ep_eth_bind_out(unsigned int slot, void *arg) ...@@ -150,7 +150,7 @@ static int rmq_ep_eth_bind_out(unsigned int slot, void *arg)
} }
typedef int (trtl_fw_rmq_bind_t) (unsigned int slot, void *arg); typedef int (trtl_fw_rmq_bind_t) (unsigned int slot, const void *arg);
/* /*
* It's true that this is slower to execute, but on the other hand * It's true that this is slower to execute, but on the other hand
...@@ -161,7 +161,7 @@ typedef int (trtl_fw_rmq_bind_t) (unsigned int slot, void *arg); ...@@ -161,7 +161,7 @@ typedef int (trtl_fw_rmq_bind_t) (unsigned int slot, void *arg);
*/ */
#define __TRTL_EP_IN 0 #define __TRTL_EP_IN 0
#define __TRTL_EP_OUT 1 #define __TRTL_EP_OUT 1
static trtl_fw_rmq_bind_t *rmq_ep_bind[__TRTL_EP_MAX][2] = { static trtl_fw_rmq_bind_t * const rmq_ep_bind[__TRTL_EP_MAX][2] = {
[TRTL_EP_ETH] = { [TRTL_EP_ETH] = {
[__TRTL_EP_IN] = rmq_ep_eth_bind_in, [__TRTL_EP_IN] = rmq_ep_eth_bind_in,
[__TRTL_EP_OUT] = rmq_ep_eth_bind_out, [__TRTL_EP_OUT] = rmq_ep_eth_bind_out,
...@@ -169,7 +169,7 @@ static trtl_fw_rmq_bind_t *rmq_ep_bind[__TRTL_EP_MAX][2] = { ...@@ -169,7 +169,7 @@ static trtl_fw_rmq_bind_t *rmq_ep_bind[__TRTL_EP_MAX][2] = {
}; };
int rmq_bind_in(unsigned int slot, enum trtl_ep_type type, void *addr) int rmq_bind_in(unsigned int slot, enum trtl_ep_type type, const void *addr)
{ {
if (type >= __TRTL_EP_MAX) if (type >= __TRTL_EP_MAX)
return -EINVAL; return -EINVAL;
...@@ -177,7 +177,7 @@ int rmq_bind_in(unsigned int slot, enum trtl_ep_type type, void *addr) ...@@ -177,7 +177,7 @@ int rmq_bind_in(unsigned int slot, enum trtl_ep_type type, void *addr)
return rmq_ep_bind[type][__TRTL_EP_IN](slot, addr); return rmq_ep_bind[type][__TRTL_EP_IN](slot, addr);
} }
int rmq_bind_out(unsigned int slot, enum trtl_ep_type type, void *addr) int rmq_bind_out(unsigned int slot, enum trtl_ep_type type, const void *addr)
{ {
if (type >= __TRTL_EP_MAX) if (type >= __TRTL_EP_MAX)
return -EINVAL; return -EINVAL;
......
...@@ -495,7 +495,7 @@ static inline void mq_send(enum trtl_mq_type type, int slot) ...@@ -495,7 +495,7 @@ static inline void mq_send(enum trtl_mq_type type, int slot)
* @param[in] type EP type to use * @param[in] type EP type to use
* @param[in] addr bind address * @param[in] addr bind address
*/ */
extern int rmq_bind_in(unsigned int slot, enum trtl_ep_type type, void *addr); extern int rmq_bind_in(unsigned int slot, enum trtl_ep_type type, const void *addr);
/** /**
* Binds an RMQ slot (output) to a particular IP configuration. Used when * Binds an RMQ slot (output) to a particular IP configuration. Used when
...@@ -504,7 +504,7 @@ extern int rmq_bind_in(unsigned int slot, enum trtl_ep_type type, void *addr); ...@@ -504,7 +504,7 @@ extern int rmq_bind_in(unsigned int slot, enum trtl_ep_type type, void *addr);
* @param[in] type EP type to use * @param[in] type EP type to use
* @param[in] addr bind address * @param[in] addr bind address
*/ */
extern int rmq_bind_out(unsigned int slot, enum trtl_ep_type type, void *addr); extern int rmq_bind_out(unsigned int slot, enum trtl_ep_type type, const void *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