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
85
//! # hisiflash
//!
//! A library for flashing HiSilicon chips.
//!
//! This crate provides the core functionality for communicating with HiSilicon
//! chips via serial port, including:
//!
//! - FWPKG firmware package parsing
//! - WS63 protocol implementation
//! - YMODEM file transfer
//! - CRC16-XMODEM checksum calculation
//!
//! ## Supported Chips
//!
//! - WS63 (primary support)
//! - More chips coming in future releases
//!
//! ## Supported Platforms
//!
//! - **Native** (default): Linux, macOS, Windows via the `serialport` crate
//! - **WASM** (experimental): Web browsers via the Web Serial API
//!
//! ## Features
//!
//! - `native` (default): Native serial port support
//! - `wasm`: WASM/Web Serial API support (experimental)
//! - `serde`: Serialization support for data types
//!
//! ## Example
//!
//! ```rust,no_run
//! use hisiflash::{Ws63Flasher, Fwpkg};
//!
//! fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Parse firmware package
//! let fwpkg = Fwpkg::from_file("firmware.fwpkg")?;
//!
//! // Create flasher and connect (native only)
//! #[cfg(feature = "native")]
//! {
//! let mut flasher = Ws63Flasher::open("/dev/ttyUSB0", 921600)?;
//! flasher.connect()?;
//!
//! // Flash the firmware
//! flasher.flash_fwpkg(&fwpkg, None, |name, current, total| {
//! println!("Flashing {}: {}/{}", name, current, total);
//! })?;
//!
//! // Reset the device
//! flasher.reset()?;
//! }
//!
//! Ok(())
//! }
//! ```
// Re-exports for convenience
pub use ;
pub use ;
pub use ;
pub use ;
pub use Ws63Flasher;
pub use ;
// Native-specific re-exports
pub use ;
// Legacy re-exports for backward compatibility
pub use ConnectionPort;
pub use ;
pub use SerialPort;