diff options
author | Daniel Estévez <daniel@destevez.net> | 2023-12-03 21:56:45 +0100 |
---|---|---|
committer | Jeff Long <willcode4@gmail.com> | 2023-12-11 12:05:16 -0500 |
commit | c3b31abffec503a30359a3ac16f79f0a9552a7ec (patch) | |
tree | d1c9e02d7ab1957e5509596c36e2dc56979b35a7 | |
parent | blocks: Fix flaky chunk throttling test (diff) | |
download | gnuradio-c3b31abffec503a30359a3ac16f79f0a9552a7ec.tar.xz gnuradio-c3b31abffec503a30359a3ac16f79f0a9552a7ec.zip |
fec: add FEC_API to CCSDS Reed-Solomon functions
This solves #4454. The (en|de)code_rs_(char|8) functions are
marked as FEC_API so that they can be used by OOT modules. The
(en|de)code_rs_ccsds functions should also be marked as FEC_API.
This is related to #3821. When building with MSVC, the compiler
gives an error if FEC_API is attached to a function definition.
It should be attached to function declarations only.
I have done some clean up to mark all this functions as FEC_API
consistently. They are declared with FEC_API in
include/gnuradio/fec/rs.h, but the implementation was not including
this file, so I have included it now in all the relevant places.
This allows to remove some redundant declarations from char.h
and fixed.h.
I have also added include guards in include/gnuradio/fec/rs.h.
The .h files in reed-solomon/ don't have include guards, but they
are only included in .c files in that folder (to do some sort of
template instantiation in C using the preprocessor).
Signed-off-by: Daniel Estévez <daniel@destevez.net>
(cherry picked from commit 0408a1fa1f1ac53d73750a4603888ff83154531e)
Signed-off-by: Jeff Long <willcode4@gmail.com>
-rw-r--r-- | gr-fec/include/gnuradio/fec/rs.h | 10 | ||||
-rw-r--r-- | gr-fec/lib/reed-solomon/ccsds.h | 3 | ||||
-rw-r--r-- | gr-fec/lib/reed-solomon/char.h | 11 | ||||
-rw-r--r-- | gr-fec/lib/reed-solomon/decode_rs_ccsds.c | 1 | ||||
-rw-r--r-- | gr-fec/lib/reed-solomon/encode_rs_ccsds.c | 1 | ||||
-rw-r--r-- | gr-fec/lib/reed-solomon/fixed.h | 5 |
6 files changed, 12 insertions, 19 deletions
diff --git a/gr-fec/include/gnuradio/fec/rs.h b/gr-fec/include/gnuradio/fec/rs.h index ae05c79eb..87634e187 100644 --- a/gr-fec/include/gnuradio/fec/rs.h +++ b/gr-fec/include/gnuradio/fec/rs.h @@ -1,9 +1,12 @@ -#include <gnuradio/fec/api.h> /* User include file for the Reed-Solomon codec * Copyright 2002, Phil Karn KA9Q * May be used under the terms of the GNU General Public License (GPL) */ +#ifndef INCLUDED_RS_H +#define INCLUDED_RS_H +#include <gnuradio/fec/api.h> + /* General purpose RS codec, 8-bit symbols */ FEC_API void encode_rs_char(void* rs, unsigned char* data, unsigned char* parity); FEC_API int decode_rs_char(void* rs, unsigned char* data, int* eras_pos, int no_eras); @@ -35,7 +38,4 @@ FEC_API int decode_rs_8(unsigned char* data, int* eras_pos, int no_eras); FEC_API void encode_rs_ccsds(unsigned char* data, unsigned char* parity); FEC_API int decode_rs_ccsds(unsigned char* data, int* eras_pos, int no_eras); -/* Tables to map from conventional->dual (Taltab) and - * dual->conventional (Tal1tab) bases - */ -extern unsigned char Taltab[], Tal1tab[]; +#endif /* INCLUDED_RS_H */ diff --git a/gr-fec/lib/reed-solomon/ccsds.h b/gr-fec/lib/reed-solomon/ccsds.h index 52746f583..65bb308d9 100644 --- a/gr-fec/lib/reed-solomon/ccsds.h +++ b/gr-fec/lib/reed-solomon/ccsds.h @@ -1 +1,4 @@ +/* Tables to map from conventional->dual (Taltab) and + * dual->conventional (Tal1tab) bases + */ extern unsigned char Taltab[], Tal1tab[]; diff --git a/gr-fec/lib/reed-solomon/char.h b/gr-fec/lib/reed-solomon/char.h index 80435b633..ea488e17b 100644 --- a/gr-fec/lib/reed-solomon/char.h +++ b/gr-fec/lib/reed-solomon/char.h @@ -6,7 +6,7 @@ #define DTYPE unsigned char -#include <gnuradio/fec/api.h> +#include <gnuradio/fec/rs.h> /* Reed-Solomon codec control block */ struct rs { @@ -47,12 +47,3 @@ static inline unsigned int modnn(struct rs* rs, unsigned int x) #define DECODE_RS decode_rs_char #define INIT_RS init_rs_char #define FREE_RS free_rs_char - -FEC_API void ENCODE_RS(void* p, DTYPE* data, DTYPE* parity); -FEC_API int DECODE_RS(void* p, DTYPE* data, int* eras_pos, int no_eras); -FEC_API void* INIT_RS(unsigned int symsize, - unsigned int gfpoly, - unsigned int fcr, - unsigned int prim, - unsigned int nroots); -FEC_API void FREE_RS(void* p); diff --git a/gr-fec/lib/reed-solomon/decode_rs_ccsds.c b/gr-fec/lib/reed-solomon/decode_rs_ccsds.c index be6e2018e..376e88ea1 100644 --- a/gr-fec/lib/reed-solomon/decode_rs_ccsds.c +++ b/gr-fec/lib/reed-solomon/decode_rs_ccsds.c @@ -4,6 +4,7 @@ * Copyright 2002, Phil Karn, KA9Q * May be used under the terms of the GNU General Public License (GPL) */ +#include <gnuradio/fec/rs.h> #define FIXED 1 #include "ccsds.h" #include "fixed.h" diff --git a/gr-fec/lib/reed-solomon/encode_rs_ccsds.c b/gr-fec/lib/reed-solomon/encode_rs_ccsds.c index 7080b3f41..a88b8b300 100644 --- a/gr-fec/lib/reed-solomon/encode_rs_ccsds.c +++ b/gr-fec/lib/reed-solomon/encode_rs_ccsds.c @@ -5,6 +5,7 @@ * May be used under the terms of the GNU General Public License (GPL) */ #define FIXED +#include <gnuradio/fec/rs.h> #include "ccsds.h" #include "fixed.h" diff --git a/gr-fec/lib/reed-solomon/fixed.h b/gr-fec/lib/reed-solomon/fixed.h index feb3105b0..cd2621c99 100644 --- a/gr-fec/lib/reed-solomon/fixed.h +++ b/gr-fec/lib/reed-solomon/fixed.h @@ -7,7 +7,7 @@ */ #define DTYPE unsigned char -#include <gnuradio/fec/api.h> +#include <gnuradio/fec/rs.h> static inline int mod255(int x) { @@ -36,6 +36,3 @@ extern unsigned char CCSDS_poly[]; #define ENCODE_RS encode_rs_8 #define DECODE_RS decode_rs_8 - -FEC_API void ENCODE_RS(DTYPE* data, DTYPE* parity); -FEC_API int DECODE_RS(DTYPE* data, int* eras_pos, int no_eras);
\ No newline at end of file |