aversive_10-03-12/modules/encoding/hamming/hamming.c File Reference

Implementation for the Hamiing module. More...

#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]


Detailed Description

Implementation for the Hamiing module.

Interface for the Hamming module.

Todo:
use progmem to store tables !
Test:
Seems to work
This module provides functions for error detection/correction

Todo:
nothing.
Test:
Seems to work
This module provides functions for error detection/correction

Definition in file hamming.c.


Define Documentation

#define P0_EMPL   0

Definition at line 50 of file hamming.c.

Referenced by hamming_process(), and hamming_unprocess().

#define P0_MASK   0x15555554

Definition at line 44 of file hamming.c.

Referenced by hamming_process(), and hamming_unprocess().

#define P1_EMPL   1

Definition at line 51 of file hamming.c.

Referenced by hamming_process(), and hamming_unprocess().

#define P1_MASK   0x06666664

Definition at line 45 of file hamming.c.

Referenced by hamming_process(), and hamming_unprocess().

#define P2_EMPL   3

Definition at line 52 of file hamming.c.

Referenced by hamming_process(), and hamming_unprocess().

#define P2_MASK   0x18787870

Definition at line 46 of file hamming.c.

Referenced by hamming_process(), and hamming_unprocess().

#define P3_EMPL   7

Definition at line 53 of file hamming.c.

Referenced by hamming_process(), and hamming_unprocess().

#define P3_MASK   0x1F807F00

Definition at line 47 of file hamming.c.

Referenced by hamming_process(), and hamming_unprocess().

#define P4_EMPL   15

Definition at line 54 of file hamming.c.

Referenced by hamming_process(), and hamming_unprocess().

#define P4_MASK   0x1FFF0000

Definition at line 48 of file hamming.c.

Referenced by hamming_process(), and hamming_unprocess().

#define P_MASK   0x0000808B

Definition at line 42 of file hamming.c.


Function Documentation

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  ) 

Definition at line 142 of file hamming.c.

References tab_dcba.

Referenced by hamming_undo().

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().


Variable Documentation

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]

Definition at line 76 of file hamming.c.

Referenced by hamming_shrink().

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().


Generated on Fri Mar 12 06:32:06 2010 for AVR by  doxygen 1.5.6