da14531: port protocol format C unit tests to Rust
What changed, and why it matters
This commit is a straightforward refactoring of unit tests: the existing C-language tests for the DA14531 serial protocol framing format are removed and reimplemented in Rust. No production code is changed, and the commit message and diff only describe test migration. There is no security-relevant change to the firmware itself.
No security action required. Treat as normal test refactoring. If reviewing, confirm the Rust tests are run in CI and cover the same cases as the removed C tests.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff deletes test/unit-test/test_da14531.c and removes the da14531 C test target from test/unit-test/CMakeLists.txt. It adds equivalent Rust unit tests inside src/rust/bitbox-framed-serial-link/src/lib.rs under #[cfg(test)] mod tests, covering the same protocol_format behavior: basic framing, byte escaping, zero-length payloads, all single-byte payloads, length-field escaping, and CRC escaping. The production protocol_format and rust_da14531_crc functions are not modified.
Changed components
src/rust/bitbox-framed-serial-link/src/lib.rs (test module only)test/unit-test/test_da14531.c (deleted)test/unit-test/CMakeLists.txt (test target removed)Inspect captured patch +351 / −509
diff --git a/src/rust/bitbox-framed-serial-link/src/lib.rs b/src/rust/bitbox-framed-serial-link/src/lib.rs
index 49a4019..73f1594 100644
--- a/src/rust/bitbox-framed-serial-link/src/lib.rs
+++ b/src/rust/bitbox-framed-serial-link/src/lib.rs
@@ -104,8 +104,359 @@ pub extern "C" fn rust_da14531_crc(data: Bytes) -> u16 {
#[cfg(test)]
mod tests {
use super::*;
+ extern crate alloc;
+ use alloc::vec;
+ use hex_lit::hex;
use util::bytes::rust_util_bytes;
+ fn assert_format_case(packet_type: ProtocolPacketType, payload: &[u8], expected: &[u8]) {
+ let mut out = vec![0u8; expected.len()];
+ let len = protocol_format(&mut out, packet_type, payload);
+ assert_eq!(len, expected.len());
+ assert_eq!(&out[..len], expected);
+ }
+
+ // Verifies a small payload that requires no escaping is formatted correctly.
+ #[test]
+ fn test_format_basic_no_escaping() {
+ let payload = hex!("010203");
+ let expected = hex!("7eb403000102034f157e");
+ assert_format_case(ProtocolPacketType::CtrlData, &payload, &expected);
+ }
+
+ // Verifies payload bytes requiring escaping are encoded correctly.
+ #[test]
+ fn test_format_payload_bytes_escaped() {
+ let payload = [SL_SOF, SL_ESCAPE, 0x55];
+ let expected = hex!("7eb403007d5e7d5d55dec37e");
+ assert_format_case(ProtocolPacketType::CtrlData, &payload, &expected);
+ }
+
+ // Verifies framing/CRC for a zero-length payload.
+ #[test]
+ fn test_format_zero_length_payload() {
+ let payload: [u8; 0] = [];
+ let expected = hex!("7eb4000040267e");
+ assert_format_case(ProtocolPacketType::CtrlData, &payload, &expected);
+ }
+ // Verifies every single-byte payload value formats correctly.
+ #[test]
+ fn test_format_payload_all_bytes() {
+ let fixtures: [&[u8]; 256] = [
+ &hex!("7e3c0100005d907e"),
+ &hex!("7e3c0100019c507e"),
+ &hex!("7e3c010002dc517e"),
+ &hex!("7e3c0100031d917e"),
+ &hex!("7e3c0100045c537e"),
+ &hex!("7e3c0100059d937e"),
+ &hex!("7e3c010006dd927e"),
+ &hex!("7e3c0100071c527e"),
+ &hex!("7e3c0100085c567e"),
+ &hex!("7e3c0100099d967e"),
+ &hex!("7e3c01000add977e"),
+ &hex!("7e3c01000b1c577e"),
+ &hex!("7e3c01000c5d957e"),
+ &hex!("7e3c01000d9c557e"),
+ &hex!("7e3c01000edc547e"),
+ &hex!("7e3c01000f1d947e"),
+ &hex!("7e3c0100105c5c7e"),
+ &hex!("7e3c0100119d9c7e"),
+ &hex!("7e3c010012dd9d7e"),
+ &hex!("7e3c0100131c5d7e"),
+ &hex!("7e3c0100145d9f7e"),
+ &hex!("7e3c0100159c5f7e"),
+ &hex!("7e3c010016dc5e7e"),
+ &hex!("7e3c0100171d9e7e"),
+ &hex!("7e3c0100185d9a7e"),
+ &hex!("7e3c0100199c5a7e"),
+ &hex!("7e3c01001adc5b7e"),
+ &hex!("7e3c01001b1d9b7e"),
+ &hex!("7e3c01001c5c597e"),
+ &hex!("7e3c01001d9d997e"),
+ &hex!("7e3c01001edd987e"),
+ &hex!("7e3c01001f1c587e"),
+ &hex!("7e3c0100205c487e"),
+ &hex!("7e3c0100219d887e"),
+ &hex!("7e3c010022dd897e"),
+ &hex!("7e3c0100231c497e"),
+ &hex!("7e3c0100245d8b7e"),
+ &hex!("7e3c0100259c4b7e"),
+ &hex!("7e3c010026dc4a7e"),
+ &hex!("7e3c0100271d8a7e"),
+ &hex!("7e3c0100285d8e7e"),
+ &hex!("7e3c0100299c4e7e"),
+ &hex!("7e3c01002adc4f7e"),
+ &hex!("7e3c01002b1d8f7e"),
+ &hex!("7e3c01002c5c4d7e"),
+ &hex!("7e3c01002d9d8d7e"),
+ &hex!("7e3c01002edd8c7e"),
+ &hex!("7e3c01002f1c4c7e"),
+ &hex!("7e3c0100305d847e"),
+ &hex!("7e3c0100319c447e"),
+ &hex!("7e3c010032dc457e"),
+ &hex!("7e3c0100331d857e"),
+ &hex!("7e3c0100345c477e"),
+ &hex!("7e3c0100359d877e"),
+ &hex!("7e3c010036dd867e"),
+ &hex!("7e3c0100371c467e"),
+ &hex!("7e3c0100385c427e"),
+ &hex!("7e3c0100399d827e"),
+ &hex!("7e3c01003add837e"),
+ &hex!("7e3c01003b1c437e"),
+ &hex!("7e3c01003c5d817e"),
+ &hex!("7e3c01003d9c417e"),
+ &hex!("7e3c01003edc407e"),
+ &hex!("7e3c01003f1d807e"),
+ &hex!("7e3c0100405c607e"),
+ &hex!("7e3c0100419da07e"),
+ &hex!("7e3c010042dda17e"),
+ &hex!("7e3c0100431c617e"),
+ &hex!("7e3c0100445da37e"),
+ &hex!("7e3c0100459c637e"),
+ &hex!("7e3c010046dc627e"),
+ &hex!("7e3c0100471da27e"),
+ &hex!("7e3c0100485da67e"),
+ &hex!("7e3c0100499c667e"),
+ &hex!("7e3c01004adc677e"),
+ &hex!("7e3c01004b1da77e"),
+ &hex!("7e3c01004c5c657e"),
+ &hex!("7e3c01004d9da57e"),
+ &hex!("7e3c01004edda47e"),
+ &hex!("7e3c01004f1c647e"),
+ &hex!("7e3c0100505dac7e"),
+ &hex!("7e3c0100519c6c7e"),
+ &hex!("7e3c010052dc6d7e"),
+ &hex!("7e3c0100531dad7e"),
+ &hex!("7e3c0100545c6f7e"),
+ &hex!("7e3c0100559daf7e"),
+ &hex!("7e3c010056ddae7e"),
+ &hex!("7e3c0100571c6e7e"),
+ &hex!("7e3c0100585c6a7e"),
+ &hex!("7e3c0100599daa7e"),
+ &hex!("7e3c01005addab7e"),
+ &hex!("7e3c01005b1c6b7e"),
+ &hex!("7e3c01005c5da97e"),
+ &hex!("7e3c01005d9c697e"),
+ &hex!("7e3c01005edc687e"),
+ &hex!("7e3c01005f1da87e"),
+ &hex!("7e3c0100605db87e"),
+ &hex!("7e3c0100619c787e"),
+ &hex!("7e3c010062dc797e"),
+ &hex!("7e3c0100631db97e"),
+ &hex!("7e3c0100645c7b7e"),
+ &hex!("7e3c0100659dbb7e"),
+ &hex!("7e3c010066ddba7e"),
+ &hex!("7e3c0100671c7a7e"),
+ &hex!("7e3c0100685c7d5e7e"),
+ &hex!("7e3c0100699dbe7e"),
+ &hex!("7e3c01006addbf7e"),
+ &hex!("7e3c01006b1c7f7e"),
+ &hex!("7e3c01006c5dbd7e"),
+ &hex!("7e3c01006d9c7d5d7e"),
+ &hex!("7e3c01006edc7c7e"),
+ &hex!("7e3c01006f1dbc7e"),
+ &hex!("7e3c0100705c747e"),
+ &hex!("7e3c0100719db47e"),
+ &hex!("7e3c010072ddb57e"),
+ &hex!("7e3c0100731c757e"),
+ &hex!("7e3c0100745db77e"),
+ &hex!("7e3c0100759c777e"),
+ &hex!("7e3c010076dc767e"),
+ &hex!("7e3c0100771db67e"),
+ &hex!("7e3c0100785db27e"),
+ &hex!("7e3c0100799c727e"),
+ &hex!("7e3c01007adc737e"),
+ &hex!("7e3c01007b1db37e"),
+ &hex!("7e3c01007c5c717e"),
+ &hex!("7e3c01007d5d9db17e"),
+ &hex!("7e3c01007d5eddb07e"),
+ &hex!("7e3c01007f1c707e"),
+ &hex!("7e3c0100805c307e"),
+ &hex!("7e3c0100819df07e"),
+ &hex!("7e3c010082ddf17e"),
+ &hex!("7e3c0100831c317e"),
+ &hex!("7e3c0100845df37e"),
+ &hex!("7e3c0100859c337e"),
+ &hex!("7e3c010086dc327e"),
+ &hex!("7e3c0100871df27e"),
+ &hex!("7e3c0100885df67e"),
+ &hex!("7e3c0100899c367e"),
+ &hex!("7e3c01008adc377e"),
+ &hex!("7e3c01008b1df77e"),
+ &hex!("7e3c01008c5c357e"),
+ &hex!("7e3c01008d9df57e"),
+ &hex!("7e3c01008eddf47e"),
+ &hex!("7e3c01008f1c347e"),
+ &hex!("7e3c0100905dfc7e"),
+ &hex!("7e3c0100919c3c7e"),
+ &hex!("7e3c010092dc3d7e"),
+ &hex!("7e3c0100931dfd7e"),
+ &hex!("7e3c0100945c3f7e"),
+ &hex!("7e3c0100959dff7e"),
+ &hex!("7e3c010096ddfe7e"),
+ &hex!("7e3c0100971c3e7e"),
+ &hex!("7e3c0100985c3a7e"),
+ &hex!("7e3c0100999dfa7e"),
+ &hex!("7e3c01009addfb7e"),
+ &hex!("7e3c01009b1c3b7e"),
+ &hex!("7e3c01009c5df97e"),
+ &hex!("7e3c01009d9c397e"),
+ &hex!("7e3c01009edc387e"),
+ &hex!("7e3c01009f1df87e"),
+ &hex!("7e3c0100a05de87e"),
+ &hex!("7e3c0100a19c287e"),
+ &hex!("7e3c0100a2dc297e"),
+ &hex!("7e3c0100a31de97e"),
+ &hex!("7e3c0100a45c2b7e"),
+ &hex!("7e3c0100a59deb7e"),
+ &hex!("7e3c0100a6ddea7e"),
+ &hex!("7e3c0100a71c2a7e"),
+ &hex!("7e3c0100a85c2e7e"),
+ &hex!("7e3c0100a99dee7e"),
+ &hex!("7e3c0100aaddef7e"),
+ &hex!("7e3c0100ab1c2f7e"),
+ &hex!("7e3c0100ac5ded7e"),
+ &hex!("7e3c0100ad9c2d7e"),
+ &hex!("7e3c0100aedc2c7e"),
+ &hex!("7e3c0100af1dec7e"),
+ &hex!("7e3c0100b05c247e"),
+ &hex!("7e3c0100b19de47e"),
+ &hex!("7e3c0100b2dde57e"),
+ &hex!("7e3c0100b31c257e"),
+ &hex!("7e3c0100b45de77e"),
+ &hex!("7e3c0100b59c277e"),
+ &hex!("7e3c0100b6dc267e"),
+ &hex!("7e3c0100b71de67e"),
+ &hex!("7e3c0100b85de27e"),
+ &hex!("7e3c0100b99c227e"),
+ &hex!("7e3c0100badc237e"),
+ &hex!("7e3c0100bb1de37e"),
+ &hex!("7e3c0100bc5c217e"),
+ &hex!("7e3c0100bd9de17e"),
+ &hex!("7e3c0100bedde07e"),
+ &hex!("7e3c0100bf1c207e"),
+ &hex!("7e3c0100c05dc07e"),
+ &hex!("7e3c0100c19c007e"),
+ &hex!("7e3c0100c2dc017e"),
+ &hex!("7e3c0100c31dc17e"),
+ &hex!("7e3c0100c45c037e"),
+ &hex!("7e3c0100c59dc37e"),
+ &hex!("7e3c0100c6ddc27e"),
+ &hex!("7e3c0100c71c027e"),
+ &hex!("7e3c0100c85c067e"),
+ &hex!("7e3c0100c99dc67e"),
+ &hex!("7e3c0100caddc77e"),
+ &hex!("7e3c0100cb1c077e"),
+ &hex!("7e3c0100cc5dc57e"),
+ &hex!("7e3c0100cd9c057e"),
+ &hex!("7e3c0100cedc047e"),
+ &hex!("7e3c0100cf1dc47e"),
+ &hex!("7e3c0100d05c0c7e"),
+ &hex!("7e3c0100d19dcc7e"),
+ &hex!("7e3c0100d2ddcd7e"),
+ &hex!("7e3c0100d31c0d7e"),
+ &hex!("7e3c0100d45dcf7e"),
+ &hex!("7e3c0100d59c0f7e"),
+ &hex!("7e3c0100d6dc0e7e"),
+ &hex!("7e3c0100d71dce7e"),
+ &hex!("7e3c0100d85dca7e"),
+ &hex!("7e3c0100d99c0a7e"),
+ &hex!("7e3c0100dadc0b7e"),
+ &hex!("7e3c0100db1dcb7e"),
+ &hex!("7e3c0100dc5c097e"),
+ &hex!("7e3c0100dd9dc97e"),
+ &hex!("7e3c0100deddc87e"),
+ &hex!("7e3c0100df1c087e"),
+ &hex!("7e3c0100e05c187e"),
+ &hex!("7e3c0100e19dd87e"),
+ &hex!("7e3c0100e2ddd97e"),
+ &hex!("7e3c0100e31c197e"),
+ &hex!("7e3c0100e45ddb7e"),
+ &hex!("7e3c0100e59c1b7e"),
+ &hex!("7e3c0100e6dc1a7e"),
+ &hex!("7e3c0100e71dda7e"),
+ &hex!("7e3c0100e85dde7e"),
+ &hex!("7e3c0100e99c1e7e"),
+ &hex!("7e3c0100eadc1f7e"),
+ &hex!("7e3c0100eb1ddf7e"),
+ &hex!("7e3c0100ec5c1d7e"),
+ &hex!("7e3c0100ed9ddd7e"),
+ &hex!("7e3c0100eedddc7e"),
+ &hex!("7e3c0100ef1c1c7e"),
+ &hex!("7e3c0100f05dd47e"),
+ &hex!("7e3c0100f19c147e"),
+ &hex!("7e3c0100f2dc157e"),
+ &hex!("7e3c0100f31dd57e"),
+ &hex!("7e3c0100f45c177e"),
+ &hex!("7e3c0100f59dd77e"),
+ &hex!("7e3c0100f6ddd67e"),
+ &hex!("7e3c0100f71c167e"),
+ &hex!("7e3c0100f85c127e"),
+ &hex!("7e3c0100f99dd27e"),
+ &hex!("7e3c0100faddd37e"),
+ &hex!("7e3c0100fb1c137e"),
+ &hex!("7e3c0100fc5dd17e"),
+ &hex!("7e3c0100fd9c117e"),
+ &hex!("7e3c0100fedc107e"),
+ &hex!("7e3c0100ff1dd07e"),
+ ];
+ for (value, expected) in fixtures.iter().enumerate() {
+ let payload = [value as u8];
+ assert_format_case(ProtocolPacketType::BleData, &payload, expected);
+ }
+ }
+
+ // Verifies escaping when the low payload length byte matches SOF/ESCAPE.
+ #[test]
+ fn test_format_len_low_escaping() {
+ let payload_7d = vec![0x11; 0x7d];
+ let mut expected_7d = hex!("7eb47d5d00").to_vec();
+ expected_7d.extend(core::iter::repeat_n(0x11, payload_7d.len()));
+ expected_7d.extend_from_slice(&hex!("08a17e"));
+ assert_format_case(ProtocolPacketType::CtrlData, &payload_7d, &expected_7d);
+
+ let payload_7e = vec![0x11; 0x7e];
+ let mut expected_7e = hex!("7eb47d5e00").to_vec();
+ expected_7e.extend(core::iter::repeat_n(0x11, payload_7e.len()));
+ expected_7e.extend_from_slice(&hex!("602e7e"));
+ assert_format_case(ProtocolPacketType::CtrlData, &payload_7e, &expected_7e);
+ }
+
+ // Verifies escaping when the high payload length byte matches SOF/ESCAPE.
+ #[test]
+ fn test_format_len_high_escaping() {
+ let payload_len_7d00 = 0x7d00usize;
+ let payload_len_7e00 = 0x7e00usize;
+ let payload = vec![0x22; payload_len_7e00];
+
+ let mut expected_7d00 = hex!("7eb4007d5d").to_vec();
+ expected_7d00.extend(core::iter::repeat_n(0x22, payload_len_7d00));
+ expected_7d00.extend_from_slice(&hex!("c2f87e"));
+ assert_eq!(expected_7d00.len(), 32008);
+ assert_format_case(
+ ProtocolPacketType::CtrlData,
+ &payload[..payload_len_7d00],
+ &expected_7d00,
+ );
+
+ let mut expected_7e00 = hex!("7eb4007d5e").to_vec();
+ expected_7e00.extend(core::iter::repeat_n(0x22, payload_len_7e00));
+ expected_7e00.extend_from_slice(&hex!("7ce97e"));
+ assert_eq!(expected_7e00.len(), 32264);
+ assert_format_case(ProtocolPacketType::CtrlData, &payload, &expected_7e00);
+ }
+
+ // Verifies CRC bytes requiring escaping are encoded correctly.
+ #[test]
+ fn test_format_crc_escaping() {
+ let payload_low = hex!("6800");
+ let payload_high = hex!("0001");
+ let expected_low = hex!("7e3c020068007d5e7d5d7e");
+ let expected_high = hex!("7e3c02000001907d5d7e");
+ assert_format_case(ProtocolPacketType::BleData, &payload_low, &expected_low);
+ assert_format_case(ProtocolPacketType::BleData, &payload_high, &expected_high);
+ }
+
#[test]
fn test_rust_da14531_crc_empty() {
let data = [];
diff --git a/test/unit-test/CMakeLists.txt b/test/unit-test/CMakeLists.txt
index 77e0703..cdc75ea 100644
--- a/test/unit-test/CMakeLists.txt
+++ b/test/unit-test/CMakeLists.txt
@@ -45,8 +45,6 @@ else()
""
memory
"-Wl,--wrap=memory_read_chunk_fake,--wrap=memory_write_chunk_fake,--wrap=rust_noise_generate_static_private_key,--wrap=memory_read_shared_bootdata_fake,--wrap=memory_write_to_address_fake,--wrap=random_32_bytes_mcu"
- da14531
- ""
util
""
ugui
@@ -75,7 +73,6 @@ else()
)
target_include_directories(${EXE} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/external/asf4-drivers/hal/utils/include
)
if(TEST_NAME STREQUAL "optiga")
target_sources(${EXE} PRIVATE
diff --git a/test/unit-test/test_da14531.c b/test/unit-test/test_da14531.c
deleted file mode 100644
index 5fea5f0..0000000
--- a/test/unit-test/test_da14531.c
+++ /dev/null
@@ -1,506 +0,0 @@
-// Copyright 2025 Shift Crypto AG
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "da14531/da14531_protocol.h"
-
-#include <limits.h>
-#include <setjmp.h>
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <cmocka.h>
-
-#define SL_SOF 0x7E
-#define SL_ESCAPE 0x7D
-
-static void _assert_format_case_fixture(
- enum da14531_protocol_packet_type type,
- const uint8_t* payload,
- uint16_t payload_len,
- const uint8_t* expected,
- size_t expected_len)
-{
- size_t buf_len = expected_len;
- assert_true(buf_len <= UINT16_MAX);
-
- uint8_t* actual = malloc(buf_len);
- assert_non_null(actual);
- memset(actual, 0xaa, buf_len);
-
- uint16_t actual_len =
- da14531_protocol_format(actual, (uint16_t)buf_len, type, payload, payload_len);
-
- assert_int_equal(actual_len, expected_len);
- assert_memory_equal(actual, expected, expected_len);
-
- free(actual);
-}
-
-// Verifies a small payload that requires no escaping is formatted correctly.
-static void _test_format_basic_no_escaping(void** state)
-{
- (void)state;
-
- const uint8_t payload[] = {0x01, 0x02, 0x03};
- const uint8_t expected[] = {0x7e, 0xb4, 0x03, 0x00, 0x01, 0x02, 0x03, 0x4f, 0x15, 0x7e};
- _assert_format_case_fixture(
- DA14531_PROTOCOL_PACKET_TYPE_CTRL_DATA,
- payload,
- (uint16_t)sizeof(payload),
- expected,
- sizeof(expected));
-}
-
-// Verifies payload bytes requiring escaping are encoded correctly.
-static void _test_format_payload_bytes_escaped(void** state)
-{
- (void)state;
-
- const uint8_t payload[] = {SL_SOF, SL_ESCAPE, 0x55};
- const uint8_t expected[] = {
- 0x7e, 0xb4, 0x03, 0x00, 0x7d, 0x5e, 0x7d, 0x5d, 0x55, 0xde, 0xc3, 0x7e};
- _assert_format_case_fixture(
- DA14531_PROTOCOL_PACKET_TYPE_CTRL_DATA,
- payload,
- (uint16_t)sizeof(payload),
- expected,
- sizeof(expected));
-}
-
-// Verifies framing/CRC for a zero-length payload.
-static void _test_format_zero_length_payload(void** state)
-{
- (void)state;
-
- uint8_t payload_dummy = 0xaa;
- const uint8_t expected[] = {0x7e, 0xb4, 0x00, 0x00, 0x40, 0x26, 0x7e};
- _assert_format_case_fixture(
- DA14531_PROTOCOL_PACKET_TYPE_CTRL_DATA, &payload_dummy, 0, expected, sizeof(expected));
-}
-
-// Verifies every single-byte payload value formats correctly.
-static void _test_format_payload_all_bytes(void** state)
-{
- (void)state;
- const uint8_t fixture_payload_all_bytes[256][9] = {
- {0x7e, 0x3c, 0x01, 0x00, 0x00, 0x5d, 0x90, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x01, 0x9c, 0x50, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x02, 0xdc, 0x51, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x03, 0x1d, 0x91, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x04, 0x5c, 0x53, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x05, 0x9d, 0x93, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x06, 0xdd, 0x92, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x07, 0x1c, 0x52, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x08, 0x5c, 0x56, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x09, 0x9d, 0x96, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x0a, 0xdd, 0x97, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x0b, 0x1c, 0x57, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x0c, 0x5d, 0x95, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x0d, 0x9c, 0x55, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x0e, 0xdc, 0x54, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x0f, 0x1d, 0x94, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x10, 0x5c, 0x5c, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x11, 0x9d, 0x9c, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x12, 0xdd, 0x9d, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x13, 0x1c, 0x5d, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x14, 0x5d, 0x9f, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x15, 0x9c, 0x5f, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x16, 0xdc, 0x5e, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x17, 0x1d, 0x9e, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x18, 0x5d, 0x9a, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x19, 0x9c, 0x5a, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x1a, 0xdc, 0x5b, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x1b, 0x1d, 0x9b, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x1c, 0x5c, 0x59, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x1d, 0x9d, 0x99, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x1e, 0xdd, 0x98, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x1f, 0x1c, 0x58, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x20, 0x5c, 0x48, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x21, 0x9d, 0x88, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x22, 0xdd, 0x89, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x23, 0x1c, 0x49, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x24, 0x5d, 0x8b, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x25, 0x9c, 0x4b, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x26, 0xdc, 0x4a, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x27, 0x1d, 0x8a, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x28, 0x5d, 0x8e, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x29, 0x9c, 0x4e, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x2a, 0xdc, 0x4f, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x2b, 0x1d, 0x8f, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x2c, 0x5c, 0x4d, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x2d, 0x9d, 0x8d, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x2e, 0xdd, 0x8c, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x2f, 0x1c, 0x4c, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x30, 0x5d, 0x84, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x31, 0x9c, 0x44, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x32, 0xdc, 0x45, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x33, 0x1d, 0x85, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x34, 0x5c, 0x47, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x35, 0x9d, 0x87, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x36, 0xdd, 0x86, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x37, 0x1c, 0x46, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x38, 0x5c, 0x42, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x39, 0x9d, 0x82, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x3a, 0xdd, 0x83, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x3b, 0x1c, 0x43, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x3c, 0x5d, 0x81, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x3d, 0x9c, 0x41, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x3e, 0xdc, 0x40, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x3f, 0x1d, 0x80, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x40, 0x5c, 0x60, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x41, 0x9d, 0xa0, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x42, 0xdd, 0xa1, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x43, 0x1c, 0x61, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x44, 0x5d, 0xa3, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x45, 0x9c, 0x63, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x46, 0xdc, 0x62, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x47, 0x1d, 0xa2, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x48, 0x5d, 0xa6, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x49, 0x9c, 0x66, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x4a, 0xdc, 0x67, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x4b, 0x1d, 0xa7, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x4c, 0x5c, 0x65, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x4d, 0x9d, 0xa5, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x4e, 0xdd, 0xa4, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x4f, 0x1c, 0x64, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x50, 0x5d, 0xac, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x51, 0x9c, 0x6c, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x52, 0xdc, 0x6d, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x53, 0x1d, 0xad, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x54, 0x5c, 0x6f, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x55, 0x9d, 0xaf, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x56, 0xdd, 0xae, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x57, 0x1c, 0x6e, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x58, 0x5c, 0x6a, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x59, 0x9d, 0xaa, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x5a, 0xdd, 0xab, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x5b, 0x1c, 0x6b, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x5c, 0x5d, 0xa9, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x5d, 0x9c, 0x69, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x5e, 0xdc, 0x68, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x5f, 0x1d, 0xa8, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x60, 0x5d, 0xb8, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x61, 0x9c, 0x78, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x62, 0xdc, 0x79, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x63, 0x1d, 0xb9, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x64, 0x5c, 0x7b, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x65, 0x9d, 0xbb, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x66, 0xdd, 0xba, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x67, 0x1c, 0x7a, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x68, 0x5c, 0x7d, 0x5e, 0x7e},
- {0x7e, 0x3c, 0x01, 0x00, 0x69, 0x9d, 0xbe, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x6a, 0xdd, 0xbf, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x6b, 0x1c, 0x7f, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x6c, 0x5d, 0xbd, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x6d, 0x9c, 0x7d, 0x5d, 0x7e},
- {0x7e, 0x3c, 0x01, 0x00, 0x6e, 0xdc, 0x7c, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x6f, 0x1d, 0xbc, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x70, 0x5c, 0x74, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x71, 0x9d, 0xb4, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x72, 0xdd, 0xb5, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x73, 0x1c, 0x75, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x74, 0x5d, 0xb7, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x75, 0x9c, 0x77, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x76, 0xdc, 0x76, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x77, 0x1d, 0xb6, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x78, 0x5d, 0xb2, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x79, 0x9c, 0x72, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x7a, 0xdc, 0x73, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x7b, 0x1d, 0xb3, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x7c, 0x5c, 0x71, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x7d, 0x5d, 0x9d, 0xb1, 0x7e},
- {0x7e, 0x3c, 0x01, 0x00, 0x7d, 0x5e, 0xdd, 0xb0, 0x7e},
- {0x7e, 0x3c, 0x01, 0x00, 0x7f, 0x1c, 0x70, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x80, 0x5c, 0x30, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x81, 0x9d, 0xf0, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x82, 0xdd, 0xf1, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x83, 0x1c, 0x31, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x84, 0x5d, 0xf3, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x85, 0x9c, 0x33, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x86, 0xdc, 0x32, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x87, 0x1d, 0xf2, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x88, 0x5d, 0xf6, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x89, 0x9c, 0x36, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x8a, 0xdc, 0x37, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x8b, 0x1d, 0xf7, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x8c, 0x5c, 0x35, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x8d, 0x9d, 0xf5, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x8e, 0xdd, 0xf4, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x8f, 0x1c, 0x34, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x90, 0x5d, 0xfc, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x91, 0x9c, 0x3c, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x92, 0xdc, 0x3d, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x93, 0x1d, 0xfd, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x94, 0x5c, 0x3f, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x95, 0x9d, 0xff, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x96, 0xdd, 0xfe, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x97, 0x1c, 0x3e, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x98, 0x5c, 0x3a, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x99, 0x9d, 0xfa, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x9a, 0xdd, 0xfb, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x9b, 0x1c, 0x3b, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x9c, 0x5d, 0xf9, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x9d, 0x9c, 0x39, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x9e, 0xdc, 0x38, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0x9f, 0x1d, 0xf8, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xa0, 0x5d, 0xe8, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xa1, 0x9c, 0x28, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xa2, 0xdc, 0x29, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xa3, 0x1d, 0xe9, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xa4, 0x5c, 0x2b, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xa5, 0x9d, 0xeb, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xa6, 0xdd, 0xea, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xa7, 0x1c, 0x2a, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xa8, 0x5c, 0x2e, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xa9, 0x9d, 0xee, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xaa, 0xdd, 0xef, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xab, 0x1c, 0x2f, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xac, 0x5d, 0xed, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xad, 0x9c, 0x2d, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xae, 0xdc, 0x2c, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xaf, 0x1d, 0xec, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xb0, 0x5c, 0x24, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xb1, 0x9d, 0xe4, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xb2, 0xdd, 0xe5, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xb3, 0x1c, 0x25, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xb4, 0x5d, 0xe7, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xb5, 0x9c, 0x27, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xb6, 0xdc, 0x26, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xb7, 0x1d, 0xe6, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xb8, 0x5d, 0xe2, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xb9, 0x9c, 0x22, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xba, 0xdc, 0x23, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xbb, 0x1d, 0xe3, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xbc, 0x5c, 0x21, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xbd, 0x9d, 0xe1, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xbe, 0xdd, 0xe0, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xbf, 0x1c, 0x20, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xc0, 0x5d, 0xc0, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xc1, 0x9c, 0x00, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xc2, 0xdc, 0x01, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xc3, 0x1d, 0xc1, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xc4, 0x5c, 0x03, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xc5, 0x9d, 0xc3, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xc6, 0xdd, 0xc2, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xc7, 0x1c, 0x02, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xc8, 0x5c, 0x06, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xc9, 0x9d, 0xc6, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xca, 0xdd, 0xc7, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xcb, 0x1c, 0x07, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xcc, 0x5d, 0xc5, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xcd, 0x9c, 0x05, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xce, 0xdc, 0x04, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xcf, 0x1d, 0xc4, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xd0, 0x5c, 0x0c, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xd1, 0x9d, 0xcc, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xd2, 0xdd, 0xcd, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xd3, 0x1c, 0x0d, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xd4, 0x5d, 0xcf, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xd5, 0x9c, 0x0f, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xd6, 0xdc, 0x0e, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xd7, 0x1d, 0xce, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xd8, 0x5d, 0xca, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xd9, 0x9c, 0x0a, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xda, 0xdc, 0x0b, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xdb, 0x1d, 0xcb, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xdc, 0x5c, 0x09, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xdd, 0x9d, 0xc9, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xde, 0xdd, 0xc8, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xdf, 0x1c, 0x08, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xe0, 0x5c, 0x18, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xe1, 0x9d, 0xd8, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xe2, 0xdd, 0xd9, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xe3, 0x1c, 0x19, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xe4, 0x5d, 0xdb, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xe5, 0x9c, 0x1b, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xe6, 0xdc, 0x1a, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xe7, 0x1d, 0xda, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xe8, 0x5d, 0xde, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xe9, 0x9c, 0x1e, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xea, 0xdc, 0x1f, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xeb, 0x1d, 0xdf, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xec, 0x5c, 0x1d, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xed, 0x9d, 0xdd, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xee, 0xdd, 0xdc, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xef, 0x1c, 0x1c, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xf0, 0x5d, 0xd4, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xf1, 0x9c, 0x14, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xf2, 0xdc, 0x15, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xf3, 0x1d, 0xd5, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xf4, 0x5c, 0x17, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xf5, 0x9d, 0xd7, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xf6, 0xdd, 0xd6, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xf7, 0x1c, 0x16, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xf8, 0x5c, 0x12, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xf9, 0x9d, 0xd2, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xfa, 0xdd, 0xd3, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xfb, 0x1c, 0x13, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xfc, 0x5d, 0xd1, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xfd, 0x9c, 0x11, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xfe, 0xdc, 0x10, 0x7e, 0x00},
- {0x7e, 0x3c, 0x01, 0x00, 0xff, 0x1d, 0xd0, 0x7e, 0x00},
- };
- const uint8_t fixture_payload_all_bytes_len[256] = {
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 8, 8, 8, 8, 9, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- };
- uint8_t payload = 0;
- for (int i = 0; i <= 0xff; i++) {
- payload = (uint8_t)i;
- _assert_format_case_fixture(
- DA14531_PROTOCOL_PACKET_TYPE_BLE_DATA,
- &payload,
- 1,
- fixture_payload_all_bytes[i],
- fixture_payload_all_bytes_len[i]);
- }
-}
-
-// Verifies escaping when the low payload length byte matches SOF/ESCAPE.
-static void _test_format_len_low_escaping(void** state)
-{
- (void)state;
- uint8_t* payload = malloc(0x7E);
- assert_non_null(payload);
- memset(payload, 0x11, 0x7E);
- const uint8_t expected_7d[] = {
- 0x7e, 0xb4, 0x7d, 0x5d, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x08, 0xa1, 0x7e};
- const uint8_t expected_7e[] = {
- 0x7e, 0xb4, 0x7d, 0x5e, 0x00, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11,
- 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x11, 0x60, 0x2e, 0x7e};
- _assert_format_case_fixture(
- DA14531_PROTOCOL_PACKET_TYPE_CTRL_DATA, payload, 0x7D, expected_7d, sizeof(expected_7d));
- _assert_format_case_fixture(
- DA14531_PROTOCOL_PACKET_TYPE_CTRL_DATA, payload, 0x7E, expected_7e, sizeof(expected_7e));
- free(payload);
-}
-
-// Verifies escaping when the high payload length byte matches SOF/ESCAPE.
-static void _test_format_len_high_escaping(void** state)
-{
- (void)state;
- const uint16_t payload_len_7d00 = 0x7D00;
- const uint16_t payload_len_7e00 = 0x7E00;
- uint8_t* payload = malloc(payload_len_7e00);
- assert_non_null(payload);
- memset(payload, 0x22, payload_len_7e00);
-
- const size_t expected_len_7d00 = 32008;
- const size_t expected_len_7e00 = 32264;
- uint8_t* expected_7d00 = malloc(expected_len_7d00);
- uint8_t* expected_7e00 = malloc(expected_len_7e00);
- assert_non_null(expected_7d00);
- assert_non_null(expected_7e00);
-
- size_t idx = 0;
- expected_7d00[idx++] = SL_SOF;
- expected_7d00[idx++] = 0xb4;
- expected_7d00[idx++] = 0x00;
- expected_7d00[idx++] = SL_ESCAPE;
- expected_7d00[idx++] = 0x5d;
- memset(&expected_7d00[idx], 0x22, payload_len_7d00);
- idx += payload_len_7d00;
- expected_7d00[idx++] = 0xc2;
- expected_7d00[idx++] = 0xf8;
- expected_7d00[idx++] = SL_SOF;
- assert_int_equal(idx, expected_len_7d00);
-
- idx = 0;
- expected_7e00[idx++] = SL_SOF;
- expected_7e00[idx++] = 0xb4;
- expected_7e00[idx++] = 0x00;
- expected_7e00[idx++] = SL_ESCAPE;
- expected_7e00[idx++] = 0x5e;
- memset(&expected_7e00[idx], 0x22, payload_len_7e00);
- idx += payload_len_7e00;
- expected_7e00[idx++] = 0x7c;
- expected_7e00[idx++] = 0xe9;
- expected_7e00[idx++] = SL_SOF;
- assert_int_equal(idx, expected_len_7e00);
-
- _assert_format_case_fixture(
- DA14531_PROTOCOL_PACKET_TYPE_CTRL_DATA,
- payload,
- payload_len_7d00,
- expected_7d00,
- expected_len_7d00);
- _assert_format_case_fixture(
- DA14531_PROTOCOL_PACKET_TYPE_CTRL_DATA,
- payload,
- payload_len_7e00,
- expected_7e00,
- expected_len_7e00);
-
- free(expected_7d00);
- free(expected_7e00);
- free(payload);
-}
-
-// Verifies CRC bytes requiring escaping are encoded correctly.
-static void _test_format_crc_escaping(void** state)
-{
- (void)state;
- const uint8_t payload_low[2] = {0x68, 0x00};
- const uint8_t payload_high[2] = {0x00, 0x01};
- const uint8_t expected_low[] = {
- 0x7e, 0x3c, 0x02, 0x00, 0x68, 0x00, 0x7d, 0x5e, 0x7d, 0x5d, 0x7e};
- const uint8_t expected_high[] = {0x7e, 0x3c, 0x02, 0x00, 0x00, 0x01, 0x90, 0x7d, 0x5d, 0x7e};
- _assert_format_case_fixture(
- DA14531_PROTOCOL_PACKET_TYPE_BLE_DATA, payload_low, 2, expected_low, sizeof(expected_low));
- _assert_format_case_fixture(
- DA14531_PROTOCOL_PACKET_TYPE_BLE_DATA,
- payload_high,
- 2,
- expected_high,
- sizeof(expected_high));
-}
-
-int main(void)
-{
- const struct CMUnitTest tests[] = {
- cmocka_unit_test(_test_format_basic_no_escaping),
- cmocka_unit_test(_test_format_payload_bytes_escaped),
- cmocka_unit_test(_test_format_zero_length_payload),
- cmocka_unit_test(_test_format_payload_all_bytes),
- cmocka_unit_test(_test_format_len_low_escaping),
- cmocka_unit_test(_test_format_len_high_escaping),
- cmocka_unit_test(_test_format_crc_escaping),
- };
-
- return cmocka_run_group_tests(tests, NULL, NULL);
-}
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.