| 1 | #include "DST_Window.h" |
|---|
| 2 | #include "DST_Common.h" |
|---|
| 3 | #include "DST_CommonAPI.h" |
|---|
| 4 | |
|---|
| 5 | #define UPDATE_OK 0 |
|---|
| 6 | #define UPDATE_CHECKING_CRC 1 |
|---|
| 7 | #define UPDATE_FINISHED 2 |
|---|
| 8 | |
|---|
| 9 | #define TUNING_FAIL 101 |
|---|
| 10 | #define OTC_WAIT_TIMEOUT_FAIL 201 |
|---|
| 11 | #define OTC_COMPLETE_TIMEOUT_FAIL 202 |
|---|
| 12 | #define WRITE_FLASH_FAIL 301 |
|---|
| 13 | #define CRC_FLASH_BOOTLOADER_FAIL 401 |
|---|
| 14 | #define CRC_FLASH_APPLICATION_FAIL 402 |
|---|
| 15 | #define CRC_READ_BOOTLOADER_FAIL 403 |
|---|
| 16 | #define CRC_READ_APPLICATION_FAIL 404 |
|---|
| 17 | #define CRC_READ_TOTAL_FAIL 405 |
|---|
| 18 | |
|---|
| 19 | #define UPDATE_SYSTEM 0 |
|---|
| 20 | #define UPDATE_BOOTLOADER 1 |
|---|
| 21 | #define UPDATE_APPLICATION 2 |
|---|
| 22 | #define UPDATE_APPLICATION0 3 |
|---|
| 23 | #define UPDATE_APPLICATION1 4 |
|---|
| 24 | #define UPDATE_VERSION_READ 5 |
|---|
| 25 | |
|---|
| 26 | #define DATA_RECEIVING 0 |
|---|
| 27 | #define DATA_RECEIVING_COMPLETE 1 |
|---|
| 28 | #define FLASH_WRITING 2 |
|---|
| 29 | #define FLASH_WRITING_COMPLETE 3 |
|---|
| 30 | #define FLASH_WRITING_FAIL 4 |
|---|
| 31 | |
|---|
| 32 | #define VERSION_ALL_SAME 0 |
|---|
| 33 | #define HW_VERSION_DIFFERENT 1 |
|---|
| 34 | #define SW_VERSION_DIFFERENT 2 |
|---|
| 35 | #define MODEL_ID_DIFFERENT 3 |
|---|
| 36 | |
|---|
| 37 | typedef struct _KernelHeader |
|---|
| 38 | { |
|---|
| 39 | unsigned long kernel_length; |
|---|
| 40 | unsigned long kernel_crc; |
|---|
| 41 | unsigned long appimg_length; |
|---|
| 42 | unsigned long appimg_crc; |
|---|
| 43 | } KernelHeader; |
|---|
| 44 | |
|---|
| 45 | typedef struct _SystemHeader |
|---|
| 46 | { |
|---|
| 47 | char project_id[4]; |
|---|
| 48 | unsigned long bootloader_length; |
|---|
| 49 | unsigned long splash_length; |
|---|
| 50 | unsigned long kernel_length; |
|---|
| 51 | unsigned long kernel_crc; |
|---|
| 52 | unsigned long app_length; |
|---|
| 53 | unsigned long app_crc; |
|---|
| 54 | |
|---|
| 55 | char model_id[8]; |
|---|
| 56 | char hw_version_id[4]; |
|---|
| 57 | char sw_version_id[16]; |
|---|
| 58 | unsigned char force_update; |
|---|
| 59 | unsigned char force_reset; |
|---|
| 60 | unsigned char reserved[38]; |
|---|
| 61 | |
|---|
| 62 | unsigned long image_crc; |
|---|
| 63 | } SystemHeader; |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | typedef struct _ImageHeader |
|---|
| 68 | { |
|---|
| 69 | unsigned long image_length; |
|---|
| 70 | unsigned long image_crc; |
|---|
| 71 | char model_id[8]; |
|---|
| 72 | char hw_version_id[2]; |
|---|
| 73 | char sw_version_id[6]; |
|---|
| 74 | unsigned char force_update; |
|---|
| 75 | unsigned char reserved[3]; |
|---|
| 76 | unsigned long header_crc; |
|---|
| 77 | } ImageHeader; |
|---|
| 78 | |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | |
|---|