openpcd/openpicc/application/decoder.h @ master
1 |
#ifndef _DECODER_H
|
---|---|
2 |
#define _DECODER_H
|
3 |
|
4 |
struct decoder_state; |
5 |
|
6 |
struct decoder_algo { |
7 |
u_int8_t oversampling_rate; |
8 |
u_int8_t bits_per_sampled_char; |
9 |
u_int32_t bytesample_mask; |
10 |
int (*decode_sample)(const u_int32_t sample, u_int8_t *data); |
11 |
u_int32_t (*get_next_bytesample)(struct decoder_state *st, u_int8_t *parity_sample); |
12 |
};
|
13 |
|
14 |
struct decoder_state { |
15 |
struct decoder_algo *algo; |
16 |
u_int8_t bit_ofs; |
17 |
const char *buf; |
18 |
const u_int32_t *buf32; |
19 |
};
|
20 |
|
21 |
extern int decoder_register(int algnum, struct decoder_algo *algo); |
22 |
extern int decoder_decode(u_int8_t algo, const char *sample_buf, |
23 |
int sample_buf_size, unsigned char *data_buf); |
24 |
extern void decoder_init(void); |
25 |
|
26 |
#define DECODER_MILLER 0
|
27 |
#define DECODER_NRZL 1
|
28 |
#define DECODER_NUM_ALGOS 2
|
29 |
|
30 |
extern struct decoder_algo nrzl_decoder; |
31 |
extern struct decoder_algo miller_decoder; |
32 |
|
33 |
#endif
|