1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
// Copyright 2025 NXP
//
// SPDX-License-Identifier: BSD-3-Clause
//! McuBoot Data Phase Packet Implementation
//!
//! This module provides structures and functionality for handling McuBoot data phase packets.
//! Data phase packets are used to transmit additional data after a command packet when the
//! command requires it (indicated by the [`CommandFlag::HasDataPhase`] flag in the command header).
//!
//! Data phase packets are typically used with commands like:
//! - [`CommandTag::WriteMemory`]: Contains the actual data to be written to memory
//! - [`CommandTag::ReceiveSBFile`]: Contains the SB (Secure Boot) file data
//! - [`CommandTag::ConfigureMemory`]: Contains configuration data for memory setup
use crate;
use crateResultComm;
use ;
/// Data phase packet identifier as defined by McuBoot protocol
const DATA_PHASE_CODE: u8 = 0xA5;
/// McuBoot data phase packet structure
///
/// Represents a data phase packet that carries additional data for commands that require it.
/// The data phase packet is sent after the command packet when the command's
/// [`CommandFlag::HasDataPhase`]
/// flag is set. This allows for transmission of variable-length data that exceeds the
/// command packet's parameter capacity.
///
/// # Usage
/// If using the McuBoot high-level interface, data phase packets are automatically sent
/// when a command requires additional data. However, if you're working with command packets
/// directly, you'll need to create and send the corresponding data phase packet manually
/// for commands that have the [`CommandFlag::HasDataPhase`] flag set.