/alps/ufodecode

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/ufodecode

« back to all changes in this revision

Viewing changes to src/ufodecode.h

  • Committer: Matthias Vogelgesang
  • Date: 2012-07-17 14:28:58 UTC
  • Revision ID: matthias.vogelgesang@kit.edu-20120717142858-9gsb7mux5vttdt31
Commit version 0.2 of libufodecode

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
#include <inttypes.h>
5
5
 
6
 
typedef struct ufo_decoder_t *ufo_decoder;
 
6
typedef struct _UfoDecoder UfoDecoder;
 
7
 
 
8
typedef struct {
 
9
    unsigned    dummy1:2;
 
10
    unsigned    fsm_master_readout:4;
 
11
    unsigned    dummy2:4;
 
12
    unsigned    fsm_daq:4;
 
13
    unsigned    pixel_full:1;
 
14
    unsigned    control_lock:1;
 
15
    unsigned    data_lock:16;
 
16
} UfoDecoderStatus1;
 
17
 
 
18
typedef struct {
 
19
    unsigned    end_of_frames:1;
 
20
    unsigned    busy_or:1;
 
21
    unsigned    busy_ddr:1;
 
22
    unsigned    busy_interl:1;
 
23
    unsigned    error_status:4;   /* What the heck? */
 
24
    unsigned    data_fifo_read_count:10;
 
25
    unsigned    data_fifo_full:1;
 
26
    unsigned    data_fifo_empty:1;
 
27
    unsigned    dummy:2;
 
28
    unsigned    ddr_fifo_write_count:8;
 
29
    unsigned    ddr_fifo_full:1;
 
30
    unsigned    ddr_fifo_empty:1;
 
31
} UfoDecoderStatus2;
 
32
 
 
33
typedef struct {
 
34
    unsigned    dummy:2;
 
35
    unsigned    row_counter:10;
 
36
    unsigned    pixel_counter:8;
 
37
    unsigned    ddr_read:4;
 
38
    unsigned    ddr_write:4;
 
39
    unsigned    ddr_arbiter:4;
 
40
} UfoDecoderStatus3;
 
41
 
 
42
typedef struct {
 
43
    uint32_t        frame_number;
 
44
    uint32_t        time_stamp;
 
45
    uint32_t        n_rows;
 
46
    uint8_t         n_skipped_rows;
 
47
    uint16_t        cmosis_start_address;
 
48
    union {
 
49
        uint32_t            bits;
 
50
        UfoDecoderStatus1   desc;
 
51
    }                       status1;
 
52
    union {
 
53
        uint32_t            bits; 
 
54
        UfoDecoderStatus2   desc;
 
55
    }                       status2;
 
56
    union {
 
57
        uint32_t            bits; 
 
58
        UfoDecoderStatus3   desc;
 
59
    }                       status3;
 
60
} UfoDecoderMeta;
7
61
 
8
62
#ifdef __cplusplus
9
63
extern "C" {
10
64
#endif
11
65
 
12
 
ufo_decoder ufo_decoder_new             (int32_t         height, 
 
66
UfoDecoder *ufo_decoder_new             (int32_t         height, 
13
67
                                         uint32_t        width, 
14
68
                                         uint32_t       *raw, 
15
69
                                         size_t          num_bytes);
16
 
void        ufo_decoder_free            (ufo_decoder     decoder);
17
 
size_t      ufo_decoder_decode_frame    (ufo_decoder     decoder, 
 
70
void        ufo_decoder_free            (UfoDecoder     *decoder);
 
71
size_t      ufo_decoder_decode_frame    (UfoDecoder     *decoder, 
18
72
                                         uint32_t       *raw, 
19
73
                                         size_t          num_bytes, 
20
74
                                         uint16_t       *pixels, 
21
 
                                         uint32_t       *num_rows, 
22
 
                                         uint32_t       *frame_number, 
23
 
                                         uint32_t       *time_stamp, 
24
 
                                         uint16_t       *cmask);
25
 
void        ufo_decoder_set_raw_data    (ufo_decoder     decoder,
 
75
                                         UfoDecoderMeta *meta);
 
76
void        ufo_decoder_set_raw_data    (UfoDecoder     *decoder,
26
77
                                         uint32_t       *raw,
27
78
                                         size_t          num_bytes);
28
 
int         ufo_decoder_get_next_frame  (ufo_decoder     decoder, 
 
79
int         ufo_decoder_get_next_frame  (UfoDecoder     *decoder, 
29
80
                                         uint16_t      **pixels, 
30
 
                                         uint32_t       *num_rows, 
31
 
                                         uint32_t       *frame_number, 
32
 
                                         uint32_t       *time_stamp, 
33
 
                                         uint16_t       *cmask);
 
81
                                         UfoDecoderMeta *meta_data);
34
82
void        ufo_deinterlace_interpolate (const uint16_t *frame_in, 
35
83
                                         uint16_t       *frame_out, 
36
84
                                         int             width,