summaryrefslogtreecommitdiffstats
path: root/pcilib
diff options
context:
space:
mode:
Diffstat (limited to 'pcilib')
-rw-r--r--pcilib/xml.c18
-rw-r--r--pcilib/xml.h7
2 files changed, 17 insertions, 8 deletions
diff --git a/pcilib/xml.c b/pcilib/xml.c
index 55cdf11..257b503 100644
--- a/pcilib/xml.c
+++ b/pcilib/xml.c
@@ -244,7 +244,6 @@ pcilib_xml_initialize_banks(pcilib_t* pci,xmlDocPtr doc){
xmlNodeSetPtr nodesetadress=NULL;
xmlNodePtr mynode;
- pcilib_register_bank_description_t* banks;
xmlXPathContextPtr context;
int i;
@@ -253,21 +252,20 @@ pcilib_xml_initialize_banks(pcilib_t* pci,xmlDocPtr doc){
/** we get the bank nodes using xpath expression*/
nodesetadress=pcilib_xml_getsetproperty(context,BANKS_PATH)->nodesetval;
- if(nodesetadress->nodeNr>0) banks=calloc((nodesetadress->nodeNr),sizeof(pcilib_register_bank_description_t));
- else return;
+ if(nodesetadress->nodeNr==0) return;
pci->banks_xml_nodes=calloc(nodesetadress->nodeNr,sizeof(xmlNodePtr));
- if(!(pci->banks_xml_nodes)) pcilib_warning("can't create bank xml nodes for pcilib_t struct");
+ if(!(pci->banks_xml_nodes)) pcilib_error("can't create bank xml nodes for pcilib_t struct");
- /** for each of the bank nodes, we create the associated structure*/
+ /** for each of the bank nodes, we create the associated structure, and push it in the pcilib environnement*/
for(i=0;i<nodesetadress->nodeNr;i++){
mynode=nodesetadress->nodeTab[i];
pcilib_xml_create_bank(&mybank,mynode,doc);
- banks[i]=mybank;
+ pcilib_add_register_banks(pci,1,&mybank);
pci->banks_xml_nodes[i]=mynode;
}
- /** we push our banks structures in the pcilib environnement*/
- pcilib_add_register_banks(pci,nodesetadress->nodeNr,banks);
+
+
}
/*
@@ -567,6 +565,10 @@ int pcilib_init_xml(pcilib_t* ctx){
free(line);
free(line_xsd);
free(docs);
+
+ xmlCleanupParser();
+ xmlMemoryDump();
+
return 0;
}
diff --git a/pcilib/xml.h b/pcilib/xml.h
index 1ef8ee5..ef08d10 100644
--- a/pcilib/xml.h
+++ b/pcilib/xml.h
@@ -12,10 +12,17 @@
#ifndef _XML_
#define _XML_
+/*#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
+*/
#include "pcilib.h"
#define REGISTERS_PATH ((xmlChar*)"/model/banks/bank/registers/register") /**<all standard registers nodes.*/
+
#define BITS_REGISTERS_PATH ((xmlChar*)"/model/banks/bank/registers/register/registers_bits/register_bits") /**<all bits registers nodes.*/
+
#define BANKS_PATH ((xmlChar*)"/model/banks/bank/bank_description") /**< path to complete nodes of banks.*/
/**