transform: Add a "nop" transform module.
This doesn't do anything, just passes input packets on unmodified.
This commit is contained in:
parent
c0a1e532f5
commit
39f1752eff
|
@ -70,7 +70,8 @@ libsigrok_la_SOURCES += \
|
||||||
|
|
||||||
# Transform modules
|
# Transform modules
|
||||||
libsigrok_la_SOURCES += \
|
libsigrok_la_SOURCES += \
|
||||||
src/transform/transform.c
|
src/transform/transform.c \
|
||||||
|
src/transform/nop.c
|
||||||
|
|
||||||
# SCPI support
|
# SCPI support
|
||||||
libsigrok_la_SOURCES += \
|
libsigrok_la_SOURCES += \
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* This file is part of the libsigrok project.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2015 Uwe Hermann <uwe@hermann-uwe.de>
|
||||||
|
*
|
||||||
|
* 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 <string.h>
|
||||||
|
#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,
|
||||||
|
};
|
|
@ -39,9 +39,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** @cond PRIVATE */
|
/** @cond PRIVATE */
|
||||||
|
extern SR_PRIV struct sr_transform_module transform_nop;
|
||||||
/* @endcond */
|
/* @endcond */
|
||||||
|
|
||||||
static const struct sr_transform_module *transform_module_list[] = {
|
static const struct sr_transform_module *transform_module_list[] = {
|
||||||
|
&transform_nop,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue