RDK-B
fwupgrade_hal.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's LICENSE file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21 * @file fwupgrade_hal.h
22 * @brief For CCSP Component: FW Upgrade HAL Layer
23 *
24 */
25 
26 /**
27  * @defgroup FWUPGRADE_HAL FWUPGRADE HAL
28  *
29  * This module provides the function call prototypes used for the FW Upgrade abstraction layer..
30  *
31  * @defgroup FWUPGRADE_HAL_TYPES FWUPGRADE HAL Data Types
32  * @ingroup FWUPGRADE_HAL
33  *
34  * @defgroup FWUPGRADE_HAL_APIS FWUPGRADE HAL APIs
35  * @ingroup FWUPGRADE_HAL
36  *
37  **/
38 
39 #ifndef __FWUPGRADE_HAL_H__
40 #define __FWUPGRADE_HAL_H__
41 
42 #include <sys/time.h>
43 
44 /**********************************************************************
45  CONSTANT DEFINITIONS
46 **********************************************************************/
47 
48 /**
49 * @addtogroup FWUPGRADE_HAL_TYPES
50 * @{
51 */
52 
53 #ifdef __cplusplus
54 extern "C"{
55 #endif
56 
57 
58 #ifndef CHAR
59 #define CHAR char
60 #endif
61 
62 #ifndef UCHAR
63 #define UCHAR unsigned char
64 #endif
65 
66 #ifndef BOOLEAN
67 #define BOOLEAN unsigned char
68 #endif
69 
70 #ifndef USHORT
71 #define USHORT unsigned short
72 #endif
73 
74 #ifndef UINT8
75 #define UINT8 unsigned char
76 #endif
77 
78 #ifndef INT
79 #define INT int
80 #endif
81 
82 #ifndef UINT
83 #define UINT unsigned int
84 #endif
85 
86 #ifndef LONG
87 #define LONG long
88 #endif
89 
90 #ifndef ULONG
91 #define ULONG unsigned long
92 #endif
93 
94 #ifndef TRUE
95 #define TRUE 1
96 #endif
97 
98 #ifndef FALSE
99 #define FALSE 0
100 #endif
101 
102 #ifndef ENABLE
103 #define ENABLE 1
104 #endif
105 
106 #ifndef RETURN_OK
107 #define RETURN_OK 0
108 #endif
109 
110 #ifndef RETURN_ERR
111 #define RETURN_ERR -1
112 #endif
113 
114 /** @} */ //END OF GROUP FWUPGRADE_HAL_TYPES
115 
116 /* FW Download HAL API Prototype */
117 
118 /**
119  * @addtogroup FWUPGRADE_HAL_APIS
120  * @{
121  */
122 
123 /* fwupgrade_hal_set_download_url - 1 */
124 
125 /**
126 * @description Set FW Download Settings
127 * @param char* pUrl
128 * @param char* pfilename
129 *
130 * @return the status of the operation
131 * @retval RETURN_OK if successful.
132 * @retval RETURN_ERR if any Downloading is in process or Url string is invalided.
133 */
134 INT fwupgrade_hal_set_download_url (char* pUrl, char* pfilename);
135 
136 /* fwupgrade_hal_get_download_Url: */
137 
138 /**
139 * @description Get FW Download Url
140 * @param char* pUrl
141 * @param char* pfilename
142 * @return the status of the operation.
143 * @retval RETURN_OK if successful.
144 * @retval RETURN_ERR if FW url string is empty.
145 */
146 INT fwupgrade_hal_get_download_url (char *pUrl, char* pfilename);
147 
148 /* fwupgrade_hal_set_download_interface: */
149 /**
150 * @description Set the FW Download Interface
151 * @param unsigned int interface - interface=0 for wan0, interface=1 for erouter0
152 * @return the status of the operation.
153 * @retval RETURN_OK if successful.
154 * @retval RETURN_ERR if any error is detected
155 */
156 /* interface=0 for wan0, interface=1 for erouter0 */
157 INT fwupgrade_hal_set_download_interface (unsigned int interface);
158 
159 /* fwupgrade_hal_GetDownload_Interface: */
160 /**
161 * @description Get the FW Download Interface
162 * @param unsigned int* pinterface - interface=0 for wan0, interface=1 for erouter0
163 * @return the status of the operation.
164 * @retval RETURN_OK if successful.
165 * @retval RETURN_ERR if any error is detected
166 */
167 /* interface=0 for wan0, interface=1 for erouter0 */
168 INT fwupgrade_hal_get_download_interface (unsigned int* pinterface);
169 
170 /* fwupgrade_halDownload - 3 */
171 /**
172 * @description Start FW Download
173 * @param <None>
174 * @return the status of the operation.
175 * @retval RETURN_OK if successful.
176 * @retval RETURN_ERR if any Downloading is in process.
177 *
178 * @execution Synchronous.
179 * @sideeffect None.
180 *
181 * @note This function must not suspend and must not invoke any blocking system
182 * calls. It should probably just send a message to a driver event handler task.
183 */
185 
186 /* fwupgrade_hal_get_download_status 4 */
187 /**
188 * @description Get the FW Download Status
189 * @param <None>
190 * @return the status of the FW Download.
191 * @retval 0 - Download is not started.
192 * @retval 0-100 - Values of percent of download.
193 * @retval 200 - Download is completed and waiting for reboot.
194 * @retval 400 - Invalided Http server Url
195 * @retval 401 - Cannot connect to Http server
196 * @retval 402 - File is not found on Http server
197 * @retval 403 - HW_Type_DL_Protection Failure
198 * @retval 404 - HW Mask DL Protection Failure
199 * @retval 405 - DL Rev Protection Failure
200 * @retval 406 - DL Header Protection Failure
201 * @retval 407 - DL CVC Failure
202 * @retval 500 - General Download Failure
203 *
204 */
206 
207 /* fwupgrade_hal_Reboot_Ready - 5 */
208 /**
209 * @description Get the Reboot Ready Status
210 * @param ULONG *pValue- Values of 1 for Ready, 2 for Not Ready
211 * @return the status of the operation.
212 * @retval RETURN_OK if successful.
213 * @retval RETURN_ERR if any error is detected
214 */
216 
217 /* fwupgrade_hal_download_reboot_now - 6*/
218 /**
219 * @description FW Download Reboot Now
220 * @param <None>
221 * @return the status of the reboot operation.
222 * @retval RETURN_OK if successful.
223 * @retval RETURN_ERR if any reboot is in process.
224 */
226 
227 /* fwupgrade_hal_FWupdateAndFactoryReset : */
228 /**
229 * @description: Firmware update and factory reset the device
230 * @param None
231 * @return the status of the Firmware update and factory reset operation.
232 * @retval RETURN_OK if successful.
233 * @retval RETURN_ERR if any reboot is in process.
234 */
236 
237 /* fwupgrade_hal_FWupdateAndFactoryReset : */
238 /**
239 * @description: Downloads and upgrades the firmware
240 * @param None
241 * @return the status of the Firmware download and upgrade status
242 * @retval RETURN_OK if successful.
243 * @retval RETURN_ERR in case of remote server not reachable
244 */
245 INT fwupgrade_hal_download_install(const char *url);
246 
247 #ifdef __cplusplus
248 }
249 #endif
250 /** @} */ //END OF GROUP FWUPGRADE_HAL_APIS
251 #endif //__FWUPGRADE_HAL_H__
252 
ULONG
#define ULONG
Definition: fwupgrade_hal.h:91
fwupgrade_hal_reboot_ready
int fwupgrade_hal_reboot_ready(unsigned long *pValue)
fwupgrade_hal_get_download_interface
int fwupgrade_hal_get_download_interface(unsigned int *pinterface)
fwupgrade_hal_download_reboot_now
int fwupgrade_hal_download_reboot_now()
fwupgrade_hal_set_download_interface
int fwupgrade_hal_set_download_interface(unsigned int interface)
fwupgrade_hal_set_download_url
int fwupgrade_hal_set_download_url(char *pUrl, char *pfilename)
fwupgrade_hal_update_and_factoryreset
int fwupgrade_hal_update_and_factoryreset()
fwupgrade_hal_download_install
int fwupgrade_hal_download_install(const char *url)
fwupgrade_hal_get_download_url
int fwupgrade_hal_get_download_url(char *pUrl, char *pfilename)
fwupgrade_hal_get_download_status
int fwupgrade_hal_get_download_status()
INT
#define INT
Definition: fwupgrade_hal.h:79
fwupgrade_hal_download
int fwupgrade_hal_download()