diff options
author | zilio nicolas <nicolas.zilio@kit.edu> | 2015-06-12 19:08:55 +0200 |
---|---|---|
committer | zilio nicolas <nicolas.zilio@kit.edu> | 2015-06-12 19:08:55 +0200 |
commit | 51ec836689e0d9e2d27f2fa4579ff1088513dacf (patch) | |
tree | 617947170dd4fa735f4d5e213179e67343dd486e | |
parent | 18e672c04c6b12d51b13f4cf32b9c197245407d6 (diff) | |
download | pcitool-51ec836689e0d9e2d27f2fa4579ff1088513dacf.tar.gz pcitool-51ec836689e0d9e2d27f2fa4579ff1088513dacf.tar.bz2 pcitool-51ec836689e0d9e2d27f2fa4579ff1088513dacf.tar.xz pcitool-51ec836689e0d9e2d27f2fa4579ff1088513dacf.zip |
some modifications
-rw-r--r-- | dma/ipe.h | 4 | ||||
-rw-r--r-- | pcilib/bank.h | 9 | ||||
-rw-r--r-- | pcilib/export.c | 3 | ||||
-rw-r--r-- | pcilib/model.h | 2 | ||||
-rw-r--r-- | protocols/software_registers.c | 7 |
5 files changed, 17 insertions, 8 deletions
@@ -39,6 +39,7 @@ static const pcilib_dma_engine_description_t ipe_dma_engines[] = { static const pcilib_register_bank_description_t ipe_dma_banks[] = { { PCILIB_REGISTER_BANK_DMA, PCILIB_REGISTER_PROTOCOL_DEFAULT, PCILIB_BAR0, 0, 0, 32, 0x0200, PCILIB_LITTLE_ENDIAN, PCILIB_LITTLE_ENDIAN, "0x%lx", "dma", "DMA Registers"}, + { PCILIB_REGISTER_BANK0, PCILIB_REGISTER_PROTOCOL_SOFTWARE_REGISTERS, PCILIB_BAR1, 0, 0, 32, 0x0003, PCILIB_LITTLE_ENDIAN, PCILIB_LITTLE_ENDIAN, "0x%lx", "test", "test Registers"}, { 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL } }; @@ -77,6 +78,9 @@ static const pcilib_register_description_t ipe_dma_registers[] = { {0x0058, 0, 32, 0, 0x00000000, PCILIB_REGISTER_RW , PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK_DMA, "last_descriptor_read", "Last descriptor read by the host"}, {0x005C, 0, 32, 0, 0x00000000, PCILIB_REGISTER_RW , PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK_DMA, "desc_mem_addr", "Number of descriptors configured"}, {0x0060, 0, 32, 0, 0x00000000, PCILIB_REGISTER_RW , PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK_DMA, "update_thresh", "Update threshold of progress register"}, + {0x0001, 0, 32, 0x1, 0x00000000, PCILIB_REGISTER_RW , PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK0, "test1", "ister"}, + {0x0002, 0, 32, 0, 0x00000000, PCILIB_REGISTER_RW , PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK0, "test2", "ter"}, + {0x0003, 0, 32, 0x020, 0x00000000, PCILIB_REGISTER_RW , PCILIB_REGISTER_STANDARD, PCILIB_REGISTER_BANK0, "test3", "er"}, {0, 0, 0, 0, 0x00000000, 0, 0, 0, NULL, NULL} }; #endif /* _PCILIB_EXPORT_C */ diff --git a/pcilib/bank.h b/pcilib/bank.h index 943c389..bc45ec4 100644 --- a/pcilib/bank.h +++ b/pcilib/bank.h @@ -2,6 +2,8 @@ #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 */ @@ -13,6 +15,7 @@ #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_KERNEL 32 /**< Protocol with registers registered in kernel directly*/ #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 */ @@ -28,7 +31,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 *ctx); /**< Optional API call to cleanup bank context */ + void (*free)(pcilib_register_bank_context_t *bank_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; @@ -60,6 +63,7 @@ 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; /** @@ -82,6 +86,9 @@ 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 *bank_software_register_adress; + pcilib_t *ctx; }; diff --git a/pcilib/export.c b/pcilib/export.c index e442fc7..ed3b5bf 100644 --- a/pcilib/export.c +++ b/pcilib/export.c @@ -5,10 +5,11 @@ #include "export.h" #include "protocols/default.h" - +#include "protocols/software_registers.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", "" }, { 0 } }; diff --git a/pcilib/model.h b/pcilib/model.h index ab55adc..b60ff3b 100644 --- a/pcilib/model.h +++ b/pcilib/model.h @@ -7,7 +7,6 @@ #include <pcilib/event.h> #include <pcilib/export.h> - typedef struct { const pcilib_version_t interface_version; @@ -24,6 +23,7 @@ typedef struct { const char *name; const char *description; + } pcilib_model_description_t; diff --git a/protocols/software_registers.c b/protocols/software_registers.c index d3c390f..68655e0 100644 --- a/protocols/software_registers.c +++ b/protocols/software_registers.c @@ -20,9 +20,7 @@ */ pcilib_register_bank_context_t* pcilib_software_registers_open(pcilib_t *ctx, pcilib_register_bank_t bank,const char* model, const void *args){ pcilib_register_bank_context_t* bank_ctx; - pcilib_register_value_t *init=NULL; pcilib_kmem_handle_t *test; - int i; int j; bank_ctx=calloc(1,sizeof(pcilib_register_bank_context_t)); @@ -35,11 +33,10 @@ pcilib_register_bank_context_t* pcilib_software_registers_open(pcilib_t *ctx, pc bank_ctx->bank_software_register_adress=test; }else{ bank_ctx->bank_software_register_adress=test; - init=test; j=0; while(ctx->model_info.registers[j].name!=NULL){ - if(ctx->model_info.registers[j].bank==(ctx->banks + bank).addr){ - pcilib_write_register_by_id(ctx,ctx->model_info.registers[j],ctx->model_info.registers[j].defvalue); + if(ctx->model_info.registers[j].bank==(ctx->banks+bank)->addr){ + pcilib_write_register_by_id(ctx,ctx->model_info.registers[j].addr,ctx->model_info.registers[j].defvalue); } j++; } |