aboutsummaryrefslogtreecommitdiff
path: root/driver_library/python/src/ethosu_driver/swig/driver.i
diff options
context:
space:
mode:
Diffstat (limited to 'driver_library/python/src/ethosu_driver/swig/driver.i')
-rw-r--r--driver_library/python/src/ethosu_driver/swig/driver.i46
1 files changed, 4 insertions, 42 deletions
diff --git a/driver_library/python/src/ethosu_driver/swig/driver.i b/driver_library/python/src/ethosu_driver/swig/driver.i
index 1ff8ded..3e4e384 100644
--- a/driver_library/python/src/ethosu_driver/swig/driver.i
+++ b/driver_library/python/src/ethosu_driver/swig/driver.i
@@ -210,31 +210,22 @@ public:
Buffer object represents a RW mapping in the virtual address space of the caller.
Created mapping is shareable, updates to the mapping are visible to other processes mapping the same region.
- Issues ETHOSU_IOCTL_BUFFER_CREATE I/O request to the device with given Maximum capacity.
+ Issues ETHOSU_IOCTL_BUFFER_CREATE I/O request to the device with given size.
- Buffer could be created for a device with given maximum capacity or instantiated directly from
+ Buffer could be created for a device with given size or instantiated directly from
a file containing binary data.
Examples:
>>> import ethosu_driver as driver
>>> # from file:
>>> buf = driver.Buffer(device, '/path/to/file')
- >>> # Empty, with maximum capacity:
+ >>> # Empty, with size:
>>> buf = driver.Buffer(device, 1024)
") Buffer;
%nodefaultctor Buffer;
class Buffer {
public:
- Buffer(const Device &device, const size_t capacity);
-
- %feature("docstring",
- "
- Returns maximum buffer capacity set during initialisation.
-
- Returns:
- int: maximum buffer capacity.
- ") capacity;
- size_t capacity() const;
+ Buffer(const Device &device, const size_t size);
%feature("docstring",
"
@@ -255,32 +246,6 @@ public:
%feature("docstring",
"
- Sets a size of the memory buffer for the device.
-
- 'offset + size' must not exceed the capacity of the buffer.
- Does not change the size of the mapped region.
-
- Issues ETHOSU_IOCTL_BUFFER_SET I/O request with a given size and offset.
-
- Args:
- size (int): Device buffer size.
- offset (int): Offset to where the data starts.
- ") resize;
- void resize(size_t size, size_t offset = 0) const;
-
- %feature("docstring",
- "
- Queries device and returns buffer data offset.
-
- Issues ETHOSU_IOCTL_BUFFER_GET I/O request.
-
- Returns:
- int: data offset
- ") offset;
- size_t offset() const;
-
- %feature("docstring",
- "
Queries device and returns buffer data size.
Issues ETHOSU_IOCTL_BUFFER_GET I/O request.
@@ -313,7 +278,6 @@ public:
stream.seekg(0, std::ios_base::beg);
auto buffer = new EthosU::Buffer(device, size);
- buffer->resize(size);
stream.read(buffer->data(), size);
return buffer;
@@ -324,7 +288,6 @@ public:
Fills the buffer from python buffer.
Copies python buffer data to the mapped memory region.
- Input buffer size must be within `Buffer` maximum capacity.
Args:
buffer: data to be copied to the mapped memory.
@@ -332,7 +295,6 @@ public:
") from_buffer;
%mutable_buffer(char* buffer, size_t size);
void from_buffer(char* buffer, size_t size) {
- self->resize(size);
char* data = $self->data();
std::memcpy(data, buffer, size);
}