summaryrefslogtreecommitdiffstats
path: root/pcilib
diff options
context:
space:
mode:
Diffstat (limited to 'pcilib')
-rw-r--r--pcilib/bank.c2
-rw-r--r--pcilib/bank.h12
-rw-r--r--pcilib/bar.c3
-rw-r--r--pcilib/export.c4
-rw-r--r--pcilib/kmem.h3
-rw-r--r--pcilib/model.h2
-rw-r--r--pcilib/pcilib.h2
7 files changed, 14 insertions, 14 deletions
diff --git a/pcilib/bank.c b/pcilib/bank.c
index dbbb427..3d53db2 100644
--- a/pcilib/bank.c
+++ b/pcilib/bank.c
@@ -65,7 +65,7 @@ void pcilib_free_register_banks(pcilib_t *ctx) {
if (ctx->bank_ctx[i]) {
if (bapi->free)
- bapi->free(ctx->bank_ctx[i]);
+ bapi->free(ctx, ctx->bank_ctx[i]);
else
free(ctx->bank_ctx[i]);
diff --git a/pcilib/bank.h b/pcilib/bank.h
index dfd2adb..8b461af 100644
--- a/pcilib/bank.h
+++ b/pcilib/bank.h
@@ -2,8 +2,6 @@
#define _PCILIB_BANK_H
#include <pcilib.h>
-#include <libxml/tree.h>
-#include <libxml/xpath.h>
#define PCILIB_REGISTER_BANK_INVALID ((pcilib_register_bank_t)-1)
#define PCILIB_REGISTER_BANK0 0 /**< First BANK to be used in the event engine */
@@ -11,13 +9,14 @@
#define PCILIB_REGISTER_BANK2 2
#define PCILIB_REGISTER_BANK3 3
#define PCILIB_REGISTER_BANK_DMA 64 /**< First BANK address to be used by DMA engines */
+#define PCILIB_REGISTER_BANK_DMACONF 65 /**< DMA configuration in the software registers */
#define PCILIB_REGISTER_BANK_DYNAMIC 128 /**< First BANK address to map dynamic XML configuration */
#define PCILIB_REGISTER_PROTOCOL_INVALID ((pcilib_register_protocol_t)-1)
#define PCILIB_REGISTER_PROTOCOL0 0 /**< First PROTOCOL address to be used in the event engine */
#define PCILIB_REGISTER_PROTOCOL_DEFAULT 64 /**< Default memmap based protocol */
+#define PCILIB_REGISTER_PROTOCOL_SOFTWARE 65 /**< Software registers */
#define PCILIB_REGISTER_PROTOCOL_DMA 96 /**< First PROTOCOL address to be used by DMA engines */
#define PCILIB_REGISTER_PROTOCOL_DYNAMIC 128 /**< First PROTOCOL address to be used by plugins */
-#define PCILIB_REGISTER_PROTOCOL_SOFTWARE_REGISTERS 32
typedef uint8_t pcilib_register_bank_t; /**< Type holding the bank position within the field listing register banks in the model */
typedef uint8_t pcilib_register_bank_addr_t; /**< Type holding the bank address number */
@@ -31,7 +30,7 @@ typedef struct {
pcilib_version_t version;
pcilib_register_bank_context_t *(*init)(pcilib_t *ctx, pcilib_register_bank_t bank, const char *model, const void *args); /**< Optional API call to initialize bank context */
- void (*free)(pcilib_register_bank_context_t *bank_ctx); /**< Optional API call to cleanup bank context */
+ void (*free)(pcilib_t *pcilib, pcilib_register_bank_context_t *ctx); /**< Optional API call to cleanup bank context */
int (*read)(pcilib_t *pcilib, pcilib_register_bank_context_t *ctx, pcilib_register_addr_t addr, pcilib_register_value_t *value); /**< Read from register, mandatory for RO/RW registers */
int (*write)(pcilib_t *pcilib, pcilib_register_bank_context_t *ctx, pcilib_register_addr_t addr, pcilib_register_value_t value); /**< Write to register, mandatory for WO/RW registers */
} pcilib_register_protocol_api_description_t;
@@ -63,7 +62,6 @@ typedef struct {
const char *format; /**< printf format for the registers, either %lu for decimal output or 0x%lx for hexdecimal */
const char *name; /**< short bank name */
const char *description; /**< longer bank description */
- xmlNodePtr xmlNode; /**<pointer to xmlNode of the bank in the file*/
} pcilib_register_bank_description_t;
/**
@@ -86,12 +84,8 @@ typedef struct {
struct pcilib_register_bank_context_s {
const pcilib_register_bank_description_t *bank; /**< Corresponding bank description */
const pcilib_register_protocol_api_description_t *api; /**< API functions */
- xmlNodeSetPtr banks_nodes;
- void *kmem_base_address;
- pcilib_t *ctx;
};
-
// we don't copy strings, they should be statically allocated
int pcilib_init_register_banks(pcilib_t *ctx);
void pcilib_free_register_banks(pcilib_t *ctx);
diff --git a/pcilib/bar.c b/pcilib/bar.c
index a2670c0..ce04f6d 100644
--- a/pcilib/bar.c
+++ b/pcilib/bar.c
@@ -131,6 +131,9 @@ int pcilib_map_register_space(pcilib_t *ctx) {
// uint32_t buf[2];
void *reg_space;
pcilib_bar_t bar = banks[i].bar;
+
+ if (bar == PCILIB_BAR_NOBAR)
+ continue;
if (bar == PCILIB_BAR_DETECT) {
uintptr_t addr = banks[0].read_addr;
diff --git a/pcilib/export.c b/pcilib/export.c
index ed3b5bf..7b78e32 100644
--- a/pcilib/export.c
+++ b/pcilib/export.c
@@ -5,11 +5,11 @@
#include "export.h"
#include "protocols/default.h"
-#include "protocols/software_registers.h"
+#include "protocols/software.h"
const pcilib_register_protocol_description_t pcilib_protocols[] = {
{ PCILIB_REGISTER_PROTOCOL_DEFAULT, &pcilib_default_protocol_api, NULL, NULL, "default", "" },
- { PCILIB_REGISTER_PROTOCOL_SOFTWARE_REGISTERS, &pcilib_register_software_register_protocol_api, NULL, NULL, "software_registers", "" },
+ { PCILIB_REGISTER_PROTOCOL_SOFTWARE, &pcilib_register_software_protocol_api, NULL, NULL, "software_registers", "" },
{ 0 }
};
diff --git a/pcilib/kmem.h b/pcilib/kmem.h
index 8302b6a..ae690fe 100644
--- a/pcilib/kmem.h
+++ b/pcilib/kmem.h
@@ -4,6 +4,8 @@
typedef struct pcilib_s pcilib_t;
typedef struct pcilib_kmem_list_s pcilib_kmem_list_t;
+#define PCILIB_KMEM_PAGE_SIZE 0x1000
+
typedef enum {
PCILIB_TRISTATE_NO = 0,
PCILIB_TRISTATE_PARTIAL = 1,
@@ -27,6 +29,7 @@ typedef enum {
PCILIB_KMEM_USE_STANDARD = 0,
PCILIB_KMEM_USE_DMA_RING = 1,
PCILIB_KMEM_USE_DMA_PAGES = 2,
+ PCILIB_KMEM_USE_SOFTWARE_REGISTERS = 3,
PCILIB_KMEM_USE_USER = 0x10
} pcilib_kmem_use_t;
diff --git a/pcilib/model.h b/pcilib/model.h
index b60ff3b..ab55adc 100644
--- a/pcilib/model.h
+++ b/pcilib/model.h
@@ -7,6 +7,7 @@
#include <pcilib/event.h>
#include <pcilib/export.h>
+
typedef struct {
const pcilib_version_t interface_version;
@@ -23,7 +24,6 @@ typedef struct {
const char *name;
const char *description;
-
} pcilib_model_description_t;
diff --git a/pcilib/pcilib.h b/pcilib/pcilib.h
index 6c1d592..9710642 100644
--- a/pcilib/pcilib.h
+++ b/pcilib/pcilib.h
@@ -85,9 +85,9 @@ typedef struct {
#define PCILIB_BAR_DETECT ((pcilib_bar_t)-1)
#define PCILIB_BAR_INVALID ((pcilib_bar_t)-1)
+#define PCILIB_BAR_NOBAR ((pcilib_bar_t)-2)
#define PCILIB_BAR0 0
#define PCILIB_BAR1 1
-#define PCILIB_BARUNDEF -1
#define PCILIB_DMA_ENGINE_INVALID ((pcilib_dma_engine_t)-1)
#define PCILIB_DMA_ENGINE_ALL ((pcilib_dma_engine_t)-1)
#define PCILIB_DMA_FLAGS_DEFAULT ((pcilib_dma_flags_t)0)