-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path0008-Portenta-removed-resource_imp-folder.patch
575 lines (572 loc) · 20.4 KB
/
0008-Portenta-removed-resource_imp-folder.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
From ab547c3d275624599b1ab2c6884d9b0814f068d8 Mon Sep 17 00:00:00 2001
From: pennam <m.pennasilico@arduino.cc>
Date: Thu, 6 May 2021 14:04:52 +0200
Subject: [PATCH 08/87] Portenta removed resource_imp folder
---
.../resources/resource_imp/whd_resources.c | 320 ------------------
.../resources/resource_imp/wiced_resource.h | 228 -------------
2 files changed, 548 deletions(-)
delete mode 100644 targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/COMPONENT_WHD/resources/resource_imp/whd_resources.c
delete mode 100644 targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/COMPONENT_WHD/resources/resource_imp/wiced_resource.h
diff --git a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/COMPONENT_WHD/resources/resource_imp/whd_resources.c b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/COMPONENT_WHD/resources/resource_imp/whd_resources.c
deleted file mode 100644
index adb3e00cbc..0000000000
--- a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/COMPONENT_WHD/resources/resource_imp/whd_resources.c
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright 2020 Cypress Semiconductor Corporation
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** @file
- * Defines WHD resource functions for BCM943340WCD1 platform
- */
-#include "resources.h"
-#include "wifi_nvram_image.h"
-#include "whd_resource_api.h"
-#include "whd_debug.h"
-#include "whd.h"
-
-/******************************************************
-* Macros
-******************************************************/
-#define BLOCK_BUFFER_SIZE (1024)
-
-/******************************************************
-* Constants
-******************************************************/
-
-#if defined(WHD_DYNAMIC_NVRAM)
-#define NVRAM_SIZE dynamic_nvram_size
-#define NVRAM_IMAGE_VARIABLE dynamic_nvram_image
-#else
-#define NVRAM_SIZE sizeof(wifi_nvram_image)
-#define NVRAM_IMAGE_VARIABLE wifi_nvram_image
-#endif
-
-/******************************************************
-* Enumerations
-******************************************************/
-
-/******************************************************
-* Type Definitions
-******************************************************/
-
-/******************************************************
-* Structures
-******************************************************/
-
-/******************************************************
-* Static Function Declarations
-******************************************************/
-uint32_t host_platform_resource_size(whd_driver_t whd_drv, whd_resource_type_t resource, uint32_t *size_out);
-uint32_t host_get_resource_block(whd_driver_t whd_drv, whd_resource_type_t type,
- uint32_t blockno, const uint8_t **data, uint32_t *size_out);
-uint32_t host_get_resource_no_of_blocks(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *block_count);
-uint32_t host_get_resource_block_size(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *size_out);
-resource_result_t resource_read(const resource_hnd_t *resource, uint32_t offset, uint32_t maxsize, uint32_t *size,
- void *buffer);
-
-/******************************************************
-* Variable Definitions
-******************************************************/
-
-#ifdef WLAN_MFG_FIRMWARE
-extern const resource_hnd_t wifi_mfg_firmware_image;
-extern const resource_hnd_t wifi_mfg_firmware_clm_blob;
-#else
-extern const resource_hnd_t wifi_firmware_image;
-extern const resource_hnd_t wifi_firmware_clm_blob;
-#endif
-
-unsigned char r_buffer[BLOCK_BUFFER_SIZE];
-
-#if defined(WHD_DYNAMIC_NVRAM)
-uint32_t dynamic_nvram_size = sizeof(wifi_nvram_image);
-void *dynamic_nvram_image = &wifi_nvram_image;
-#endif
-
-/******************************************************
-* Function Definitions
-******************************************************/
-
-resource_result_t resource_read(const resource_hnd_t *resource, uint32_t offset, uint32_t maxsize, uint32_t *size,
- void *buffer)
-{
- if (offset > resource->size)
- {
- return RESOURCE_OFFSET_TOO_BIG;
- }
-
- *size = MIN(maxsize, resource->size - offset);
-
- if (resource->location == RESOURCE_IN_MEMORY)
- {
- memcpy(buffer, &resource->val.mem.data[offset], *size);
- }
-#ifdef USES_RESOURCES_IN_EXTERNAL_STORAGE
- else if (resource->location == RESOURCE_IN_EXTERNAL_STORAGE)
- {
- return platform_read_external_resource(resource, offset, maxsize, size, buffer);
- }
-#endif
-#ifdef USES_RESOURCE_GENERIC_FILESYSTEM
- else
- {
- wiced_file_t file_handle;
- uint64_t size64;
- uint64_t maxsize64 = maxsize;
- if (WICED_SUCCESS !=
- wiced_filesystem_file_open (&resource_fs_handle, &file_handle, resource->val.fs.filename,
- WICED_FILESYSTEM_OPEN_FOR_READ) )
- {
- return RESOURCE_FILE_OPEN_FAIL;
- }
- if (WICED_SUCCESS != wiced_filesystem_file_seek (&file_handle, (offset + resource->val.fs.offset), SEEK_SET) )
- {
- return RESOURCE_FILE_SEEK_FAIL;
- }
- if (WICED_SUCCESS != wiced_filesystem_file_read (&file_handle, buffer, maxsize64, &size64) )
- {
- wiced_filesystem_file_close (&file_handle);
- return RESOURCE_FILE_READ_FAIL;
- }
- *size = (uint32_t)size64;
- wiced_filesystem_file_close (&file_handle);
- }
-#else
-#ifdef USES_RESOURCE_FILESYSTEM
- else
- {
- wicedfs_file_t file_hnd;
-
- if (0 != wicedfs_fopen(&resource_fs_handle, &file_hnd, resource->val.fs.filename) )
- {
- return RESOURCE_FILE_OPEN_FAIL;
- }
-
- if (0 != wicedfs_fseek(&file_hnd, (long)(offset + resource->val.fs.offset), SEEK_SET) )
- {
- wicedfs_fclose(&file_hnd);
- return RESOURCE_FILE_SEEK_FAIL;
- }
-
- if (*size != wicedfs_fread(buffer, 1, *size, &file_hnd) )
- {
- wicedfs_fclose(&file_hnd);
- return RESOURCE_FILE_READ_FAIL;
- }
-
- wicedfs_fclose(&file_hnd);
- }
-#endif /* ifdef USES_RESOURCE_FILESYSTEM */
-#endif /* USES_RESOURCE_GENERIC_FILESYSTEM */
- return RESOURCE_SUCCESS;
-}
-
-uint32_t host_platform_resource_size(whd_driver_t whd_drv, whd_resource_type_t resource, uint32_t *size_out)
-{
- if (resource == WHD_RESOURCE_WLAN_FIRMWARE)
- {
-#ifdef NO_WIFI_FIRMWARE
- whd_assert("Request firmware in a no wifi firmware application", 0 == 1);
- *size_out = 0;
-#else
-#ifdef WIFI_FIRMWARE_IN_MULTI_APP
- wiced_app_t wifi_app;
-
- *size_out = 0;
- if (wiced_waf_app_open(DCT_WIFI_FIRMWARE_INDEX, &wifi_app) != WICED_SUCCESS)
- {
- return ( whd_result_t )RESOURCE_UNSUPPORTED;
- }
- wiced_waf_app_get_size(&wifi_app, size_out);
-#else
-#ifdef WLAN_MFG_FIRMWARE
- *size_out = (uint32_t)resource_get_size(&wifi_mfg_firmware_image);
-#else
- *size_out = (uint32_t)resource_get_size(&wifi_firmware_image);
-#endif /* WLAN_MFG_FIRMWARE */
-#endif /* WIFI_FIRMWARE_IN_MULTI_APP */
-#endif /* NO_WIFI_FIRMWARE */
-
- }
- else if (resource == WHD_RESOURCE_WLAN_NVRAM)
- {
- *size_out = NVRAM_SIZE;
- }
- else
- {
-#ifdef WLAN_MFG_FIRMWARE
- *size_out = (uint32_t)resource_get_size(&wifi_mfg_firmware_clm_blob);
-#else
- *size_out = (uint32_t)resource_get_size(&wifi_firmware_clm_blob);
-#endif /* WLAN_MFG_FIRMWARE */
- }
- return WHD_SUCCESS;
-}
-
-uint32_t host_get_resource_block(whd_driver_t whd_drv, whd_resource_type_t type,
- uint32_t blockno, const uint8_t **data, uint32_t *size_out)
-{
- uint32_t resource_size;
- uint32_t block_size;
- uint32_t block_count;
- uint32_t read_pos;
- uint32_t result;
-
- host_platform_resource_size(whd_drv, type, &resource_size);
- host_get_resource_block_size(whd_drv, type, &block_size);
- host_get_resource_no_of_blocks(whd_drv, type, &block_count);
- memset(r_buffer, 0, block_size);
- read_pos = blockno * block_size;
-
- if (blockno >= block_count)
- {
- return WHD_BADARG;
- }
-
- if (type == WHD_RESOURCE_WLAN_FIRMWARE)
- {
-#ifdef WLAN_MFG_FIRMWARE
- result = resource_read( (const resource_hnd_t *)&wifi_mfg_firmware_image, read_pos, block_size, size_out,
- r_buffer );
-#else
- result = resource_read( (const resource_hnd_t *)&wifi_firmware_image, read_pos, block_size, size_out,
- r_buffer );
-#endif /* WLAN_MFG_FIRMWARE */
- if (result != WHD_SUCCESS)
- {
- return result;
- }
- *data = (uint8_t *)&r_buffer;
- /*
- * In case of local buffer read use the following code
- *
- * *size_out = MIN(BLOCK_BUFFER_SIZE, resource_size - transfer_progress);
- * *data = (uint8_t *)wifi_firmware_image_data;
- *
- * For sending the entire buffer in single block set size out as following
- * *size_out = (uint32_t)resource_get_size(&wifi_firmware_image);
- */
- }
- else if (type == WHD_RESOURCE_WLAN_NVRAM)
- {
- if (NVRAM_SIZE - read_pos > block_size)
- {
- *size_out = block_size;
- }
- else
- {
- *size_out = NVRAM_SIZE - read_pos;
- }
- *data = ( (uint8_t *)NVRAM_IMAGE_VARIABLE ) + read_pos;
- }
- else
- {
-#ifdef WLAN_MFG_FIRMWARE
- result = resource_read( (const resource_hnd_t *)&wifi_mfg_firmware_clm_blob, read_pos, block_size,
- size_out,
- r_buffer );
-#else
- result = resource_read( (const resource_hnd_t *)&wifi_firmware_clm_blob, read_pos, block_size,
- size_out,
- r_buffer );
-#endif /* WLAN_MFG_FIRMWARE */
- if (result != WHD_SUCCESS)
- {
- return result;
- }
- *data = (uint8_t *)&r_buffer;
- /*
- * In case of local buffer read use the following code
- *
- * *size_out = MIN(BLOCK_BUFFER_SIZE, resource_size - transfer_progress);
- * *data = (uint8_t *)wifi_firmware_clm_blob_image_data;
- *
- * For sending the entire buffer in single block set size out as following
- * *size_out = sizeof(wifi_firmware_clm_blob_image_data);
- */
-
- }
-
- return WHD_SUCCESS;
-}
-
-uint32_t host_get_resource_block_size(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *size_out)
-{
- *size_out = BLOCK_BUFFER_SIZE;
- return WHD_SUCCESS;
-}
-
-uint32_t host_get_resource_no_of_blocks(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *block_count)
-{
- uint32_t resource_size;
- uint32_t block_size;
-
- host_platform_resource_size(whd_drv, type, &resource_size);
- host_get_resource_block_size(whd_drv, type, &block_size);
- *block_count = resource_size / block_size;
- if (resource_size % block_size)
- *block_count += 1;
-
- return WHD_SUCCESS;
-}
-
-whd_resource_source_t resource_ops =
-{
- .whd_resource_size = host_platform_resource_size,
- .whd_get_resource_block_size = host_get_resource_block_size,
- .whd_get_resource_no_of_blocks = host_get_resource_no_of_blocks,
- .whd_get_resource_block = host_get_resource_block
-};
-
diff --git a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/COMPONENT_WHD/resources/resource_imp/wiced_resource.h b/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/COMPONENT_WHD/resources/resource_imp/wiced_resource.h
deleted file mode 100644
index 0a1cccd870..0000000000
--- a/targets/TARGET_STM/TARGET_STM32H7/TARGET_STM32H747xI/TARGET_PORTENTA_H7/COMPONENT_WHD/resources/resource_imp/wiced_resource.h
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
- * Copyright 2020 Cypress Semiconductor Corporation
- * SPDX-License-Identifier: Apache-2.0
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** @file
- * WICED Resource API's
- * The Resource Management functions reads resource from a resource location
- * and returns the number of bytes from an offset in an caller filled buffer.
- *
- * Functions to get the resource size and resource data
- *
- * The Resource could be one of the three locations
- *
- * - Wiced Filesystem (File System)
- * - Internal Memory (Embedded Flash memory)
- * - External Storage ( External Flash connected via SPI interface)
- *
- */
-
-#ifndef INCLUDED_RESOURCE_H_
-#define INCLUDED_RESOURCE_H_
-
-#include <stdint.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/******************************************************
-* Macros
-******************************************************/
-#ifndef MIN
-#define MIN(x, y) ( (x) < (y) ? (x) : (y) )
-#endif /* ifndef MIN */
-
-/* Suppress unused parameter warning */
-#ifndef UNUSED_PARAMETER
-#define UNUSED_PARAMETER(x) ( (void)(x) )
-#endif
-
-#ifndef RESULT_ENUM
-#define RESULT_ENUM(prefix, name, value) prefix ## name = (value)
-#endif /* ifndef RESULT_ENUM */
-
-#if defined(CY_SECTION)
-#define CY_SECTION_WHD CY_SECTION
-#else
-#if !defined(CY_SECTION_WHD)
-#if defined(__ARMCC_VERSION)
-#define CY_SECTION_WHD(name) __attribute__ ( (section(name) ) )
-#elif defined (__GNUC__)
-#if defined (__clang__)
-#define CY_SECTION_WHD(name) __attribute__ ( (section("__DATA, "name) ) )
-#else
-#define CY_SECTION_WHD(name) __attribute__ ( (section(name) ) )
-#endif
-#elif defined (__ICCARM__)
-#define CY_SECTION_WHD(name) CY_PRAGMA(location = name)
-#else
-#error "An unsupported toolchain"
-#endif /* (__ARMCC_VERSION) */
-#endif /* !defined(CY_SECTION_WHD) */
-#endif /* defined(CY_SECTION) */
-
-/* These Enum result values are for Resource errors
- * Values: 4000 - 4999
- */
-#define RESOURCE_RESULT_LIST(prefix) \
- RESULT_ENUM(prefix, SUCCESS, 0), /**< Success */ \
- RESULT_ENUM(prefix, UNSUPPORTED, 7), /**< Unsupported function */ \
- RESULT_ENUM(prefix, OFFSET_TOO_BIG, 4001), /**< Offset past end of resource */ \
- RESULT_ENUM(prefix, FILE_OPEN_FAIL, 4002), /**< Failed to open resource file */ \
- RESULT_ENUM(prefix, FILE_SEEK_FAIL, 4003), /**< Failed to seek to requested offset in resource file */ \
- RESULT_ENUM(prefix, FILE_READ_FAIL, 4004), /**< Failed to read resource file */
-
-#define resource_get_size(resource) ( (resource)->size )
-
-/******************************************************
-* Constants
-******************************************************/
-
-#define RESOURCE_ENUM_OFFSET (1300)
-
-/******************************************************
-* Enumerations
-******************************************************/
-
-/**
- * Result type for WICED Resource function
- */
-typedef enum
-{
- RESOURCE_RESULT_LIST(RESOURCE_)
-} resource_result_t;
-
-/******************************************************
-* Type Definitions
-******************************************************/
-
-typedef const void *resource_data_t;
-typedef unsigned long resource_size_t;
-
-/******************************************************
-* Structures
-******************************************************/
-
-/**
- * Memory handle
- */
-typedef struct
-{
- const char *data; /**< resource data */
-} memory_resource_handle_t;
-
-/**
- * Filesystem handle
- */
-typedef struct
-{
- unsigned long offset; /**< Offset to the start of the resource */
- const char *filename; /**< name of the resource */
-} filesystem_resource_handle_t;
-
-
-typedef enum
-{
- RESOURCE_IN_MEMORY, /**< resource location in memory */
- RESOURCE_IN_FILESYSTEM, /**< resource location in filesystem */
- RESOURCE_IN_EXTERNAL_STORAGE /**< resource location in external storage */
-} resource_location_t;
-
-/**
- * Resource handle structure
- */
-typedef struct
-{
- resource_location_t location; /**< resource location */
- unsigned long size; /**< resource size */
- union
- {
- filesystem_resource_handle_t fs; /** < filesystem resource handle */
- memory_resource_handle_t mem; /** < memory resource handle */
- void *external_storage_context; /** < external storage context */
- } val;
-} resource_hnd_t;
-
-/******************************************************
-* Global Variables
-******************************************************/
-
-/******************************************************
-* Function Declarations
-******************************************************/
-
-/*****************************************************************************/
-/** @addtogroup resourceapi Wiced Resource Management API's
- * @ingroup framework
- *
- * WCIED Resource Management API's has functions to get the
- * resource size and reads resource data from a resource
- * location and returns the number of bytes in an caller
- * filled buffer
- *
- * The Resource could be one of the three locations
- *
- * - Wiced Filesystem ( File System)
- * - Internal Memory (Embedded Flash memory)
- * - External Storage ( External Flash connected via SPI interface )
- *
- * @{
- */
-/*****************************************************************************/
-
-/** Read resource using the handle specified
- *
- * @param[in] resource : handle of the resource to read
- * @param[in] offset : offset from the beginning of the resource block
- * @param[in] maxsize : size of the buffer
- * @param[out] size : size of the data successfully read
- * @param[in] buffer : pointer to a buffer to contain the read data
- *
- * @return @ref resource_result_t
- */
-extern resource_result_t resource_read(const resource_hnd_t *resource, uint32_t offset, uint32_t maxsize,
- uint32_t *size, void *buffer);
-
-/** Retrieve a read only resource buffer using the handle specified
- *
- * @param[in] resource : handle of the resource to read
- * @param[in] offset : offset from the beginning of the resource block
- * @param[in] maxsize : size of the buffer
- * @param[out] size : size of the data successfully read
- * @param[out] buffer : pointer to a buffer pointer to point to the resource data
- *
- * @return @ref resource_result_t
- */
-extern resource_result_t resource_get_readonly_buffer(const resource_hnd_t *resource, uint32_t offset, uint32_t maxsize,
- uint32_t *size_out, const void **buffer);
-
-/** Free a read only resource buffer using the handle specified
- *
- * @param[in] resource : handle of the resource to read
- * @param[in] buffer : pointer to a buffer set using resource_get_readonly_buffer
- *
- * @return @ref resource_result_t
- */
-extern resource_result_t resource_free_readonly_buffer(const resource_hnd_t *handle, const void *buffer);
-/* @} */
-#ifdef __cplusplus
-} /*extern "C" */
-#endif
-
-#endif /* ifndef INCLUDED_RESOURCE_H_ */
-
--
2.30.2