Zephyr Project API  3.4.0
A Scalable Open Source RTOS
os_mgmt.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018-2021 mcumgr authors
3 * Copyright (c) 2022 Laird Connectivity
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef H_OS_MGMT_
9#define H_OS_MGMT_
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
18#define OS_MGMT_ID_ECHO 0
19#define OS_MGMT_ID_CONS_ECHO_CTRL 1
20#define OS_MGMT_ID_TASKSTAT 2
21#define OS_MGMT_ID_MPSTAT 3
22#define OS_MGMT_ID_DATETIME_STR 4
23#define OS_MGMT_ID_RESET 5
24#define OS_MGMT_ID_MCUMGR_PARAMS 6
25#define OS_MGMT_ID_INFO 7
26
33
36
39};
40
41/* Bitmask values used by the os info command handler. Note that the width of this variable is
42 * 32-bits, allowing 32 flags, custom user-level implementations should start at
43 * OS_MGMT_INFO_FORMAT_USER_CUSTOM_START and reference that directly as additional format
44 * specifiers might be added to this list in the future.
45 */
56
58};
59
60/* Structure provided in the MGMT_EVT_OP_OS_MGMT_INFO_CHECK notification callback */
62 /* Input format string from the mcumgr client */
63 struct zcbor_string *format;
64 /* Bitmask of values specifying which outputs should be present */
66 /* Number of valid format characters parsed, must be incremented by 1 for each valid
67 * character
68 */
70 /* Needs to be set to true if the OS name is being provided by external code */
72};
73
74/* Structure provided in the MGMT_EVT_OP_OS_MGMT_INFO_APPEND notification callback */
76 /* The format bitmask from the processed commands, the bits should be cleared once
77 * processed, note that if all_format_specified is specified, the corrisponding bits here
78 * will not be set
79 */
81 /* Will be true if the all 'a' specifier was provided */
83 /* The output buffer which the responses should be appended to. If prior_output is true, a
84 * space must be added prior to the output response
85 */
87 /* The current size of the output response in the output buffer, must be updated to be the
88 * size of the output response after appending data
89 */
91 /* The size of the output buffer, including null terminator character, if the output
92 * response would exceed this size, the function must abort and return false to return a
93 * memory error to the client
94 */
96 /* If there has been prior output, must be set to true if a response has been output */
98};
99
100#ifdef CONFIG_MCUMGR_SMP_SUPPORT_ORIGINAL_PROTOCOL
101/*
102 * @brief Translate OS mgmt group error code into MCUmgr error code
103 *
104 * @param ret #os_mgmt_ret_code_t error code
105 *
106 * @return #mcumgr_err_t error code
107 */
108int os_mgmt_translate_error_code(uint16_t ret);
109#endif
110
111#ifdef __cplusplus
112}
113#endif
114
115#endif /* H_OS_MGMT_ */
#define BIT(n)
Unsigned integer with bit position n set (signed in assembly language).
Definition: util_macro.h:44
static ZTEST_BMEM volatile int ret
Definition: k_float_disable.c:29
os_mgmt_ret_code_t
Definition: os_mgmt.h:30
@ OS_MGMT_RET_RC_OK
Definition: os_mgmt.h:32
@ OS_MGMT_RET_RC_INVALID_FORMAT
Definition: os_mgmt.h:38
@ OS_MGMT_RET_RC_UNKNOWN
Definition: os_mgmt.h:35
os_mgmt_info_formats
Definition: os_mgmt.h:46
@ OS_MGMT_INFO_FORMAT_KERNEL_VERSION
Definition: os_mgmt.h:50
@ OS_MGMT_INFO_FORMAT_PROCESSOR
Definition: os_mgmt.h:53
@ OS_MGMT_INFO_FORMAT_KERNEL_RELEASE
Definition: os_mgmt.h:49
@ OS_MGMT_INFO_FORMAT_HARDWARE_PLATFORM
Definition: os_mgmt.h:54
@ OS_MGMT_INFO_FORMAT_MACHINE
Definition: os_mgmt.h:52
@ OS_MGMT_INFO_FORMAT_NODE_NAME
Definition: os_mgmt.h:48
@ OS_MGMT_INFO_FORMAT_OPERATING_SYSTEM
Definition: os_mgmt.h:55
@ OS_MGMT_INFO_FORMAT_USER_CUSTOM_START
Definition: os_mgmt.h:57
@ OS_MGMT_INFO_FORMAT_BUILD_DATE_TIME
Definition: os_mgmt.h:51
@ OS_MGMT_INFO_FORMAT_KERNEL_NAME
Definition: os_mgmt.h:47
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Definition: os_mgmt.h:75
uint8_t * output
Definition: os_mgmt.h:86
uint32_t * format_bitmask
Definition: os_mgmt.h:80
bool all_format_specified
Definition: os_mgmt.h:82
bool * prior_output
Definition: os_mgmt.h:97
uint16_t * output_length
Definition: os_mgmt.h:90
uint16_t buffer_size
Definition: os_mgmt.h:95
Definition: os_mgmt.h:61
uint32_t * format_bitmask
Definition: os_mgmt.h:65
bool * custom_os_name
Definition: os_mgmt.h:71
uint16_t * valid_formats
Definition: os_mgmt.h:69
struct zcbor_string * format
Definition: os_mgmt.h:63