#include <aversive.h>
Go to the source code of this file.
Defines | |
#define | P_MASK 0x0000808B |
#define | P0_MASK 0x15555554 |
#define | P1_MASK 0x06666664 |
#define | P2_MASK 0x18787870 |
#define | P3_MASK 0x1F807F00 |
#define | P4_MASK 0x1FFF0000 |
#define | P0_EMPL 0 |
#define | P1_EMPL 1 |
#define | P2_EMPL 3 |
#define | P3_EMPL 7 |
#define | P4_EMPL 15 |
Functions | |
uint32_t | hamming_expand (uint32_t frame) |
uint32_t | hamming_shrink (uint32_t frame) |
uint32_t | hamming_process (uint32_t frame) |
uint8_t | hamming_unprocess (uint32_t frame) |
uint32_t | hamming_correct (uint32_t frame, uint8_t i) |
void | hamming_do (uint32_t *frame) |
uint8_t | hamming_undo (uint32_t *frame) |
Variables | |
uint8_t | tab_abcd [16] |
uint8_t | tab_dcba [32] |
uint8_t | tab_parity [256] |
Interface for the Hamming module.
Definition in file hamming.c.
#define P0_EMPL 0 |
#define P0_MASK 0x15555554 |
#define P1_EMPL 1 |
#define P1_MASK 0x06666664 |
#define P2_EMPL 3 |
#define P2_MASK 0x18787870 |
#define P3_EMPL 7 |
#define P3_MASK 0x1F807F00 |
#define P4_EMPL 15 |
#define P4_MASK 0x1FFF0000 |
uint32_t hamming_correct | ( | uint32_t | frame, | |
uint8_t | i | |||
) |
Definition at line 291 of file hamming.c.
References parse_symbols::l.
Referenced by hamming_undo().
void hamming_do | ( | uint32_t * | frame | ) |
Encode the frame (the 24 LSB bits) into a 29 bits frame with hamming error correction bits. The 3 MSB bits are not used.
Definition at line 299 of file hamming.c.
References hamming_expand(), and hamming_process().
uint32_t hamming_expand | ( | uint32_t | frame | ) |
Definition at line 119 of file hamming.c.
References extr32_08_2, extr32_16_mid, and tab_abcd.
Referenced by hamming_do().
uint32_t hamming_process | ( | uint32_t | frame | ) |
Definition at line 163 of file hamming.c.
References parse_symbols::l, P0_EMPL, P0_MASK, P1_EMPL, P1_MASK, P2_EMPL, P2_MASK, P3_EMPL, P3_MASK, P4_EMPL, P4_MASK, and tab_parity.
Referenced by hamming_do().
uint32_t hamming_shrink | ( | uint32_t | frame | ) |
uint8_t hamming_undo | ( | uint32_t * | frame | ) |
Decode the 29 bits frame into a 24 bits one. If an error occurs, the function tries to correct it and returns a positive value. If there is no error, the function returns 0.
Definition at line 306 of file hamming.c.
References hamming_correct(), hamming_shrink(), and hamming_unprocess().
uint8_t hamming_unprocess | ( | uint32_t | frame | ) |
Definition at line 218 of file hamming.c.
References parse_symbols::l, P0_EMPL, P0_MASK, P1_EMPL, P1_MASK, P2_EMPL, P2_MASK, P3_EMPL, P3_MASK, P4_EMPL, P4_MASK, and tab_parity.
Referenced by hamming_undo().
uint8_t tab_abcd[16] |
Initial value:
{ 0, 4, 16, 20, 32, 36, 48, 52, 64, 68, 80, 84, 96, 100, 112, 116 }
Definition at line 56 of file hamming.c.
Referenced by hamming_expand().
uint8_t tab_dcba[32] |
uint8_t tab_parity[256] |
Initial value:
{ 0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,1,0,0,1,0,1,1,0 }
Definition at line 112 of file hamming.c.
Referenced by hamming_process(), and hamming_unprocess().