lib/include/fec_table.h

Go to the documentation of this file.
00001 //  This file is part of MOS, the MANTIS Operating System
00002 //  See http://mantis.cs.colorado.edu/
00003 //
00004 //  Copyright (c) 2002 - 2007 University of Colorado, Boulder
00005 //
00006 //   All rights reserved.
00007 //
00008 //   Redistribution and use in source and binary forms, with or without
00009 //   modification, are permitted provided that the following conditions are
00010 //   met:
00011 //
00012 //       * Redistributions of source code must retain the above copyright
00013 //         notice, this list of conditions and the following disclaimer.
00014 //       * Redistributions in binary form must reproduce the above
00015 //         copyright notice, this list of conditions and the following
00016 //         disclaimer in the documentation and/or other materials provided
00017 //         with the distribution. 
00018 //       * Neither the name of the MANTIS Project nor the names of its
00019 //         contributors may be used to endorse or promote products derived
00020 //         from this software without specific prior written permission.
00021 //
00022 //   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023 //   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024 //   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
00025 //   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
00026 //   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027 //   INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028 //   BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029 //   LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00030 //   CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00031 //   LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00032 //   ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00033 //   POSSIBILITY OF SUCH DAMAGE.
00034 
00039 #include "fec.h"
00040 
00041 #ifndef PLATFORM_LINUX
00042 #include "plat_dep.h"
00043 #endif
00044 
00045 #ifdef ARCH_AVR
00046 static uint8_t galois_exp [] ARCH_PROGMEM = {
00047    1  ,   2,   4,   8,  16,  32,  64, 128,  29,  58,
00048    116, 232, 205, 135,  19,  38,  76, 152,  45,  90,
00049    180, 117, 234, 201, 143,   3,   6,  12,  24,  48,
00050    96 , 192, 157,  39,  78, 156,  37,  74, 148,  53,
00051    106, 212, 181, 119, 238, 193, 159,  35,  70, 140,
00052    5  ,  10,  20,  40,  80, 160,  93, 186, 105, 210,
00053    185, 111, 222, 161,  95, 190,  97, 194, 153,  47,
00054    94 , 188, 101, 202, 137,  15,  30,  60, 120, 240,
00055    253, 231, 211, 187, 107, 214, 177, 127, 254, 225,
00056    223, 163,  91, 182, 113, 226, 217, 175,  67, 134,
00057    17 ,  34,  68, 136,  13,  26,  52, 104, 208, 189,
00058    103, 206, 129,  31,  62, 124, 248, 237, 199, 147,
00059    59 , 118, 236, 197, 151,  51, 102, 204, 133,  23,
00060    46 ,  92, 184, 109, 218, 169,  79, 158,  33,  66,
00061    132,  21,  42,  84, 168,  77, 154,  41,  82, 164,
00062    85 , 170,  73, 146,  57, 114, 228, 213, 183, 115,
00063    230, 209, 191,  99, 198, 145,  63, 126, 252, 229,
00064    215, 179, 123, 246, 241, 255, 227, 219, 171,  75,
00065    150,  49,  98, 196, 149,  55, 110, 220, 165,  87,
00066    174,  65, 130,  25,  50, 100, 200, 141,   7,  14,
00067    28 ,  56, 112, 224, 221, 167,  83, 166,  81, 162,
00068    89 , 178, 121, 242, 249, 239, 195, 155,  43,  86,
00069    172,  69, 138,   9,  18,  36,  72, 144,  61, 122,
00070    244, 245, 247, 243, 251, 235, 203, 139,  11,  22,
00071    44 ,  88, 176, 125, 250, 233, 207, 131,  27,  54,
00072    108, 216, 173,  71, 142,
00073    // data repeats here
00074    1  ,   2,   4,   8,  16,  32,  64, 128,  29,  58,
00075    116, 232, 205, 135,  19,  38,  76, 152,  45,  90,
00076    180, 117, 234, 201, 143,   3,   6,  12,  24,  48,
00077    96 , 192, 157,  39,  78, 156,  37,  74, 148,  53,
00078    106, 212, 181, 119, 238, 193, 159,  35,  70, 140,
00079    5  ,  10,  20,  40,  80, 160,  93, 186, 105, 210,
00080    185, 111, 222, 161,  95, 190,  97, 194, 153,  47,
00081    94 , 188, 101, 202, 137,  15,  30,  60, 120, 240,
00082    253, 231, 211, 187, 107, 214, 177, 127, 254, 225,
00083    223, 163,  91, 182, 113, 226, 217, 175,  67, 134,
00084    17 ,  34,  68, 136,  13,  26,  52, 104, 208, 189,
00085    103, 206, 129,  31,  62, 124, 248, 237, 199, 147,
00086    59 , 118, 236, 197, 151,  51, 102, 204, 133,  23,
00087    46 ,  92, 184, 109, 218, 169,  79, 158,  33,  66,
00088    132,  21,  42,  84, 168,  77, 154,  41,  82, 164,
00089    85 , 170,  73, 146,  57, 114, 228, 213, 183, 115,
00090    230, 209, 191,  99, 198, 145,  63, 126, 252, 229,
00091    215, 179, 123, 246, 241, 255, 227, 219, 171,  75,
00092    150,  49,  98, 196, 149,  55, 110, 220, 165,  87,
00093    174,  65, 130,  25,  50, 100, 200, 141,   7,  14,
00094    28 ,  56, 112, 224, 221, 167,  83, 166,  81, 162,
00095    89 , 178, 121, 242, 249, 239, 195, 155,  43,  86,
00096    172,  69, 138,   9,  18,  36,  72, 144,  61, 122,
00097    244, 245, 247, 243, 251, 235, 203, 139,  11,  22,
00098    44 ,  88, 176, 125, 250, 233, 207, 131,  27,  54,
00099    108, 216, 173,  71, 142,
00100    // data repeats again... kinda
00101    1  ,   0};
00102 
00103 static uint8_t galois_log [] ARCH_PROGMEM = {
00104    0  ,   0,   1,  25,   2,  50,  26, 198,   3, 223,
00105    51 , 238,  27, 104, 199,  75,   4, 100, 224,  14,
00106    52 , 141, 239, 129,  28, 193, 105, 248, 200,   8,
00107    76 , 113,   5, 138, 101,  47, 225,  36,  15,  33,
00108    53 , 147, 142, 218, 240,  18, 130,  69,  29, 181,
00109    194, 125, 106,  39, 249, 185, 201, 154,   9, 120,
00110    77 , 228, 114, 166,   6, 191, 139,  98, 102, 221,
00111    48 , 253, 226, 152,  37, 179,  16, 145,  34, 136,
00112    54 , 208, 148, 206, 143, 150, 219, 189, 241, 210,
00113    19 ,  92, 131,  56,  70,  64,  30,  66, 182, 163,
00114    195,  72, 126, 110, 107,  58,  40,  84, 250, 133,
00115    186,  61, 202,  94, 155, 159,  10,  21, 121,  43,
00116    78 , 212, 229, 172, 115, 243, 167,  87,   7, 112,
00117    192, 247, 140, 128,  99,  13, 103,  74, 222, 237,
00118    49 , 197, 254,  24, 227, 165, 153, 119,  38, 184,
00119    180, 124,  17,  68, 146, 217,  35,  32, 137,  46,
00120    55 ,  63, 209,  91, 149, 188, 207, 205, 144, 135,
00121    151, 178, 220, 252, 190,  97, 242,  86, 211, 171,
00122    20 ,  42,  93, 158, 132,  60,  57,  83,  71, 109,
00123    65 , 162,  31,  45,  67, 216, 183, 123, 164, 118,
00124    196,  23,  73, 236, 127,  12, 111, 246, 108, 161,
00125    59 ,  82,  41, 157,  85, 170, 251,  96, 134, 177,
00126    187, 204,  62,  90, 203,  89,  95, 176, 156, 169,
00127    160,  81,  11, 245,  22, 235, 122, 117,  44, 215,
00128    79 , 174, 213, 233, 230, 231, 173, 232, 116, 214,
00129    244, 234, 168,  80,  88, 175};
00130 
00131 static uint8_t galois_poly_2 [] ARCH_PROGMEM = {
00132    8  ,   6,   1,   0,   0,   0,   0,   0};
00133 
00134 static uint8_t galois_poly_4 [] ARCH_PROGMEM = {
00135    116, 231, 216,  30,   1,   0,   0,   0,   0,   0,
00136    0  ,   0,   0,   0,   0,   0,   0,   0,   0,   0,
00137    0  ,   0,   0,   0,   0,   0};
00138 
00139 static uint8_t galois_poly_8 [] ARCH_PROGMEM = {
00140    37 , 224,   8, 172,  71, 178,  44, 227,   1,   0,
00141    0  ,   0,   0,   0,   0,   0,   0,   0,   0,   0,
00142    0  ,   0,   0,   0,   0,   0,   0,   0,   0,   0,
00143    0  ,   0,   0,   0,   0,   0,   0,   0,   0,   0,
00144    0  ,   0,   0};
00145 
00146 static const uint8_t *galois_poly;
00147 
00148 #else
00149 static uint8_t galois_exp[512];
00150 static uint8_t galois_log[256];
00151 static uint8_t galois_poly[MAXIMUM_IMPLEMENTED_PARITY_BYTES * 4];
00152 #endif

Generated on Mon Nov 23 06:25:59 2009 for MANTIS by  doxygen 1.4.6