Mistake on this page? Email us
fota_block_device.h
1 // ----------------------------------------------------------------------------
2 // Copyright 2019-2021 Pelion Ltd.
3 //
4 // SPDX-License-Identifier: Apache-2.0
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 //
10 // http://www.apache.org/licenses/LICENSE-2.0
11 //
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 // See the License for the specific language governing permissions and
16 // limitations under the License.
17 // ----------------------------------------------------------------------------
18 
19 #ifndef __FOTA_BLOCK_DEVICE_H_
20 #define __FOTA_BLOCK_DEVICE_H_
21 
22 #include "fota/fota_base.h"
23 
24 #if defined(MBED_CLOUD_CLIENT_FOTA_ENABLE)
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
46 int fota_bd_init(void);
47 
53 int fota_bd_deinit(void);
54 
61 int fota_bd_size(size_t *size);
62 
72 int fota_bd_read(void *buffer, size_t addr, size_t size);
73 
86 int fota_bd_program(const void *buffer, size_t addr, size_t size);
87 
97 int fota_bd_erase(size_t addr, size_t size);
98 
105 int fota_bd_get_read_size(size_t *read_size);
106 
113 int fota_bd_get_program_size(size_t *prog_size);
114 
122 int fota_bd_get_erase_size(size_t addr, size_t *erase_size);
123 
131 int fota_bd_get_erase_value(int *erase_value);
132 
142 size_t fota_bd_physical_addr_to_logical_addr(size_t phys_addr);
143 
144 #ifdef __cplusplus
145 }
146 #endif
147 
148 #endif // defined(MBED_CLOUD_CLIENT_FOTA_ENABLE)
149 #endif // __FOTA_BLOCK_DEVICE_H_