Zephyr Project API 4.2.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
17#include <zephyr/types.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
24#define MCUMGR_SERIAL_HDR_PKT 0x0609
26#define MCUMGR_SERIAL_HDR_FRAG 0x0414
28#define MCUMGR_SERIAL_MAX_FRAME 127
29
31#define MCUMGR_SERIAL_HDR_PKT_1 (MCUMGR_SERIAL_HDR_PKT >> 8)
33#define MCUMGR_SERIAL_HDR_PKT_2 (MCUMGR_SERIAL_HDR_PKT & 0xff)
35#define MCUMGR_SERIAL_HDR_FRAG_1 (MCUMGR_SERIAL_HDR_FRAG >> 8)
37#define MCUMGR_SERIAL_HDR_FRAG_2 (MCUMGR_SERIAL_HDR_FRAG & 0xff)
38
51
60typedef int (*mcumgr_serial_tx_cb)(const void *data, int len);
61
82 struct mcumgr_serial_rx_ctxt *rx_ctxt,
83 const uint8_t *frag, int frag_len);
84
95
96#ifdef __cplusplus
97}
98#endif
99
104#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:60
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:42
uint16_t pkt_len
Length of full packet, as read from header.
Definition serial.h:49
struct net_buf * nb
Contains the partially- or fully-received mcumgr request.
Definition serial.h:46
Network buffer representation.
Definition net_buf.h:1006
uint8_t * data
Pointer to the start of data in the buffer.
Definition net_buf.h:1032
uint16_t len
Length of the data behind the data pointer.
Definition net_buf.h:1035