1 // SPDX-License-Identifier: GPL-2.0-only
16 uint16_t her_znaet_chto
; //v dushe ne ebu
22 * Reverses endianess of a 32bit int, if the ENDIAN_REVERSE_NEEDED defined at compile-time
26 uint32_t reverse_endian32 ( uint32_t data
);
29 * Reverses endianess of a 16bit int, if the ENDIAN_REVERSE_NEEDED defined at compile-time
33 uint16_t reverse_endian16 ( uint16_t data
);
35 * Calculates the strange crc (used by bcm modems) of the file. Thnx fly out to Vector for the algorithm.
39 uint32_t get_file_crc ( char* filename
);
42 * Calculates HCS of the header.
46 uint16_t get_hcs ( ldr_header_t
* hd
);
49 * Constructs the header of the image with the information given It also automagically calculates HCS and writes it there.
50 * @param magic - magic device bytes
51 * @param rev_maj - major revision
52 * @param rev_min - minor revision
53 * @param build_date - build date (seconds from EPOCH UTC)
54 * @param filelen - file length in bytes
55 * @param ldaddress - Load adress
56 * @param filename - filename
57 * @param crc_data - the crc of the data
60 ldr_header_t
* construct_header ( uint32_t magic
, uint16_t rev_maj
,uint16_t rev_min
, uint32_t build_date
, uint32_t filelen
, uint32_t ldaddress
, const char* filename
, uint32_t crc_data
);
63 * Dumps header information to stdout.
66 int dump_header ( ldr_header_t
* hd
);
70 * Returns a null terminated string describing what the control number meens
75 char* get_control_info ( uint16_t control
);
79 * Calculates bcmCRC of a data buffer.
80 * @param filebuffer - pointer to buffer
81 * @param size - buffer size
84 uint32_t get_buffer_crc ( char* filebuffer
, size_t size
);