Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
serial.h
Go to the documentation of this file.
1/*
2 * Copyright Runtime.io 2018. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
12
13#ifndef ZEPHYR_INCLUDE_MGMT_SERIAL_H_
14#define ZEPHYR_INCLUDE_MGMT_SERIAL_H_
15
22
23#include <zephyr/types.h>
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
30#define MCUMGR_SERIAL_HDR_PKT 0x0609
32#define MCUMGR_SERIAL_HDR_FRAG 0x0414
34#define MCUMGR_SERIAL_MAX_FRAME 127
35
37#define MCUMGR_SERIAL_HDR_PKT_1 (MCUMGR_SERIAL_HDR_PKT >> 8)
39#define MCUMGR_SERIAL_HDR_PKT_2 (MCUMGR_SERIAL_HDR_PKT & 0xff)
41#define MCUMGR_SERIAL_HDR_FRAG_1 (MCUMGR_SERIAL_HDR_FRAG >> 8)
43#define MCUMGR_SERIAL_HDR_FRAG_2 (MCUMGR_SERIAL_HDR_FRAG & 0xff)
44
52 struct net_buf *nb;
53
56
57#if defined(CONFIG_MCUMGR_TRANSPORT_SERIAL_HAS_SMP_OVER_CONSOLE) && \
58 defined(CONFIG_MCUMGR_TRANSPORT_SERIAL_HAS_RAW_BINARY_NON_SMP_OVER_CONSOLE)
63 const bool raw_transport;
64#endif
65};
66
75typedef int (*mcumgr_serial_tx_cb)(const void *data, int len);
76
97 struct mcumgr_serial_rx_ctxt *rx_ctxt,
98 const uint8_t *frag, int frag_len);
99
110
111#ifdef __cplusplus
112}
113#endif
114
118
119#endif
int(* mcumgr_serial_tx_cb)(const void *data, int len)
Transmits a chunk of raw response data.
Definition serial.h:75
struct net_buf * mcumgr_serial_process_frag(struct mcumgr_serial_rx_ctxt *rx_ctxt, const uint8_t *frag, int frag_len)
Processes an mcumgr request fragment received over a serial transport.
int mcumgr_serial_tx_pkt(const uint8_t *data, int len, mcumgr_serial_tx_cb cb)
Encodes and transmits an mcumgr packet over serial.
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Maintains state for an incoming mcumgr request packet.
Definition serial.h:48
uint16_t pkt_len
Length of full packet, as read from header.
Definition serial.h:55
struct net_buf * nb
Contains the partially- or fully-received mcumgr request.
Definition serial.h:52
Network buffer representation.
Definition net_buf.h:1015
uint8_t * data
Pointer to the start of data in the buffer.
Definition net_buf.h:1104
uint16_t len
Length of the data behind the data pointer.
Definition net_buf.h:1107