mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-30 00:00:11 +01:00
fix: Formatting
Signed-off-by: Steffen Vogel <post@steffenvogel.de>
This commit is contained in:
parent
124e59ecc7
commit
66f44c8ba4
21 changed files with 44 additions and 45 deletions
|
@ -18,7 +18,7 @@ namespace devices {
|
||||||
|
|
||||||
class Device {
|
class Device {
|
||||||
public:
|
public:
|
||||||
virtual ~Device(){};
|
virtual ~Device() {};
|
||||||
|
|
||||||
virtual std::optional<std::unique_ptr<Driver>> driver() const = 0;
|
virtual std::optional<std::unique_ptr<Driver>> driver() const = 0;
|
||||||
virtual std::optional<int> iommu_group() const = 0;
|
virtual std::optional<int> iommu_group() const = 0;
|
||||||
|
|
|
@ -24,7 +24,7 @@ private:
|
||||||
IpDevice() = delete;
|
IpDevice() = delete;
|
||||||
IpDevice(
|
IpDevice(
|
||||||
const std::filesystem::path valid_path) //! Dont allow unvalidated paths
|
const std::filesystem::path valid_path) //! Dont allow unvalidated paths
|
||||||
: PlatformDevice(valid_path){};
|
: PlatformDevice(valid_path) {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
size_t addr() const;
|
size_t addr() const;
|
||||||
|
|
|
@ -32,12 +32,12 @@ private:
|
||||||
public:
|
public:
|
||||||
LinuxDriver(const std::filesystem::path path)
|
LinuxDriver(const std::filesystem::path path)
|
||||||
: LinuxDriver(path, path / std::filesystem::path(BIND_DEFAULT),
|
: LinuxDriver(path, path / std::filesystem::path(BIND_DEFAULT),
|
||||||
path / std::filesystem::path(UNBIND_DEFAULT)){};
|
path / std::filesystem::path(UNBIND_DEFAULT)) {};
|
||||||
|
|
||||||
LinuxDriver(const std::filesystem::path path,
|
LinuxDriver(const std::filesystem::path path,
|
||||||
const std::filesystem::path bind_path,
|
const std::filesystem::path bind_path,
|
||||||
const std::filesystem::path unbind_path)
|
const std::filesystem::path unbind_path)
|
||||||
: path(path), bind_path(bind_path), unbind_path(unbind_path){};
|
: path(path), bind_path(bind_path), unbind_path(unbind_path) {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void attach(const Device &device) const override;
|
void attach(const Device &device) const override;
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace kernel {
|
||||||
namespace devices {
|
namespace devices {
|
||||||
|
|
||||||
#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
|
#define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
|
||||||
#define PCI_FUNC(devfn) ((devfn)&0x07)
|
#define PCI_FUNC(devfn) ((devfn) & 0x07)
|
||||||
|
|
||||||
class Id {
|
class Id {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -29,13 +29,13 @@ private:
|
||||||
public:
|
public:
|
||||||
PlatformDevice(const std::filesystem::path path)
|
PlatformDevice(const std::filesystem::path path)
|
||||||
: PlatformDevice(path, std::filesystem::path(PROBE_DEFAULT),
|
: PlatformDevice(path, std::filesystem::path(PROBE_DEFAULT),
|
||||||
path / std::filesystem::path(OVERRIDE_DEFAULT)){};
|
path / std::filesystem::path(OVERRIDE_DEFAULT)) {};
|
||||||
|
|
||||||
PlatformDevice(const std::filesystem::path path,
|
PlatformDevice(const std::filesystem::path path,
|
||||||
const std::filesystem::path probe_path,
|
const std::filesystem::path probe_path,
|
||||||
const std::filesystem::path override_path)
|
const std::filesystem::path override_path)
|
||||||
: m_path(path), m_probe_path(probe_path),
|
: m_path(path), m_probe_path(probe_path),
|
||||||
m_override_path(override_path){};
|
m_override_path(override_path) {};
|
||||||
|
|
||||||
// Implement device interface
|
// Implement device interface
|
||||||
std::optional<std::unique_ptr<Driver>> driver() const override;
|
std::optional<std::unique_ptr<Driver>> driver() const override;
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct Task {
|
||||||
#if PERIODIC_TASK_IMPL == TIMERFD
|
#if PERIODIC_TASK_IMPL == TIMERFD
|
||||||
int fd; // The timerfd_create(2) file descriptior.
|
int fd; // The timerfd_create(2) file descriptior.
|
||||||
#elif PERIODIC_TASK_IMPL == RDTSC
|
#elif PERIODIC_TASK_IMPL == RDTSC
|
||||||
struct Tsc tsc; // Initialized by tsc_init().
|
struct Tsc tsc; // Initialized by tsc_init().
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Create a new task with the given rate.
|
// Create a new task with the given rate.
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
#ifdef ALIGN
|
#ifdef ALIGN
|
||||||
#undef ALIGN
|
#undef ALIGN
|
||||||
#endif
|
#endif
|
||||||
#define ALIGN(x, a) ALIGN_MASK(x, (uintptr_t)(a)-1)
|
#define ALIGN(x, a) ALIGN_MASK(x, (uintptr_t)(a) - 1)
|
||||||
#define ALIGN_MASK(x, m) (((uintptr_t)(x) + (m)) & ~(m))
|
#define ALIGN_MASK(x, m) (((uintptr_t)(x) + (m)) & ~(m))
|
||||||
#define IS_ALIGNED(x, a) (ALIGN(x, a) == (uintptr_t)x)
|
#define IS_ALIGNED(x, a) (ALIGN(x, a) == (uintptr_t)x)
|
||||||
|
|
||||||
|
@ -65,13 +65,13 @@
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
// Round-up integer division
|
// Round-up integer division
|
||||||
#define CEIL(x, y) (((x) + (y)-1) / (y))
|
#define CEIL(x, y) (((x) + (y) - 1) / (y))
|
||||||
|
|
||||||
// Get nearest up-rounded power of 2
|
// Get nearest up-rounded power of 2
|
||||||
#define LOG2_CEIL(x) (1 << (villas::utils::log2i((x)-1) + 1))
|
#define LOG2_CEIL(x) (1 << (villas::utils::log2i((x) - 1) + 1))
|
||||||
|
|
||||||
// Check if the number is a power of 2
|
// Check if the number is a power of 2
|
||||||
#define IS_POW2(x) (((x) != 0) && !((x) & ((x)-1)))
|
#define IS_POW2(x) (((x) != 0) && !((x) & ((x) - 1)))
|
||||||
|
|
||||||
// Calculate the number of elements in an array.
|
// Calculate the number of elements in an array.
|
||||||
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a)[0])
|
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a)[0])
|
||||||
|
|
|
@ -110,7 +110,7 @@ std::vector<byte> decode(const std::string &input) {
|
||||||
|
|
||||||
decoded.push_back((temp >> 16) & 0x000000FF);
|
decoded.push_back((temp >> 16) & 0x000000FF);
|
||||||
decoded.push_back((temp >> 8) & 0x000000FF);
|
decoded.push_back((temp >> 8) & 0x000000FF);
|
||||||
decoded.push_back((temp)&0x000000FF);
|
decoded.push_back((temp) & 0x000000FF);
|
||||||
}
|
}
|
||||||
|
|
||||||
return decoded;
|
return decoded;
|
||||||
|
|
|
@ -19,8 +19,7 @@ namespace fpga {
|
||||||
namespace ip {
|
namespace ip {
|
||||||
|
|
||||||
#define I2C_SWTICH_ADDR 0x70
|
#define I2C_SWTICH_ADDR 0x70
|
||||||
#define I2C_SWITCH_CHANNEL_MAP \
|
#define I2C_SWITCH_CHANNEL_MAP {0x20, 0x80, 0x02, 0x08, 0x10, 0x40, 0x01, 0x04}
|
||||||
{ 0x20, 0x80, 0x02, 0x08, 0x10, 0x40, 0x01, 0x04 }
|
|
||||||
#define I2C_IOEXT_ADDR 0x20
|
#define I2C_IOEXT_ADDR 0x20
|
||||||
#define I2C_IOEXT_REG_DIR 0x03
|
#define I2C_IOEXT_REG_DIR 0x03
|
||||||
#define I2C_IOEXT_REG_OUT 0x01
|
#define I2C_IOEXT_REG_OUT 0x01
|
||||||
|
@ -47,7 +46,7 @@ public:
|
||||||
public:
|
public:
|
||||||
Switch(I2c *i2c, uint8_t address, Logger logger = villas::Log::get("i2c"))
|
Switch(I2c *i2c, uint8_t address, Logger logger = villas::Log::get("i2c"))
|
||||||
: i2c(i2c), address(address), channel(0), readOnce(false), switchLock(),
|
: i2c(i2c), address(address), channel(0), readOnce(false), switchLock(),
|
||||||
logger(logger){};
|
logger(logger) {};
|
||||||
Switch(const Switch &other) = delete;
|
Switch(const Switch &other) = delete;
|
||||||
Switch &operator=(const Switch &other) = delete;
|
Switch &operator=(const Switch &other) = delete;
|
||||||
void setChannel(uint8_t channel);
|
void setChannel(uint8_t channel);
|
||||||
|
|
|
@ -89,7 +89,7 @@ protected:
|
||||||
BufferedSampleFormatter(const size_t bufSamples, const size_t bufSampleSize)
|
BufferedSampleFormatter(const size_t bufSamples, const size_t bufSampleSize)
|
||||||
: buf(bufSamples * bufSampleSize + 1), // Leave room for a final `\0'
|
: buf(bufSamples * bufSampleSize + 1), // Leave room for a final `\0'
|
||||||
bufSamples(bufSamples), bufSampleSize(bufSampleSize),
|
bufSamples(bufSamples), bufSampleSize(bufSampleSize),
|
||||||
currentBufLoc(0){};
|
currentBufLoc(0) {};
|
||||||
BufferedSampleFormatter() = delete;
|
BufferedSampleFormatter() = delete;
|
||||||
BufferedSampleFormatter(const BufferedSampleFormatter &) = delete;
|
BufferedSampleFormatter(const BufferedSampleFormatter &) = delete;
|
||||||
virtual char *nextBufPos() { return &buf[(currentBufLoc++) * bufSampleSize]; }
|
virtual char *nextBufPos() { return &buf[(currentBufLoc++) * bufSampleSize]; }
|
||||||
|
@ -98,7 +98,7 @@ protected:
|
||||||
class BufferedSampleFormatterShort : public BufferedSampleFormatter {
|
class BufferedSampleFormatterShort : public BufferedSampleFormatter {
|
||||||
public:
|
public:
|
||||||
BufferedSampleFormatterShort(size_t bufSizeInSamples)
|
BufferedSampleFormatterShort(size_t bufSizeInSamples)
|
||||||
: BufferedSampleFormatter(bufSizeInSamples, formatStringSize){};
|
: BufferedSampleFormatter(bufSizeInSamples, formatStringSize) {};
|
||||||
|
|
||||||
virtual void format(float value) override {
|
virtual void format(float value) override {
|
||||||
size_t chars;
|
size_t chars;
|
||||||
|
@ -119,7 +119,7 @@ class BufferedSampleFormatterLong : public BufferedSampleFormatter {
|
||||||
public:
|
public:
|
||||||
BufferedSampleFormatterLong(size_t bufSizeInSamples)
|
BufferedSampleFormatterLong(size_t bufSizeInSamples)
|
||||||
: BufferedSampleFormatter(bufSizeInSamples, formatStringSize),
|
: BufferedSampleFormatter(bufSizeInSamples, formatStringSize),
|
||||||
sampleCnt(0){};
|
sampleCnt(0) {};
|
||||||
|
|
||||||
virtual void format(float value) override {
|
virtual void format(float value) override {
|
||||||
if (std::snprintf(nextBufPos(), formatStringSize + 1, formatString,
|
if (std::snprintf(nextBufPos(), formatStringSize + 1, formatString,
|
||||||
|
|
|
@ -48,8 +48,9 @@ PCIeCardFactory::make(json_t *json_card, std::string card_name,
|
||||||
|
|
||||||
json_error_t err;
|
json_error_t err;
|
||||||
int ret = json_unpack_ex(
|
int ret = json_unpack_ex(
|
||||||
json_card, &err, 0, "{ s: o, s?: i, s?: b, s?: s, s?: s, s?: b, s?: o, s?: o}",
|
json_card, &err, 0,
|
||||||
"ips", &json_ips, "affinity", &affinity, "do_reset", &do_reset, "slot",
|
"{ s: o, s?: i, s?: b, s?: s, s?: s, s?: b, s?: o, s?: o}", "ips",
|
||||||
|
&json_ips, "affinity", &affinity, "do_reset", &do_reset, "slot",
|
||||||
&pci_slot, "id", &pci_id, "polling", &polling, "paths", &json_paths,
|
&pci_slot, "id", &pci_id, "polling", &polling, "paths", &json_paths,
|
||||||
"ignore_ips", &ignored_ips_array);
|
"ignore_ips", &ignored_ips_array);
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
#include <villas/signal_list.hpp>
|
#include <villas/signal_list.hpp>
|
||||||
|
|
||||||
#ifndef CONFIG_GOOSE_DEFAULT_DST_ADDRESS
|
#ifndef CONFIG_GOOSE_DEFAULT_DST_ADDRESS
|
||||||
#define CONFIG_GOOSE_DEFAULT_DST_ADDRESS \
|
#define CONFIG_GOOSE_DEFAULT_DST_ADDRESS {0x01, 0x0c, 0xcd, 0x01, 0x00, 0x01}
|
||||||
{ 0x01, 0x0c, 0xcd, 0x01, 0x00, 0x01 }
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace villas {
|
namespace villas {
|
||||||
|
|
|
@ -58,7 +58,7 @@ protected:
|
||||||
: node(n), id(id), rate(rate), warmup(warmup), cooldown(cooldown),
|
: node(n), id(id), rate(rate), warmup(warmup), cooldown(cooldown),
|
||||||
values(values), count(count), sent(0), received(0), missed(0),
|
values(values), count(count), sent(0), received(0), missed(0),
|
||||||
count_warmup(count_warmup), sent_warmup(0), received_warmup(0),
|
count_warmup(count_warmup), sent_warmup(0), received_warmup(0),
|
||||||
missed_warmup(0), filename(filename){};
|
missed_warmup(0), filename(filename) {};
|
||||||
|
|
||||||
int start();
|
int start();
|
||||||
int stop();
|
int stop();
|
||||||
|
@ -96,7 +96,7 @@ public:
|
||||||
: Node(id, name), task(), formatter(nullptr), stream(nullptr),
|
: Node(id, name), task(), formatter(nullptr), stream(nullptr),
|
||||||
shutdown(false) {}
|
shutdown(false) {}
|
||||||
|
|
||||||
virtual ~TestRTT(){};
|
virtual ~TestRTT() {};
|
||||||
|
|
||||||
virtual int prepare();
|
virtual int prepare();
|
||||||
|
|
||||||
|
|
|
@ -134,7 +134,7 @@ int HookList::process(struct Sample *smps[], unsigned cnt) {
|
||||||
stop:
|
stop:
|
||||||
SWAP(smps[processed], smps[current]);
|
SWAP(smps[processed], smps[current]);
|
||||||
processed++;
|
processed++;
|
||||||
skip : {}
|
skip: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
return processed;
|
return processed;
|
||||||
|
|
|
@ -415,9 +415,9 @@ int villas::node::file_poll_fds(NodeCompat *n, int fds[]) {
|
||||||
int villas::node::file_init(NodeCompat *n) {
|
int villas::node::file_init(NodeCompat *n) {
|
||||||
auto *f = n->getData<struct file>();
|
auto *f = n->getData<struct file>();
|
||||||
|
|
||||||
// We require a real-time clock here as we can sync against the
|
// We require a real-time clock here as we can sync against the
|
||||||
// timestamps in the file.
|
// timestamps in the file.
|
||||||
new (&f->task) Task(CLOCK_REALTIME);
|
new (&f->task) Task(CLOCK_REALTIME);
|
||||||
|
|
||||||
// Default values
|
// Default values
|
||||||
f->rate = 0;
|
f->rate = 0;
|
||||||
|
|
|
@ -752,7 +752,7 @@ int villas::node::ngsi_init(NodeCompat *n) {
|
||||||
int ret;
|
int ret;
|
||||||
auto *i = n->getData<struct ngsi>();
|
auto *i = n->getData<struct ngsi>();
|
||||||
|
|
||||||
new (&i->task) Task();
|
new (&i->task) Task();
|
||||||
|
|
||||||
ret = list_init(&i->in.signals);
|
ret = list_init(&i->in.signals);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
@ -256,9 +256,9 @@ int villas::node::redis_init(NodeCompat *n) {
|
||||||
r->notify = true;
|
r->notify = true;
|
||||||
r->rate = 1.0;
|
r->rate = 1.0;
|
||||||
|
|
||||||
new (&r->options) sw::redis::ConnectionOptions;
|
new (&r->options) sw::redis::ConnectionOptions;
|
||||||
new (&r->task) Task();
|
new (&r->task) Task();
|
||||||
new (&r->key) std::string();
|
new (&r->key) std::string();
|
||||||
|
|
||||||
/* We need a timeout in order for RedisConnection::loop() to properly
|
/* We need a timeout in order for RedisConnection::loop() to properly
|
||||||
* terminate after the node is stopped */
|
* terminate after the node is stopped */
|
||||||
|
|
|
@ -175,8 +175,8 @@ Signal::Ptr SignalNodeSignal::toSignal(Signal::Ptr tpl) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
SignalNode::SignalNode(const uuid_t &id, const std::string &name)
|
SignalNode::SignalNode(const uuid_t &id, const std::string &name)
|
||||||
: Node(id, name), task(), rt(1), rate(10),
|
: Node(id, name), task(), rt(1), rate(10), monitor_missed(true), limit(-1),
|
||||||
monitor_missed(true), limit(-1), missed_steps(0) {}
|
missed_steps(0) {}
|
||||||
|
|
||||||
int SignalNode::prepare() {
|
int SignalNode::prepare() {
|
||||||
assert(state == State::CHECKED);
|
assert(state == State::CHECKED);
|
||||||
|
|
|
@ -78,7 +78,7 @@ static const char *signal_node_type_str(enum signal_node::SignalType type) {
|
||||||
int villas::node::signal_node_init(NodeCompat *n) {
|
int villas::node::signal_node_init(NodeCompat *n) {
|
||||||
auto *s = n->getData<struct signal_node>();
|
auto *s = n->getData<struct signal_node>();
|
||||||
|
|
||||||
new (&s->task) Task();
|
new (&s->task) Task();
|
||||||
|
|
||||||
s->rt = 1;
|
s->rt = 1;
|
||||||
s->limit = -1;
|
s->limit = -1;
|
||||||
|
|
|
@ -137,7 +137,7 @@ int villas::node::stats_node_init(NodeCompat *n) {
|
||||||
int ret;
|
int ret;
|
||||||
auto *s = n->getData<struct stats_node>();
|
auto *s = n->getData<struct stats_node>();
|
||||||
|
|
||||||
new (&s->task) Task();
|
new (&s->task) Task();
|
||||||
|
|
||||||
ret = list_init(&s->signals);
|
ret = list_init(&s->signals);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|
|
@ -93,15 +93,15 @@ void *polled_consumer(void *ctx) {
|
||||||
|
|
||||||
ParameterizedTestParameters(queue_signalled, simple) {
|
ParameterizedTestParameters(queue_signalled, simple) {
|
||||||
static struct param params[] = {
|
static struct param params[] = {
|
||||||
{QueueSignalledMode::AUTO, 0, false},
|
{QueueSignalledMode::AUTO, 0, false},
|
||||||
{QueueSignalledMode::PTHREAD, 0, false},
|
{QueueSignalledMode::PTHREAD, 0, false},
|
||||||
{QueueSignalledMode::PTHREAD, 0, false},
|
{QueueSignalledMode::PTHREAD, 0, false},
|
||||||
{QueueSignalledMode::PTHREAD, (int)QueueSignalledFlags::PROCESS_SHARED,
|
{QueueSignalledMode::PTHREAD, (int)QueueSignalledFlags::PROCESS_SHARED,
|
||||||
false},
|
false},
|
||||||
{QueueSignalledMode::POLLING, 0, false},
|
{QueueSignalledMode::POLLING, 0, false},
|
||||||
#if defined(__linux__) && defined(HAS_EVENTFD)
|
#if defined(__linux__) && defined(HAS_EVENTFD)
|
||||||
{QueueSignalledMode::EVENTFD, 0, false},
|
{QueueSignalledMode::EVENTFD, 0, false},
|
||||||
{QueueSignalledMode::EVENTFD, 0, true}
|
{QueueSignalledMode::EVENTFD, 0, true}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue