@@ -68,14 +68,8 @@ resource_result_t resource_read(const resource_hnd_t *resource, uint32_t offset,
68
68
* Variable Definitions
69
69
******************************************************/
70
70
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
75
71
extern const resource_hnd_t wifi_firmware_image ;
76
72
extern const resource_hnd_t wifi_firmware_clm_blob ;
77
- #endif
78
-
79
73
unsigned char r_buffer [BLOCK_BUFFER_SIZE ];
80
74
81
75
#if defined(WHD_DYNAMIC_NVRAM )
@@ -110,25 +104,22 @@ resource_result_t resource_read(const resource_hnd_t *resource, uint32_t offset,
110
104
#ifdef USES_RESOURCE_GENERIC_FILESYSTEM
111
105
else
112
106
{
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 ) )
119
110
{
120
- return RESOURCE_FILE_OPEN_FAIL ;
111
+ return WHD_BADARG ;
121
112
}
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 )) )
123
114
{
124
- return RESOURCE_FILE_SEEK_FAIL ;
115
+ wiced_filesystem_file_close (& file_handle );
116
+ return WHD_BADARG ;
125
117
}
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 ) )
127
119
{
128
120
wiced_filesystem_file_close (& file_handle );
129
- return RESOURCE_FILE_READ_FAIL ;
121
+ return WHD_BADARG ;
130
122
}
131
- * size = (uint32_t )size64 ;
132
123
wiced_filesystem_file_close (& file_handle );
133
124
}
134
125
#else
@@ -178,14 +169,10 @@ uint32_t host_platform_resource_size(whd_driver_t whd_drv, whd_resource_type_t r
178
169
return ( whd_result_t )RESOURCE_UNSUPPORTED ;
179
170
}
180
171
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 );
184
172
#else
185
173
* 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
189
176
190
177
}
191
178
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
194
181
}
195
182
else
196
183
{
197
- #ifdef WLAN_MFG_FIRMWARE
198
- * size_out = (uint32_t )resource_get_size (& wifi_mfg_firmware_clm_blob );
199
- #else
200
184
* size_out = (uint32_t )resource_get_size (& wifi_firmware_clm_blob );
201
- #endif /* WLAN_MFG_FIRMWARE */
202
185
}
203
186
return WHD_SUCCESS ;
204
187
}
@@ -225,13 +208,8 @@ uint32_t host_get_resource_block(whd_driver_t whd_drv, whd_resource_type_t type,
225
208
226
209
if (type == WHD_RESOURCE_WLAN_FIRMWARE )
227
210
{
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
232
211
result = resource_read ( (const resource_hnd_t * )& wifi_firmware_image , read_pos , block_size , size_out ,
233
212
r_buffer );
234
- #endif /* WLAN_MFG_FIRMWARE */
235
213
if (result != WHD_SUCCESS )
236
214
{
237
215
return result ;
@@ -261,15 +239,9 @@ uint32_t host_get_resource_block(whd_driver_t whd_drv, whd_resource_type_t type,
261
239
}
262
240
else
263
241
{
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
269
242
result = resource_read ( (const resource_hnd_t * )& wifi_firmware_clm_blob , read_pos , block_size ,
270
243
size_out ,
271
244
r_buffer );
272
- #endif /* WLAN_MFG_FIRMWARE */
273
245
if (result != WHD_SUCCESS )
274
246
{
275
247
return result ;
0 commit comments