@@ -68,14 +68,8 @@ resource_result_t resource_read(const resource_hnd_t *resource, uint32_t offset,
6868* Variable Definitions
6969******************************************************/
7070
71- #ifdef WLAN_MFG_FIRMWARE
72- extern const resource_hnd_t wifi_mfg_firmware_image ;
73- extern const resource_hnd_t wifi_mfg_firmware_clm_blob ;
74- #else
7571extern const resource_hnd_t wifi_firmware_image ;
7672extern const resource_hnd_t wifi_firmware_clm_blob ;
77- #endif
78-
7973unsigned char r_buffer [BLOCK_BUFFER_SIZE ];
8074
8175#if defined(WHD_DYNAMIC_NVRAM )
@@ -110,25 +104,22 @@ resource_result_t resource_read(const resource_hnd_t *resource, uint32_t offset,
110104#ifdef USES_RESOURCE_GENERIC_FILESYSTEM
111105 else
112106 {
113- wiced_file_t file_handle ;
114- uint64_t size64 ;
115- uint64_t maxsize64 = maxsize ;
116- if (WICED_SUCCESS !=
117- wiced_filesystem_file_open (& resource_fs_handle , & file_handle , resource -> val .fs .filename ,
118- WICED_FILESYSTEM_OPEN_FOR_READ ) )
107+ int file_handle = -1 ;
108+ if (WHD_SUCCESS !=
109+ wiced_filesystem_file_open (& file_handle , resource -> val .fs .filename ) )
119110 {
120- return RESOURCE_FILE_OPEN_FAIL ;
111+ return WHD_BADARG ;
121112 }
122- if (WICED_SUCCESS != wiced_filesystem_file_seek (& file_handle , (offset + resource -> val .fs .offset ), SEEK_SET ) )
113+ if (WHD_SUCCESS != wiced_filesystem_file_seek (& file_handle , (offset + resource -> val .fs .offset )) )
123114 {
124- return RESOURCE_FILE_SEEK_FAIL ;
115+ wiced_filesystem_file_close (& file_handle );
116+ return WHD_BADARG ;
125117 }
126- if (WICED_SUCCESS != wiced_filesystem_file_read (& file_handle , buffer , maxsize64 , & size64 ) )
118+ if (WHD_SUCCESS != wiced_filesystem_file_read (& file_handle , buffer , * size , & size ) )
127119 {
128120 wiced_filesystem_file_close (& file_handle );
129- return RESOURCE_FILE_READ_FAIL ;
121+ return WHD_BADARG ;
130122 }
131- * size = (uint32_t )size64 ;
132123 wiced_filesystem_file_close (& file_handle );
133124 }
134125#else
@@ -178,14 +169,10 @@ uint32_t host_platform_resource_size(whd_driver_t whd_drv, whd_resource_type_t r
178169 return ( whd_result_t )RESOURCE_UNSUPPORTED ;
179170 }
180171 wiced_waf_app_get_size (& wifi_app , size_out );
181- #else
182- #ifdef WLAN_MFG_FIRMWARE
183- * size_out = (uint32_t )resource_get_size (& wifi_mfg_firmware_image );
184172#else
185173 * size_out = (uint32_t )resource_get_size (& wifi_firmware_image );
186- #endif /* WLAN_MFG_FIRMWARE */
187- #endif /* WIFI_FIRMWARE_IN_MULTI_APP */
188- #endif /* NO_WIFI_FIRMWARE */
174+ #endif
175+ #endif
189176
190177 }
191178 else if (resource == WHD_RESOURCE_WLAN_NVRAM )
@@ -194,11 +181,7 @@ uint32_t host_platform_resource_size(whd_driver_t whd_drv, whd_resource_type_t r
194181 }
195182 else
196183 {
197- #ifdef WLAN_MFG_FIRMWARE
198- * size_out = (uint32_t )resource_get_size (& wifi_mfg_firmware_clm_blob );
199- #else
200184 * size_out = (uint32_t )resource_get_size (& wifi_firmware_clm_blob );
201- #endif /* WLAN_MFG_FIRMWARE */
202185 }
203186 return WHD_SUCCESS ;
204187}
@@ -225,13 +208,8 @@ uint32_t host_get_resource_block(whd_driver_t whd_drv, whd_resource_type_t type,
225208
226209 if (type == WHD_RESOURCE_WLAN_FIRMWARE )
227210 {
228- #ifdef WLAN_MFG_FIRMWARE
229- result = resource_read ( (const resource_hnd_t * )& wifi_mfg_firmware_image , read_pos , block_size , size_out ,
230- r_buffer );
231- #else
232211 result = resource_read ( (const resource_hnd_t * )& wifi_firmware_image , read_pos , block_size , size_out ,
233212 r_buffer );
234- #endif /* WLAN_MFG_FIRMWARE */
235213 if (result != WHD_SUCCESS )
236214 {
237215 return result ;
@@ -261,15 +239,9 @@ uint32_t host_get_resource_block(whd_driver_t whd_drv, whd_resource_type_t type,
261239 }
262240 else
263241 {
264- #ifdef WLAN_MFG_FIRMWARE
265- result = resource_read ( (const resource_hnd_t * )& wifi_mfg_firmware_clm_blob , read_pos , block_size ,
266- size_out ,
267- r_buffer );
268- #else
269242 result = resource_read ( (const resource_hnd_t * )& wifi_firmware_clm_blob , read_pos , block_size ,
270243 size_out ,
271244 r_buffer );
272- #endif /* WLAN_MFG_FIRMWARE */
273245 if (result != WHD_SUCCESS )
274246 {
275247 return result ;
0 commit comments