2018-09-24 21:30:57 +02:00
|
|
|
/** Node-type for uldaq connections.
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @author Manuel Pitz <manuel.pitz@eonerc.rwth-aachen.de>
|
2022-12-14 17:41:58 +01:00
|
|
|
* @author Steffen Vogel <post@steffenvogel.de>
|
2022-03-15 09:28:57 -04:00
|
|
|
* @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC
|
2022-07-04 18:20:03 +02:00
|
|
|
* @license Apache 2.0
|
2018-09-24 21:30:57 +02:00
|
|
|
*********************************************************************************/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2018-09-25 20:27:01 +02:00
|
|
|
#include <pthread.h>
|
|
|
|
|
2018-09-24 21:30:57 +02:00
|
|
|
#include <villas/queue_signalled.h>
|
2021-08-10 10:12:48 -04:00
|
|
|
#include <villas/pool.hpp>
|
2018-09-24 21:30:57 +02:00
|
|
|
|
2018-09-24 22:28:51 +02:00
|
|
|
#include <uldaq.h>
|
|
|
|
|
2018-09-25 09:55:38 +02:00
|
|
|
#define ULDAQ_MAX_DEV_COUNT 100
|
|
|
|
#define ULDAQ_MAX_RANGE_COUNT 8
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
namespace villas {
|
|
|
|
namespace node {
|
|
|
|
|
2018-09-24 22:28:51 +02:00
|
|
|
struct uldaq {
|
2018-10-04 03:00:14 +02:00
|
|
|
const char *device_id;
|
|
|
|
|
2018-09-25 09:55:38 +02:00
|
|
|
DaqDeviceHandle device_handle;
|
2018-10-04 03:00:14 +02:00
|
|
|
DaqDeviceDescriptor *device_descriptor;
|
2018-09-25 09:55:38 +02:00
|
|
|
DaqDeviceInterface device_interface_type;
|
|
|
|
|
2018-09-25 21:46:42 +02:00
|
|
|
uint64_t sequence;
|
|
|
|
|
2018-09-24 22:28:51 +02:00
|
|
|
struct {
|
2018-09-25 09:55:38 +02:00
|
|
|
double sample_rate;
|
2018-09-25 20:27:01 +02:00
|
|
|
double *buffer;
|
2018-10-04 03:00:14 +02:00
|
|
|
size_t buffer_len;
|
|
|
|
size_t buffer_pos;
|
|
|
|
size_t channel_count;
|
2018-09-25 09:55:38 +02:00
|
|
|
|
|
|
|
ScanOption scan_options;
|
|
|
|
AInScanFlag flags;
|
|
|
|
AiQueueElement *queues;
|
2018-09-25 20:27:01 +02:00
|
|
|
ScanStatus status; // protected by mutex
|
|
|
|
TransferStatus transfer_status; // protected by mutex
|
|
|
|
|
|
|
|
pthread_mutex_t mutex;
|
|
|
|
pthread_cond_t cv;
|
2018-09-24 22:28:51 +02:00
|
|
|
} in;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
// TODO
|
|
|
|
} out;
|
|
|
|
};
|
|
|
|
|
2021-08-10 10:12:48 -04:00
|
|
|
int uldaq_type_start(SuperNode *sn);
|
|
|
|
|
|
|
|
int uldaq_init(NodeCompat *n);
|
|
|
|
|
|
|
|
int uldaq_destroy(NodeCompat *n);
|
|
|
|
|
|
|
|
int uldaq_parse(NodeCompat *n, json_t *json);
|
|
|
|
|
|
|
|
char * uldaq_print(NodeCompat *n);
|
|
|
|
|
|
|
|
int uldaq_check(NodeCompat *n);
|
|
|
|
|
|
|
|
int uldaq_start(NodeCompat *n);
|
|
|
|
|
|
|
|
int uldaq_stop(NodeCompat *n);
|
|
|
|
|
|
|
|
int uldaq_read(NodeCompat *n, struct Sample * const smps[], unsigned cnt);
|
|
|
|
|
|
|
|
|
2023-08-28 09:34:02 +02:00
|
|
|
} // namespace node
|
|
|
|
} // namespace villas
|