• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Bestechnic (Shanghai) Co., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 #ifndef __OTA_BASIC_H__
16 #define __OTA_BASIC_H__
17 
18 // ota data path is exclusive, anytime there is only one ota datapath available
19 typedef enum
20 {
21     OTA_BASIC_NO_DATAPATH_ENALBED  = 0,
22     OTA_BASIC_SPP_DATAPATH_ENABLED = 1,
23     OTA_BASIC_BLE_DATAPATH_ENABLED = 2,
24 } OTA_BASIC_ENABLED_DATAPATH_E;
25 
26 typedef enum
27 {
28     OTA_BASIC_TWS_INVALID_ROLE   = 0,
29     OTA_BASIC_TWS_FREEMAN   = 1,
30     OTA_BASIC_TWS_MASTER    = 2,
31     OTA_BASIC_TWS_SLAVE     = 3,
32     OTA_BASIC_TWS_UNKNOWN   = 4,
33 } OTA_BASIC_TWS_ROLE_E;
34 
35 #ifndef NEW_IMAGE_FLASH_OFFSET
36 #define NEW_IMAGE_FLASH_OFFSET    0x180000
37 #endif
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 void ota_basic_env_init(void);
44 bool ota_basic_enable_datapath_status(OTA_BASIC_ENABLED_DATAPATH_E datapath, uint8_t* macAddr);
45 bool ota_basic_disable_datapath_status(OTA_BASIC_ENABLED_DATAPATH_E datapath, uint8_t* macAddr);
46 uint8_t* ota_basic_get_mac_addr(void);
47 OTA_BASIC_TWS_ROLE_E ota_basic_get_tws_role(void);
48 OTA_BASIC_ENABLED_DATAPATH_E ota_basic_get_datapath(void);
49 bool ota_basic_is_remap_enabled(void);
50 uint32_t ota_basic_get_remap_offset(void);
51 uint32_t ota_basic_get_max_image_size(void);
52 
53 #ifdef __cplusplus
54 }
55 #endif
56 
57 #endif
58 
59