1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

Tried out dumper

This commit is contained in:
Vincent Bareiß 2021-08-23 16:03:58 +02:00
parent a05ba6673f
commit 6f09e60a6a
3 changed files with 12 additions and 60 deletions

View file

@ -24,25 +24,6 @@ nodes = {
{ name = "pps", type = "float", channel = 0 }
)
}
},
pmu = {
type = "socket",
layer = "udp",
format = "villas.binary",
in = {
address = "*:13001"
},
out = {
vectorize = 100
address = "172.16.11.130:13000"
#address = "10.200.0.180:13000"
signals = {
count = 8
type = "float"
}
}
}
}
@ -50,29 +31,5 @@ nodes = {
paths = (
{
in = "ft4222"
out = "pmu",
hooks = ({
type="print"
enabled = false
priority = 2
},{
type="pps_ts"
avg_length = 0
signal_index = 1
threshold = 2.
priority = 3
enable = true
expected_smp_rate = 10000
#pll_gain = 1.
#},{
# type = "dft"
# priority = 4
# enabled = true
},{
type="print"
enabled = false
priority = 5
})
}
)

View file

@ -13,24 +13,18 @@
#pragma once
#include <pthread.h> //Multithreading
#include <villas/dumper.hpp>
#include <libft4222.h> //FT4222h vendor API
#include <ftd2xx.h> //D2XX Driver
#define FT4222_SIGLE_BUF_SIZE 2048
#define FT4222_FULL_BUF_SIZE (3*FT4222_SIGLE_BUF_SIZE)
//Macros for easier bit manipulation when reading out the sample array
#define GET_NEXT_24_BIT(ARRAY,INDEX) ((ARRAY[(INDEX)]) | ((ARRAY[(INDEX)+1]) << 8) | ((ARRAY[(INDEX)+2]) << 16)) //This macro reads out 3 bytes of data in ARRAY and puts it in the 24 lower byts of a 32 bit int in this order |EMPTY|+2|+1|+0
#define UPPER_SMP(DATA) (((DATA) & 0xFFF000) >> 12); //This macro gets the upper 12 bit of the data produced by the macro above
#define LOWER_SMP(DATA) ((DATA) & 0xFFF); //This macro gets the lower 12 bits of the data produced by GET_NETXT_24_bit
static FT_DEVICE_LIST_INFO_NODE ft4222_devices[4]; //There can be at most 4 FT devices at a time
struct ft4222
{
/* Device */
FT_HANDLE dev_handle;
villas::node::Dumper *raw_dumper;
struct
{
@ -38,11 +32,6 @@ struct ft4222
size_t channel_count;
long long unsigned int sequece;
};
};

View file

@ -234,6 +234,9 @@ int ft4222_init(struct vnode *n)
return -1;
}
//DEBUG:
s->raw_dumper = new villas::node::Dumper("/tmp/test_sock");
n->logger->error("Logger started");
return 0;
}
@ -285,10 +288,10 @@ int ft4222_destroy(struct vnode *n)
//Todo: Kill thread and stuff
FT4222_UnInitialize(&s->dev_handle);
FT_Close(&s->dev_handle);
free(&s->raw_dumper);
return 0;
}
/**
* @brief This function parses the .conf configuration file.
*/
@ -330,7 +333,6 @@ int ft4222_parse(struct vnode *n, json_t *json)
return 0;
}
/**
* @brief TODO
*
@ -343,7 +345,7 @@ char *ft_print(struct vnode *n)
/* TODO: Add implementation here. The following is just an example */
return strf("This is default stuff");
return strf("This one is with the fucking fucks that fuck");
}
/**
@ -410,7 +412,11 @@ int ft4222_read(struct vnode *n, struct sample *const smps[], unsigned cnt)
{
throw new RuntimeError("Allignment faliure");
}
u->raw_dumper->writeDataBinary(1,&(smp->data[chan_index].f));
n->logger->error("Hihihi");
}
smp->length = u->channel_count;
smp->signals = &n->in.signals;
smp->sequence = u->sequece++;