00001
00002
00003
00004
00005
00006
00007
00008 #define DTYPE unsigned char
00009
00010 static inline int mod255(int x){
00011 while (x >= 255) {
00012 x -= 255;
00013 x = (x >> 8) + (x & 255);
00014 }
00015 return x;
00016 }
00017 #define MODNN(x) mod255(x)
00018
00019 extern unsigned char CCSDS_alpha_to[];
00020 extern unsigned char CCSDS_index_of[];
00021 extern unsigned char CCSDS_poly[];
00022
00023 #define MM 8
00024 #define NN 255
00025 #define ALPHA_TO CCSDS_alpha_to
00026 #define INDEX_OF CCSDS_index_of
00027 #define GENPOLY CCSDS_poly
00028 #define NROOTS 32
00029 #define FCR 112
00030 #define PRIM 11
00031 #define IPRIM 116
00032 #define A0 (NN)
00033
00034 #define ENCODE_RS encode_rs_8
00035 #define DECODE_RS decode_rs_8
00036
00037 void ENCODE_RS(DTYPE *data,DTYPE *parity);
00038 int DECODE_RS(DTYPE *data, int *eras_pos, int no_eras);