Zephyr Project API  3.2.0
A Scalable Open Source RTOS
smp.h
Go to the documentation of this file.
1/*
2 * Copyright Runtime.io 2018. All rights reserved.
3 * Copyright (c) 2022 Nordic Semiconductor ASA
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef ZEPHYR_INCLUDE_MGMT_SMP_H_
9#define ZEPHYR_INCLUDE_MGMT_SMP_H_
10
11#include <zephyr/kernel.h>
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
18struct net_buf;
19
29typedef int zephyr_smp_transport_out_fn(struct net_buf *nb);
30
45
60 const struct net_buf *src);
61
71typedef void zephyr_smp_transport_ud_free_fn(void *ud);
72
84typedef bool zephyr_smp_transport_query_valid_check_fn(struct net_buf *nb, void *arg);
85
90 /* Must be the first member. */
92
93 /* FIFO containing incoming requests to be processed. */
95
101
102#ifdef CONFIG_MCUMGR_SMP_REASSEMBLY
103 /* Packet reassembly internal data, API access only */
104 struct {
105 struct net_buf *current; /* net_buf used for reassembly */
106 uint16_t expected; /* expected bytes to come */
107 } __reassembly;
108#endif
109};
110
122 zephyr_smp_transport_out_fn *output_func,
126 zephyr_smp_transport_query_valid_check_fn *query_valid_check_func);
127
138void smp_rx_remove_invalid(struct zephyr_smp_transport *zst, void *arg);
139
140#ifdef __cplusplus
141}
142#endif
143
144#endif
Public kernel APIs.
void zephyr_smp_transport_init(struct zephyr_smp_transport *zst, zephyr_smp_transport_out_fn *output_func, zephyr_smp_transport_get_mtu_fn *get_mtu_func, zephyr_smp_transport_ud_copy_fn *ud_copy_func, zephyr_smp_transport_ud_free_fn *ud_free_func, zephyr_smp_transport_query_valid_check_fn *query_valid_check_func)
Initializes a Zephyr SMP transport object.
void zephyr_smp_transport_ud_free_fn(void *ud)
SMP free buffer user_data function for Zephyr.
Definition: smp.h:71
int zephyr_smp_transport_out_fn(struct net_buf *nb)
SMP transmit function for Zephyr.
Definition: smp.h:29
bool zephyr_smp_transport_query_valid_check_fn(struct net_buf *nb, void *arg)
Function for checking if queued data is still valid.
Definition: smp.h:84
void smp_rx_remove_invalid(struct zephyr_smp_transport *zst, void *arg)
Used to remove queued requests for an SMP transport that are no longer valid. A zephyr_smp_transport_...
int zephyr_smp_transport_ud_copy_fn(struct net_buf *dst, const struct net_buf *src)
SMP copy buffer user_data function for Zephyr.
Definition: smp.h:59
uint16_t zephyr_smp_transport_get_mtu_fn(const struct net_buf *nb)
SMP MTU query function for Zephyr.
Definition: smp.h:44
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Definition: kernel.h:2209
A structure used to submit work.
Definition: kernel.h:3664
Network buffer representation.
Definition: buf.h:914
Provides Zephyr-specific functionality for sending SMP responses.
Definition: smp.h:89
struct k_work zst_work
Definition: smp.h:91
struct k_fifo zst_fifo
Definition: smp.h:94
zephyr_smp_transport_get_mtu_fn * zst_get_mtu
Definition: smp.h:97
zephyr_smp_transport_ud_copy_fn * zst_ud_copy
Definition: smp.h:98
zephyr_smp_transport_ud_free_fn * zst_ud_free
Definition: smp.h:99
zephyr_smp_transport_query_valid_check_fn * zst_query_valid_check
Definition: smp.h:100
zephyr_smp_transport_out_fn * zst_output
Definition: smp.h:96
static ZTEST_BMEM struct thread_data expected