4
* @brief header file to support of xml configuration.
6
* @details this file is the header file for the implementation of dynamic registers using xml and several funtionalities for the "pci-tool" line command tool from XML files. the xml part has been implemented using libxml2.
8
* this code was meant to be evolutive as the XML files evolute. In this meaning, most of the xml parsing is realized with XPath expressions(when it was possible), so that changing the xml xould result mainly in changing the XPAth pathes present here.
9
* @todo cf compilation chain
16
#include <libxml/tree.h>
17
#include <libxml/xpath.h>
18
#include <libxml/xmlschemas.h>
20
#define PCILIB_MAX_MODEL_FILES 32
22
typedef struct pcilib_xml_s pcilib_xml_t;
25
size_t num_files; /**< Number of currently loaded XML documents */
27
xmlDocPtr docs[PCILIB_MAX_MODEL_FILES]; /**< Pointers to parsed XML documents */
28
xmlXPathContextPtr xpath[PCILIB_MAX_MODEL_FILES]; /**< Per-file XPath context */
30
xmlParserCtxtPtr parser; /**< Pointer to the XML parser context */
31
xmlSchemaPtr schema; /**< Pointer to the parsed xsd schema */
32
xmlSchemaValidCtxtPtr validator; /**< Pointer to the XML validation context */
34
xmlNodePtr bank_nodes[PCILIB_MAX_REGISTER_BANKS]; /**< pointer to xml nodes of banks in the xml file */
42
* this function gets the xml files and validates them, before filling the pcilib_t struct with the registers and banks of those files
43
*@param[in,out] ctx the pcilib_t struct running that gets filled with banks and registers
44
*@param[in] model the name of the model
46
int pcilib_init_xml(pcilib_t *ctx, const char *model);
49
* this function free the xml parts of the pcilib_t running, and some libxml ashes
50
* @param[in] ctx the pcilib_t running
52
void pcilib_free_xml(pcilib_t *ctx);
55
/** pcilib_process_xml
56
* this function free the xml parts of the pcilib_t running, and some libxml ashes
57
* @param[in] ctx the pcilib_t running
58
* @param[in] location of XML files relative to the PCILIB_MODEL_DIR
60
int pcilib_process_xml(pcilib_t *ctx, const char *location);
66
#endif /*_PCILIB_XML_H */