-libnpu_inc = include_directories('include')
+libnpu_inc = [
+ ne_includedir,
+ include_directories('include'),
+]
libnpu_sources = ['src/NPUdrvAPI.c']
# Build library (static)
-# Do NOT enable C in core
-# C++ is only allowed inside test directory for gtest.
-
-project('npu-engine', 'c',
- version: '0.0.1',
- license: ['Proprietary'],
- meson_version: '>=0.42.0',
- default_options: [
- 'werror=true',
- 'warning_level=1',
- 'c_std=gnu89',
- ]
-)
-
-add_project_arguments('-DVERSION="' + meson.project_version() + '"', language: ['c'])
-
-cc = meson.get_compiler('c')
-
-warning_c_flags = [
- '-Wmissing-declarations',
- '-Wmissing-prototypes',
- '-Wnested-externs',
- '-Waggregate-return',
- '-Wold-style-definition',
- '-Wdeclaration-after-statement'
-]
-
-foreach extra_arg : warning_c_flags
- if cc.has_argument (extra_arg)
- add_project_arguments([extra_arg], language: 'c')
- endif
-endforeach
-
-# Install Paths
-ne_prefix = get_option('prefix')
-ne_libdir = join_paths(ne_prefix, get_option('libdir'))
-ne_bindir = join_paths(ne_prefix, get_option('bindir'))
-ne_includedir = join_paths(ne_prefix, get_option('includedir'))
-ne_inidir = get_option('sysconfdir')
-
-libdl_dep = cc.find_library('dl') # DL library
-libm_dep = cc.find_library('m') # math library
-libdrm_dep = dependency('libdrm') # libdrm library
-thread_dep = dependency('threads') # pthread library
-iniparser_dep = dependency('iniparser') # iniparser library
-
subdir('libgem-core')
subdir('libnpu-core')
subdir('npu-engine')
-
subdir('test')
+++ /dev/null
-option('comm_opt', type : 'combo', choices : ['usb', 'ip', 'fm'], value : 'fm')
-# DO NOTHING, YET
+plugin_ip_inc = [
+ ne_includedir,
+ npu_host_inc,
+]
+plugin_ip_sources = []
+
+plugin_ip_common_sources = ['plugin-ip-comm.c']
+
+foreach s : plugin_ip_common_sources
+ plugin_ip_sources += join_paths(meson.current_source_dir(), s)
+endforeach
+
+# Declare dependency
+plugin_ip_src_dep = declare_dependency(
+ sources : plugin_ip_sources,
+ include_directories: plugin_ip_inc)
--- /dev/null
+/**
+ * Proprietary
+ * Copyright (C) 2019 Samsung Electronics
+ * Copyright (C) 2019 MyungJoo Ham <myungjoo.ham@samsung.com>
+ * Copyright (C) 2019 Parichay Kapoor <pk.kapoor@samsung.com>
+ */
+/**
+ * @file plugin-ip-comm.c
+ * @date 26 Jul 2019
+ * @brief Implement API to access NPU from Host
+ * @see http://suprem.sec.samsung.net/confluence/display/ODLC/Software+Stack
+ * @author MyungJoo Ham <myungjoo.ham@samsung.com>
+ * @author Parichay Kapoor <pk.kapoor@samsung.com>
+ * @bug No known bugs except for NYI items
+ *
+ * To packagers: this is exported to HOST PROGRAMMERS as a devel package.
+ */
+
+#include <libnpuhost.h>
-npu_engine_inc = include_directories('.', '../../../common/include')
+npu_engine_inc = [
+ ne_includedir,
+ include_directories('.'),
+]
npu_engine_sources = []
# Dependencies
# Plugins
npu_engine_plugins = [
'ip',
- 'usb',
- 'fm'
+# 'fm',
]
foreach p : npu_engine_plugins
endforeach
comm_opt = get_option('comm_opt')
-if comm_opt == 'usb'
- npu_engine_dependencies += plugin_usb_dep
-elif comm_opt == 'ip'
- npu_engine_dependencies += plugin_ip_dep
-else # fastmodel
- npu_engine_dependencies += plugin_fm_dep
-endif
-
-# Declare dependency
-npu_engine_dep = declare_dependency(
- sources : npu_engine_common_sources,
- dependencies: npu_engine_dependencies,
- include_directories: npu_engine_inc)
# Build executable
-npu_engine_executable = executable('npu-engine',
- join_paths(meson.current_source_dir(), 'main.c'),
- dependencies: npu_engine_dep,
- include_directories: npu_engine_inc,
-)
+if comm_opt == 'fm'
+ # Declare dependency
+ npu_engine_dep = declare_dependency(
+ sources : npu_engine_common_sources,
+ dependencies: npu_engine_dependencies,
+ include_directories: npu_engine_inc)
+# npu_engine_dependencies += plugin_fm_dep
+
+ npu_engine_executable = executable('npu-engine-test',
+ sources : join_paths(meson.current_source_dir(), 'main.c'),
+ dependencies : npu_engine_dep,
+ include_directories: npu_engine_inc)
+else # ip comm
+ npu_engine_build = static_library('npu-engine-common',
+ npu_engine_sources,
+ include_directories : npu_engine_inc,
+ dependencies : npu_engine_dependencies,
+ install : false)
+
+ # Declare dependency for other modules
+ npu_engine_dep = declare_dependency(link_with : npu_engine_build,
+ include_directories: npu_engine_inc)
+endif
#define __NPU_HOST_LIBNPUHOST_H__
#include <stdint.h>
-#include "../../../common/include/typedef.h"
+#include <typedef.h>
/* NNstreamer/GStreamer supports up to 16 bufs */
#define NPU_TENSOR_CARDINALITY_MAX (16)
* @return @c The number of NPU devices.
* @retval 0 if no NPU devices available. if positive (number of NPUs) if NPU devices available. otherwise, a negative error value.
*/
-int getnumNPUdevice();
+int getnumNPUdevice(void);
/**
* @brief Returns the handle of the chosen NPU devices.
* Approach 2: thread pooling for callback invocation.
* Approach 3: 1 + 2.
*/
-typedef void (*callback) (output_buffer *output, uint64_t sequence,
- void *data)
- npuOutputNotify;
+typedef void (*npuOutputNotify) (output_buffer *output, uint64_t sequence,
+ void *data);
/**
* @brief Let NPU accept input frames from its internal source continuously
* @param[in] mode Configures how this operation works.
* @return @c 0 if no error. otherwise a negative error value
*/
-int runNPU_async(npudev_h dev, uint32_t modelid, const npu_tensors *input,
+int runNPU_async(npudev_h dev, uint32_t modelid, const input_buffers *input,
npuOutputNotify *cb, uint64_t *sequence, void *data,
npu_async_mode mode);
/** Optional Features. May be left unimplemented until later versions */
/** @todo func prototype TBD. This does not use callback. */
-int runNPU_async_noalloc(npudev_h dev, uint32_t modelid, const npu_tensors *input,
- npu_tensors *output, uint64_t *sequence, npu_async_mode mode);
+int runNPU_async_noalloc(npudev_h dev, uint32_t modelid, const input_buffers *input,
+ output_buffer *output, uint64_t *sequence, npu_async_mode mode);
/** @todo func prototype TBD */
int getRegisteredNPUmodels(npudev_h dev, uint32_t **modelids, uint32_t *nummodels);
-# DO NOTHING, YET
+npu_host_inc = include_directories('include')
-project('npu-host', 'c',
- version: '0.0.1',
- license: ['Proprietary'],
- meson_version: '>=0.42.0',
- default_options: [
- 'werror=true',
- 'warning_level=1',
- 'c_std=gnu89',
- ]
-)
-
-add_project_arguments('-DVERSION="' + meson.project_version() + '"', language: ['c'])
-
-cc = meson.get_compiler('c')
-
-warning_c_flags = [
- '-Wmissing-declarations',
- '-Wmissing-prototypes',
- '-Wnested-externs',
- '-Waggregate-return',
- '-Wold-style-definition',
- '-Wdeclaration-after-statement'
-]
-
-foreach extra_arg : warning_c_flags
- if cc.has_argument (extra_arg)
- add_project_arguments([extra_arg], language: 'c')
- endif
-endforeach
-
-# Install Paths
-nh_prefix = get_option('prefix')
-nh_libdir = join_paths(nh_prefix, get_option('libdir'))
-nh_bindir = join_paths(nh_prefix, get_option('bindir'))
-nh_includedir = join_paths(nh_prefix, get_option('includedir'))
-nh_inidir = get_option('sysconfdir')
-
subdir('libnpuhost')
-
subdir('test')
--- /dev/null
+# Do NOT enable C in core
+# C++ is only allowed inside test directory for gtest.
+
+project('npu-engine', 'c',
+ version: '0.0.1',
+ license: ['Proprietary'],
+ meson_version: '>=0.42.0',
+ default_options: [
+ 'werror=true',
+ 'warning_level=1',
+ 'c_std=gnu89',
+ ]
+)
+
+add_project_arguments('-DVERSION="' + meson.project_version() + '"', language: ['c'])
+
+cc = meson.get_compiler('c')
+
+warning_c_flags = [
+ '-Wmissing-declarations',
+ '-Wmissing-prototypes',
+ '-Wnested-externs',
+ '-Waggregate-return',
+ '-Wold-style-definition',
+ '-Wdeclaration-after-statement'
+]
+
+foreach extra_arg : warning_c_flags
+ if cc.has_argument (extra_arg)
+ add_project_arguments([extra_arg], language: 'c')
+ endif
+endforeach
+
+# Install Paths
+ne_prefix = get_option('prefix')
+ne_libdir = join_paths(ne_prefix, get_option('libdir'))
+ne_bindir = join_paths(ne_prefix, get_option('bindir'))
+ne_includedir = [
+ join_paths(ne_prefix, get_option('includedir')),
+ include_directories('common/include')
+]
+ne_inidir = get_option('sysconfdir')
+
+libdl_dep = cc.find_library('dl') # DL library
+libm_dep = cc.find_library('m') # math library
+libdrm_dep = dependency('libdrm') # libdrm library
+thread_dep = dependency('threads') # pthread library
+iniparser_dep = dependency('iniparser') # iniparser library
+
+subdir('host')
+subdir('core')
+
+comm_opt = get_option('comm_opt')
+
+if comm_opt == 'ip'
+ ne_dependencies = [
+ npu_engine_dep,
+ plugin_ip_src_dep
+ ]
+
+ # Build final exported so
+ plugin_ip_executable = shared_library('npu-engine',
+ dependencies: ne_dependencies,
+ install : false)
+endif
--- /dev/null
+option('comm_opt', type : 'combo', choices : ['ip', 'fm'], value : 'ip')