From a21dea7a0d06cbdfe9a94c88b1ba99425bf2e102 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sat, 14 May 2016 01:10:33 +0200 Subject: Allow mapping of arbitrary memory areas --- pcilib/mem.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 pcilib/mem.h (limited to 'pcilib/mem.h') diff --git a/pcilib/mem.h b/pcilib/mem.h new file mode 100644 index 0000000..2e3ac02 --- /dev/null +++ b/pcilib/mem.h @@ -0,0 +1,29 @@ +#ifndef _PCILIB_MEM_H +#define _PCILIB_MEM_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Maps the specified memory area in the address space of the process. + * @param[in,out] ctx - pcilib context + * @param[in] addr - hardware address (should be page-aligned) + * @param[in] size - size (should be multiple of page size) + * return - the address where the memory area is mapped + */ +void *pcilib_map_area(pcilib_t *ctx, uintptr_t addr, size_t size); + +/** + * Unmaps the specified memory area in the address space of the process. + * @param[in,out] ctx - pcilib context + * @param[in] addr - pointer to the virtual address where the area is mapped + * @param[in] size - size (should be multiple of page size) + */ +void pcilib_unmap_area(pcilib_t *ctx, void *addr, size_t size); + +#ifdef __cplusplus +} +#endif + +#endif /* _PCILIB_MEM_H */ -- cgit v1.2.3