Zephyr API Documentation  3.0.0
A Scalable Open Source RTOS
3.0.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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
100typedef int (*mcumgr_serial_tx_cb)(const void *data, int len, void *arg);
101
122 struct mcumgr_serial_rx_ctxt *rx_ctxt,
123 const uint8_t *frag, int frag_len);
124
136 void *arg);
137
138#ifdef __cplusplus
139}
140#endif
141
142#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:100
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:81
uint16_t pkt_len
Definition: serial.h:88
struct net_buf * nb
Definition: serial.h:85
Network buffer representation.
Definition: buf.h:915
uint16_t len
Definition: buf.h:946
static fdata_t data[2]
Definition: test_fifo_contexts.c:15