xref: /OK3568_Linux_fs/external/recovery/update_engine/update.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright (C) 2023 Rockchip Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *       http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _UPDATE_H
18 #define _UPDATE_H
19 #include <stdbool.h>
20 
21 typedef int (*update_func)(char *src_path, void* pupdate_cmd);
22 typedef struct {
23     char name[32];
24     bool need_update;
25     bool is_ab;
26     long long size;
27     long long offset;
28     long long flash_offset;
29     char dest_path[100];
30     bool skip_verify;
31     update_func cmd;
32 } UPDATE_CMD, *PUPDATE_CMD;
33 
34 typedef enum {
35     RK_UPGRADE_FINISHED,
36     RK_UPGRADE_START,
37     RK_UPGRADE_ERR,
38 } RK_Upgrade_Status_t;
39 
40 typedef void(*RK_upgrade_callback)(void *user_data, RK_Upgrade_Status_t status);
41 typedef void (*RK_print_callback)(char *pszPrompt);
42 
43 void RK_ota_set_url(char *url, char *savepath);
44 bool RK_ota_set_partition(int partition);
45 void RK_ota_start(RK_upgrade_callback cb, RK_print_callback print_cb);
46 //void RK_ota_stop();
47 int RK_ota_get_progress();
48 void RK_ota_get_sw_version(char *buffer, int maxLength);
49 bool RK_ota_check_version(char *url);
50 
51 #endif
52