TizenRT Libs&Environment  v2.0 M2
fota_hal.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  ****************************************************************************/
18 #ifndef __APPS_INCLUDE_SYSTEM_FOTA_HAL_H
19 #define __APPS_INCLUDE_SYSTEM_FOTA_HAL_H
20 /****************************************************************************
21 * Included Files
22 ****************************************************************************/
23 #include <tinyara/config.h>
24 #include <sys/types.h>
25 
26 /****************************************************************************
27 * Pre-processor Definitions
28 ****************************************************************************/
29 
30 /****************************************************************************
31 * Public Types
32 ****************************************************************************/
33 #ifndef __ASSEMBLY__
38 };
39 
41 
43  uint32_t fotahal_magic;
44  uint32_t fotahal_bin_id;
46  uint32_t fotahal_bin_size;
47  uint32_t fotahal_bin_reserved[3];
48  uint32_t fotahal_checksum;
49 };
50 
52 
69 };
70 
72 
73 typedef void *fotahal_handle_t;
74 
75 /****************************************************************************
76 * Public Data
77 ****************************************************************************/
78 #ifdef __cplusplus
79 #define EXTERN extern "C"
80 extern "C" {
81 #else
82 #define EXTERN extern
83 #endif
84 /****************************************************************************
85 * Inline Functions
86 ****************************************************************************/
87 /****************************************************************************
88 * Public Function Prototypes
89 ****************************************************************************/
90 /****************************************************************************
91  * Name: fotahal_open
92  *
93  * Description:
94  * open fotahal layer
95  ****************************************************************************/
97 
98 #ifdef CONFIG_SYSTEM_FOTA_SET_SPECIFIC
99 /****************************************************************************
100  * Name: fotahal_get_partition
101  *
102  * Description:
103  * Get current running partition id
104  * Return -1 on failure, on Success return part_id
105  ****************************************************************************/
106 fota_partition_id_t fotahal_get_partition(fotahal_handle_t handle);
107 
108 /****************************************************************************
109  * Name: fotahal_set_partition
110  *
111  * Description:
112  * Set a new partition for fota write
113  ****************************************************************************/
114 fotahal_return_t fotahal_set_partition(fotahal_handle_t handle, fota_partition_id_t part_id);
115 
116 /****************************************************************************
117  * Name: fotahal_set_binary
118  *
119  * Description:
120  * Set a binary type for fota write
121  ****************************************************************************/
122 fotahal_return_t fotahal_set_binary(fotahal_handle_t handle, uint32_t bin_id);
123 #endif
124 
125 /****************************************************************************
126  * Name: fotahal_write
127  *
128  * Description:
129  * write binary chunck in buffer to fota partition
130  ****************************************************************************/
131 fotahal_return_t fotahal_write(fotahal_handle_t handle, const char *buffer, uint32_t bin_size);
132 
133 /****************************************************************************
134  * Name: fotahal_erase
135  *
136  * Description:
137  * erase fota partition
138  ****************************************************************************/
140 
141 /****************************************************************************
142  * Name: fotahal_update_bootparam
143  *
144  * Description:
145  * Update boot param
146  ****************************************************************************/
148 
149 /****************************************************************************
150  * Name: fotahal_close
151  *
152  * Description:
153  * close fotahal
154  ****************************************************************************/
156 
157 /****************************************************************************
158  * Name: fotahal_update
159  *
160  * Description:
161  * update to new
162  ****************************************************************************/
163 #ifdef CONFIG_BOARDCTL_RESET
164 int fotahal_update(void);
165 #endif
166 #undef EXTERN
167 #ifdef __cplusplus
168 }
169 #endif /* __cplusplus */
170 #endif /* __ASSEMBLY__ */
171 #endif /* __APPS_INCLUDE_SYSTEM_FOTA_HAL_H */
uint32_t fotahal_bin_reserved[3]
Definition: fota_hal.h:47
fotahal_handle_t fotahal_open(void)
fotahal_return_t fotahal_update_bootparam(fotahal_handle_t handle)
fotahal_return_t fotahal_close(fotahal_handle_t handle)
uint32_t fotahal_bin_id
Definition: fota_hal.h:44
fotahal_return_t fotahal_write(fotahal_handle_t handle, const char *buffer, uint32_t bin_size)
uint32_t fotahal_checksum
Definition: fota_hal.h:48
enum fota_partition_id_s fota_partition_id_t
Definition: fota_hal.h:40
uint32_t fotahal_magic
Definition: fota_hal.h:43
uint32_t fotahal_bin_partaddr
Definition: fota_hal.h:45
void * fotahal_handle_t
Definition: fota_hal.h:73
fota_partition_id_s
Definition: fota_hal.h:34
enum fotahal_return_e fotahal_return_t
Definition: fota_hal.h:71
fotahal_return_t fotahal_erase(fotahal_handle_t handle)
fotahal_return_e
Definition: fota_hal.h:53
uint32_t fotahal_bin_size
Definition: fota_hal.h:46