openpcd/firmware/src/picc/decoder.h @ master
1 | 548ec55e | (no author) | #ifndef _DECODER_H
|
---|---|---|---|
2 | #define _DECODER_H
|
||
3 | |||
4 | struct decoder_state; |
||
5 | |||
6 | struct decoder_algo { |
||
7 | 373c172a | Harald Welte | uint8_t oversampling_rate; |
8 | uint8_t bits_per_sampled_char; |
||
9 | uint32_t bytesample_mask; |
||
10 | int (*decode_sample)(const uint32_t sample, uint8_t data); |
||
11 | uint32_t (*get_next_bytesample)(struct decoder_state *st, uint8_t *parity_sample); |
||
12 | 548ec55e | (no author) | };
|
13 | |||
14 | struct decoder_state { |
||
15 | struct decoder_algo *algo; |
||
16 | 373c172a | Harald Welte | uint8_t bit_ofs; |
17 | 548ec55e | (no author) | const char *buf; |
18 | 373c172a | Harald Welte | const uint32_t *buf32; |
19 | 548ec55e | (no author) | };
|
20 | |||
21 | 29d8974f | (no author) | extern int decoder_register(int algnum, struct decoder_algo *algo); |
22 | 373c172a | Harald Welte | extern int decoder_decode(uint8_t algo, const char *sample_buf, |
23 | 548ec55e | (no author) | int sample_buf_size, char *data_buf); |
24 | |||
25 | #define DECODER_MILLER 0
|
||
26 | #define DECODER_NRZL 1
|
||
27 | #define DECODER_NUM_ALGOS 2
|
||
28 | |||
29 | 29d8974f | (no author) | static struct decoder_algo nrzl_decoder; |
30 | static struct decoder_algo miller_decoder; |
||
31 | 548ec55e | (no author) | |
32 | #endif
|