bzr branch
http://suren.me/webbzr/alps/pcitool
273.1.1
by zilio nicolas
added soft_reg |
1 |
/**
|
275
by Suren A. Chilingaryan
Integration of software registers |
2 |
* @file software.h
|
305.1.5
by zilio nicolas
reviewd old tasks comments for doxygen and update |
3 |
* @brief header file for implementation of the protocol with software registers allocated in the kernel space, for parameters sharing between concurrent pcitool instances
|
273.1.1
by zilio nicolas
added soft_reg |
4 |
*/
|
5 |
||
321
by Suren A. Chilingaryan
Support computed (property-based) registers |
6 |
#ifndef _PCILIB_PROTOCOL_SOFTWARE_H
|
7 |
#define _PCILIB_PROTOCOL_SOFTWARE_H
|
|
273.1.1
by zilio nicolas
added soft_reg |
8 |
|
9 |
#include "pcilib.h" |
|
10 |
#include "version.h" |
|
11 |
#include "model.h" |
|
12 |
||
13 |
/**
|
|
14 |
* this function initialize the kernel space memory for the use of software register. it initializes the kernel space memory and stores in it the default values of the registers of the given bank index, if it was not initialized by a concurrent process, and return a bank context containing the adress of this kernel space. If the kernel space memory was already initialized by a concurrent process, then this function just return the bank context with the adress of this kernel space already used
|
|
305.1.5
by zilio nicolas
reviewd old tasks comments for doxygen and update |
15 |
* @param[in] - ctx the pcilib_t structure running
|
16 |
* @param[in] - bank the bank index that will permits to get the bank we want registers from
|
|
17 |
* @param[in] - model not used
|
|
18 |
* @param[in] - args not used
|
|
19 |
* @return a bank context with the adress of the kernel space memory related to it, as we could have for BAR
|
|
273.1.1
by zilio nicolas
added soft_reg |
20 |
*/
|
21 |
pcilib_register_bank_context_t* pcilib_software_registers_open(pcilib_t *ctx, pcilib_register_bank_t bank, const char* model, const void *args); |
|
22 |
||
23 |
/**
|
|
305.1.5
by zilio nicolas
reviewd old tasks comments for doxygen and update |
24 |
* this function clear the kernel memory space that could have been allocated for software registers and the bank context that correspond to it too
|
25 |
* @param[in] ctx - the pcilib_t structure runnning
|
|
26 |
* @param[in] bank_ctx - the bank context running that we get from the initialisation function
|
|
273.1.1
by zilio nicolas
added soft_reg |
27 |
*/
|
275
by Suren A. Chilingaryan
Integration of software registers |
28 |
void pcilib_software_registers_close(pcilib_t *ctx, pcilib_register_bank_context_t *bank_ctx); |
273.1.1
by zilio nicolas
added soft_reg |
29 |
|
30 |
/**
|
|
332
by Suren A. Chilingaryan
Provide API calls for register and bank address resolution |
31 |
* this function resolve the virtual address of the register for direct access
|
32 |
* @param[in] - ctx the pcilib_t structure runnning
|
|
33 |
* @param[in] - bank_ctx the bank context that was returned by the initialisation function
|
|
34 |
* @param[in] - flags
|
|
35 |
* @param[in] - addr the adress of the register we want to read
|
|
36 |
* @return virtual address or PCILIB_ADDRESS_INVALID on error
|
|
37 |
*/
|
|
38 |
uintptr_t pcilib_software_registers_resolve(pcilib_t *ctx, pcilib_register_bank_context_t *bank_ctx, pcilib_address_resolution_flags_t flags, pcilib_register_addr_t addr); |
|
39 |
||
40 |
/**
|
|
273.1.1
by zilio nicolas
added soft_reg |
41 |
* this function read the value of a said register in the kernel space.
|
305.1.5
by zilio nicolas
reviewd old tasks comments for doxygen and update |
42 |
* @param[in] - ctx the pcilib_t structure runnning
|
43 |
* @param[in] - bank_ctx the bank context that was returned by the initialisation function
|
|
44 |
* @param[in] - addr the adress of the register we want to read
|
|
45 |
* @param[out] - value the value of the register
|
|
46 |
* @return error code : 0 in case of success
|
|
273.1.1
by zilio nicolas
added soft_reg |
47 |
*/
|
275
by Suren A. Chilingaryan
Integration of software registers |
48 |
int pcilib_software_registers_read(pcilib_t *ctx, pcilib_register_bank_context_t* bank_ctx, pcilib_register_addr_t addr, pcilib_register_value_t *value); |
273.1.1
by zilio nicolas
added soft_reg |
49 |
|
50 |
/**
|
|
305.1.5
by zilio nicolas
reviewd old tasks comments for doxygen and update |
51 |
* this function write the given value to a given register in the kernel space
|
52 |
* @param[in] ctx - the pcilib_t structure runnning
|
|
53 |
* @param[in] bank_ctx - the bank context that was returned by the initialisation function
|
|
54 |
* @param[in] addr - the adress of the register we want to write in
|
|
55 |
* @param[in] value - the value we want to write in the register
|
|
56 |
* @return error code : 0 in case of success
|
|
273.1.1
by zilio nicolas
added soft_reg |
57 |
*/
|
58 |
int pcilib_software_registers_write(pcilib_t *ctx,pcilib_register_bank_context_t* bank_ctx, pcilib_register_addr_t addr, pcilib_register_value_t value); |
|
59 |
||
60 |
#ifdef _PCILIB_EXPORT_C
|
|
61 |
/**
|
|
305.1.5
by zilio nicolas
reviewd old tasks comments for doxygen and update |
62 |
* software protocol addition to the protocol api.
|
273.1.1
by zilio nicolas
added soft_reg |
63 |
*/
|
321
by Suren A. Chilingaryan
Support computed (property-based) registers |
64 |
const pcilib_register_protocol_api_description_t pcilib_software_protocol_api = |
332
by Suren A. Chilingaryan
Provide API calls for register and bank address resolution |
65 |
{ PCILIB_VERSION, pcilib_software_registers_open, pcilib_software_registers_close, pcilib_software_registers_resolve, pcilib_software_registers_read, pcilib_software_registers_write }; |
273.1.1
by zilio nicolas
added soft_reg |
66 |
#endif /* _PCILIB_EXPORT_C */ |
67 |
||
321
by Suren A. Chilingaryan
Support computed (property-based) registers |
68 |
#endif /* _PCILIB_PROTOCOL_SOFTWARE_H */ |