diff options
author | Suren A. Chilingaryan <csa@suren.me> | 2014-12-19 00:14:21 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@suren.me> | 2014-12-19 00:14:21 +0100 |
commit | a640c40c6bcf4bad0b78e0ea6ea04f2a5f3f877f (patch) | |
tree | 7a6b899c130510e3cca87c23b26a5a1ffc033f20 /kapture | |
parent | 0e16eeef08ed9b27f0fbc7f02a562a81e10c4119 (diff) | |
download | pcitool-a640c40c6bcf4bad0b78e0ea6ea04f2a5f3f877f.tar.gz pcitool-a640c40c6bcf4bad0b78e0ea6ea04f2a5f3f877f.tar.bz2 pcitool-a640c40c6bcf4bad0b78e0ea6ea04f2a5f3f877f.tar.xz pcitool-a640c40c6bcf4bad0b78e0ea6ea04f2a5f3f877f.zip |
Initial implementation of IPEDMA, dummy driver for KAPTURE, start of API changes
Diffstat (limited to 'kapture')
-rw-r--r-- | kapture/CMakeLists.txt | 9 | ||||
-rw-r--r-- | kapture/kapture.c | 62 | ||||
-rw-r--r-- | kapture/kapture.h | 6 | ||||
-rw-r--r-- | kapture/model.h | 81 | ||||
-rw-r--r-- | kapture/private.h | 10 |
5 files changed, 168 insertions, 0 deletions
diff --git a/kapture/CMakeLists.txt b/kapture/CMakeLists.txt new file mode 100644 index 0000000..af74edd --- /dev/null +++ b/kapture/CMakeLists.txt @@ -0,0 +1,9 @@ +include_directories( + ${CMAKE_SOURCE_DIR} + ${UFODECODE_INCLUDE_DIRS} +) + +set(HEADERS ${HEADERS} model.h) + +add_library(kapture STATIC kapture.c) + diff --git a/kapture/kapture.c b/kapture/kapture.c new file mode 100644 index 0000000..4384592 --- /dev/null +++ b/kapture/kapture.c @@ -0,0 +1,62 @@ +#define _KAPTURE_C +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <sys/time.h> +#include <pthread.h> +#include <assert.h> + +#include "../tools.h" +#include "../error.h" +#include "../event.h" + +#include "pcilib.h" +#include "model.h" +#include "kapture.h" +#include "private.h" + + +pcilib_context_t *kapture_init(pcilib_t *vctx) { + kapture_t *ctx = malloc(sizeof(kapture_t)); + + if (ctx) { + memset(ctx, 0, sizeof(kapture_t)); + } + + return ctx; +} + +void kapture_free(pcilib_context_t *vctx) { + if (vctx) { + kapture_t *ctx = (kapture_t*)vctx; + kapture_stop(vctx, PCILIB_EVENT_FLAGS_DEFAULT); + free(ctx); + } +} + +int kapture_reset(pcilib_context_t *ctx) { +} + +int kapture_start(pcilib_context_t *ctx, pcilib_event_t event_mask, pcilib_event_flags_t flags) { +} + +int kapture_stop(pcilib_context_t *ctx, pcilib_event_flags_t flags) { +} + +int kapture_trigger(pcilib_context_t *ctx, pcilib_event_t event, size_t trigger_size, void *trigger_data) { +} + +int kapture_stream(pcilib_context_t *ctx, pcilib_event_callback_t callback, void *user) { +} + +int kapture_next_event(pcilib_context_t *ctx, pcilib_timeout_t timeout, pcilib_event_id_t *evid, size_t info_size, pcilib_event_info_t *info) { +} + +int kapture_get(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 kapture_return(pcilib_context_t *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, void *data) { +} + + diff --git a/kapture/kapture.h b/kapture/kapture.h new file mode 100644 index 0000000..3944b8c --- /dev/null +++ b/kapture/kapture.h @@ -0,0 +1,6 @@ +#ifndef _KAPTURE_H +#define _KAPTURE_H + +typedef struct kapture_s kapture_t; + +#endif /* _KAPTURE_H */ diff --git a/kapture/model.h b/kapture/model.h new file mode 100644 index 0000000..b45969a --- /dev/null +++ b/kapture/model.h @@ -0,0 +1,81 @@ +#ifndef _KAPTURE_MODEL_H +#define _KAPTURE_MODEL_H + +#include <stdio.h> + +#include "../pcilib.h" + + +#define KAPTURE_REGISTER_SPACE 0x9000 + +#ifdef _KAPTURE_C +pcilib_register_bank_description_t kapture_register_banks[] = { +// { PCILIB_REGISTER_BANK0, PCILIB_BAR0, 0x0200, PCILIB_DEFAULT_PROTOCOL , KAPTURE_REGISTER_SPACE, KAPTURE_REGISTER_SPACE, PCILIB_LITTLE_ENDIAN, 32, PCILIB_LITTLE_ENDIAN, "0x%lx", "fpga", "KAPTURE Registers" }, + { PCILIB_REGISTER_BANK_DMA, PCILIB_BAR0, 0x0200, PCILIB_DEFAULT_PROTOCOL , 0, 0, PCILIB_LITTLE_ENDIAN, 32, PCILIB_LITTLE_ENDIAN, "0x%lx", "dma", "DMA Registers"}, + { 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } +}; + +pcilib_register_description_t kapture_registers[] = { +{0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL} +}; + +pcilib_register_range_t kapture_register_ranges[] = { + {0, 0, 0, 0} +}; + +pcilib_event_description_t kapture_events[] = { + {PCILIB_EVENT0, "event", ""}, + {0, NULL, NULL} +}; + +pcilib_event_data_type_description_t kapture_data_types[] = { + {PCILIB_EVENT_RAW_DATA, PCILIB_EVENT0, "raw", "raw data from kapture" }, + {0, 0, NULL, NULL} +}; + +#else +extern pcilib_register_description_t kapture_registers[]; +extern pcilib_register_bank_description_t kapture_register_banks[]; +extern pcilib_register_range_t kapture_register_ranges[]; +extern pcilib_event_description_t kapture_events[]; +extern pcilib_event_data_type_description_t kapture_data_types[]; +#endif + + +pcilib_context_t *kapture_init(pcilib_t *pcilib); +void kapture_free(pcilib_context_t *ctx); + +int kapture_reset(pcilib_context_t *ctx); +int kapture_start(pcilib_context_t *ctx, pcilib_event_t event_mask, pcilib_event_flags_t flags); +int kapture_stop(pcilib_context_t *ctx, pcilib_event_flags_t flags); +int kapture_trigger(pcilib_context_t *ctx, pcilib_event_t event, size_t trigger_size, void *trigger_data); +int kapture_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, void *user); +int kapture_next_event(pcilib_context_t *vctx, pcilib_timeout_t timeout, pcilib_event_id_t *evid, size_t info_size, pcilib_event_info_t *info); +int kapture_get(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 kapture_return(pcilib_context_t *ctx, pcilib_event_id_t event_id, pcilib_event_data_type_t data_type, void *data); + +#ifdef _KAPTURE_C +pcilib_event_api_description_t kapture_api = { + "kapture", + + kapture_init, + kapture_free, + + NULL, + + kapture_reset, + kapture_start, + kapture_stop, + kapture_trigger, + + kapture_stream, + kapture_next_event, + kapture_get, + kapture_return +}; +#else +extern pcilib_event_api_description_t kapture_api; +#endif + + +#endif /* _KAPTURE_MODEL_H */ diff --git a/kapture/private.h b/kapture/private.h new file mode 100644 index 0000000..bf084c3 --- /dev/null +++ b/kapture/private.h @@ -0,0 +1,10 @@ +#ifndef _KAPTURE_PRIVATE_H +#define _KAPTURE_PRIVATE_H + +struct kapture_s { + pcilib_context_t event; + +}; + + +#endif /* _KAPTURE_PRIVATE_H */ |