X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Ftransform%2Fnop.c;fp=src%2Ftransform%2Fnop.c;h=8de2f2d743019adc179a9aee11f71edca1e3998b;hb=39f1752eff0cde7eaedcc5ed950d56f4f244ea32;hp=0000000000000000000000000000000000000000;hpb=c0a1e532f57c0405621a06f5b360c1ef25aa4c52;p=libsigrok.git diff --git a/src/transform/nop.c b/src/transform/nop.c new file mode 100644 index 00000000..8de2f2d7 --- /dev/null +++ b/src/transform/nop.c @@ -0,0 +1,49 @@ +/* + * This file is part of the libsigrok project. + * + * Copyright (C) 2015 Uwe Hermann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) 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, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include +#include "libsigrok.h" +#include "libsigrok-internal.h" + +#define LOG_PREFIX "transform/nop" + +static int receive(const struct sr_transform *t, + struct sr_datafeed_packet *packet_in, + struct sr_datafeed_packet **packet_out) +{ + if (!t || !t->sdi || !packet_in || !packet_out) + return SR_ERR_ARG; + + /* Do nothing, just pass on packets unmodified. */ + sr_spew("Received packet of type %d, passing on unmodified.", packet_in->type); + *packet_out = packet_in; + + return SR_OK; +} + +SR_PRIV struct sr_transform_module transform_nop = { + .id = "nop", + .name = "NOP", + .desc = "Do nothing", + .options = NULL, + .init = NULL, + .receive = receive, + .cleanup = NULL, +};