Zephyr API Documentation  2.7.0-rc2
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
59#ifndef ZEPHYR_INCLUDE_MGMT_SERIAL_H_
60#define ZEPHYR_INCLUDE_MGMT_SERIAL_H_
61
62#include <zephyr/types.h>
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68#define MCUMGR_SERIAL_HDR_PKT 0x0609
69#define MCUMGR_SERIAL_HDR_FRAG 0x0414
70#define MCUMGR_SERIAL_MAX_FRAME 128
71
72#define MCUMGR_SERIAL_HDR_PKT_1 (MCUMGR_SERIAL_HDR_PKT >> 8)
73#define MCUMGR_SERIAL_HDR_PKT_2 (MCUMGR_SERIAL_HDR_PKT & 0xff)
74#define MCUMGR_SERIAL_HDR_FRAG_1 (MCUMGR_SERIAL_HDR_FRAG >> 8)
75#define MCUMGR_SERIAL_HDR_FRAG_2 (MCUMGR_SERIAL_HDR_FRAG & 0xff)
76
81 /* Contains the partially- or fully-received mcumgr request. Data
82 * stored in this buffer has already been base64-decoded.
83 */
84 struct net_buf *nb;
85
86 /* Length of full packet, as read from header. */
88};
89
99typedef int (*mcumgr_serial_tx_cb)(const void *data, int len, void *arg);
100
121 struct mcumgr_serial_rx_ctxt *rx_ctxt,
122 const uint8_t *frag, int frag_len);
123
135 void *arg);
136
137#ifdef __cplusplus
138}
139#endif
140
141#endif
int mcumgr_serial_tx_pkt(const uint8_t *data, int len, mcumgr_serial_tx_cb cb, void *arg)
Encodes and transmits an mcumgr packet over serial.
int(* mcumgr_serial_tx_cb)(const void *data, int len, void *arg)
Transmits a chunk of raw response data.
Definition: serial.h:99
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.
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58
__UINT16_TYPE__ uint16_t
Definition: stdint.h:59
Maintains state for an incoming mcumgr request packet.
Definition: serial.h:80
uint16_t pkt_len
Definition: serial.h:87
struct net_buf * nb
Definition: serial.h:84
Network buffer representation.
Definition: buf.h:919
uint16_t len
Definition: buf.h:947
static fdata_t data[2]
Definition: test_fifo_contexts.c:15