Home | History | Annotate | Download | only in fec
      1 /* Generate tables for CCSDS code
      2  * Copyright 2002 Phil Karn, KA9Q
      3  * May be used under the terms of the GNU Lesser General Public License (LGPL)
      4  */
      5 #include <stdio.h>
      6 #include <stdlib.h>
      7 #include <assert.h>
      8 #include "char.h"
      9 #include "rs-common.h"
     10 #include "fec.h"
     11 
     12 int main(){
     13   struct rs *rs;
     14   int i;
     15 
     16   rs = init_rs_char(8,0x187,112,11,32,0); /* CCSDS standard */
     17   assert(rs != NULL);
     18   printf("char CCSDS_alpha_to[] = {");
     19   for(i=0;i<256;i++){
     20     if((i % 16) == 0)
     21       printf("\n");
     22     printf("0x%02x,",rs->alpha_to[i]);
     23   }
     24   printf("\n};\n\nchar CCSDS_index_of[] = {");
     25   for(i=0;i<256;i++){
     26     if((i % 16) == 0)
     27       printf("\n");
     28     printf("%3d,",rs->index_of[i]);
     29   }
     30   printf("\n};\n\nchar CCSDS_poly[] = {");
     31   for(i=0;i<33;i++){
     32     if((i % 16) == 0)
     33       printf("\n");
     34 
     35     printf("%3d,",rs->genpoly[i]);
     36   }
     37   printf("\n};\n");
     38   exit(0);
     39 }
     40