diff options
| author | Author Name <[email protected]> | 2023-07-07 12:20:59 +0930 |
|---|---|---|
| committer | David Rowe <[email protected]> | 2023-07-07 12:29:06 +0930 |
| commit | ac7c48b4dee99d4c772f133d70d8d1b38262fcd2 (patch) | |
| tree | a2d0ace57a9c0e2e5b611c4987f6fed1b38b81e7 /src/modem_probe.h | |
shallow zip-file copy from codec2 e9d726bf20
Diffstat (limited to 'src/modem_probe.h')
| -rw-r--r-- | src/modem_probe.h | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/src/modem_probe.h b/src/modem_probe.h new file mode 100644 index 0000000..e038603 --- /dev/null +++ b/src/modem_probe.h @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + + FILE........: modem_probe.h + AUTHOR......: Brady O'Brien + DATE CREATED: 9 January 2016 + + Library to easily extract debug traces from modems during development + +\*---------------------------------------------------------------------------*/ + +/* + Copyright (C) 2016 David Rowe + + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License version 2.1, as + published by the Free Software Foundation. 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 Lesser General Public License + along with this program; if not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef __MODEMPROBE_H +#define __MODEMPROBE_H + +#include <stdint.h> +#include <stdlib.h> +#include <complex.h> +#include "comp.h" + +#ifdef MODEMPROBE_ENABLE + +/* Internal functions */ +void modem_probe_init_int(char *modname, char *runname); +void modem_probe_close_int(); + +void modem_probe_samp_i_int(char * tracename,int samp[],size_t cnt); +void modem_probe_samp_f_int(char * tracename,float samp[],size_t cnt); +void modem_probe_samp_c_int(char * tracename,COMP samp[],size_t cnt); + +/* + * Init the probe library. + * char *modname - Name of the modem under test + * char *runname - Name/path of the file data is dumped to + */ +static inline void modem_probe_init(char *modname,char *runname){ + modem_probe_init_int(modname,runname); +} + +/* + * Dump traces to a file and clean up + */ +static inline void modem_probe_close(){ + modem_probe_close_int(); +} + +/* + * Save some number of int samples to a named trace + * char *tracename - name of trace being saved to + * int samp[] - int samples + * size_t cnt - how many samples to save + */ +static inline void modem_probe_samp_i(char *tracename,int samp[],size_t cnt){ + modem_probe_samp_i_int(tracename,samp,cnt); +} + +/* + * Save some number of float samples to a named trace + * char *tracename - name of trace being saved to + * float samp[] - int samples + * size_t cnt - how many samples to save + */ +static inline void modem_probe_samp_f(char *tracename,float samp[],size_t cnt){ + modem_probe_samp_f_int(tracename,samp,cnt); +} + +/* + * Save some number of complex samples to a named trace + * char *tracename - name of trace being saved to + * COMP samp[] - int samples + * size_t cnt - how many samples to save + */ +static inline void modem_probe_samp_c(char *tracename,COMP samp[],size_t cnt){ + modem_probe_samp_c_int(tracename,samp,cnt); +} + +/* + * Save some number of complex samples to a named trace + * char *tracename - name of trace being saved to + * float complex samp[] - int samples + * size_t cnt - how many samples to save + */ +static inline void modem_probe_samp_cft(char *tracename,complex float samp[],size_t cnt){ + modem_probe_samp_c_int(tracename,(COMP*)samp,cnt); +} + +#else + +static inline void modem_probe_init(char *modname,char *runname){ + return; +} + +static inline void modem_probe_close(){ + return; +} + +static inline void modem_probe_samp_i(char *name,int samp[],size_t sampcnt){ + return; +} + +static inline void modem_probe_samp_f(char *name,float samp[],size_t cnt){ + return; +} + +static inline void modem_probe_samp_c(char *name,COMP samp[],size_t cnt){ + return; +} + +static inline void modem_probe_samp_cft(char *name,complex float samp[],size_t cnt){ + return; +} + +#endif + +#endif |
