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

  • 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:
19
19
#include "error.h"
20
20
 
21
21
 
22
 
int pcilib_add_registers(pcilib_t *ctx, size_t n, const pcilib_register_description_t *registers) {
 
22
int pcilib_add_registers(pcilib_t *ctx, pcilib_model_modification_flags_t flags, size_t n, const pcilib_register_description_t *registers, pcilib_register_t *ids) {
23
23
        // DS: Overrride existing registers 
24
24
        // Registers identified by addr + offset + size + type or name
25
25
        
52
52
 
53
53
    memcpy(ctx->registers + ctx->num_reg, registers, n * sizeof(pcilib_register_description_t));
54
54
    memset(ctx->registers + ctx->num_reg + n, 0, sizeof(pcilib_register_description_t));
 
55
 
 
56
    if (ids) {
 
57
        size_t i;
 
58
        
 
59
        for (i = 0; i < n; i++)
 
60
            ids[i] = ctx->num_reg + i;
 
61
    }
 
62
 
55
63
    ctx->num_reg += n;
 
64
    
56
65
 
57
66
    return 0;
58
67
}