15 uint16_t her_znaet_chto; //v dushe ne ebu
21 * Reverses endianess of a 32bit int, if the ENDIAN_REVERSE_NEEDED defined at compile-time
25 uint32_t reverse_endian32 ( uint32_t data );
28 * Reverses endianess of a 16bit int, if the ENDIAN_REVERSE_NEEDED defined at compile-time
32 uint16_t reverse_endian16 ( uint16_t data );
34 * Calculates the strange crc (used by bcm modems) of the file. Thnx fly out to Vector for the algorithm.
38 uint32_t get_file_crc ( char* filename );
41 * Calculates HCS of the header.
45 uint16_t get_hcs ( ldr_header_t* hd );
48 * Constructs the header of the image with the information given It also automagically calculates HCS and writes it there.
49 * @param magic - magic device bytes
50 * @param rev_maj - major revision
51 * @param rev_min - minor revision
52 * @param build_date - build date (seconds from EPOCH UTC)
53 * @param filelen - file length in bytes
54 * @param ldaddress - Load adress
55 * @param filename - filename
56 * @param crc_data - the crc of the data
59 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 );
62 * Dumps header information to stdout.
65 int dump_header ( ldr_header_t* hd );
69 * Returns a null terminated string describing what the control number meens
74 char* get_control_info ( uint16_t control );
78 * Calculates bcmCRC of a data buffer.
79 * @param filebuffer - pointer to buffer
80 * @param size - buffer size
83 uint32_t get_buffer_crc ( char* filebuffer, size_t size );