Add serial number support
[mfgtools.git] / libuuu / rominfo.h
blob4468bbb730e48aaa53fdd98bf20535d75e4bad04
1 /*
2 * Copyright 2018 NXP.
4 * Redistribution and use in source and binary forms, with or without modification,
5 * are permitted provided that the following conditions are met:
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
10 * Redistributions in binary form must reproduce the above copyright notice, this
11 * list of conditions and the following disclaimer in the documentation and/or
12 * other materials provided with the distribution.
14 * Neither the name of the NXP Semiconductor nor the names of its
15 * contributors may be used to endorse or promote products derived from this
16 * software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
22 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 * POSSIBILITY OF SUCH DAMAGE.
32 #pragma once
34 #include <cstdint>
35 #include <memory>
36 #include <string>
38 class ConfigItem;
39 class FileBuffer;
40 class DataBuffer;
42 constexpr uint32_t ROM_INFO_HID = 0x1;
43 constexpr uint32_t ROM_INFO_HID_MX23 = 0x2;
44 constexpr uint32_t ROM_INFO_HID_MX50 = 0x4;
45 constexpr uint32_t ROM_INFO_HID_MX6 = 0x8;
46 constexpr uint32_t ROM_INFO_HID_SKIP_DCD = 0x10;
47 constexpr uint32_t ROM_INFO_HID_MX8_MULTI_IMAGE = 0x20;
48 constexpr uint32_t ROM_INFO_HID_MX8_STREAM = 0x40;
49 constexpr uint32_t ROM_INFO_HID_UID_STRING = 0x80;
50 // Omitted value: 0x100
51 // Omitted value: 0x200
52 constexpr uint32_t ROM_INFO_HID_NO_CMD = 0x400;
53 constexpr uint32_t ROM_INFO_SPL_JUMP = 0x800;
54 constexpr uint32_t ROM_INFO_HID_EP1 = 0x1000;
55 constexpr uint32_t ROM_INFO_HID_PACK_SIZE_1020 = 0x2000;
56 constexpr uint32_t ROM_INFO_HID_SDP_NO_MAX_PER_TRANS = 0x4000;
57 constexpr uint32_t ROM_INFO_AUTO_SCAN_UBOOT_POS = 0x8000;
58 constexpr uint32_t ROM_INFO_HID_ROMAPI = 0x10000;
59 constexpr uint32_t ROM_INFO_NEED_BAREBOX_FULL_IMAGE = 0x20000;
61 struct ROM_INFO
63 const char * m_name;
64 uint32_t free_addr;
65 uint32_t flags;
66 int serial_idx;
69 const ROM_INFO * search_rom_info(const std::string &s);
70 const ROM_INFO * search_rom_info(const ConfigItem *item);
72 size_t GetContainerActualSize(std::shared_ptr<DataBuffer> p, size_t offset, bool bROMAPI=false, bool skipspl=false);
73 size_t GetFlashHeaderSize(std::shared_ptr<DataBuffer> p, size_t offset = 0);