bzr branch
http://suren.me/webbzr/alps/pcitool
403
by Suren A. Chilingaryan
Allow mapping of arbitrary memory areas |
1 |
#ifndef _PCILIB_MEM_H
|
2 |
#define _PCILIB_MEM_H
|
|
3 |
||
4 |
#ifdef __cplusplus
|
|
5 |
extern "C" { |
|
6 |
#endif
|
|
7 |
||
8 |
/**
|
|
9 |
* Maps the specified memory area in the address space of the process.
|
|
10 |
* @param[in,out] ctx - pcilib context
|
|
11 |
* @param[in] addr - hardware address (should be page-aligned)
|
|
12 |
* @param[in] size - size (should be multiple of page size)
|
|
13 |
* return - the address where the memory area is mapped
|
|
14 |
*/
|
|
15 |
void *pcilib_map_area(pcilib_t *ctx, uintptr_t addr, size_t size); |
|
16 |
||
17 |
/**
|
|
18 |
* Unmaps the specified memory area in the address space of the process.
|
|
19 |
* @param[in,out] ctx - pcilib context
|
|
20 |
* @param[in] addr - pointer to the virtual address where the area is mapped
|
|
21 |
* @param[in] size - size (should be multiple of page size)
|
|
22 |
*/
|
|
23 |
void pcilib_unmap_area(pcilib_t *ctx, void *addr, size_t size); |
|
24 |
||
25 |
#ifdef __cplusplus
|
|
26 |
}
|
|
27 |
#endif
|
|
28 |
||
29 |
#endif /* _PCILIB_MEM_H */ |