Zephyr API Documentation  3.6.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
7#ifndef ZEPHYR_INCLUDE_MGMT_SERIAL_H_
8#define ZEPHYR_INCLUDE_MGMT_SERIAL_H_
9
10#include <zephyr/types.h>
11
12#ifdef __cplusplus
13extern "C" {
14#endif
15
16#define MCUMGR_SERIAL_HDR_PKT 0x0609
17#define MCUMGR_SERIAL_HDR_FRAG 0x0414
18#define MCUMGR_SERIAL_MAX_FRAME 127
19
20#define MCUMGR_SERIAL_HDR_PKT_1 (MCUMGR_SERIAL_HDR_PKT >> 8)
21#define MCUMGR_SERIAL_HDR_PKT_2 (MCUMGR_SERIAL_HDR_PKT & 0xff)
22#define MCUMGR_SERIAL_HDR_FRAG_1 (MCUMGR_SERIAL_HDR_FRAG >> 8)
23#define MCUMGR_SERIAL_HDR_FRAG_2 (MCUMGR_SERIAL_HDR_FRAG & 0xff)
24
29 /* Contains the partially- or fully-received mcumgr request. Data
30 * stored in this buffer has already been base64-decoded.
31 */
32 struct net_buf *nb;
33
34 /* Length of full packet, as read from header. */
36};
37
46typedef int (*mcumgr_serial_tx_cb)(const void *data, int len);
47
68 struct mcumgr_serial_rx_ctxt *rx_ctxt,
69 const uint8_t *frag, int frag_len);
70
81
82#ifdef __cplusplus
83}
84#endif
85
86#endif
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_cb)(const void *data, int len)
Transmits a chunk of raw response data.
Definition: serial.h:46
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:28
uint16_t pkt_len
Definition: serial.h:35
struct net_buf * nb
Definition: serial.h:32
Network buffer representation.
Definition: buf.h:1004
uint8_t * data
Pointer to the start of data in the buffer.
Definition: buf.h:1030
uint16_t len
Length of the data behind the data pointer.
Definition: buf.h:1033