/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to event.h

  • Committer: Suren A. Chilingaryan
  • Date: 2015-04-20 20:01:04 UTC
  • Revision ID: csa@suren.me-20150420200104-b5xny65io8lvoz3w
Big redign of model structures

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
#include "pcilib.h"
5
5
 
 
6
typedef struct {
 
7
    size_t max_events;
 
8
    pcilib_timeout_t duration;
 
9
} pcilib_autostop_parameters_t;
 
10
 
 
11
typedef struct {
 
12
    pcilib_event_rawdata_callback_t callback;
 
13
    void *user;
 
14
} pcilib_rawdata_parameters_t;
 
15
 
 
16
typedef struct {
 
17
    size_t max_threads;
 
18
} pcilib_parallel_parameters_t;
 
19
 
 
20
typedef struct {
 
21
    pcilib_autostop_parameters_t autostop;
 
22
    pcilib_rawdata_parameters_t rawdata;
 
23
    pcilib_parallel_parameters_t parallel;
 
24
} pcilib_event_parameters_t;
 
25
 
 
26
struct pcilib_event_context_s {
 
27
    pcilib_event_parameters_t params;
 
28
    pcilib_t *pcilib;
 
29
};
 
30
 
 
31
typedef struct {
 
32
    pcilib_event_t evid;
 
33
    const char *name;
 
34
    const char *description;
 
35
} pcilib_event_description_t;
 
36
 
 
37
typedef struct {
 
38
    pcilib_event_data_type_t data_type;
 
39
    pcilib_event_t evid;
 
40
    const char *name;
 
41
    const char *description;
 
42
} pcilib_event_data_type_description_t;
 
43
 
 
44
typedef enum {
 
45
    PCILIB_STREAMING_STOP = 0,          /**< stop streaming */
 
46
    PCILIB_STREAMING_CONTINUE = 1,      /**< wait the default DMA timeout for a new data */
 
47
    PCILIB_STREAMING_WAIT = 2,          /**< wait the specified timeout for a new data */
 
48
    PCILIB_STREAMING_CHECK = 3,         /**< do not wait for the data, bail out imideatly if no data ready */
 
49
    PCILIB_STREAMING_FAIL = 4,          /**< fail if data is not available on timeout */
 
50
    PCILIB_STREAMING_REQ_FRAGMENT = 5,  /**< only fragment of a packet is read, wait for next fragment and fail if no data during DMA timeout */
 
51
    PCILIB_STREAMING_REQ_PACKET = 6,    /**< wait for next packet and fail if no data during the specified timeout */
 
52
    PCILIB_STREAMING_TIMEOUT_MASK = 3   /**< mask specifying all timeout modes */
 
53
} pcilib_streaming_action_t;
6
54
 
7
55
/*
8
56
 * get_data: This call is used by get_data and copy_data functions of public  
16
64
 * returned instead. The copy can be managed by the envelope function.
17
65
 */
18
66
 
19
 
struct pcilib_event_api_description_s {
20
 
    const char *title;
21
 
    
 
67
typedef struct {
22
68
    pcilib_context_t *(*init)(pcilib_t *ctx);
23
69
    void (*free)(pcilib_context_t *ctx);
24
70
 
35
81
 
36
82
    int (*get_data)(pcilib_context_t *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, size_t arg_size, void *arg, size_t *size, void **data);
37
83
    int (*return_data)(pcilib_context_t *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, void *data);
38
 
};
39
 
 
40
 
 
41
 
typedef struct {
42
 
    size_t max_events;
43
 
    pcilib_timeout_t duration;
44
 
} pcilib_autostop_parameters_t;
45
 
 
46
 
typedef struct {
47
 
    pcilib_event_rawdata_callback_t callback;
48
 
    void *user;
49
 
} pcilib_rawdata_parameters_t;
50
 
 
51
 
typedef struct {
52
 
    size_t max_threads;
53
 
} pcilib_parallel_parameters_t;
54
 
 
55
 
typedef struct {
56
 
    pcilib_autostop_parameters_t autostop;
57
 
    pcilib_rawdata_parameters_t rawdata;
58
 
    pcilib_parallel_parameters_t parallel;
59
 
} pcilib_event_parameters_t;
60
 
 
61
 
struct pcilib_event_context_s {
62
 
    pcilib_event_parameters_t params;
63
 
    pcilib_t *pcilib;
64
 
};
 
84
} pcilib_event_api_description_t;
65
85
 
66
86
 
67
87
int pcilib_init_event_engine(pcilib_t *ctx);
68
88
 
 
89
 
69
90
#endif /* _PCILIB_EVENT_H */