Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
version.h
Go to the documentation of this file.
1
9
10#ifndef INFUSE_SDK_INCLUDE_INFUSE_VERSION_H_
11#define INFUSE_SDK_INCLUDE_INFUSE_VERSION_H_
12
13#include <zephyr/dfu/mcuboot.h>
14#include <zephyr/storage/flash_map.h>
15
16#if __has_include("zephyr/app_version.h")
17#include "zephyr/app_version.h"
18#else
19/* Fallback for applications without VERSION file */
21#define APP_VERSION_MAJOR 0
23#define APP_VERSION_MINOR 0
25#define APP_PATCHLEVEL 0
27#define APP_TWEAK 0
28#endif
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
40
42#define infuse_version mcuboot_img_sem_ver
43
51#define INFUSE_VERSION_INT(v) \
52 ((((uint32_t)(v)->major) << 24) | (((uint32_t)(v)->minor) << 16) | \
53 ((uint32_t)(v)->revision))
54
61
76static inline int infuse_version_compare(struct infuse_version *a, struct infuse_version *b)
77{
78 uint32_t a_int = INFUSE_VERSION_INT(a);
79 uint32_t b_int = INFUSE_VERSION_INT(b);
80
81 if (a_int < b_int) {
82 return 1;
83 }
84 if (a_int > b_int) {
85 return -1;
86 }
87 return 0;
88}
89
93
94#ifdef __cplusplus
95}
96#endif
97
98#endif /* INFUSE_SDK_INCLUDE_INFUSE_VERSION_H_ */
static int infuse_version_compare(struct mcuboot_img_sem_ver *a, struct mcuboot_img_sem_ver *b)
Compare two version structures.
Definition version.h:76
struct mcuboot_img_sem_ver application_version_get(void)
Get version of the currently running application.
#define infuse_version
Infuse version structure, uses the MCUboot semantic version definition.
Definition version.h:42
#define INFUSE_VERSION_INT(v)
Convert version struct to sortable integer.
Definition version.h:51