From 8d3ad26d8331c43659d0d4e77e8a50fbc3cfc1e4 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Mon, 27 Apr 2015 01:54:44 +0200 Subject: Further adjustments to get ready for independent event plugins --- pcilib/CMakeLists.txt | 6 +++--- pcilib/config.c | 37 ------------------------------------- pcilib/config.h | 17 ----------------- pcilib/config.h.in | 3 +++ pcilib/dma.h | 4 ++++ pcilib/error.c | 2 +- pcilib/event.h | 3 +++ pcilib/export.c | 38 ++++++++++++++++++++++++++++++++++++++ pcilib/export.h | 17 +++++++++++++++++ pcilib/model.h | 4 +++- pcilib/pci.h | 3 +-- 11 files changed, 73 insertions(+), 61 deletions(-) delete mode 100644 pcilib/config.c delete mode 100644 pcilib/config.h create mode 100644 pcilib/config.h.in create mode 100644 pcilib/export.c create mode 100644 pcilib/export.h (limited to 'pcilib') diff --git a/pcilib/CMakeLists.txt b/pcilib/CMakeLists.txt index c5297ab..df3dcd9 100644 --- a/pcilib/CMakeLists.txt +++ b/pcilib/CMakeLists.txt @@ -3,8 +3,8 @@ include_directories( ${CMAKE_SOURCE_DIR}/pcilib ) -set(HEADERS pcilib.h pci.h config.h model.h bank.h register.h kmem.h irq.h dma.h event.h tools.h error.h) -add_library(pcilib SHARED pci.c config.c model.c bank.c register.c kmem.c irq.c dma.c event.c tools.c error.c) +set(HEADERS pcilib.h pci.h export.h model.h bank.h register.h kmem.h irq.h dma.h event.h tools.h error.h config.h) +add_library(pcilib SHARED pci.c export.c model.c bank.c register.c kmem.c irq.c dma.c event.c tools.c error.c) target_link_libraries(pcilib dma protocols ${CMAKE_THREAD_LIBS_INIT} ${UFODECODE_LIBRARIES} ) add_dependencies(pcilib dma protocols) @@ -16,6 +16,6 @@ install(FILES pcilib.h DESTINATION include ) -install(FILES bank.h register.h dma.h event.h model.h error.h tools.h config.h +install(FILES bank.h register.h dma.h event.h model.h error.h tools.h export.h DESTINATION include/pcilib ) diff --git a/pcilib/config.c b/pcilib/config.c deleted file mode 100644 index 21a0e53..0000000 --- a/pcilib/config.c +++ /dev/null @@ -1,37 +0,0 @@ -#define _PCILIB_CONFIG_C - -#include - -#include "error.h" -#include "config.h" - -#include "protocols/default.h" - - -void (*pcilib_error)(const char *msg, ...) = pcilib_print_error; -void (*pcilib_warning)(const char *msg, ...) = pcilib_print_error; - - -const pcilib_register_protocol_description_t pcilib_protocols[] = { - { PCILIB_REGISTER_PROTOCOL_DEFAULT, &pcilib_default_protocol_api, NULL, NULL, "default", "" }, - { 0 } -}; - -#include "dma/nwl.h" -#include "dma/ipe.h" - - -const pcilib_dma_description_t pcilib_ipedma = - { &ipe_dma_api, ipe_dma_banks, ipe_dma_registers, ipe_dma_engines, NULL, NULL, "ipedma", "DMA engine developed by M. Caselle" }; - -const pcilib_dma_description_t pcilib_nwldma = - { &nwl_dma_api, nwl_dma_banks, nwl_dma_registers, NULL, NULL, NULL, "nwldma", "North West Logic DMA Engine" }; - -const pcilib_dma_description_t pcilib_dma[] = { - { &ipe_dma_api, ipe_dma_banks, ipe_dma_registers, ipe_dma_engines, NULL, NULL, "ipedma", "DMA engine developed by M. Caselle" }, - { &nwl_dma_api, nwl_dma_banks, nwl_dma_registers, NULL, NULL, NULL, "nwldma", "North West Logic DMA Engine" }, - { &nwl_dma_api, nwl_dma_banks, nwl_dma_registers, NULL, "ipecamera", NULL, "nwldma-ipe", "North West Logic DMA Engine" }, - { 0 } -}; - - diff --git a/pcilib/config.h b/pcilib/config.h deleted file mode 100644 index 710bff8..0000000 --- a/pcilib/config.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef _PCILIB_CONFIG_H -#define _PCILIB_CONFIG_H - - -#include -#include -#include - -extern const pcilib_register_protocol_description_t pcilib_protocols[]; -extern const pcilib_dma_description_t pcilib_dma[]; - -extern const pcilib_register_protocol_api_description_t pcilib_default_protocol_api; - -extern const pcilib_dma_description_t pcilib_ipedma; -extern const pcilib_dma_description_t pcilib_nwldma; - -#endif /* _PCILIB_CONFIG_H */ diff --git a/pcilib/config.h.in b/pcilib/config.h.in new file mode 100644 index 0000000..653fa56 --- /dev/null +++ b/pcilib/config.h.in @@ -0,0 +1,3 @@ +#cmakedefine PCILIB_PLUGIN_DIR "${PCILIB_PLUGIN_DIR}" +#cmakedefine PCILIB_DATA_DIR "${PCILIB_DATA_DIR}" +#cmakedefine PCILIB_MODEL_DIR "${PCILIB_MODEL_DIR}" diff --git a/pcilib/dma.h b/pcilib/dma.h index 83bc0fd..c6e240e 100644 --- a/pcilib/dma.h +++ b/pcilib/dma.h @@ -1,6 +1,10 @@ #ifndef _PCILIB_DMA_H #define _PCILIB_DMA_H +#include +#include +#include + #define PCILIB_DMA_BUFFER_INVALID ((size_t)-1) typedef struct { diff --git a/pcilib/error.c b/pcilib/error.c index f242209..9df7d9d 100644 --- a/pcilib/error.c +++ b/pcilib/error.c @@ -1,7 +1,7 @@ #include #include -#include "config.h" +#include "export.h" #include "error.h" void pcilib_print_error(const char *msg, ...) { diff --git a/pcilib/event.h b/pcilib/event.h index 93f659c..7ab3aae 100644 --- a/pcilib/event.h +++ b/pcilib/event.h @@ -2,6 +2,9 @@ #define _PCILIB_EVENT_H #include +#include + +#define PCILIB_EVENT_INTERFACE_VERSION 0 typedef struct { size_t max_events; diff --git a/pcilib/export.c b/pcilib/export.c new file mode 100644 index 0000000..2027870 --- /dev/null +++ b/pcilib/export.c @@ -0,0 +1,38 @@ +#define _PCILIB_EXPORT_C + +#include + +#include "error.h" +#include "export.h" + +#include "protocols/default.h" + + +void (*pcilib_error)(const char *msg, ...) = pcilib_print_error; +void (*pcilib_warning)(const char *msg, ...) = pcilib_print_error; + + +const pcilib_register_protocol_description_t pcilib_protocols[] = { + { PCILIB_REGISTER_PROTOCOL_DEFAULT, &pcilib_default_protocol_api, NULL, NULL, "default", "" }, + { 0 } +}; + +#include "dma/nwl.h" +#include "dma/ipe.h" + +/* +const pcilib_dma_description_t pcilib_ipedma = + { &ipe_dma_api, ipe_dma_banks, ipe_dma_registers, ipe_dma_engines, NULL, NULL, "ipedma", "DMA engine developed by M. Caselle" }; + +const pcilib_dma_description_t pcilib_nwldma = + { &nwl_dma_api, nwl_dma_banks, nwl_dma_registers, NULL, NULL, NULL, "nwldma", "North West Logic DMA Engine" }; +*/ + +const pcilib_dma_description_t pcilib_dma[] = { + { &ipe_dma_api, ipe_dma_banks, ipe_dma_registers, ipe_dma_engines, NULL, NULL, "ipedma", "DMA engine developed by M. Caselle" }, + { &nwl_dma_api, nwl_dma_banks, nwl_dma_registers, NULL, NULL, NULL, "nwldma", "North West Logic DMA Engine" }, + { &nwl_dma_api, nwl_dma_banks, nwl_dma_registers, NULL, "ipecamera", NULL, "nwldma-ipe", "North West Logic DMA Engine" }, + { 0 } +}; + + diff --git a/pcilib/export.h b/pcilib/export.h new file mode 100644 index 0000000..e2e6eca --- /dev/null +++ b/pcilib/export.h @@ -0,0 +1,17 @@ +#ifndef _PCILIB_EXPORT_H +#define _PCILIB_EXPORT_H + + +#include +#include +#include + +extern const pcilib_register_protocol_description_t pcilib_protocols[]; +extern const pcilib_dma_description_t pcilib_dma[]; + +extern const pcilib_register_protocol_api_description_t pcilib_default_protocol_api; + +extern const pcilib_dma_description_t pcilib_ipedma; +extern const pcilib_dma_description_t pcilib_nwldma; + +#endif /* _PCILIB_EXPORT_H */ diff --git a/pcilib/model.h b/pcilib/model.h index 0b18c59..a12ea1a 100644 --- a/pcilib/model.h +++ b/pcilib/model.h @@ -5,9 +5,11 @@ #include #include #include -#include +#include typedef struct { + const unsigned int interface_version; + const pcilib_event_api_description_t *api; const pcilib_dma_description_t *dma; diff --git a/pcilib/pci.h b/pcilib/pci.h index fe2ff8a..2e2b509 100644 --- a/pcilib/pci.h +++ b/pcilib/pci.h @@ -6,7 +6,6 @@ #define PCILIB_TRIGGER_TIMEOUT 100000 /**< us */ #define PCILIB_DMA_TIMEOUT 10000 /**< us */ #define PCILIB_DMA_SKIP_TIMEOUT 1000000 /**< us */ -#define PCILIB_REGISTER_TIMEOUT 10000 /**< us */ #define PCILIB_MAX_BARS 6 /**< this is defined by PCI specification */ #define PCILIB_DEFAULT_REGISTER_SPACE 1024 /**< number of registers to allocate on init */ #define PCILIB_MAX_REGISTER_BANKS 32 /**< maximum number of register banks to allocate space for */ @@ -24,7 +23,7 @@ #include "dma.h" #include "event.h" #include "model.h" -#include "config.h" +#include "export.h" struct pcilib_s { int handle; /**< file handle of device */ -- cgit v1.2.3