99
// we don't copy strings, they should be statically allocated
100
* Initalizes context of register banks. This is an internal function and will
101
* be called automatically when new register banks are added. On error no new
102
* banks are initalized
103
* @param[in,out] ctx - pcilib context
104
* @return - error or 0 on success
100
106
int pcilib_init_register_banks(pcilib_t *ctx);
101
void pcilib_free_register_banks(pcilib_t *ctx);
109
* Destroys contexts of register banks. This is an internal function and will
110
* be called during clean-up.
111
* @param[in,out] ctx - pcilib context
112
* @param[in] start - specifies first bank to clean (used to clean only part of the banks to keep the defined state if pcilib_init_register_banks has failed)
114
void pcilib_free_register_banks(pcilib_t *ctx, pcilib_register_bank_t start);
118
* Use this function to add new register banks into the model or override configuration
119
* of the existing banks. The function will copy the context of banks structure, but name,
120
* description, and other strings in the structure are considered to have static duration
121
* and will not be copied. On error no new banks are initalized.
122
* @param[in,out] ctx - pcilib context
123
* @param[in] flags - instructs if existing banks should be reported as error (default), overriden or ignored
124
* @param[in] n - number of banks to initialize. It is OK to pass 0 if banks variable is NULL terminated (last member of banks array have all members set to 0)
125
* @param[in] banks - bank descriptions
126
* @param[out] ids - if specified will contain the ids of the newly registered and overriden banks
127
* @return - error or 0 on success
103
129
int pcilib_add_register_banks(pcilib_t *ctx, pcilib_model_modification_flags_t flags, size_t n, const pcilib_register_bank_description_t *banks, pcilib_register_bank_t *ids);
132
* Use this function to add new register protocols into the model. It is error to re-register
133
* already registered protocols. The function will copy the context of banks structure, but name,
134
* description, and other strings in the structure are considered to have static duration
135
* and will not be copied. On error no new protocols are initalized.
136
* @param[in,out] ctx - pcilib context
137
* @param[in] flags - not used
138
* @param[in] n - number of protocols to initialize. It is OK to pass 0 if protocols variable is NULL terminated (last member of protocols array have all members set to 0)
139
* @param[in] protocols - protocol descriptions
140
* @param[out] ids - if specified will contain the ids of the newly registered protocols
141
* @return - error or 0 on success
104
143
int pcilib_add_register_protocols(pcilib_t *ctx, pcilib_model_modification_flags_t flags, size_t n, const pcilib_register_protocol_description_t *protocols, pcilib_register_protocol_t *ids);
146
* Use this function to add new register ranges into the model. It is error register
147
* overlapping registered ranges. On error no new ranges are initalized.
148
* @param[in,out] ctx - pcilib context
149
* @param[in] flags - not used
150
* @param[in] n - number of protocols to initialize. It is OK to pass 0 if protocols variable is NULL terminated.
151
* @param[in] ranges - range descriptions
152
* @return - error or 0 on success
105
154
int pcilib_add_register_ranges(pcilib_t *ctx, pcilib_model_modification_flags_t flags, size_t n, const pcilib_register_range_t *ranges);
107
157
pcilib_register_bank_t pcilib_find_register_bank_by_addr(pcilib_t *ctx, pcilib_register_bank_addr_t bank);
108
158
pcilib_register_bank_t pcilib_find_register_bank_by_name(pcilib_t *ctx, const char *bankname);
109
159
pcilib_register_bank_t pcilib_find_register_bank(pcilib_t *ctx, const char *bank);