Zephyr Project API  3.2.0
A Scalable Open Source RTOS
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
60#ifndef ZEPHYR_INCLUDE_MGMT_SERIAL_H_
61#define ZEPHYR_INCLUDE_MGMT_SERIAL_H_
62
63#include <zephyr/types.h>
64
65#ifdef __cplusplus
66extern "C" {
67#endif
68
69#define MCUMGR_SERIAL_HDR_PKT 0x0609
70#define MCUMGR_SERIAL_HDR_FRAG 0x0414
71#define MCUMGR_SERIAL_MAX_FRAME 128
72
73#define MCUMGR_SERIAL_HDR_PKT_1 (MCUMGR_SERIAL_HDR_PKT >> 8)
74#define MCUMGR_SERIAL_HDR_PKT_2 (MCUMGR_SERIAL_HDR_PKT & 0xff)
75#define MCUMGR_SERIAL_HDR_FRAG_1 (MCUMGR_SERIAL_HDR_FRAG >> 8)
76#define MCUMGR_SERIAL_HDR_FRAG_2 (MCUMGR_SERIAL_HDR_FRAG & 0xff)
77
82 /* Contains the partially- or fully-received mcumgr request. Data
83 * stored in this buffer has already been base64-decoded.
84 */
85 struct net_buf *nb;
86
87 /* Length of full packet, as read from header. */
89};
90
99typedef int (*mcumgr_serial_tx_cb)(const void *data, int len);
100
121 struct mcumgr_serial_rx_ctxt *rx_ctxt,
122 const uint8_t *frag, int frag_len);
123
134
135#ifdef __cplusplus
136}
137#endif
138
139#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:99
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:81
uint16_t pkt_len
Definition: serial.h:88
struct net_buf * nb
Definition: serial.h:85
Network buffer representation.
Definition: buf.h:914
uint16_t len
Definition: buf.h:945
static fdata_t data[2]
Definition: test_fifo_contexts.c:15