summaryrefslogtreecommitdiffstats
path: root/pcilib/mem.h
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2016-05-14 01:10:33 +0200
committerSuren A. Chilingaryan <csa@suren.me>2016-05-14 01:10:33 +0200
commita21dea7a0d06cbdfe9a94c88b1ba99425bf2e102 (patch)
tree1c08af911cef8869ed1eb90902f89db83b524c53 /pcilib/mem.h
parent71f64d82453f5c86dd40104839d98fc12ae44ddf (diff)
downloadpcitool-a21dea7a0d06cbdfe9a94c88b1ba99425bf2e102.tar.gz
pcitool-a21dea7a0d06cbdfe9a94c88b1ba99425bf2e102.tar.bz2
pcitool-a21dea7a0d06cbdfe9a94c88b1ba99425bf2e102.tar.xz
pcitool-a21dea7a0d06cbdfe9a94c88b1ba99425bf2e102.zip
Allow mapping of arbitrary memory areas
Diffstat (limited to 'pcilib/mem.h')
-rw-r--r--pcilib/mem.h29
1 files changed, 29 insertions, 0 deletions
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 */