forked from mutability/dump978
-
Notifications
You must be signed in to change notification settings - Fork 4
/
fec.h
44 lines (38 loc) · 1.71 KB
/
fec.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
//
// Copyright 2015, Oliver Jowett <[email protected]>
//
// This file is free software: you may copy, redistribute and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation, either version 2 of the License, or (at your
// option) any later version.
//
// This file is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef DUMP978_FEC_H
#define DUMP978_FEC_H
/* Initialize. Must be called once before correct_* */
void init_fec(void);
/* Correct a downlink frame.
*
* 'to' should contain LONG_FRAME_BYTES of data.
* Errors are corrected in-place within 'to'.
* Returns -1 on uncorrectable errors, 1 for a valid basic frame, 2 for a valid long frame.
* Sets *rs_errors to the number of corrected errors, or 9999 if uncorrectable.
*/
int correct_adsb_frame(uint8_t *to, int *rs_errors);
/* Deinterleave and correct an uplink frame.
*
* 'from' should point to UPLINK_FRAME_BYTES of interleaved input data
* 'to' should point to UPLINK_FRAME_BYTES of space for output data
* (only the first UPLINK_FRAME_DATA_BYTES will contain useful data)
* Blocks are deinterleaved and corrected, and written to 'to'.
* Returns -1 on uncorrectable errors, 1 for a valid uplink frame.
* Sets *rs_errors to the number of corrected errors, or 9999 if uncorrectable.
*/
int correct_uplink_frame(uint8_t *from, uint8_t *to, int *rs_errors);
#endif