/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.c

  • Committer: Suren A. Chilingaryan
  • Date: 2016-02-23 06:20:33 UTC
  • mfrom: (346.1.18 pcitool)
  • Revision ID: csa@suren.me-20160223062033-mz8qkpm1a2oioveb
Merge Python scripting support from Vasiliy Chernov

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include "xml.h"
41
41
#include "error.h"
42
42
#include "view.h"
 
43
#include "py.h"
43
44
#include "views/enum.h"
44
45
#include "views/transform.h"
45
46
 
48
49
#define REGISTERS_PATH ((xmlChar*)"./register")                                 /**< all standard registers nodes */
49
50
#define BIT_REGISTERS_PATH ((xmlChar*)"./field")                                /**< all bits registers nodes */
50
51
#define REGISTER_VIEWS_PATH ((xmlChar*)"./view")                                /**< supported register & field views */
51
 
#define TRANSFORM_VIEWS_PATH ((xmlChar*)"/model/transform")                     /**< path to complete nodes of views */
 
52
#define TRANSFORM_VIEWS_PATH ((xmlChar*)"/model/transform")             /**< path to complete nodes of views */
52
53
#define ENUM_VIEWS_PATH ((xmlChar*)"/model/enum")                               /**< path to complete nodes of views */
53
54
#define ENUM_ELEMENTS_PATH ((xmlChar*)"./name")                                 /**< all elements in the enum */
54
55
#define UNITS_PATH ((xmlChar*)"/model/unit")                                    /**< path to complete nodes of units */
55
 
#define UNIT_TRANSFORMS_PATH ((xmlChar*)"./transform")                          /**< all transforms of the unit */
 
56
#define UNIT_TRANSFORMS_PATH ((xmlChar*)"./transform")                  /**< all transforms of the unit */
56
57
 
57
58
 
58
59
 
492
493
    xmlAttrPtr cur;
493
494
    const char *value, *name;
494
495
 
 
496
    int inconsistent = (desc->mode & PCILIB_ACCESS_INCONSISTENT);
 
497
 
495
498
    for (cur = node->properties; cur != NULL; cur = cur->next) {
496
499
        if (!cur->children) continue;
497
500
        if (!xmlNodeIsText(cur->children)) continue;
537
540
                pcilib_error("Invalid access mode (%s) is specified in the XML register description", value);
538
541
                return PCILIB_ERROR_INVALID_DATA;
539
542
            }
540
 
        }
 
543
        } else if (!strcasecmp(name, "write_verification")) {
 
544
            if (strcmp(value, "0")) inconsistent = 0;
 
545
            else inconsistent = 1;
 
546
        }
541
547
    }
 
548
        
 
549
    if (inconsistent) desc->mode |= PCILIB_ACCESS_INCONSISTENT;
 
550
    else desc->mode &= ~PCILIB_ACCESS_INCONSISTENT;
542
551
 
543
552
    return 0;
544
553
}
585
594
            }
586
595
            desc.write_to_reg = value;
587
596
            if ((value)&&(*value)) mode |= PCILIB_ACCESS_W;
588
 
        } 
 
597
        } else if (!strcasecmp(name, "script")) {
 
598
            desc.script = value;
 
599
            break;
 
600
        }
589
601
    }
590
 
 
591
 
    desc.base.mode &= mode;
 
602
    desc.base.mode &= (~PCILIB_ACCESS_RW)|mode;
592
603
 
593
604
    err = pcilib_add_views_custom(ctx, 1, (pcilib_view_description_t*)&desc, &view_ctx);
594
605
    if (err) return err;
597
608
    return 0;
598
609
}
599
610
 
600
 
 
601
611
static int pcilib_xml_parse_value_name(pcilib_t *ctx, xmlXPathContextPtr xpath, xmlDocPtr doc, xmlNodePtr node, pcilib_register_value_name_t *desc) {
602
612
    xmlAttr *cur;
603
613
    char *value, *name;