Skip to content
Snippets Groups Projects
Commit 79959871 authored by Adam Wujek's avatar Adam Wujek :speech_balloon:
Browse files

userspace/libwr: move softpll header to libwr


--move softpll_export.h to the libwr
--create libwr/softpll.h with:
  FPGA_SPLL_STAT
  SPLL_MAGIC
--move strncpy_e from snmpd to libwr

Signed-off-by: default avatarAdam Wujek <adam.wujek@cern.ch>
parent 5abeb095
No related merge requests found
#ifndef __SOFTPLL_H
#define __SOFTPLL_H
#include "softpll_export.h"
#define FPGA_SPLL_STAT 0x10006800
#define SPLL_MAGIC 0x5b1157a7
#endif /* __SOFTPLL_H */
......@@ -14,4 +14,8 @@ uint64_t get_monotonic_tics(void);
/* get monotonic number of seconds */
time_t get_monotonic_sec(void);
/* Change endianess of the string, for example when accessing strings in
* the SoftPLL */
void strncpy_e(char *d, char *s, int len);
#endif /* __LIBWR_HW_UTIL_H */
......@@ -4,6 +4,7 @@
#include <libwr/wrs-msg.h>
#include <libwr/util.h>
#include <arpa/inet.h> /* for ntohl */
static int loops_per_msec = -1;
......@@ -69,3 +70,18 @@ time_t get_monotonic_sec(void)
clock_gettime(CLOCK_MONOTONIC, &tv);
return tv.tv_sec;
}
/* change endianess of the string, for example when accessing strings in
* the SoftPLL */
void strncpy_e(char *d, char *s, int len)
{
int i;
int len_4;
uint32_t *s_i, *d_i;
s_i = (uint32_t *)s;
d_i = (uint32_t *)d;
len_4 = (len+3)/4; /* ceil len to word lenth (4) */
for (i = 0; i < len_4; i++)
d_i[i] = ntohl(s_i[i]);
}
#include "wrsSnmp.h"
#include "softpll_export.h"
#include <libwr/softpll.h>
#include "wrsSpllStatusGroup.h"
#include "snmp_mmap.h"
#define FPGA_SPLL_STAT 0x10006800
#define SPLL_MAGIC 0x5b1157a7
static struct spll_stats *spll_stats_p;
static struct pickinfo wrsSpllStatus_pickinfo[] = {
......
#ifndef WRS_SPLL_STATUS_GROUP_H
#define WRS_SPLL_STATUS_GROUP_H
#include "softpll_export.h"
#include <libwr/softpll.h>
#define WRSSPLLSTATUS_CACHE_TIMEOUT 5
#define WRSSPLLSTATUS_OID WRS_OID, 7, 3, 2
......
#include "wrsSnmp.h"
#include "wrsSpllVersionGroup.h"
#include "softpll_export.h"
#include <libwr/softpll.h>
#include <libwr/util.h>
#include "snmp_mmap.h"
#define FPGA_SPLL_STAT 0x10006800
#define SPLL_MAGIC 0x5b1157a7
static struct spll_stats *spll_stats_p;
static struct pickinfo wrsSpllVersion_pickinfo[] = {
......@@ -16,20 +14,6 @@ static struct pickinfo wrsSpllVersion_pickinfo[] = {
struct wrsSpllVersion_s wrsSpllVersion_s;
/* change endianess of the string */
static void strncpy_e(char *d, char *s, int len)
{
int i;
int len_4;
uint32_t *s_i, *d_i;
s_i = (uint32_t *)s;
d_i = (uint32_t *)d;
len_4 = (len+3)/4; /* ceil len to word lenth (4) */
for (i = 0; i < len_4; i++)
d_i[i] = ntohl(s_i[i]);
}
time_t wrsSpllVersion_data_fill(void)
{
static time_t time_update;
......
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