-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecc_hamming.h
148 lines (119 loc) · 6.09 KB
/
ecc_hamming.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
/*
*********************************************************************************************************
* uC/CRC
* ERROR DETECTING CODE (EDC) & ERROR CORRECTING CODE (ECC) CALCULATION UTILITIES
*
* Copyright 2007-2020 Silicon Laboratories Inc. www.silabs.com
*
* SPDX-License-Identifier: APACHE-2.0
*
* This software is subject to an open source license and is distributed by
* Silicon Laboratories Inc. pursuant to the terms of the Apache License,
* Version 2.0 available at www.apache.org/licenses/LICENSE-2.0.
*
*********************************************************************************************************
*/
/*
*********************************************************************************************************
*
* HAMMING CODE CALCULATION
*
* Filename : ecc_hamming.h
* Version : V1.10.00
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* MODULE
*********************************************************************************************************
*/
#ifndef ECC_HAMMING_PRESENT
#define ECC_HAMMING_PRESENT
/*
*********************************************************************************************************
* INCLUDE FILES
*********************************************************************************************************
*/
#include <cpu.h>
#include <cpu_core.h>
#include <lib_def.h>
#include <lib_mem.h>
#include "crc_cfg.h"
#include "ecc.h"
/*
*********************************************************************************************************
* EXTERNS
*********************************************************************************************************
*/
#ifdef ECC_HAMMING_MODULE
#define ECC_HAMMING_EXT
#else
#define ECC_HAMMING_EXT extern
#endif
/*
*********************************************************************************************************
* DEFINES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* DATA TYPES
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* GLOBAL VARIABLES
*********************************************************************************************************
*/
extern const ECC_CALC Hamming_ECC;
/*
*********************************************************************************************************
* MACRO'S
*********************************************************************************************************
*/
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
void Hamming_Calc (void *p_buf, /* Calc Hamming code. */
CPU_SIZE_T len,
void *p_buf_ext,
CPU_SIZE_T len_ext,
CPU_INT08U *p_ecc,
ECC_ERR *p_err);
CPU_INT08U Hamming_Chk (void *p_buf, /* Chk Hamming code. */
CPU_SIZE_T len,
void *p_buf_ext,
CPU_SIZE_T len_ext,
CPU_INT08U *p_ecc,
ECC_ERR_LOC err_loc_tbl[],
CPU_INT08U err_loc_tbl_size,
ECC_ERR *p_err);
void Hamming_Correct(void *p_buf, /* Correct errors. */
CPU_SIZE_T len,
void *p_buf_ext,
CPU_SIZE_T len_ext,
CPU_INT08U *p_ecc,
ECC_ERR *p_err);
/*
*********************************************************************************************************
* CONFIGURATION ERRORS
*********************************************************************************************************
*/
#ifndef ECC_HAMMING_CFG_ARG_CHK_EXT_EN
#error "ECC_HAMMING_CFG_ARG_CHK_EXT_EN not #define'd in 'crc_cfg.h'"
#error " [MUST be DEF_ENABLED ] "
#error " [ || DEF_DISABLED] "
#elif ((ECC_HAMMING_CFG_ARG_CHK_EXT_EN != DEF_DISABLED) && \
(ECC_HAMMING_CFG_ARG_CHK_EXT_EN != DEF_ENABLED ))
#error "ECC_HAMMING_CFG_ARG_CHK_EXT_EN illegally #define'd in 'crc_cfg.h'"
#error " [MUST be DEF_ENABLED ] "
#error " [ || DEF_DISABLED] "
#endif
/*
*********************************************************************************************************
* MODULE END
*********************************************************************************************************
*/
#endif /* End of HAMMING module include. */