micro_ihex/
ihex.rs

1use crate::types;
2
3#[derive(Debug, PartialEq)]
4pub enum IHex {
5    Data {
6        bytes: [u8; 0xFF],
7        length: u8,
8        offset: u16,
9    },
10    EndOfFile,
11    ExtendedSegmentAddress(u16),
12    StartSegmentAddress {
13        cs: u16,
14        ip: u16,
15    },
16    ExtendedLinearAddress(u16),
17    StartLinearAddress(u32),
18}
19
20impl IHex {
21    pub fn record_type(&self) -> u8 {
22        match self {
23            Self::Data { .. } => types::DATA,
24            Self::EndOfFile => types::END_OF_FILE,
25            Self::ExtendedSegmentAddress(_) => types::EXTENDED_SEGMENT_ADDRESS,
26            Self::StartSegmentAddress { .. } => types::START_SEGMENT_ADDRESS,
27            Self::ExtendedLinearAddress(_) => types::EXTENDED_LINEAR_ADDRESS,
28            Self::StartLinearAddress(_) => types::START_LINEAR_ADDRESS,
29        }
30    }
31}