Commit 8f9966a0 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/wrsw_rtud: move mac.[ch] to libwr

Remove local copy of mac_to_buffer from rtu_stat
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent b6a228b8
......@@ -2,7 +2,8 @@ OBJS = init.o fpga_io.o util.o pps_gen.o i2c.o shw_io.o i2c_bitbang.o \
i2c_fpga_reg.o pio.o libshw_i2c.o i2c_sfp.o fan.o i2c_io.o hwiu.o \
ptpd_netif.o hal_client.o \
shmem.o rt_client.o \
dot-config.o wrs-msg.o
dot-config.o wrs-msg.o \
mac.o
LIB = libwr.a
......
......@@ -63,6 +63,6 @@ static inline uint8_t *mac_clean(uint8_t mac[ETH_ALEN])
char *mac_to_string(uint8_t mac[ETH_ALEN]);
char *mac_to_buffer(uint8_t mac[ETH_ALEN], char buffer[ETH_ALEN_STR]);
int mac_from_str(uint8_t * tomac, const char *fromstr);
int mac_from_str(uint8_t *tomac, const char *fromstr);
#endif /* __WHITERABBIT_RTU_MAC_H */
......@@ -25,7 +25,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "mac.h"
#include <libwr/mac.h>
#include <stdio.h>
/**
......@@ -54,7 +54,7 @@ char *mac_to_buffer(uint8_t mac[ETH_ALEN], char buffer[ETH_ALEN_STR])
/**
* \brief Function to retrieve mac address from text input (argument in terminal)
*/
int mac_from_str(uint8_t * tomac, const char *fromstr)
int mac_from_str(uint8_t *tomac, const char *fromstr)
{
if (tomac == 0 || fromstr == 0)
return -1;
......
......@@ -30,10 +30,10 @@
#include <libwr/shmem.h>
#include <libwr/hal_shmem.h>
#include <libwr/rtu_shmem.h>
#include <libwr/mac.h>
#include <minipc.h>
#include <rtud_exports.h>
#include <mac.h>
#include <errno.h>
#define MINIPC_TIMEOUT 200
......@@ -69,17 +69,6 @@ int rtudexp_vlan_entry(int vid, int fid, const char *ch_mask, int drop, int prio
return (ret<0)?ret:val;
}
/**
* \brief Write mac address into a buffer to avoid concurrent access on static variable.
*/
//TODO: already defined in wrsw_rtud lib but we do not link to it. 3 opts: make it inline, move to libwr or link to the rtud lib?
char *mac_to_buffer(uint8_t mac[ETH_ALEN],char buffer[ETH_ALEN_STR])
{
if(mac && buffer)
snprintf(buffer, ETH_ALEN_STR, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0],mac[1],mac[2],mac[3],mac[4],mac[5]);
return buffer;
}
static int cmp_rtu_entries(const void *p1, const void *p2)
{
const struct rtu_filtering_entry *e1 = p1;
......
PROGRAM = wrsw_rtud
SRCFILES = mac.c rtu_drv.c rtu_ext_drv.c rtu_hash.c rtu_fd.c rtud.c \
SRCFILES = rtu_drv.c rtu_ext_drv.c rtu_hash.c rtu_fd.c rtud.c \
rtud_exports.c utils.c
OBJFILES = $(patsubst %.c,%.o,$(SRCFILES))
......
......@@ -29,7 +29,7 @@
#ifndef __WHITERABBIT_RTU_HASH_H
#define __WHITERABBIT_RTU_HASH_H
#include "mac.h"
#include <libwr/mac.h>
/*
Hash polynomials implemented by RTU
......
......@@ -41,9 +41,9 @@
#include <libwr/wrs-msg.h>
#include <libwr/shmem.h>
#include <libwr/hal_shmem.h>
#include <libwr/mac.h>
#include "rtu.h"
#include "mac.h"
#include "rtu_fd.h"
#include "rtu_drv.h"
#include "rtu_ext_drv.h"
......
......@@ -37,7 +37,7 @@
#include "rtu.h"
#include "rtu_fd.h"
#include "rtud_exports.h"
#include "mac.h"
#include <libwr/mac.h>
/* The channel */
static struct minipc_ch *rtud_ch;
......
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