From d852b637800b0f91b9c921cda17311bc203939e5 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Thu, 25 May 2023 23:10:58 +0200 Subject: Move event api definition to events.h --- events.h | 35 +++++++++++++++++++++++++++++++++++ model.c | 35 ----------------------------------- pcidev.h | 6 ------ registers.c | 1 - 4 files changed, 35 insertions(+), 42 deletions(-) diff --git a/events.h b/events.h index 5d09d74..2c19713 100644 --- a/events.h +++ b/events.h @@ -4,6 +4,7 @@ #include #include + #include "pcidev.h" pcilib_context_t *pcidev_init(pcilib_t *pcilib); @@ -21,4 +22,38 @@ int pcidev_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, void int pcidev_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 **buf); int pcidev_return_data(pcilib_context_t *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, void *data); + +# ifdef _PCIDEV_MODEL_C +static const pcilib_event_description_t pcidev_events[] = { + {PCILIB_EVENT0, "new_event", ""}, + {0, NULL, NULL} +}; + +static const pcilib_event_data_type_description_t pcidev_data_types[] = { + {PCIDEV_RAW_DATA, PCILIB_EVENT0, "raw", "raw data from device" }, + {PCIDEV_STANDARD_DATA, PCILIB_EVENT0, "std", "processed data" }, + {0, 0, NULL, NULL} +}; + + +pcilib_event_api_description_t pcidev_event_api = { + PCIDEV_VERSION, + + pcidev_init, + pcidev_free, + + pcidev_init_dma, + + pcidev_reset, + pcidev_start, + pcidev_stop, + pcidev_trigger, + + pcidev_stream, + NULL, + pcidev_get_data, + pcidev_return_data +}; +# endif /* _PCIDEV_MODEL_C */ + #endif /* _PCIDEV_EVENTS_H */ diff --git a/model.c b/model.c index 28391a2..765a885 100644 --- a/model.c +++ b/model.c @@ -13,41 +13,6 @@ #include "events.h" #include "model.h" - - - -static const pcilib_event_description_t pcidev_events[] = { - {PCILIB_EVENT0, "new_event", ""}, - {0, NULL, NULL} -}; - -static const pcilib_event_data_type_description_t pcidev_data_types[] = { - {PCIDEV_RAW_DATA, PCILIB_EVENT0, "raw", "raw data from device" }, - {PCIDEV_STANDARD_DATA, PCILIB_EVENT0, "std", "processed data" }, - {0, 0, NULL, NULL} -}; - - -pcilib_event_api_description_t pcidev_event_api = { - PCIDEV_VERSION, - - pcidev_init, - pcidev_free, - - pcidev_init_dma, - - pcidev_reset, - pcidev_start, - pcidev_stop, - pcidev_trigger, - - pcidev_stream, - NULL, - pcidev_get_data, - pcidev_return_data -}; - - static const pcilib_model_description_t pcidev_models[] = {{ PCILIB_EVENT_INTERFACE_VERSION, &pcidev_event_api, diff --git a/pcidev.h b/pcidev.h index 55700c2..0563bf7 100644 --- a/pcidev.h +++ b/pcidev.h @@ -3,16 +3,11 @@ typedef struct pcidev_s pcidev_t; -typedef struct { - unsigned int size; -} pcidev_image_dimensions_t; - typedef enum { PCIDEV_STANDARD_DATA = 0, PCIDEV_RAW_DATA = 1, } pcidev_data_type_t; - typedef struct { pcilib_event_info_t info; } pcidev_event_info_t; @@ -22,7 +17,6 @@ extern "C" { #endif int pcidev_set_buffer_size(pcidev_t *ctx, int size); -pcilib_event_id_t pcidev_get_last_event_id(pcidev_t *ctx); #ifdef __cplusplus } diff --git a/registers.c b/registers.c index 1c7ce2d..e5fb09d 100644 --- a/registers.c +++ b/registers.c @@ -1,6 +1,5 @@ #define _DEFAULT_SOURCE #define _BSD_SOURCE -#define _PCIDEV_MODEL_C #include #include #include -- cgit v1.2.3