[Core/NPUDrvAPI/Triv2] Implement stop_target()
authorWook Song <wook16.song@samsung.com>
Tue, 11 Aug 2020 12:44:29 +0000 (21:44 +0900)
committer채동주/On-Device Lab(SR)/Staff Engineer/삼성전자 <dongju.chae@samsung.com>
Wed, 12 Aug 2020 05:04:41 +0000 (14:04 +0900)
This patch adds implementation of the virtual function, stop_target().

Signed-off-by: Wook Song <wook16.song@samsung.com>
src/core/npu/NPUdrvAPI.h
src/core/npu/NPUdrvAPI_triv2.cc

index d4f8351..cf5defa 100644 (file)
@@ -165,6 +165,7 @@ class TrinityVision2API : public DriverAPI {
 
     int runInput (input_config_t *input) const;
     int stop () const;
+    int stop_target (int id) const;
 
     int registerModel (model_config_t *model) const;
     int deregisterModel (unsigned long long id) const;
index 1f760c1..5670d5a 100644 (file)
@@ -349,6 +349,20 @@ TrinityVision2API::stop () const
   return 0;
 }
 
+int TrinityVision2API::stop_target (int id) const
+{
+  int ret;
+
+  if (!this->initialized())
+    return -EPERM;
+
+  ret = ioctl (this->getDeviceFD (), TRINITY_IOCTL_STOP_REQUEST, &id);
+  if (ret != 0)
+    return -errno;
+
+  return 0;
+}
+
 int
 TrinityVision2API::getDrvVersion () const
 {