summaryrefslogtreecommitdiffstats
path: root/event.h
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-04-20 22:01:04 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-04-20 22:01:04 +0200
commit77c4d6e67debf0e729734d882df033c4c0f5b0c3 (patch)
tree4a59e86332d6cc78fc5c97110ecba281b0f67bc9 /event.h
parent0002c0cc260a6a8e2b6c53f19ae99a625eca4355 (diff)
downloadpcitool-77c4d6e67debf0e729734d882df033c4c0f5b0c3.tar.gz
pcitool-77c4d6e67debf0e729734d882df033c4c0f5b0c3.tar.bz2
pcitool-77c4d6e67debf0e729734d882df033c4c0f5b0c3.tar.xz
pcitool-77c4d6e67debf0e729734d882df033c4c0f5b0c3.zip
Big redign of model structures
Diffstat (limited to 'event.h')
-rw-r--r--event.h81
1 files changed, 51 insertions, 30 deletions
diff --git a/event.h b/event.h
index 0675b94..a71d761 100644
--- a/event.h
+++ b/event.h
@@ -3,6 +3,54 @@
#include "pcilib.h"
+typedef struct {
+ size_t max_events;
+ pcilib_timeout_t duration;
+} pcilib_autostop_parameters_t;
+
+typedef struct {
+ pcilib_event_rawdata_callback_t callback;
+ void *user;
+} pcilib_rawdata_parameters_t;
+
+typedef struct {
+ size_t max_threads;
+} pcilib_parallel_parameters_t;
+
+typedef struct {
+ pcilib_autostop_parameters_t autostop;
+ pcilib_rawdata_parameters_t rawdata;
+ pcilib_parallel_parameters_t parallel;
+} pcilib_event_parameters_t;
+
+struct pcilib_event_context_s {
+ pcilib_event_parameters_t params;
+ pcilib_t *pcilib;
+};
+
+typedef struct {
+ pcilib_event_t evid;
+ const char *name;
+ const char *description;
+} pcilib_event_description_t;
+
+typedef struct {
+ pcilib_event_data_type_t data_type;
+ pcilib_event_t evid;
+ const char *name;
+ const char *description;
+} pcilib_event_data_type_description_t;
+
+typedef enum {
+ PCILIB_STREAMING_STOP = 0, /**< stop streaming */
+ PCILIB_STREAMING_CONTINUE = 1, /**< wait the default DMA timeout for a new data */
+ PCILIB_STREAMING_WAIT = 2, /**< wait the specified timeout for a new data */
+ PCILIB_STREAMING_CHECK = 3, /**< do not wait for the data, bail out imideatly if no data ready */
+ PCILIB_STREAMING_FAIL = 4, /**< fail if data is not available on timeout */
+ PCILIB_STREAMING_REQ_FRAGMENT = 5, /**< only fragment of a packet is read, wait for next fragment and fail if no data during DMA timeout */
+ PCILIB_STREAMING_REQ_PACKET = 6, /**< wait for next packet and fail if no data during the specified timeout */
+ PCILIB_STREAMING_TIMEOUT_MASK = 3 /**< mask specifying all timeout modes */
+} pcilib_streaming_action_t;
/*
* get_data: This call is used by get_data and copy_data functions of public
@@ -16,9 +64,7 @@
* returned instead. The copy can be managed by the envelope function.
*/
-struct pcilib_event_api_description_s {
- const char *title;
-
+typedef struct {
pcilib_context_t *(*init)(pcilib_t *ctx);
void (*free)(pcilib_context_t *ctx);
@@ -35,35 +81,10 @@ struct pcilib_event_api_description_s {
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);
int (*return_data)(pcilib_context_t *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, void *data);
-};
-
-
-typedef struct {
- size_t max_events;
- pcilib_timeout_t duration;
-} pcilib_autostop_parameters_t;
-
-typedef struct {
- pcilib_event_rawdata_callback_t callback;
- void *user;
-} pcilib_rawdata_parameters_t;
-
-typedef struct {
- size_t max_threads;
-} pcilib_parallel_parameters_t;
-
-typedef struct {
- pcilib_autostop_parameters_t autostop;
- pcilib_rawdata_parameters_t rawdata;
- pcilib_parallel_parameters_t parallel;
-} pcilib_event_parameters_t;
-
-struct pcilib_event_context_s {
- pcilib_event_parameters_t params;
- pcilib_t *pcilib;
-};
+} pcilib_event_api_description_t;
int pcilib_init_event_engine(pcilib_t *ctx);
+
#endif /* _PCILIB_EVENT_H */