mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 06:49:24 -05:00
Add types for tagged data chunks in SPI flash.
This commit is contained in:
parent
f683980052
commit
0e62876578
@ -30,6 +30,58 @@
|
||||
namespace portapack {
|
||||
namespace spi_flash {
|
||||
|
||||
struct image_tag_t {
|
||||
constexpr image_tag_t(
|
||||
) : c { 0, 0, 0, 0 }
|
||||
{
|
||||
}
|
||||
|
||||
constexpr image_tag_t(
|
||||
char c0, char c1, char c2, char c3
|
||||
) : c { c0, c1, c2, c3 }
|
||||
{
|
||||
}
|
||||
|
||||
image_tag_t& operator=(const image_tag_t& other) {
|
||||
c[0] = other.c[0];
|
||||
c[1] = other.c[1];
|
||||
c[2] = other.c[2];
|
||||
c[3] = other.c[3];
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const image_tag_t& other) const {
|
||||
return (c[0] == other.c[0]) && (c[1] == other.c[1]) && (c[2] == other.c[2]) && (c[3] == other.c[3]);
|
||||
}
|
||||
|
||||
operator bool() const {
|
||||
return (c[0] != 0) || (c[1] != 0) || (c[2] != 0) || (c[3] != 0);
|
||||
}
|
||||
|
||||
private:
|
||||
char c[4];
|
||||
};
|
||||
|
||||
constexpr image_tag_t image_tag_ais { 'P', 'A', 'I', 'S' };
|
||||
constexpr image_tag_t image_tag_am_audio { 'P', 'A', 'M', 'A' };
|
||||
constexpr image_tag_t image_tag_capture { 'P', 'C', 'A', 'P' };
|
||||
constexpr image_tag_t image_tag_ert { 'P', 'E', 'R', 'T' };
|
||||
constexpr image_tag_t image_tag_nfm_audio { 'P', 'N', 'F', 'M' };
|
||||
constexpr image_tag_t image_tag_tpms { 'P', 'T', 'P', 'M' };
|
||||
constexpr image_tag_t image_tag_wfm_audio { 'P', 'W', 'F', 'M' };
|
||||
constexpr image_tag_t image_tag_wideband_spectrum { 'P', 'S', 'P', 'E' };
|
||||
constexpr image_tag_t image_tag_hackrf { 'H', 'R', 'F', '1' };
|
||||
|
||||
struct chunk_t {
|
||||
const image_tag_t tag;
|
||||
const uint32_t length;
|
||||
const uint8_t data[];
|
||||
|
||||
const chunk_t* next() const {
|
||||
return reinterpret_cast<const chunk_t*>(&data[length]);
|
||||
}
|
||||
};
|
||||
|
||||
struct region_t {
|
||||
const size_t offset;
|
||||
const size_t size;
|
||||
|
Loading…
Reference in New Issue
Block a user