lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | #ifndef UPI_UPDATE_H |
| 2 | #define UPI_UPDATE_H |
| 3 | |
| 4 | #define _GNU_SOURCE |
| 5 | #include <stdio.h> |
| 6 | #include <stdlib.h> |
| 7 | #include <sys/types.h> |
| 8 | #include <sys/stat.h> |
| 9 | #include <fcntl.h> |
| 10 | #include <sys/reboot.h> |
| 11 | |
| 12 | |
| 13 | #include "upi_public.h" |
| 14 | #include "upi_img_interface.h" |
| 15 | //#include "upi_mtd.h" |
| 16 | #include "zxic_fota_ab_upgrade.h" |
| 17 | |
| 18 | |
lh | 758261d | 2023-07-13 05:52:04 -0700 | [diff] [blame] | 19 | // #define FOTA_PACKAGE_FILE "/cache/zte_fota_ab/upgrade.package" |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 20 | |
lh | 758261d | 2023-07-13 05:52:04 -0700 | [diff] [blame] | 21 | |
| 22 | typedef enum |
| 23 | { |
| 24 | UPGRADE_STATUS_UNKNOWN = -1, |
| 25 | UPGRADE_STATUS_VERIFING = 0, |
| 26 | UPGRADE_STATUS_VERIFY_SUCCESS, |
| 27 | UPGRADE_STATUS_VERIFY_FAIL, |
| 28 | UPGRADE_STATUS_UPDATING, |
| 29 | UPGRADE_STATUS_UPDATE_SUCCESS, |
| 30 | UPGRADE_STATUS_UPDATE_FAIL, |
| 31 | UPGRADE_STATUS_NO_NEED_UPDATE, |
| 32 | UPGRADE_STATUS_NEED_UPDATE |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 33 | } upgrade_status_s_type; |
| 34 | |
lh | 758261d | 2023-07-13 05:52:04 -0700 | [diff] [blame] | 35 | typedef struct |
| 36 | { |
| 37 | int upgrage_package_file_desc; // upgrade package file description |
| 38 | unsigned int upgrade_data_offset; // upgrade package offset in file |
| 39 | unsigned int upgrade_file_size; // upgrade package file size |
| 40 | } partition_upgrade_package_info_t; |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 41 | |
| 42 | |
lh | 758261d | 2023-07-13 05:52:04 -0700 | [diff] [blame] | 43 | typedef struct |
| 44 | { |
| 45 | char partition_name[PARTITION_NAME_LEN]; |
| 46 | int partition_type; |
| 47 | long long len; |
| 48 | int offset; |
| 49 | int zipped; |
| 50 | char hash[HASH_MAX_LEN]; |
| 51 | int index; |
| 52 | int partition_total_count; |
| 53 | partition_upgrade_package_info_t pkg_info; |
| 54 | partition_mtd_info_t mtd_info; |
lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 55 | } device_data_t; |
| 56 | |
| 57 | int upi_update(z_upgrade_flush_status_t* flush_status); |
| 58 | |
| 59 | |
| 60 | #endif /*UPI_UPDATE_H*/ |