You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2018/01/06 02:02:13 UTC
[mynewt-mcumgr] 03/03: Add stubs for unimplemented OS-specific
functions.
This is an automated email from the ASF dual-hosted git repository.
ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-mcumgr.git
commit 22dcc8c6dd57c4b337ad432da13e70f523b6d758
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Fri Jan 5 17:57:23 2018 -0800
Add stubs for unimplemented OS-specific functions.
---
cmd/img_mgmt/include/img_mgmt/img_mgmt_impl.h | 8 +++--
cmd/img_mgmt/src/stubs.c | 45 +++++++++++++++++++++++++++
cmd/os_mgmt/include/os_mgmt/os_mgmt_impl.h | 7 +++++
cmd/os_mgmt/src/stubs.c | 19 +++++++++++
4 files changed, 76 insertions(+), 3 deletions(-)
diff --git a/cmd/img_mgmt/include/img_mgmt/img_mgmt_impl.h b/cmd/img_mgmt/include/img_mgmt/img_mgmt_impl.h
index b6b81b0..3ed13b0 100644
--- a/cmd/img_mgmt/include/img_mgmt/img_mgmt_impl.h
+++ b/cmd/img_mgmt/include/img_mgmt/img_mgmt_impl.h
@@ -1,9 +1,11 @@
#ifndef H_IMG_MGMT_IMPL_
#define H_IMG_MGMT_IMPL_
-/* This file declares implementation-specific functions required by image
- * management. Each function must be defined in a way that is compatible with
- * the host OS.
+/**
+ * @file
+ * @brief Declares implementation-specific functions required by image
+ * management. The default stubs can be overridden with functions that are
+ * compatible with the host OS.
*/
/**
diff --git a/cmd/img_mgmt/src/stubs.c b/cmd/img_mgmt/src/stubs.c
new file mode 100644
index 0000000..c6774ce
--- /dev/null
+++ b/cmd/img_mgmt/src/stubs.c
@@ -0,0 +1,45 @@
+/**
+ * These stubs get linked in when there is no equivalent OS-specific
+ * implementation.
+ */
+
+#include "mgmt/mgmt.h"
+#include "img_mgmt/img_mgmt_impl.h"
+
+int __attribute__((weak))
+img_mgmt_impl_erase_slot(void)
+{
+ return MGMT_ERR_ENOTSUP;
+}
+
+int __attribute__((weak))
+img_mgmt_impl_write_pending(int slot, bool permanent)
+{
+ return MGMT_ERR_ENOTSUP;
+}
+
+int __attribute__((weak))
+img_mgmt_impl_write_confirmed(void)
+{
+ return MGMT_ERR_ENOTSUP;
+}
+
+int __attribute__((weak))
+img_mgmt_impl_read(int slot, unsigned int offset, void *dst,
+ unsigned int num_bytes)
+{
+ return MGMT_ERR_ENOTSUP;
+}
+
+int __attribute__((weak))
+img_mgmt_impl_write_image_data(unsigned int offset, const void *data,
+ unsigned int num_bytes, bool last)
+{
+ return MGMT_ERR_ENOTSUP;
+}
+
+int __attribute__((weak))
+img_mgmt_impl_swap_type(void)
+{
+ return MGMT_ERR_ENOTSUP;
+}
diff --git a/cmd/os_mgmt/include/os_mgmt/os_mgmt_impl.h b/cmd/os_mgmt/include/os_mgmt/os_mgmt_impl.h
index b697f12..78beefe 100644
--- a/cmd/os_mgmt/include/os_mgmt/os_mgmt_impl.h
+++ b/cmd/os_mgmt/include/os_mgmt/os_mgmt_impl.h
@@ -1,6 +1,13 @@
#ifndef H_OS_MGMT_IMPL_
#define H_OS_MGMT_IMPL_
+/**
+ * @file
+ * @brief Declares implementation-specific functions required by OS management.
+ * The default stubs can be overridden with functions that are compatible with
+ * the host OS.
+ */
+
struct os_mgmt_task_info;
/**
diff --git a/cmd/os_mgmt/src/stubs.c b/cmd/os_mgmt/src/stubs.c
new file mode 100644
index 0000000..5eb2935
--- /dev/null
+++ b/cmd/os_mgmt/src/stubs.c
@@ -0,0 +1,19 @@
+/**
+ * These stubs get linked in when there is no equivalent OS-specific
+ * implementation.
+ */
+
+#include "mgmt/mgmt.h"
+#include "os_mgmt/os_mgmt_impl.h"
+
+int __attribute__((weak))
+os_mgmt_impl_task_info(int idx, struct os_mgmt_task_info *out_info)
+{
+ return MGMT_ERR_ENOTSUP;
+}
+
+int __attribute__((weak))
+os_mgmt_impl_reset(void)
+{
+ return MGMT_ERR_ENOTSUP;
+}
--
To stop receiving notification emails like this one, please contact
"commits@mynewt.apache.org" <co...@mynewt.apache.org>.