49
51
pcilib_view_reference_t *views; /**< List of supported views for this register */
50
52
} pcilib_register_description_t;
55
const char *name; /**< Register name */
56
pcilib_register_t reg; /**< Register index */
57
pcilib_register_bank_t bank; /**< Reference to bank containing the register */
58
pcilib_register_value_t min, max; /**< Minimum & maximum allowed values */
59
pcilib_xml_node_t *xml; /**< Additional XML properties */
60
pcilib_view_reference_t *views; /**< For non-static list of views, this vairables holds a copy of a NULL-terminated list from model (if present, memory should be de-allocated) */
62
} pcilib_register_context_t;
69
* Use this function to add new registers into the model. Currently, it is considered a error
70
* to re-add already defined register. If it will turn out to be useful to redefine some registers
71
* from the model, it may change in the future. However, we should think how to treat bit-registers
72
* in this case. The function will copy the context of registers structure, but name,
73
* description, and other strings in the structure are considered to have static duration
74
* and will not be copied. On error no new registers are initalized.
75
* @param[in,out] ctx - pcilib context
76
* @param[in] flags - not used now, but in future may instruct if existing registers should be reported as error (default), overriden or ignored
77
* @param[in] n - number of registers to initialize. It is OK to pass 0 if registers array is NULL terminated (last member of the array have all members set to 0)
78
* @param[in] registers - register descriptions
79
* @param[out] ids - if specified will contain the ids of the newly registered and overriden registers
80
* @return - error or 0 on success
57
82
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);
58
void pcilib_clean_registers(pcilib_t *ctx);
85
* Destroys data associated with registers. This is an internal function and will
86
* be called during clean-up.
87
* @param[in,out] ctx - pcilib context
88
* @param[in] start - specifies first register to clean (used to clean only part of the registers to keep the defined state if pcilib_add_registers has failed)
90
void pcilib_clean_registers(pcilib_t *ctx, pcilib_register_t start);