forked from EnJens/vendor-sony-oss-fingerprint
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathDmaBuffer.h
49 lines (41 loc) · 1.07 KB
/
DmaBuffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <BufferAllocator/BufferAllocator.h>
#include <stddef.h>
#define DMABUF_QCOM_QSEECOM_HEAP_NAME "qcom,qseecom"
class DmaBuffer {
int allocFd;
size_t len;
void *map;
public:
DmaBuffer(BufferAllocator &allocator, size_t len);
~DmaBuffer();
DmaBuffer(DmaBuffer &) = delete;
const DmaBuffer &operator=(const DmaBuffer &) = delete;
size_t requestedSize() const;
int fd() const;
void *operator()();
const void *operator()() const;
};
template <typename T>
class TypedDmaBuffer : public DmaBuffer {
public:
TypedDmaBuffer(BufferAllocator &allocator) : DmaBuffer(allocator, sizeof(T)) {
}
T *operator()() {
return (T *)DmaBuffer::operator()();
}
const T *operator()() const {
return (T *)DmaBuffer::operator()();
}
T *operator->() {
return (T *)DmaBuffer::operator()();
}
const T *operator->() const {
return (T *)DmaBuffer::operator()();
}
T &operator*() {
return *operator()();
}
const T &operator*() const {
return *operator()();
}
};