/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to pcilib/xml.h

  • Committer: Suren A. Chilingaryan
  • Date: 2015-09-10 03:08:04 UTC
  • mfrom: (277.2.17 test_xml)
  • Revision ID: csa@suren.me-20150910030804-djti3wcmk4yubhp7
Initial integration of XML support

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @file xml.h
 
3
 * @version 1.0
 
4
 * @brief header file to support of xml configuration.
 
5
 *
 
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.
 
7
 *
 
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
 
10
 */
 
11
 
 
12
#ifndef _PCILIB_XML_H
 
13
#define _PCILIB_XML_H
 
14
 
 
15
#include <pcilib.h>
 
16
#include <libxml/tree.h>
 
17
#include <libxml/xpath.h>
 
18
#include <libxml/xmlschemas.h>
 
19
 
 
20
#define PCILIB_MAX_MODEL_FILES 32
 
21
 
 
22
typedef struct pcilib_xml_s pcilib_xml_t;
 
23
 
 
24
struct pcilib_xml_s {
 
25
    size_t num_files;                                   /**< Number of currently loaded XML documents */
 
26
    
 
27
    xmlDocPtr docs[PCILIB_MAX_MODEL_FILES];             /**< Pointers to parsed XML documents */
 
28
    xmlXPathContextPtr xpath[PCILIB_MAX_MODEL_FILES];   /**< Per-file XPath context */
 
29
    
 
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 */
 
33
 
 
34
    xmlNodePtr bank_nodes[PCILIB_MAX_REGISTER_BANKS];   /**< pointer to xml nodes of banks in the xml file */
 
35
};
 
36
 
 
37
#ifdef __cplusplus
 
38
extern "C" {
 
39
#endif
 
40
 
 
41
/**
 
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
 
45
 */
 
46
int pcilib_init_xml(pcilib_t *ctx, const char *model);
 
47
 
 
48
/** pcilib_free_xml
 
49
 * this function free the xml parts of the pcilib_t running, and some libxml ashes
 
50
 * @param[in] ctx the pcilib_t running
 
51
*/
 
52
void pcilib_free_xml(pcilib_t *ctx);
 
53
 
 
54
 
 
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
 
59
*/
 
60
int pcilib_process_xml(pcilib_t *ctx, const char *location);
 
61
 
 
62
#ifdef __cplusplus
 
63
}
 
64
#endif
 
65
 
 
66
#endif /*_PCILIB_XML_H */