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

cleanup: removed trailing whitespaces in code

This commit is contained in:
Steffen Vogel 2017-05-05 19:24:16 +00:00
parent 74ee677b41
commit 49054eef9f
206 changed files with 1906 additions and 1906 deletions

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -18,7 +18,7 @@ stats = 3; # The interval in seconds to print path statistics.
name = "villas-acs" # The name of this VILLASnode. Might by used by node-types
# to identify themselves (default is the hostname).
log = {
level = 5; # The level of verbosity for debug messages
# Higher number => increased verbosity
@ -46,7 +46,7 @@ nodes = {
{ label = "Sine" },
{ label = "Rect" },
{ label = "Ramp" }
)
)
},
socket1 = {
type = "socket",

View file

@ -18,12 +18,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -39,7 +39,7 @@ nodes = {
udp_node = { # The dictionary is indexed by the name of the node.
type = "socket", # Type can be one of: socket, opal, file, gtfpga, ngsi
# Start the server without arguments for a list of supported node types.
### The following settings are specific to the socket node-type!! ###
layer = "udp", # Layer can be one of:
@ -57,15 +57,15 @@ nodes = {
endian = "network", # Endianess of header and data:
# big | network Use big endianess. Also know as network byte order (default)
# little Use little endianess.
local = "127.0.0.1:12001", # This node only received messages on this IP:Port pair
remote = "127.0.0.1:12000" # This node sents outgoing messages to this IP:Port pair
vectorize = 30 # Receive and sent 30 samples per message (combining).
},
ethernet_node = {
type = "socket", # See above.
### The following settings are specific to the socket node-type!! ###
layer = "eth",
@ -87,7 +87,7 @@ nodes = {
},
opal_node = { # The server can be started as an Asynchronous process
type = "opal", # from within an OPAL-RT model.
### The following settings are specific to the opal node-type!! ###
send_id = 1, # It's possible to have multiple send / recv Icons per model
@ -96,13 +96,13 @@ nodes = {
},
file_node = {
type = "file",
### The following settings are specific to the file node-type!! ###
in = {
uri = "logs/input.log", # These options specify the path prefix where the the files are stored
mode = "r", # The mode in which files should be opened (see open(2))
epoch_mode = "direct" # One of: direct (default), wait, relative, absolute
epoch = 10 # The interpretation of this value depends on epoch_mode (default is 0).
# Consult the documentation of a full explanation
@ -118,24 +118,24 @@ nodes = {
},
gtfpga_node = {
type = "gtfpga",
### The following settings are specific to the gtfpga node-type!! ###
slot = "01:00.0", # The PCIe slot location (see first column in 'lspci' output)
id = "1ab8:4005", # The PCIe vendor:device ID (see third column in 'lspci -n' output)
rate = 1
},
ngsi_node = {
type = "ngsi",
### The following settings are specific to the ngsi node-type!! ###
endpoint = "http://46.101.131.212:1026",# The HTTP REST API endpoint of the FIRWARE context broker
entity_id = "S3_ElectricalGrid",
entity_id = "S3_ElectricalGrid",
entity_type = "ElectricalGridMonitoring",
timeout = 5, # Timeout of HTTP request in seconds (default is 1)
verify_ssl = false, # Verification of SSL server certificates (default is true)
@ -146,7 +146,7 @@ nodes = {
},
websocket_node = {
type = "websocket"
destinations = [ "http://example.com/node-name1", "https://example.com/another-node" ]
}
};
@ -158,20 +158,20 @@ paths = (
{
enabled = true, # Enable this path (default: true)
reverse = true, # Setup a path in the reverse direction as well (default: false)
in = "acs", # Name of the node we receive messages from (see node dictionary)
out = "sintef", # Name of the node we send messages to.
rate = 100, # Send message over this path with a fixed (constant) rate (default: 0).
# Setting this value to 0 will disable this feature.
queuelen = 128,
samplelen = 64
},
{
enabled = false,
reverse = false,
in = "opal_node", # There's only a single source node allowed!
out = [ "udp_node", "tcp_node" ], # Multiple destination nodes are supported too.
},

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -34,11 +34,11 @@ fpgas = {
/* Card identification */
id = "10ee:7022";
slot = "01:00.0";
intc = 0x5000;
reset = 0x2000;
do_reset = true;
ips = {
switch_0 = {
vlnv = "xilinx.com:ip:axis_interconnect:2.1"
@ -57,7 +57,7 @@ fpgas = {
irq = 0
}
}
/* Configure switch_0 */
paths = (
{ in = "dma_0", out = "rtds_0" },

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -45,7 +45,7 @@ fpgas = {
# baseaddr Baseaddress as accessible from BAR0 memory region
# irq Interrupt index of MSI interrupt controller
# port Port index of AXI4-Stream interconnect
ips = {
### Utility IPs
axi_pcie_intc_0 = {
@ -66,7 +66,7 @@ fpgas = {
baseaddr = 0x4000;
irq = 0;
},
### Data mover IPs
dma_0 = {
vlnv = "xilinx.com:ip:axi_dma:7.1";
@ -87,7 +87,7 @@ fpgas = {
port = 2;
irq = 2;
},
### Interface IPs
rtds_axis_0 = {
vlnv = "acs.eonerc.rwth-aachen.de:user:rtds_axis:1.0";
@ -95,14 +95,14 @@ fpgas = {
port = 0;
irq = 5; /* 5 -7 */
},
### Model IPs
hls_dft_0 = {
vlnv = "acs.eonerc.rwth-aachen.de:hls:hls_dft:1.0";
baseaddr = 0x9000;
port = 5;
irq = 1;
period = 400; /* in samples: 20ms / 50uS = 400*/
harmonics = [ 0, 1, 3, 5, 7 ]
decimation = 0; /* 0 = disabled */

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -42,7 +42,7 @@ stats = 3; # The interval in seconds to print path statistics.
name = "villas-acs" # The name of this VILLASnode. Might by used by node-types
# to identify themselves (default is the hostname).
log = {
level = 5; # The level of verbosity for debug messages
# Higher number => increased verbosity
@ -50,13 +50,13 @@ log = {
faciltities = [ "path", "socket" ]; # The list of enabled debug faciltities.
# If omitted, all faciltities are enabled
# For a full list of available faciltities, check lib/log.c
file = "/var/log/villas-node.log"; # File for logs
};
http = {
enabled = true, # Do not listen on port if true
htdocs = "/villas/web/socket/", # Root directory of internal webserver
port = 80 # Port for HTTP connections
}

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -56,7 +56,7 @@ paths = (
{
in = "node1", # Name of the node we listen to (see above)
out = "node1", # And we loop back to the origin
# Hooks
print = {
output = "stdout"

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -56,7 +56,7 @@ paths = (
{
in = "node1", # Name of the node we listen to (see above)
out = "node1", # And we loop back to the origin
# Hooks
print = {
output = "stdout"

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -57,7 +57,7 @@ paths = (
{
in = "node1", # Name of the node we listen to (see above)
out = "node1", # And we loop back to the origin
# Hooks
print = {
output = "stdout"

View file

@ -35,12 +35,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -17,12 +17,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -45,7 +45,7 @@ nodes = {
{ label = "Sine", unit = "A" },
{ label = "Rect", unit = "Var"},
{ label = "Ramp", unit = "°C" }
)
)
}
};

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -31,7 +31,7 @@
struct advio {
CURL *curl;
FILE *file;
unsigned char hash[SHA_DIGEST_LENGTH];
char mode[2];

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -49,9 +49,9 @@ typedef int (*api_cb_t)(struct api_action *c, json_t *args, json_t **resp, struc
struct api {
struct list sessions; /**< List of currently active connections */
enum state state;
struct super_node *super_node;
};

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -43,7 +43,7 @@ enum api_mode {
struct api_session {
enum api_mode mode;
enum api_version version;
int runs;
struct {
@ -54,11 +54,11 @@ struct api_session {
struct web_buffer body; /**< HTTP body / WS payload */
struct web_buffer headers; /**< HTTP headers */
} response;
bool completed; /**< Did we receive the complete body yet? */
enum state state;
struct api *api;
};

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -26,7 +26,7 @@
#include <openssl/sha.h>
/** Calculate SHA1 hash of complete file \p f and place it into \p sha1.
*
*
* @param sha1[out] Must be SHA_DIGEST_LENGTH (20) in size.
* @retval 0 Everything was okay.
*/

View file

@ -13,12 +13,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -44,7 +44,7 @@ struct fpga_card {
struct pci *pci;
struct pci_device filter; /**< Filter for PCI device. */
struct vfio_container *vfio_container;
struct vfio_device vfio_device; /**< VFIO device handle. */
@ -62,7 +62,7 @@ struct fpga_card {
struct fpga_ip *intc;
struct fpga_ip *reset;
struct fpga_ip *sw;
config_setting_t *cfg;
};

View file

@ -13,12 +13,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -68,7 +68,7 @@ struct fpga_ip_type {
int (*destroy)(struct fpga_ip *c);
int (*reset)(struct fpga_ip *c);
void (*dump)(struct fpga_ip *c);
size_t size; /**< Amount of memory which should be reserved for struct fpga_ip::_vd */
};

View file

@ -18,7 +18,7 @@ struct ip;
struct dft {
XHls_dft inst;
int period; /* in samples */
int num_harmonics;
float *fharmonics;

View file

@ -12,7 +12,7 @@
*/
#pragma once
#include <stdlib.h>
#include <stdint.h>
#include <sys/types.h>

View file

@ -20,7 +20,7 @@
struct fifo {
XLlFifo inst;
uint32_t baseaddr_axi4;
};

View file

@ -22,7 +22,7 @@ struct intc {
int efds[32]; /**< Event FDs */
int nos[32]; /**< Interrupt numbers from /proc/interrupts */
int flags[32]; /**< Mask of intc_flags */
};

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -36,22 +36,22 @@ typedef uintmax_t hist_cnt_t;
/** Histogram structure used to collect statistics. */
struct hist {
double resolution; /**< The distance between two adjacent buckets. */
double high; /**< The value of the highest bucket. */
double low; /**< The value of the lowest bucket. */
double highest; /**< The highest value observed (may be higher than #high). */
double lowest; /**< The lowest value observed (may be lower than #low). */
double last; /**< The last value which has been put into the buckets */
int length; /**< The number of buckets in #data. */
hist_cnt_t total; /**< Total number of counted values. */
hist_cnt_t higher; /**< The number of values which are higher than #high. */
hist_cnt_t higher; /**< The number of values which are higher than #high. */
hist_cnt_t lower; /**< The number of values which are lower than #low. */
hist_cnt_t *data; /**< Pointer to dynamically allocated array of size length. */
double _m[2], _s[2]; /**< Private variables for online variance calculation */
};

View file

@ -17,12 +17,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@ -31,7 +31,7 @@
* @ingroup path
* @{
*********************************************************************************/
#pragma once
#include <time.h>
@ -55,15 +55,15 @@ struct hook_type {
bool builtin; /**< Should we add this hook by default to every path?. */
size_t size; /**< Size of allocation for struct hook::_vd */
int (*parse)(struct hook *h, config_setting_t *cfg);
int (*init)(struct hook *h); /**< Called before path is started to parseHOOK_DESTROYs. */
int (*destroy)(struct hook *h); /**< Called after path has been stopped to release memory allocated by HOOK_INIT */
int (*destroy)(struct hook *h); /**< Called after path has been stopped to release memory allocated by HOOK_INIT */
int (*start)(struct hook *h); /**< Called whenever a path is started; before threads are created. */
int (*stop)(struct hook *h); /**< Called whenever a path is stopped; after threads are destoyed. */
int (*periodic)(struct hook *h);/**< Called periodically. Period is set by global 'stats' option in the configuration file. */
int (*restart)(struct hook *h); /**< Called whenever a new simulation case is started. This is detected by a sequence no equal to zero. */
@ -77,10 +77,10 @@ struct hook {
struct sample *prev, *last;
struct path *path;
struct hook_type *_vt; /**< C++ like Vtable pointer. */
void *_vd; /**< Private data for this hook. This pointer can be used to pass data between consecutive calls of the callback. */
int priority; /**< A priority to change the order of execution within one type of hook. */
};

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -34,7 +34,7 @@
* @retval >=0 Interface index of outgoing interface.
* @retval <0 Error. Something went wrong.
*/
int nl_get_egress(struct nl_addr *addr);
int nl_get_egress(struct nl_addr *addr);
/** Get or create global netlink socket. */
struct nl_sock * nl_init();

View file

@ -20,7 +20,7 @@ struct pci_device {
int device;
int class;
} id;
struct {
int domain;
int bus;

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -16,12 +16,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -28,7 +28,7 @@
.lock = PTHREAD_MUTEX_INITIALIZER, \
.state = STATE_INITIALIZED \
}
#define list_length(list) ((list)->length)
#define list_at_safe(list, index) ((list)->length > index ? (list)->array[index] : NULL)
#define list_at(list, index) ((list)->array[index])
@ -42,7 +42,7 @@
*/
typedef int (*dtor_cb_t)(void *);
/** Callback to search or sort a list. */
/** Callback to search or sort a list. */
typedef int (*cmp_cb_t)(const void *, const void *);
/* The list data structure. */

View file

@ -11,16 +11,16 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#pragma once
#ifdef __cplusplus
@ -41,7 +41,7 @@ extern "C" {
/* The log level which is passed as first argument to print() */
#define LOG_LVL_DEBUG GRY("Debug")
#define LOG_LVL_INFO WHT("Info ")
#define LOG_LVL_INFO WHT("Info ")
#define LOG_LVL_WARN YEL("Warn ")
#define LOG_LVL_ERROR RED("Error")
#define LOG_LVL_STATS MAG("Stats")
@ -66,7 +66,7 @@ enum log_facilities {
LOG_XIL = (1L << 20),
LOG_TC = (1L << 21),
LOG_IF = (1L << 22),
/* Node-types */
LOG_SOCKET = (1L << 23),
LOG_FILE = (1L << 24),
@ -74,16 +74,16 @@ enum log_facilities {
LOG_NGSI = (1L << 26),
LOG_WEBSOCKET = (1L << 27),
LOG_OPAL = (1L << 28),
/* Classes */
LOG_NODES = LOG_NODE | LOG_SOCKET | LOG_FILE | LOG_FPGA | LOG_NGSI | LOG_WEBSOCKET | LOG_OPAL,
LOG_KERNEL = LOG_VFIO | LOG_PCI | LOG_TC | LOG_IF,
LOG_ALL = ~0xFF
LOG_ALL = ~0xFF
};
struct log {
enum state state;
struct timespec epoch; /**< A global clock used to prefix the log messages. */
/** Debug level used by the debug() macro.
@ -93,10 +93,10 @@ struct log {
/** Debug facilities used by the debug() macro. */
long facilities;
/** Path of the log file */
const char *path;
/** Send all log output to this file / stdout / stderr */
FILE *file;
};
@ -136,7 +136,7 @@ void log_outdent(int *);
*
* The first case enables only faciltities which are in the list.
* The second case enables all faciltities with exception of those which are in the list.
*
*
* @param expression The expression
* @return The new facilties mask (see enum log_faciltities)
*/
@ -155,7 +155,7 @@ void log_print(struct log *l, const char *lvl, const char *fmt, ...)
* @param lvl The log level
* @param fmt The format string (printf alike)
* @param va The variadic argument list (see stdarg.h)
*/
*/
void log_vprint(struct log *l, const char *lvl, const char *fmt, va_list va);
/** Printf alike debug message with level. */

View file

@ -11,16 +11,16 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
#pragma once
struct log;

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -79,7 +79,7 @@ struct mapping_entry {
struct mapping {
enum state state;
int real_length;
struct list entries;

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -43,9 +43,9 @@ enum memtype_flags {
struct memtype {
const char *name;
int flags;
size_t alignment;
memzone_allocator_t alloc;
memzone_deallocator_t free;
@ -68,10 +68,10 @@ struct memblock {
/** @todo Unused for now */
struct memzone {
struct memtype * const type;
void *addr;
uintptr_t physaddr;
size_t len;
size_t len;
};
/** Initilialize memory subsystem */

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -66,10 +66,10 @@ struct msg
unsigned type : 2; /**< Data or control message (see MSG_TYPE_*) */
unsigned rsvd1 : 2; /**< Reserved bits */
unsigned rsvd2 : 8; /**< Reserved bits */
uint16_t length; /**< The number of values in msg::data[]. */
uint32_t sequence; /**< The sequence number is incremented by one for consecutive messages. */
/** A timestamp per message. */
struct {
uint32_t sec; /**< Seconds since 1970-01-01 00:00:00 */

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
@ -50,13 +50,13 @@ struct node
int vectorize; /**< Number of messages to send / recv at once (scatter / gather) */
int affinity; /**< CPU Affinity of this node */
int id; /**< An id of this node which is only unique in the scope of it's super-node (VILLASnode instance). */
unsigned long sequence; /**< This is a counter of received samples, in case the node-type does not generate sequence numbers itself. */
enum state state;
struct node_type *_vt; /**< Virtual functions (C++ OOP style) */
void *_vd; /**< Virtual data (used by struct node::_vt functions) */

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
@ -42,9 +42,9 @@ struct node_type {
struct list instances; /**< A list of all existing nodes of this type. */
size_t size; /**< Size of private data bock. @see node::_vd */
enum state state;
/** Global initialization per node type.
*
* This callback is invoked once per node-type.
@ -62,13 +62,13 @@ struct node_type {
* @retval <0 Error. Something went wrong.
*/
int (*deinit)();
/** Allocate memory for an instance of this type.
/** Allocate memory for an instance of this type.
*
* @return A pointer to the node-type specific private data.
*/
void * (*create)();
/** Free memory of an instance of this type.
*
* @param n A pointer to the node object.
@ -135,7 +135,7 @@ struct node_type {
* @return The number of messages actually sent.
*/
int (*write)(struct node *n, struct sample *smps[], unsigned cnt);
/** Reverse source and destination of a node.
*
* This is not supported by all node types!

View file

@ -8,7 +8,7 @@
/**
* @addtogroup cbuilder RTDS CBuilder model node
* @ingroup node
* @{
* @{
*/
#pragma once
@ -23,7 +23,7 @@ struct cbuilder;
struct cbuilder_model {
void (*code)();
void (*ram)();
int (*init)(struct cbuilder *cb);
int (*read)(float inputs[], int len);
int (*write)(float outputs[], int len);
@ -34,7 +34,7 @@ struct cbuilder {
double timestep;
struct cbuilder_model *model;
float *params;
int paramlen;

View file

@ -13,12 +13,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -50,7 +50,7 @@ struct file {
char *uri; /**< Real file name. */
} read, write;
int rewind; /**< Should we rewind the file when we reach EOF? */
enum read_epoch_mode {

View file

@ -29,7 +29,7 @@ struct fpga_ip;
/** The node type */
struct fpga {
struct fpga_ip *ip;
struct pci *pci;
struct vfio_container *vfio_container;

View file

@ -17,12 +17,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -13,12 +13,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -49,7 +49,7 @@ struct opal {
int send_id;
int recv_id;
Opal_SendAsyncParam send_params;
Opal_RecvAsyncParam recv_params;
};

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -13,12 +13,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -58,7 +58,7 @@ union sockaddr_union {
struct socket {
int sd; /**> The socket descriptor */
int mark; /**> Socket mark for netem, routing and filtering */
enum {
SOCKET_ENDIAN_LITTLE,
SOCKET_ENDIAN_BIG

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -50,7 +50,7 @@ struct lws;
struct websocket {
struct list connections; /**< List of active libwebsocket connections in server mode (struct websocket_connection). */
struct list destinations; /**< List of websocket servers connect to in client mode (struct websocket_destination). */
struct pool pool;
struct queue_signalled queue; /**< For samples which are received from WebSockets */
};
@ -59,21 +59,21 @@ struct websocket {
struct websocket_connection {
struct node *node;
struct lws *wsi;
struct queue queue; /**< For samples which are sent to the WebSocket */
struct queue queue; /**< For samples which are sent to the WebSocket */
struct {
char name[64];
char ip[64];
} peer;
enum {
WEBSOCKET_MODE_CLIENT,
WEBSOCKET_MODE_SERVER,
} mode;
enum state state;
char *_name;
};

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -48,7 +48,7 @@ struct path_source
struct node *node;
struct pool pool;
int samplelen;
pthread_t tid;
pthread_t tid;
};
struct path_destination
@ -63,7 +63,7 @@ struct path_destination
struct path
{
enum state state; /**< Path state. */
/* Each path has a single source and multiple destinations */
struct path_source *source; /**< Pointer to the incoming node */
struct list destinations; /**< List of all outgoing nodes (struct path_destination). */
@ -72,16 +72,16 @@ struct path
int enabled; /**< Is this path enabled. */
int reverse; /**< This path as a matching reverse path. */
int samplelen;
int queuelen;
pthread_t tid; /**< The thread id for this path. */
char *_name; /**< Singleton: A string which is used to print this path to screen. */
struct stats *stats; /**< Statistic counters. This is a pointer to the statistic hooks private data. */
struct super_node *super_node; /**< The super node this path belongs to. */
config_setting_t *cfg; /**< A pointer to the libconfig object which instantiated this path. */
};

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -55,14 +55,14 @@ struct plugin {
char *description;
void *handle;
char *path;
enum plugin_type type;
enum state state;
int (*load)(struct plugin *p);
int (*unload)(struct plugin *p);
union {
struct api_action api;
struct node_type node;

View file

@ -13,12 +13,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -36,18 +36,18 @@
struct pool {
off_t buffer_off; /**< Offset from the struct address to the underlying memory area */
struct memtype *mem;
enum state state;
size_t len; /**< Length of the underlying memory area */
size_t blocksz; /**< Length of a block in bytes */
size_t alignment; /**< Alignment of a block in bytes */
struct queue queue; /**< The queue which is used to keep track of free blocks */
};
#define INLINE static inline __attribute__((unused))
#define INLINE static inline __attribute__((unused))
/** Initiazlize a pool
*

View file

@ -6,19 +6,19 @@
* @author Steffen Vogel <post@steffenvogel.de>
* @copyright 2017 Steffen Vogel
* @license BSD 2-Clause License
*
*
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* modiffication, are permitted provided that the following conditions are met:
*
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@ -55,7 +55,7 @@ struct queue_cell {
/** A lock-free multiple-producer, multiple-consumer (MPMC) queue. */
struct queue {
cacheline_pad_t _pad0; /**< Shared area: all threads read */
enum state state;
struct memtype *mem;
@ -83,7 +83,7 @@ int queue_destroy(struct queue *q);
*
* Note: This is only an estimation and not accurate as long other
* threads are performing operations.
*/
*/
size_t queue_available(struct queue *q);
int queue_push(struct queue *q, void *ptr);

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -56,7 +56,7 @@ struct sample {
int sequence; /**< The sequence number of this sample. */
int length; /**< The number of values in sample::values which are valid. */
int capacity; /**< The number of values in sample::values for which memory is reserved. */
atomic_int refcnt; /**< Reference counter. */
off_t pool_off; /**< This sample belongs to this memory pool (relative pointer). */
struct node *source; /**< The node from which this sample originates. */
@ -67,7 +67,7 @@ struct sample {
struct timespec received; /**< The point in time when this data was received. */
struct timespec sent; /**< The point in time when this data was send for the last time. */
} ts;
uint64_t format; /**< A long bitfield indicating the number representation of the first 64 values in sample::data[] */
/** The values. */

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -55,13 +55,13 @@ enum stats_id {
struct stats_delta {
double values[STATS_COUNT];
int update; /**< Bitmask of stats_id. Only those which are masked will be updated */
struct sample *last;
};
struct stats {
struct hist histograms[STATS_COUNT];
struct hist histograms[STATS_COUNT];
struct stats_delta *delta;
};

View file

@ -15,12 +15,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -49,12 +49,12 @@ struct super_node {
struct log log;
struct api api;
struct web web;
struct {
int argc;
char **argv;
} cli;
enum state state;
config_t cfg; /**< Pointer to configuration file */

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -25,7 +25,7 @@
#include <stdio.h>
#include <stdint.h>
#include <time.h>
#include <sys/timerfd.h>

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -33,9 +33,9 @@ struct api;
struct web {
struct api *api;
enum state state;
struct lws_context *context; /**< The libwebsockets server context. */
struct lws_vhost *vhost; /**< The libwebsockets vhost. */
@ -43,7 +43,7 @@ struct web {
const char *htdocs; /**< The root directory for files served via HTTP. */
const char *ssl_cert; /**< Path to the SSL certitifcate for HTTPS / WSS. */
const char *ssl_private_key; /**< Path to the SSL private key for HTTPS / WSS. */
pthread_t thread;
};

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -36,7 +36,7 @@ struct web_buffer {
size_t prefix; /**< The used length of the buffer. */
enum lws_write_protocol protocol;
enum state state;
};

View file

@ -11,12 +11,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -14,12 +14,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -71,10 +71,10 @@ struct webmsg
uint8_t id; /**< The node index from / to which this sample received / sent to.
* Corresponds to the index of the node in the http://localhost/nodes.json array. */
uint16_t length; /**< The number of values in msg::data[]. */
uint32_t sequence; /**< The sequence number is incremented by one for consecutive messages. */
/** A timestamp per message. */
struct {
uint32_t sec; /**< Seconds since 1970-01-01 00:00:00 */

View file

@ -12,12 +12,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -80,9 +80,9 @@ AFILE * afopen(const char *uri, const char *mode)
int ret;
AFILE *af = alloc(sizeof(AFILE));
strncpy(af->mode, mode, sizeof(af->mode));
af->uri = strdup(uri);
if (!af->uri)
goto out2;
@ -90,7 +90,7 @@ AFILE * afopen(const char *uri, const char *mode)
af->file = tmpfile();
if (!af->file)
goto out2;
af->curl = curl_easy_init();
if (!af->curl)
goto out1;
@ -107,7 +107,7 @@ AFILE * afopen(const char *uri, const char *mode)
curl_easy_setopt(af->curl, CURLOPT_XFERINFOFUNCTION, advio_xferinfo);
curl_easy_setopt(af->curl, CURLOPT_XFERINFODATA, af);
curl_easy_setopt(af->curl, CURLOPT_NOPROGRESS, 0L);
ret = adownload(af);
if (ret)
goto out0;
@ -125,15 +125,15 @@ out2: free(af->uri);
int afclose(AFILE *af)
{
int ret;
ret = afflush(af);
curl_easy_cleanup(af->curl);
fclose(af->file);
free(af->uri);
free(af);
return ret;
}
@ -141,11 +141,11 @@ int afflush(AFILE *af)
{
bool dirty;
unsigned char hash[SHA_DIGEST_LENGTH];
/* Check if fle was modified on disk by comparing hashes */
sha1sum(af->file, hash);
dirty = memcmp(hash, af->hash, sizeof(hash));
if (dirty)
return aupload(af);
@ -174,7 +174,7 @@ int aupload(AFILE *af)
fflush(stderr); /* do not continue in the same line as the progress bar */
fseek(af->file, pos, SEEK_SET); /* Restore old stream pointer */
if (res != CURLE_OK)
return -1;
@ -192,10 +192,10 @@ int adownload(AFILE *af)
fseek(af->file, 0, SEEK_SET);
res = curl_easy_perform(af->curl);
fprintf(stderr, "\e[2K");
fflush(stderr); /* do not continue in the same line as the progress bar */
switch (res) {
case CURLE_OK:
curl_easy_getinfo(af->curl, CURLINFO_RESPONSE_CODE, &code);
@ -207,7 +207,7 @@ int adownload(AFILE *af)
}
/* The following error codes indicate that the file does not exist
* Check the fopen mode to see if we should continue with an emoty file */
* Check the fopen mode to see if we should continue with an emoty file */
case CURLE_FILE_COULDNT_READ_FILE:
case CURLE_TFTP_NOTFOUND:
case CURLE_REMOTE_FILE_NOT_FOUND:
@ -218,7 +218,7 @@ int adownload(AFILE *af)
af->file = fopen(af->uri, af->mode);
if (!af->file)
return -1;
default:
error("Failed to fetch file: %s: %s\n", af->uri, curl_easy_strerror(res));
return -1;
@ -245,7 +245,7 @@ exist: /* File exists */
fseek(af->file, 0, SEEK_END);
else if (af->mode[0] == 'r' || af->mode[0] == 'w')
fseek(af->file, 0, SEEK_SET);
sha1sum(af->file, af->hash);
return 0;

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -47,11 +47,11 @@ int api_ws_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, void *
/* Parse request URI */
char uri[64];
lws_hdr_copy(wsi, uri, sizeof(uri), WSI_TOKEN_GET_URI); /* The path component of the*/
ret = sscanf(uri, "/v%d", (int *) &s->version);
if (ret != 1)
return -1;
ret = api_session_init(s, w->api, API_MODE_WS);
if (ret)
return -1;
@ -63,9 +63,9 @@ int api_ws_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, void *
ret = api_session_destroy(s);
if (ret)
return -1;
debug(LOG_API, "Closed API session");
break;
case LWS_CALLBACK_SERVER_WRITEABLE:
@ -75,14 +75,14 @@ int api_ws_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, void *
return -1;
break;
case LWS_CALLBACK_RECEIVE:
web_buffer_append(&s->request.body, in, len);
json_t *req, *resp;
while (web_buffer_read_json(&s->request.body, &req) >= 0) {
api_session_run_command(s, req, &resp);
web_buffer_append_json(&s->response.body, resp);
lws_callback_on_writable(wsi);
}
@ -138,7 +138,7 @@ int api_http_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, void
s->completed = true;
break;
case LWS_CALLBACK_CLOSED_HTTP:
ret = api_session_destroy(s);
if (ret)
@ -147,7 +147,7 @@ int api_http_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, void
case LWS_CALLBACK_HTTP_BODY:
web_buffer_append(&s->request.body, in, len);
json_t *req, *resp;
while (web_buffer_read_json(&s->request.body, &req) == 1) {
api_session_run_command(s, req, &resp);
@ -211,8 +211,8 @@ int api_stop(struct api *a)
info("Stopping API sub-system");
list_destroy(&a->sessions, (dtor_cb_t) api_session_destroy, false);
a->state = STATE_STOPPED;
return 0;
}

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -28,10 +28,10 @@ static int api_capabilities(struct api_action *h, json_t *args, json_t **resp, s
json_t *json_apis = json_array();
json_t *json_nodes = json_array();
json_t *json_name;
for (size_t i = 0; i < list_length(&plugins); i++) {
struct plugin *p = list_at(&plugins, i);
json_name = json_string(p->name);
switch (p->type) {
@ -41,13 +41,13 @@ static int api_capabilities(struct api_action *h, json_t *args, json_t **resp, s
default: { }
}
}
*resp = json_pack("{ s: s, s: o, s: o, s: o }",
"build", BUILDID,
"hooks", json_hooks,
"node-types", json_nodes,
"apis", json_apis);
return 0;
}

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -30,9 +30,9 @@
static int api_config(struct api_action *h, json_t *args, json_t **resp, struct api_session *s)
{
config_setting_t *cfg_root = config_root_setting(&s->api->super_node->cfg);
*resp = cfg_root ? config_to_json(cfg_root) : json_object();
return 0;
}

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -45,14 +45,14 @@ static int api_nodes(struct api_action *r, json_t *args, json_t **resp, struct a
"affinity", n->affinity,
"id", i
);
/* Add all additional fields of node here.
* This can be used for metadata */
* This can be used for metadata */
json_object_update(json_node, config_to_json(n->cfg));
json_array_append_new(json_nodes, json_node);
}
*resp = json_nodes;
return 0;

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -29,9 +29,9 @@ int api_session_init(struct api_session *s, struct api *a, enum api_mode m)
{
s->mode = m;
s->api = a;
s->completed = false;
web_buffer_init(&s->request.body, s->mode == API_MODE_HTTP ? LWS_WRITE_HTTP : LWS_WRITE_TEXT);
web_buffer_init(&s->response.body, s->mode == API_MODE_HTTP ? LWS_WRITE_HTTP : LWS_WRITE_TEXT);
@ -45,15 +45,15 @@ int api_session_destroy(struct api_session *s)
{
if (s->state == STATE_DESTROYED)
return 0;
web_buffer_destroy(&s->request.body);
web_buffer_destroy(&s->response.body);
if (s->mode == API_MODE_HTTP)
web_buffer_destroy(&s->response.headers);
s->state = STATE_DESTROYED;
return 0;
}
@ -63,9 +63,9 @@ int api_session_run_command(struct api_session *s, json_t *json_in, json_t **jso
const char *action;
char *id;
struct plugin *p;
json_t *json_args = NULL, *json_resp;
ret = json_unpack(json_in, "{ s: s, s: s, s?: o }",
"action", &action,
"id", &id,
@ -77,7 +77,7 @@ int api_session_run_command(struct api_session *s, json_t *json_in, json_t **jso
"code", ret);
goto out;
}
p = plugin_lookup(PLUGIN_TYPE_API, action);
if (!p) {
ret = -101;

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -34,7 +34,7 @@ size_t json_dumpb(const json_t *json, char *buffer, size_t size, size_t flags)
str = json_dumps(json, flags);
if (!str)
return 0;
len = strlen(str); // not \0 terminated
if (buffer && len <= size)
memcpy(buffer, str, len);

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -28,7 +28,7 @@ int sha1sum(FILE *f, unsigned char *sha1)
char buf[512];
ssize_t bytes;
long seek;
seek = ftell(f);
fseek(f, 0, SEEK_SET);
@ -41,7 +41,7 @@ int sha1sum(FILE *f, unsigned char *sha1)
}
SHA1_Final(sha1, &c);
fseek(f, seek, SEEK_SET);
return 0;

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -40,18 +40,18 @@ int fpga_card_init(struct fpga_card *c, struct pci *pci, struct vfio_container *
c->vfio_container = vc;
c->pci = pci;
list_init(&c->ips);
/* Default values */
c->filter.id.vendor = FPGA_PCI_VID_XILINX;
c->filter.id.device = FPGA_PCI_PID_VFPGA;
c->affinity = 0;
c->do_reset = 0;
c->state = STATE_INITIALIZED;
return 0;
}
@ -89,7 +89,7 @@ int fpga_card_parse(struct fpga_card *c, config_setting_t *cfg)
else
cerror(cfg_slot, "PCI ID must be a string");
}
cfg_ips = config_setting_get_member(cfg, "ips");
if (!cfg_ips)
cerror(cfg, "FPGA configuration is missing ips section");
@ -98,53 +98,53 @@ int fpga_card_parse(struct fpga_card *c, config_setting_t *cfg)
config_setting_t *cfg_ip = config_setting_get_elem(cfg_ips, i);
const char *vlnv;
struct fpga_ip_type *vt;
struct fpga_ip ip = {
.card = c,
.state = STATE_DESTROYED
};
if (!config_setting_lookup_string(cfg, "vlnv", &vlnv))
cerror(cfg, "FPGA IP core %s is missing the VLNV identifier", c->name);
vt = fpga_ip_type_lookup(vlnv);
if (!vt)
cerror(cfg, "FPGA IP core VLNV identifier '%s' is invalid", vlnv);
ret = fpga_ip_init(&ip, vt);
if (ret)
error("Failed to initalize FPGA IP core");
ret = fpga_ip_parse(&ip, cfg_ip);
if (ret)
cerror(cfg_ip, "Failed to parse FPGA IP core");
list_push(&c->ips, memdup(&ip, sizeof(ip)));
}
c->cfg = cfg;
c->state = STATE_PARSED;
return 0;
}
int fpga_card_parse_list(struct list *cards, config_setting_t *cfg)
{
int ret;
if (!config_setting_is_group(cfg))
cerror(cfg, "FPGA configuration section must be a group");
for (int i = 0; i < config_setting_length(cfg); i++) {
config_setting_t *cfg_fpga = config_setting_get_elem(cfg, i);
struct fpga_card c;
ret = fpga_card_parse(&c, cfg_fpga);
if (ret)
cerror(cfg_fpga, "Failed to parse FPGA card configuration");
list_push(cards, memdup(&c, sizeof(c)));
}
@ -178,7 +178,7 @@ int fpga_card_start(struct fpga_card *c)
ret = vfio_pci_enable(&c->vfio_device);
if (ret)
serror("Failed to enable PCI device");
/* Reset system? */
if (c->do_reset) {
/* Reset / detect PCI device */
@ -210,7 +210,7 @@ int fpga_card_stop(struct fpga_card *c)
int ret;
assert(c->state == STATE_STOPPED);
for (size_t j = 0; j < list_length(&c->ips); j++) {
struct fpga_ip *i = list_at(&c->ips, j);
@ -218,9 +218,9 @@ int fpga_card_stop(struct fpga_card *c)
if (ret)
error("Failed to stop FPGA IP core: %s (%u)", i->name, ret);
}
c->state = STATE_STOPPED;
return 0;
}
@ -242,7 +242,7 @@ void fpga_card_dump(struct fpga_card *c)
fpga_ip_dump(i);
}
}
vfio_dump(c->vfio_device.group->container);
}
@ -260,7 +260,7 @@ int fpga_card_check(struct fpga_card *c)
c->sw = fpga_vlnv_lookup(&c->ips, &(struct fpga_vlnv) { "xilinx.com", "ip", "axis_interconnect", NULL });
if (!c->sw)
warn("FPGA is missing an AXI4-Stream switch");
return 0;
}
@ -296,7 +296,7 @@ int fpga_card_reset(struct fpga_card *c)
/* After reset the value should be zero again */
if (rst_reg[0])
return -2;
c->state = STATE_INITIALIZED;
return 0;

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -29,9 +29,9 @@
int fpga_ip_init(struct fpga_ip *c, struct fpga_ip_type *vt)
{
int ret;
assert(c->state == STATE_DESTROYED);
c->_vt = vt;
c->_vd = alloc(vt->size);
@ -40,7 +40,7 @@ int fpga_ip_init(struct fpga_ip *c, struct fpga_ip_type *vt)
return ret;
c->state = STATE_INITIALIZED;
debug(8, "IP Core %s initalized (%u)", c->name, ret);
return ret;
@ -50,7 +50,7 @@ int fpga_ip_parse(struct fpga_ip *c, config_setting_t *cfg)
{
int ret;
long long baseaddr;
assert(c->state != STATE_STARTED && c->state != STATE_DESTROYED);
c->cfg = cfg;
@ -74,7 +74,7 @@ int fpga_ip_parse(struct fpga_ip *c, config_setting_t *cfg)
ret = c->_vt && c->_vt->parse ? c->_vt->parse(c) : 0;
if (ret)
error("Failed to parse settings for IP core '%s'", c->name);
c->state = STATE_PARSED;
return 0;
@ -85,13 +85,13 @@ int fpga_ip_start(struct fpga_ip *c)
int ret;
assert(c->state == STATE_CHECKED);
ret = c->_vt->start ? c->_vt->start(c) : 0;
if (ret)
return ret;
c->state = STATE_STARTED;
return 0;
}
@ -100,13 +100,13 @@ int fpga_ip_stop(struct fpga_ip *c)
int ret;
assert(c->state == STATE_STARTED);
ret = c->_vt->stop ? c->_vt->stop(c) : 0;
if (ret)
return ret;
c->state = STATE_STOPPED;
return 0;
}
@ -115,7 +115,7 @@ int fpga_ip_destroy(struct fpga_ip *c)
int ret;
assert(c->state != STATE_DESTROYED);
fpga_vlnv_destroy(&c->vlnv);
ret = c->_vt->destroy ? c->_vt->destroy(c) : 0;
@ -141,7 +141,7 @@ void fpga_ip_dump(struct fpga_ip *c)
assert(c->state != STATE_DESTROYED);
info("IP %s: vlnv=%s:%s:%s:%s baseaddr=%#jx, irq=%d, port=%d",
c->name, c->vlnv.vendor, c->vlnv.library, c->vlnv.name, c->vlnv.version,
c->name, c->vlnv.vendor, c->vlnv.library, c->vlnv.name, c->vlnv.version,
c->baseaddr, c->irq, c->port);
if (c->_vt->dump)
@ -153,11 +153,11 @@ struct fpga_ip_type * fpga_ip_type_lookup(const char *vstr)
int ret;
struct fpga_vlnv vlnv;
ret = fpga_vlnv_parse(&vlnv, vstr);
if (ret)
return NULL;
/* Try to find matching IP type */
for (size_t i = 0; i < list_length(&plugins); i++) {
struct plugin *p = list_at(&plugins, i);
@ -165,6 +165,6 @@ struct fpga_ip_type * fpga_ip_type_lookup(const char *vstr)
if (p->type == PLUGIN_TYPE_FPGA_IP && !fpga_vlnv_cmp(&vlnv, &p->ip.vlnv))
return &p->ip;
}
return NULL;
}

View file

@ -18,24 +18,24 @@ int dft_parse(struct fpga_ip *c)
struct dft *dft = c->_vd;
config_setting_t *cfg_harms;
if (!config_setting_lookup_int(c->cfg, "period", &dft->period))
cerror(c->cfg, "DFT IP core requires 'period' setting");
if (!config_setting_lookup_int(c->cfg, "decimation", &dft->decimation))
cerror(c->cfg, "DFT IP core requires 'decimation' setting");
cfg_harms = config_setting_get_member(c->cfg, "harmonics");
if (!cfg_harms)
cerror(c->cfg, "DFT IP core requires 'harmonics' setting!");
if (!config_setting_is_array(cfg_harms))
cerror(c->cfg, "DFT IP core requires 'harmonics' to be an array of integers!");
dft->num_harmonics = config_setting_length(cfg_harms);
if (dft->num_harmonics <= 0)
cerror(cfg_harms, "DFT IP core requires 'harmonics' to contain at least 1 integer!");
dft->fharmonics = alloc(sizeof(float) * dft->num_harmonics);
for (int i = 0; i < dft->num_harmonics; i++)
@ -47,7 +47,7 @@ int dft_parse(struct fpga_ip *c)
int dft_start(struct fpga_ip *c)
{
int ret;
struct fpga_card *f = c->card;
struct dft *dft = c->_vd;
@ -66,14 +66,14 @@ int dft_start(struct fpga_ip *c)
error("DFT IP core supports a maximum of %u harmonics", max_harmonics);
XHls_dft_Set_num_harmonics_V(xdft, dft->num_harmonics);
XHls_dft_Set_decimation_V(xdft, dft->decimation);
memcpy((void *) (uintptr_t) XHls_dft_Get_fharmonics_BaseAddress(xdft), dft->fharmonics, dft->num_harmonics * sizeof(dft->fharmonics[0]));
XHls_dft_EnableAutoRestart(xdft);
XHls_dft_Start(xdft);
return 0;
}
@ -84,7 +84,7 @@ int dft_stop(struct fpga_ip *c)
XHls_dft *xdft = &dft->inst;
XHls_dft_DisableAutoRestart(xdft);
return 0;
}
@ -96,7 +96,7 @@ int dft_destroy(struct fpga_ip *c)
free(dft->fharmonics);
dft->fharmonics = NULL;
}
return 0;
}

View file

@ -38,7 +38,7 @@ int dma_mem_split(struct dma_mem *o, struct dma_mem *a, struct dma_mem *b)
int dma_alloc(struct fpga_ip *c, struct dma_mem *mem, size_t len, int flags)
{
int ret;
struct fpga_card *f = c->card;
/* Align to next bigger page size chunk */
@ -63,15 +63,15 @@ int dma_alloc(struct fpga_ip *c, struct dma_mem *mem, size_t len, int flags)
int dma_free(struct fpga_ip *c, struct dma_mem *mem)
{
int ret;
ret = vfio_unmap_dma(c->card->vfio_device.group->container, (uint64_t) mem->base_virt, (uint64_t) mem->base_phys, mem->len);
if (ret)
return ret;
ret = munmap(mem->base_virt, mem->len);
if (ret)
return ret;
return 0;
}
@ -82,15 +82,15 @@ int dma_ping_pong(struct fpga_ip *c, char *src, char *dst, size_t len)
ret = dma_read(c, dst, len);
if (ret)
return ret;
ret = dma_write(c, src, len);
if (ret)
return ret;
ret = dma_write_complete(c, NULL, NULL);
if (ret)
return ret;
ret = dma_read_complete(c, NULL, NULL);
if (ret)
return ret;
@ -116,7 +116,7 @@ int dma_read(struct fpga_ip *c, char *buf, size_t len)
struct dma *dma = c->_vd;
XAxiDma *xdma = &dma->inst;
debug(25, "DMA read: dmac=%s buf=%p len=%#zx", c->name, buf, len);
return xdma->HasSg
@ -203,7 +203,7 @@ int dma_sg_write(struct fpga_ip *c, char *buf, size_t len)
cr |= XAXIDMA_BD_CTRL_TXSOF_MASK;
if (i == bdcnt - 1)
cr |= XAXIDMA_BD_CTRL_TXEOF_MASK;
XAxiDma_BdSetCtrl(bd, cr);
XAxiDma_BdSetId(bd, (uintptr_t) buf);
@ -311,9 +311,9 @@ int dma_sg_write_complete(struct fpga_ip *c, char **buf, size_t *len)
while (!(XAxiDma_IntrGetIrq(xdma, XAXIDMA_DMA_TO_DEVICE) & XAXIDMA_IRQ_IOC_MASK))
intc_wait(c->card->intc, c->irq);
XAxiDma_IntrAckIrq(xdma, XAXIDMA_IRQ_IOC_MASK, XAXIDMA_DMA_TO_DEVICE);
processed = XAxiDma_BdRingFromHw(ring, XAXIDMA_ALL_BDS, &bds);
if (len != NULL)
*len = XAxiDma_BdGetActualLength(bds, XAXIDMA_MAX_TRANSFER_LEN);
@ -354,12 +354,12 @@ int dma_sg_read_complete(struct fpga_ip *c, char **buf, size_t *len)
bd = bds;
for (int i = 0; i < bdcnt; i++) {
recvlen += XAxiDma_BdGetActualLength(bd, ring->MaxTransferLen);
sr = XAxiDma_BdGetSts(bd);
if (sr & XAXIDMA_BD_STS_RXSOF_MASK)
if (i != 0)
warn("sof not first");
if (sr & XAXIDMA_BD_STS_RXEOF_MASK)
if (i != bdcnt - 1)
warn("eof not last");
@ -368,7 +368,7 @@ int dma_sg_read_complete(struct fpga_ip *c, char **buf, size_t *len)
bd = (XAxiDma_Bd *) XAxiDma_BdRingNext(ring, bd);
}
if (len != NULL)
*len = recvlen;
if (buf != NULL)
@ -378,7 +378,7 @@ int dma_sg_read_complete(struct fpga_ip *c, char **buf, size_t *len)
ret = XAxiDma_BdRingFree(ring, bdcnt, bds);
if (ret != XST_SUCCESS)
return -3;
return 0;
}
@ -398,13 +398,13 @@ int dma_simple_read(struct fpga_ip *c, char *buf, size_t len)
if (!xdma->HasS2Mm)
return -3;
if (!ring->HasDRE) {
uint32_t mask = xdma->MicroDmaMode ? XAXIDMA_MICROMODE_MIN_BUF_ALIGN : ring->DataWidth - 1;
if ((uintptr_t) buf & mask)
return -4;
}
if(!(XAxiDma_ReadReg(ring->ChanBase, XAXIDMA_SR_OFFSET) & XAXIDMA_HALTED_MASK)) {
if (XAxiDma_Busy(xdma, XAXIDMA_DEVICE_TO_DMA))
return -5;
@ -485,7 +485,7 @@ int dma_simple_read_complete(struct fpga_ip *c, char **buf, size_t *len)
int dma_simple_write_complete(struct fpga_ip *c, char **buf, size_t *len)
{
struct dma *dma = c->_vd;
XAxiDma *xdma = &dma->inst;
XAxiDma_BdRing *ring = XAxiDma_GetTxRing(xdma);
@ -566,7 +566,7 @@ int dma_start(struct fpga_ip *c)
struct dma *dma = c->_vd;
XAxiDma *xdma = &dma->inst;
/* Guess DMA type */
sg = (XAxiDma_In32((uintptr_t) c->card->map + c->baseaddr + XAXIDMA_TX_OFFSET+ XAXIDMA_SR_OFFSET) &
XAxiDma_In32((uintptr_t) c->card->map + c->baseaddr + XAXIDMA_RX_OFFSET+ XAXIDMA_SR_OFFSET) & XAXIDMA_SR_SGINCL_MASK) ? 1 : 0;
@ -588,7 +588,7 @@ int dma_start(struct fpga_ip *c)
.MicroDmaMode = 0,
.AddrWidth = 32
};
ret = XAxiDma_CfgInitialize(xdma, &xdma_cfg);
if (ret != XST_SUCCESS)
return -1;
@ -597,7 +597,7 @@ int dma_start(struct fpga_ip *c)
ret = XAxiDma_Selftest(xdma);
if (ret != XST_SUCCESS)
return -2;
/* Map buffer descriptors */
if (xdma->HasSg) {
ret = dma_alloc(c, &dma->bd, FPGA_DMA_BD_SIZE, 0);
@ -619,7 +619,7 @@ int dma_start(struct fpga_ip *c)
int dma_reset(struct fpga_ip *c)
{
struct dma *dma = c->_vd;
XAxiDma_Reset(&dma->inst);
return 0;

View file

@ -19,17 +19,17 @@
int fifo_start(struct fpga_ip *c)
{
int ret;
struct fpga_card *f = c->card;
struct fifo *fifo = c->_vd;
XLlFifo *xfifo = &fifo->inst;
XLlFifo_Config fifo_cfg = {
.BaseAddress = (uintptr_t) f->map + c->baseaddr,
.Axi4BaseAddress = (uintptr_t) c->card->map + fifo->baseaddr_axi4,
.Datainterface = (fifo->baseaddr_axi4 != -1) ? 1 : 0 /* use AXI4 for Data, AXI4-Lite for control */
};
ret = XLlFifo_CfgInitialize(xfifo, &fifo_cfg, (uintptr_t) c->card->map + c->baseaddr);
if (ret != XST_SUCCESS)
return -1;
@ -42,7 +42,7 @@ int fifo_start(struct fpga_ip *c)
int fifo_stop(struct fpga_ip *c)
{
struct fifo *fifo = c->_vd;
XLlFifo *xfifo = &fifo->inst;
XLlFifo_IntDisable(xfifo, XLLF_INT_RC_MASK); /* Receive complete IRQ */
@ -84,7 +84,7 @@ ssize_t fifo_read(struct fpga_ip *c, char *buf, size_t len)
/* Get length of next frame */
rxlen = XLlFifo_RxGetLen(xllfifo);
nextlen = MIN(rxlen, len);
/* Read from FIFO */
XLlFifo_Read(xllfifo, buf, nextlen);
@ -96,7 +96,7 @@ int fifo_parse(struct fpga_ip *c)
struct fifo *fifo = c->_vd;
int baseaddr_axi4;
if (config_setting_lookup_int(c->cfg, "baseaddr_axi4", &baseaddr_axi4))
fifo->baseaddr_axi4 = baseaddr_axi4;
else
@ -108,7 +108,7 @@ int fifo_parse(struct fpga_ip *c)
int fifo_reset(struct fpga_ip *c)
{
struct fifo *fifo = c->_vd;
XLlFifo_Reset(&fifo->inst);
return 0;

View file

@ -6,14 +6,14 @@
#include <unistd.h>
#include "config.h"
#include "config.h"
#include "log.h"
#include "plugin.h"
#include "nodes/fpga.h"
#include "kernel/vfio.h"
#include "kernel/kernel.h"
#include "kernel/vfio.h"
#include "kernel/kernel.h"
#include "fpga/ip.h"
#include "fpga/card.h"
@ -57,7 +57,7 @@ int intc_start(struct fpga_ip *c)
XIntc_Out32(base + XIN_MER_OFFSET, XIN_INT_HARDWARE_ENABLE_MASK | XIN_INT_MASTER_ENABLE_MASK);
debug(4, "FPGA: enabled interrupts");
return 0;
}
@ -67,7 +67,7 @@ int intc_destroy(struct fpga_ip *c)
struct intc *intc = c->_vd;
vfio_pci_msi_deinit(&f->vfio_device, intc->efds);
return 0;
}
@ -85,7 +85,7 @@ int intc_enable(struct fpga_ip *c, uint32_t mask, int flags)
/* Clear pending IRQs */
XIntc_Out32(base + XIN_IAR_OFFSET, mask);
for (int i = 0; i < intc->num_irqs; i++) {
if (mask & (1 << i))
intc->flags[i] = flags;
@ -145,7 +145,7 @@ uint64_t intc_wait(struct fpga_ip *c, int irq)
ssize_t ret = read(intc->efds[irq], &cnt, sizeof(cnt));
if (ret != sizeof(cnt))
return 0;
return cnt;
}
}

View file

@ -29,7 +29,7 @@ static int model_info_destroy(struct model_info *i)
{
free(i->field);
free(i->value);
return 0;
}
@ -58,7 +58,7 @@ static int model_xsg_map_parse(uint32_t *map, size_t len, struct list *parameter
uint16_t type = map[j] & 0xFFFF;
uint16_t length = map[j] >> 16;
uint32_t *data = &map[j+1];
switch (type) {
case XSG_BLOCK_GATEWAY_IN:
case XSG_BLOCK_GATEWAY_OUT:
@ -73,7 +73,7 @@ static int model_xsg_map_parse(uint32_t *map, size_t len, struct list *parameter
p.direction = type & 0x1;
p.type = (data[0] >> 0) & 0xFF;
p.binpt = (data[0] >> 8) & 0xFF;
e = list_lookup(parameters, p.name);
if (e)
model_param_update(e, &p);
@ -86,14 +86,14 @@ static int model_xsg_map_parse(uint32_t *map, size_t len, struct list *parameter
i->field = copy_string(0);
i->value = copy_string((int) ceil((double) (strlen(i->field) + 1) / 4))
list_push(infos, i);
break;
default:
warn("Unknown block type: %#06x", type);
}
j += length + 1;
}
@ -140,7 +140,7 @@ int model_parse(struct fpga_ip *c)
struct model_param p;
config_setting_t *cfg_params, *cfg_param;
if (strcmp(c->vlnv.library, "hls") == 0)
m->type = MODEL_TYPE_HLS;
else if (strcmp(c->vlnv.library, "sysgen") == 0)
@ -233,7 +233,7 @@ int model_destroy(struct fpga_ip *c)
if (m->xsg.map != NULL)
free(m->xsg.map);
return 0;
}
@ -248,7 +248,7 @@ void model_dump(struct fpga_ip *c)
info("Parameters:");
for (size_t i = 0; i < list_length(&m->parameters); i++) { INDENT
struct model_param *p = list_at(&m->parameters, i);
if (p->direction == MODEL_PARAM_IN)
info("%#jx: %s (%s) = %.3f %s %u",
p->offset,
@ -293,7 +293,7 @@ int model_param_read(struct model_param *p, double *v)
case MODEL_PARAM_TYPE_FLOAT:
*v = (double) ptr->flt;
break;
case MODEL_PARAM_TYPE_BOOLEAN:
*v = (double) ptr->ufix ? 1 : 0;
}
@ -319,7 +319,7 @@ int model_param_write(struct model_param *p, double v)
case MODEL_PARAM_TYPE_FLOAT:
ptr->flt = (float) v;
break;
case MODEL_PARAM_TYPE_BOOLEAN:
ptr->bol = (bool) v;
break;
@ -332,11 +332,11 @@ void model_param_add(struct fpga_ip *c, const char *name, enum model_param_direc
{
struct model *m = c->_vd;
struct model_param *p = alloc(sizeof(struct model_param));
p->name = strdup(name);
p->type = type;
p->direction = dir;
list_push(&m->parameters, p);
}
@ -344,13 +344,13 @@ int model_param_remove(struct fpga_ip *c, const char *name)
{
struct model *m = c->_vd;
struct model_param *p;
p = list_lookup(&m->parameters, name);
if (!p)
return -1;
list_remove(&m->parameters, p);
return 0;
}

View file

@ -18,7 +18,7 @@
int switch_start(struct fpga_ip *c)
{
int ret;
struct fpga_card *f = c->card;
struct sw *sw = c->_vd;
@ -34,7 +34,7 @@ int switch_start(struct fpga_ip *c)
.MaxNumMI = sw->num_ports,
.MaxNumSI = sw->num_ports
};
ret = XAxisScr_CfgInitialize(xsw, &sw_cfg, (uintptr_t) c->card->map + c->baseaddr);
if (ret != XST_SUCCESS)
return -1;
@ -43,7 +43,7 @@ int switch_start(struct fpga_ip *c)
XAxisScr_RegUpdateDisable(xsw);
XAxisScr_MiPortDisableAll(xsw);
XAxisScr_RegUpdateEnable(xsw);
switch_init_paths(c);
return 0;
@ -58,14 +58,14 @@ int switch_init_paths(struct fpga_ip *c)
XAxisScr_RegUpdateDisable(xsw);
XAxisScr_MiPortDisableAll(xsw);
for (size_t i = 0; i < list_length(&sw->paths); i++) {
struct sw_path *p = list_at(&sw->paths, i);
struct fpga_ip *mi, *si;
mi = list_lookup(&c->card->ips, p->out);
si = list_lookup(&c->card->ips, p->in);
if (!mi || !si || mi->port == -1 || si->port == -1)
error("Invalid path configuration for FPGA");
@ -84,7 +84,7 @@ int switch_destroy(struct fpga_ip *c)
struct sw *sw = c->_vd;
list_destroy(&sw->paths, NULL, true);
return 0;
}
@ -103,13 +103,13 @@ int switch_parse(struct fpga_ip *c)
cfg_sw = config_setting_get_member(f->cfg, "paths");
if (!cfg_sw)
return 0; /* no switch config available */
for (int i = 0; i < config_setting_length(cfg_sw); i++) {
cfg_path = config_setting_get_elem(cfg_sw, i);
struct sw_path path;
int reverse;
if (!config_setting_lookup_bool(cfg_path, "reverse", &reverse))
reverse = 0;
@ -132,11 +132,11 @@ int switch_parse(struct fpga_ip *c)
const char *tmp = path.in;
path.in = path.out;
path.out = tmp;
list_push(&sw->paths, memdup(&path, sizeof(path)));
}
}
return 0;
}
@ -144,7 +144,7 @@ int switch_connect(struct fpga_ip *c, struct fpga_ip *mi, struct fpga_ip *si)
{
struct sw *sw = c->_vd;
XAxis_Switch *xsw = &sw->inst;
uint32_t mux, port;
/* Check if theres already something connected */
@ -166,11 +166,11 @@ int switch_connect(struct fpga_ip *c, struct fpga_ip *mi, struct fpga_ip *si)
XAxisScr_RegUpdateDisable(xsw);
XAxisScr_MiPortEnable(xsw, mi->port, si->port);
XAxisScr_RegUpdateEnable(xsw);
/* Reset IPs */
/*ip_reset(mi);
ip_reset(si);*/
debug(8, "FPGA: Switch connected %s (%u) to %s (%u)", mi->name, mi->port, si->name, si->port);
return 0;

View file

@ -27,7 +27,7 @@ int timer_start(struct fpga_ip *c)
XTmrCtr_CfgInitialize(xtmr, &xtmr_cfg, (uintptr_t) f->map + c->baseaddr);
XTmrCtr_InitHw(xtmr);
return 0;
}

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -47,7 +47,7 @@ int fpga_vlnv_parse(struct fpga_vlnv *c, const char *vlnv)
c->library = strdup(strtok(NULL, ":"));
c->name = strdup(strtok(NULL, ":"));
c->version = strdup(strtok(NULL, ":"));
free(tmp);
return 0;
@ -59,6 +59,6 @@ int fpga_vlnv_destroy(struct fpga_vlnv *v)
free(v->library);
free(v->name);
free(v->version);
return 0;
}

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -50,7 +50,7 @@ int hist_init(struct hist *h, double low, double high, double resolution)
}
hist_reset(h);
return 0;
}
@ -60,14 +60,14 @@ int hist_destroy(struct hist *h)
free(h->data);
h->data = NULL;
}
return 0;
}
void hist_put(struct hist *h, double value)
{
int idx = INDEX(h, value);
h->last = value;
/* Update min/max */
@ -135,7 +135,7 @@ void hist_print(struct hist *h, int details)
{ INDENT
if (h->length > 0) {
hist_cnt_t missed = h->total - h->higher - h->lower;
stats("Counted values: %ju (%ju between %f and %f)", h->total, missed, h->low, h->high);
stats("Highest: %f Lowest: %f", h->highest, h->lowest);
stats("Mu: %f Sigma2: %f Sigma: %f", hist_mean(h), hist_var(h), hist_stddev(h));
@ -182,14 +182,14 @@ void hist_plot(struct hist *h)
char * hist_dump(struct hist *h)
{
char *buf = alloc(128);
strcatf(&buf, "[ ");
for (int i = 0; i < h->length; i++)
strcatf(&buf, "%ju ", h->data[i]);
strcatf(&buf, "]");
return buf;
}
@ -216,7 +216,7 @@ json_t * hist_json(struct hist *h)
for (int i = 0; i < h->length; i++)
json_array_append(json_buckets, json_integer(h->data[i]));
json_object_set(json_hist, "buckets", json_buckets);
}
@ -226,11 +226,11 @@ json_t * hist_json(struct hist *h)
int hist_dump_json(struct hist *h, FILE *f)
{
json_t *j = hist_json(h);
int ret = json_dumpf(j, f, 0);
json_decref(j);
return ret;
}
#endif /* WITH_JANNSON */
@ -248,7 +248,7 @@ int hist_dump_matlab(struct hist *h, FILE *f)
fprintf(f, "'mean', %f, ", hist_mean(h));
fprintf(f, "'variance', %f, ", hist_var(h));
fprintf(f, "'stddev', %f, ", hist_stddev(h));
if (h->total - h->lower - h->higher > 0) {
char *buf = hist_dump(h);
fprintf(f, "'buckets', %s", buf);
@ -258,6 +258,6 @@ int hist_dump_matlab(struct hist *h, FILE *f)
fprintf(f, "'buckets', zeros(1, %d)", h->length);
fprintf(f, ")");
return 0;
}

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -37,20 +37,20 @@ int hook_init(struct hook *h, struct hook_type *vt, struct path *p)
int ret;
assert(h->state == STATE_DESTROYED);
h->priority = vt->priority;
h->path = p;
h->_vt = vt;
h->_vd = alloc(vt->size);
ret = h->_vt->init ? h->_vt->init(h) : 0;
if (ret)
return ret;
h->state = STATE_INITIALIZED;
return 0;
}
@ -67,7 +67,7 @@ int hook_parse(struct hook *h, config_setting_t *cfg)
return ret;
h->state = STATE_PARSED;
return 0;
}
@ -76,16 +76,16 @@ int hook_destroy(struct hook *h)
int ret;
assert(h->state != STATE_DESTROYED);
ret = h->_vt->destroy ? h->_vt->destroy(h) : 0;
if (ret)
return ret;
if (h->_vd)
free(h->_vd);
h->state = STATE_DESTROYED;
return 0;
}
@ -157,7 +157,7 @@ int hook_cmp_priority(const void *a, const void *b)
{
struct hook *ha = (struct hook *) a;
struct hook *hb = (struct hook *) b;
return ha->priority - hb->priority;
}
@ -172,26 +172,26 @@ int hook_parse_list(struct list *list, config_setting_t *cfg, struct path *o)
for (int i = 0; i < config_setting_length(cfg); i++) {
config_setting_t *cfg_hook = config_setting_get_elem(cfg, i);
const char *name = config_setting_name(cfg_hook);
p = plugin_lookup(PLUGIN_TYPE_HOOK, name);
if (!p)
continue; /* We ignore all non hook settings in this libconfig object setting */
if (!config_setting_is_group(cfg_hook))
cerror(cfg_hook, "The 'hooks' setting must be an array of strings.");
struct hook h = { .state = STATE_DESTROYED };
ret = hook_init(&h, &p->hook, o);
if (ret)
continue;
/* If the user does not assign a priority, we will use the
* position of the hook section in the congiguration file. */
h.priority = priority++;
ret = hook_parse(&h, cfg_hook);
if (ret)
continue;

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -32,7 +32,7 @@ struct convert {
TO_FIXED,
TO_FLOAT
} mode;
double scale;
long long mask;
@ -41,7 +41,7 @@ struct convert {
static int convert_init(struct hook *h)
{
struct convert *p = h->_vd;
p->scale = 1;
p->mask = -1;
@ -51,9 +51,9 @@ static int convert_init(struct hook *h)
static int convert_parse(struct hook *h, config_setting_t *cfg)
{
struct convert *p = h->_vd;
const char *mode;
config_setting_lookup_float(cfg, "scale", &p->scale);
config_setting_lookup_int64(cfg, "mask", &p->mask);
@ -66,7 +66,7 @@ static int convert_parse(struct hook *h, config_setting_t *cfg)
p->mode = TO_FLOAT;
else
error("Invalid parameter '%s' for hook 'convert'", mode);
return 0;
}
@ -76,11 +76,11 @@ static int convert_read(struct hook *h, struct sample *smps[], size_t *cnt)
for (int i = 0; i < *cnt; i++) {
for (int k = 0; k < smps[i]->length; k++) {
/* Only convert values which are not masked */
if ((k < sizeof(p->mask) * 8) && !(p->mask & (1LL << k)))
continue;
switch (p->mode) {
case TO_FIXED:
smps[i]->data[k].i = smps[i]->data[k].f * p->scale;

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -35,7 +35,7 @@ struct decimate {
static int decimate_init(struct hook *h)
{
struct decimate *p = h->_vd;
p->counter = 0;
return 0;
@ -44,7 +44,7 @@ static int decimate_init(struct hook *h)
static int decimate_parse(struct hook *h, config_setting_t *cfg)
{
struct decimate *p = h->_vd;
if (!cfg)
error("Missing configuration for hook: '%s'", plugin_name(h->_vt));
@ -57,18 +57,18 @@ static int decimate_parse(struct hook *h, config_setting_t *cfg)
static int decimate_read(struct hook *h, struct sample *smps[], size_t *cnt)
{
struct decimate *p = h->_vd;
int i, ok;
for (i = 0, ok = 0; i < *cnt; i++) {
if (p->counter++ % p->ratio == 0) {
struct sample *tmp;
tmp = smps[ok];
smps[ok++] = smps[i];
smps[i] = tmp;
}
}
*cnt = ok;
return 0;
@ -88,5 +88,5 @@ static struct plugin p = {
};
REGISTER_PLUGIN(&p)
/** @} */

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -32,10 +32,10 @@
static int drop_read(struct hook *h, struct sample *smps[], size_t *cnt)
{
int i, ok, dist;
for (i = 0, ok = 0; i < *cnt; i++) {
h->last = smps[i];
if (h->prev) {
dist = h->last->sequence - (int32_t) h->prev->sequence;
if (dist <= 0) {
@ -45,12 +45,12 @@ static int drop_read(struct hook *h, struct sample *smps[], size_t *cnt)
}
else {
struct sample *tmp;
tmp = smps[i];
smps[i] = smps[ok];
smps[ok++] = tmp;
}
/* To discard the first X samples in 'smps[]' we must
* shift them to the end of the 'smps[]' array.
* In case the hook returns a number 'ok' which is smaller than 'cnt',
@ -59,7 +59,7 @@ static int drop_read(struct hook *h, struct sample *smps[], size_t *cnt)
}
else {
struct sample *tmp;
tmp = smps[i];
smps[i] = smps[ok];
smps[ok++] = tmp;
@ -69,7 +69,7 @@ static int drop_read(struct hook *h, struct sample *smps[], size_t *cnt)
}
*cnt = ok;
return 0;
}

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -43,7 +43,7 @@ static int curr_count = 0;
*
* Drawbacks: No protection for out of order packets. Default positive delay assumed,
* so GPS timestamp should be earlier than NTP timestamp. If difference b/w NTP and GPS ts
* is high (i.e. several mins depending on GPS_NTP_DELAY_WIN_SIZE),
* is high (i.e. several mins depending on GPS_NTP_DELAY_WIN_SIZE),
* the variance value will overrun the 64bit value.
*/
int hook_jitter_ts(struct hook *h, struct sample *smps[], size_t *cnt)
@ -58,13 +58,13 @@ int hook_jitter_ts(struct hook *h, struct sample *smps[], size_t *cnt)
/* Calc on microsec instead of nenosec delay as variance formula overflows otherwise.*/
curr_delay_us = delay_sec*1000000 + delay_nsec/1000;
delay_mov_sum = delay_mov_sum + curr_delay_us - delay_series[curr_count];
moving_avg[curr_count] = delay_mov_sum/(GPS_NTP_DELAY_WIN_SIZE); /* Will be valid after GPS_NTP_DELAY_WIN_SIZE initial values */
delay_mov_sum_sqrd = delay_mov_sum_sqrd + (curr_delay_us*curr_delay_us) - (delay_series[curr_count]*delay_series[curr_count]);
moving_var[curr_count] = (delay_mov_sum_sqrd - (delay_mov_sum*delay_mov_sum)/GPS_NTP_DELAY_WIN_SIZE)/(GPS_NTP_DELAY_WIN_SIZE-1);
delay_series[curr_count] = curr_delay_us; /* Update the last delay value */
/* Jitter calc formula as used in Wireshark according to RFC3550 (RTP)
@ -72,9 +72,9 @@ int hook_jitter_ts(struct hook *h, struct sample *smps[], size_t *cnt)
J(i) = J(i-1)+(|D(i-1,i)|-J(i-1))/16
*/
jitter_val[(curr_count+1)%GPS_NTP_DELAY_WIN_SIZE] = jitter_val[curr_count] + (abs(curr_delay_us) - jitter_val[curr_count])/16;
info("jitter %ld usec, moving average %ld usec, moving variance %ld usec\n", jitter_val[(curr_count+1)%GPS_NTP_DELAY_WIN_SIZE], moving_avg[curr_count], moving_var[curr_count]);
curr_count++;
if(curr_count >= GPS_NTP_DELAY_WIN_SIZE)
curr_count = 0;

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -55,11 +55,11 @@ static int map_parse(struct hook *h, config_setting_t *cfg)
int ret;
struct map *p = h->_vd;
config_setting_t *cfg_mapping;
cfg_mapping = config_setting_lookup(cfg, "mapping");
if (!cfg_mapping || !config_setting_is_array(cfg_mapping))
return -1;
ret = mapping_parse(&p->mapping, cfg_mapping);
if (ret)
return ret;
@ -82,7 +82,7 @@ static int map_read(struct hook *h, struct sample *smps[], size_t *cnt)
for (int i = 0; i < *cnt; i++) {
mapping_remap(&p->mapping, smps[i], tmp[i], NULL);
SWAP(smps[i], tmp[i]);
}

View file

@ -10,12 +10,12 @@
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************************/
@ -47,13 +47,13 @@ static int print_init(struct hook *h)
static int print_start(struct hook *h)
{
struct print *p = h->_vd;
if (p->uri) {
p->output = fopen(p->uri, "w+");
if (!p->output)
error("Failed to open file %s for writing", p->uri);
}
return 0;
}
@ -72,7 +72,7 @@ static int print_parse(struct hook *h, config_setting_t *cfg)
struct print *p = h->_vd;
config_setting_lookup_string(cfg, "output", &p->uri);
return 0;
}

Some files were not shown because too many files have changed in this diff Show more