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

move checks to read/write functions

This commit is contained in:
Steffen Vogel 2015-10-13 16:14:01 +02:00
parent 3b437c1c0c
commit 5bd0c9cf1e
2 changed files with 12 additions and 13 deletions

View file

@ -63,12 +63,6 @@ int gtfpga_parse(config_setting_t *cfg, struct node *n)
const char *slot, *id, *err;
config_setting_t *cfg_slot, *cfg_id;
/* Checks */
if (n->combine != 1) {
config_setting_t *cfg_combine = config_setting_get_member(cfg, "combine");
cerror(cfg_combine, "The GTFPGA node type does not support combining!");
}
pci_filter_init(NULL, &g->filter);
cfg_slot = config_setting_get_member(cfg, "slot");
@ -247,6 +241,9 @@ int gtfpga_read(struct node *n, struct msg *pool, int poolsize, int first, int c
struct gtfpga *g = n->gtfpga;
struct msg *m = &pool[first % poolsize];
if (cnt != 1)
error("The GTFPGA node type does not support combining!");
uint64_t runs;
read(g->fd_irq, &runs, sizeof(runs));
@ -262,8 +259,10 @@ int gtfpga_read(struct node *n, struct msg *pool, int poolsize, int first, int c
int gtfpga_write(struct node *n, struct msg *pool, int poolsize, int first, int cnt)
{
// struct gtfpga *g = n->gtfpga;
// struct msg *m = &pool[first % poolsize];
if (cnt != 1)
error("The GTFPGA node type does not support combining!");
return 0;
}

View file

@ -135,12 +135,6 @@ int opal_parse(config_setting_t *cfg, struct node *n)
{
struct opal *o = alloc(sizeof(struct opal));
/* Checks */
if (n->combine != 1) {
config_setting_t *cfg_combine = config_setting_get_member(cfg, "combine");
cerror(cfg_combine, "The OPAL-RT node type does not support combining!");
}
config_setting_lookup_int(cfg, "send_id", &o->send_id);
config_setting_lookup_int(cfg, "recv_id", &o->recv_id);
config_setting_lookup_bool(cfg, "reply", &o->reply);
@ -206,6 +200,9 @@ int opal_read(struct node *n, struct msg *pool, int poolsize, int first, int cnt
struct msg *m = &pool[first % poolsize];
double data[MSG_VALUES];
if (cnt != 1)
error("The OPAL-RT node type does not support combining!");
/* This call unblocks when the 'Data Ready' line of a send icon is asserted. */
do {
@ -267,6 +264,9 @@ int opal_write(struct node *n, struct msg *pool, int poolsize, int first, int cn
int state;
int len;
double data[m->length];
if (cnt != 1)
error("The OPAL-RT node type does not support combining!");
state = OpalGetAsyncModelState();
if ((state == STATE_RESET) || (state == STATE_STOP))