forked from peterkvt80/vbit2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tables.h
170 lines (161 loc) · 6.82 KB
/
tables.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/** ***************************************************************************
* Description : Teletext tables for VBIT
* Compiler : GCC
*
* Copyright (C) 2010, Peter Kwan
*
* Permission to use, copy, modify, and distribute this software
* and its documentation for any purpose and without fee is hereby
* granted, provided that the above copyright notice appear in all
* copies and that both that the copyright notice and this
* permission notice and warranty disclaimer appear in supporting
* documentation, and that the name of the author not be used in
* advertising or publicity pertaining to distribution of the
* software without specific, written prior permission.
*
* The author disclaim all warranties with regard to this
* software, including all implied warranties of merchantability
* and fitness. In no event shall the author be liable for any
* special, indirect or consequential damages or any damages
* whatsoever resulting from loss of use, data or profits, whether
* in an action of contract, negligence or other tortious action,
* arising out of or in connection with the use or performance of
* this software.
*************************************************************************** **/
#ifndef _TABLES_H_
#define _TABLES_H_
/*--------------------------------------
*TABLES
--------------------------------------*/
/* Parity table.
* Use 1st half to add odd parity,
* Use 2nd half to add even parity
* Both halves to remove odd parity - signals error if -ve.
*/
extern const unsigned char ParTab[];
/*-------------------------------------------
* Hamming code table
* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
extern const unsigned char HamTab[];
/*-------------------------------------------*/
extern const unsigned char DehamTable[];
/* Hamming decode table
DHMTBL 0x01,0x80,0x01,0x01,0x80,0x00,0x01,0x80
0x80,0x02,0x01,0x80,0x0A,0x80,0x80,0x07
0x80,0x00,0x01,0x80,0x00,0x00,0x80,0x00
0x06,0x80,0x80,0x0B,0x80,0x00,0x03,0x80
0x80,0x0C,0x01,0x80,0x04,0x80,0x80,0x07
0x06,0x80,0x80,0x07,0x80,0x07,0x07,0x07
0x06,0x80,0x80,0x05,0x80,0x00,0x0D,0x80
0x06,0x06,0x06,0x80,0x06,0x80,0x80,0x07
0x80,0x02,0x01,0x80,0x04,0x80,0x80,0x09
0x02,0x02,0x80,0x02,0x80,0x02,0x03,0x80
0x08,0x80,0x80,0x05,0x80,0x00,0x03,0x80
0x80,0x02,0x03,0x80,0x03,0x80,0x03,0x03
0x04,0x80,0x80,0x05,0x04,0x04,0x04,0x80
0x80,0x02,0x0F,0x80,0x04,0x80,0x80,0x07
0x80,0x05,0x05,0x05,0x04,0x80,0x80,0x05
0x06,0x80,0x80,0x05,0x80,0x0E,0x03,0x80
0x80,0x0C,0x01,0x80,0x0A,0x80,0x80,0x09
0x0A,0x80,0x80,0x0B,0x0A,0x0A,0x0A,0x80
0x08,0x80,0x80,0x0B,0x80,0x00,0x0D,0x80
0x80,0x0B,0x0B,0x0B,0x0A,0x80,0x80,0x0B
0x0C,0x0C,0x80,0x0C,0x80,0x0C,0x0D,0x80
0x80,0x0C,0x0F,0x80,0x0A,0x80,0x80,0x07
0x80,0x0C,0x0D,0x80,0x0D,0x80,0x0D,0x0D
0x06,0x80,0x80,0x0B,0x80,0x0E,0x0D,0x80
0x08,0x80,0x80,0x09,0x80,0x09,0x09,0x09
0x80,0x02,0x0F,0x80,0x0A,0x80,0x80,0x09
0x08,0x08,0x08,0x80,0x08,0x80,0x80,0x09
0x08,0x80,0x80,0x0B,0x80,0x0E,0x03,0x80
0x80,0x0C,0x0F,0x80,0x04,0x80,0x80,0x09
0x0F,0x80,0x0F,0x0F,0x80,0x0E,0x0F,0x80
0x08,0x80,0x80,0x05,0x80,0x0E,0x0D,0x80
0x80,0x0E,0x0F,0x80,0x0E,0x0E,0x80,0x0E
*-------------------------------------------
*/
// Four bit reverse nybble
extern unsigned char BitRev[16];
/*------------------------------------------
*Mrag Table. Contains pairs of bytes for
*Mrags for lines 0-27 in mags 1-8.
* While this is convenient it is a bit extravagant and might be a candidate for coding
* because it is a simple bit manipulation task.
*/
#define LenMragMagEntry 56
extern const unsigned char MragTable[8][LenMragMagEntry];
/*----------------------------------------------*/
extern const unsigned char TL[];
extern const unsigned char TH[];
/*------------------------------------------*/
/*
*CRC lookup tables
*high byte table
TH 0x00,0x52,0x25,0x77,0x4A,0x18,0x6F,0x3D
0x94,0xC6,0xB1,0xE3,0xDE,0x8C,0xFB,0xA9
0x28,0x7A,0x0D,0x5F,0x62,0x30,0x47,0x15
0xBC,0xEE,0x99,0xCB,0xF6,0xA4,0xD3,0x81
0x50,0x02,0x75,0x27,0x1A,0x48,0x3F,0x6D
0xC4,0x96,0xE1,0xB3,0x8E,0xDC,0xAB,0xF9
0x78,0x2A,0x5D,0x0F,0x32,0x60,0x17,0x45
0xEC,0xBE,0xC9,0x9B,0xA6,0xF4,0x83,0xD1
0xA0,0xF2,0x85,0xD7,0xEA,0xB8,0xCF,0x9D
0x34,0x66,0x11,0x43,0x7E,0x2C,0x5B,0x09
0x88,0xDA,0xAD,0xFF,0xC2,0x90,0xE7,0xB5
0x1C,0x4E,0x39,0x6B,0x56,0x04,0x73,0x21
0xF0,0xA2,0xD5,0x87,0xBA,0xE8,0x9F,0xCD
0x64,0x36,0x41,0x13,0x2E,0x7C,0x0B,0x59
0xD8,0x8A,0xFD,0xAF,0x92,0xC0,0xB7,0xE5
0x4C,0x1E,0x69,0x3B,0x06,0x54,0x23,0x71
0x40,0x12,0x65,0x37,0x0A,0x58,0x2F,0x7D
0xD4,0x86,0xF1,0xA3,0x9E,0xCC,0xBB,0xE9
0x68,0x3A,0x4D,0x1F,0x22,0x70,0x07,0x55
0xFC,0xAE,0xD9,0x8B,0xB6,0xE4,0x93,0xC1
0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,0xF3,0x79,0xF1
0x89,0x01,0x8B,0x03,0x8D,0x05,0x8F,0x07
0x81,0x09,0x83,0x0B,0x85,0x0D,0x87,0x0F
0x98,0x10,0x9A,0x12,0x9C,0x14,0x9E,0x16
0x90,0x18,0x92,0x1A,0x94,0x1C,0x96,0x1E
0xAB,0x23,0xA9,0x21,0xAF,0x27,0xAD,0x25
0xA3,0x2B,0xA1,0x29,0xA7,0x2F,0xA5,0x2D
0xBA,0x32,0xB8,0x30,0xBE,0x36,0xBC,0x34
0xB2,0x3A,0xB0,0x38,0xB6,0x3E,0xB4,0x3C
0xCD,0x45,0xCF,0x47,0xC9,0x41,0xCB,0x43
0xC5,0x4D,0xC7,0x4F,0xC1,0x49,0xC3,0x4B
0xDC,0x54,0xDE,0x56,0xD8,0x50,0xDA,0x52
0xD4,0x5C,0xD6,0x5E,0xD0,0x58,0xD2,0x5A
0xEF,0x67,0xED,0x65,0xEB,0x63,0xE9,0x61
0xE7,0x6F,0xE5,0x6D,0xE3,0x6B,0xE1,0x69
0xFE,0x76,0xFC,0x74,0xFA,0x72,0xF8,0x70
0xF6,0x7E,0xF4,0x7C,0xF2,0x7A,0xF0,0x78
*---------------------------------------------------------------------
*/
#endif