Mistake on this page?
Report an issue in GitHub or email us
whd_resource_api.h
Go to the documentation of this file.
1 /*
2  * Copyright 2021, Cypress Semiconductor Corporation (an Infineon company)
3  * SPDX-License-Identifier: Apache-2.0
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, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 /** @file whd_resource_api.h
19  * Prototypes of functions for providing external resources to the radio driver
20  *
21  * This file provides prototypes for functions which allow
22  * WHD to download firmware, NVRAM and CLM BLOB on a particular hardware platform.
23  *
24  */
25 #include "whd.h"
26 
27 #ifndef INCLUDED_WHD_RESOURCE_API_H_
28 #define INCLUDED_WHD_RESOURCE_API_H_
29 
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #endif
34 
35 #define BLOCK_SIZE 1024 /**< Size of the block */
36 /**
37  * Type of resources
38  */
39 typedef enum
40 {
41  WHD_RESOURCE_WLAN_FIRMWARE, /**< Resource type: WLAN Firmware */
42  WHD_RESOURCE_WLAN_NVRAM, /**< Resource type: NVRAM file */
43  WHD_RESOURCE_WLAN_CLM, /**< Resource type: CLM_BLOB file */
45 
46 /******************************************************
47 * Global Variables
48 ******************************************************/
49 
50 /** @addtogroup res WHD Resource API
51  * @brief Functions that enable WHD to download WLAN firmware, NVRAM and CLM BLOB on a particular hardware platform.
52  * @{
53  */
54 
55 /**
56  * Interface to a data source that provides external resources to the radio driver
57  */
58 
59 /** This data structure defines a source for data generally intended to be downloaded to the radio device.
60  *
61  * The data is assumed to be available as a set of blocks that are all the same size with the exception
62  * of the last block. The whd_get_resource_block_size function returns this block size. The whd_get_resource_block call
63  * returns a pointer to a block of data. The actual storage for the data block is owned by the data source, so only a pointer
64  * to the block is returned. There are two predominate use cases. If the data is stored in the internal
65  * flash memory, then whd_get_resource_no_of_blocks will return 1 and a call to whd_get_resource_block will return a pointer to
66  * the data image with the size being the size of the data image. If the data is stored in an external flash of some
67  * type, each block of data can be read from the external flash one at a time. whd_get_resource_no_of_blocks will return
68  * the physical number of blocks in the data and each call to whd_get_resource_block will read data from the external memory
69  * and make it available via an internal buffer.
70  */
72 {
73  /** Gets the size of the resource for respective resource type
74  *
75  *
76  * @param whd_drv Pointer to handle instance of the driver
77  * @param resource Type of resource - WHD_RESOURCE_WLAN_FIRMWARE, WHD_RESOURCE_WLAN_NVRAM, WHD_RESOURCE_WLAN_CLM
78  * @param size_out Size of the resource
79  *
80  * @return WHD_SUCCESS or error code
81  *
82  */
83  uint32_t (*whd_resource_size)(whd_driver_t whd_drv, whd_resource_type_t resource, uint32_t *size_out);
84 
85  /** Gets the resource block for specified resource type
86  *
87  * @param whd_drv Pointer to handle instance of the driver
88  * @param type Type of resource - WHD_RESOURCE_WLAN_FIRMWARE, WHD_RESOURCE_WLAN_NVRAM, WHD_RESOURCE_WLAN_CLM
89  * @param blockno The number of block
90  * @param data Pointer to a block of data
91  * @param size_out Size of the resource
92  *
93  * @return WHD_SUCCESS or error code
94  *
95  */
96  uint32_t (*whd_get_resource_block)(whd_driver_t whd_drv, whd_resource_type_t type,
97  uint32_t blockno, const uint8_t **data, uint32_t *size_out);
98 
99  /** Gets block count for the specified resource_type
100  *
101  * @param whd_drv Pointer to handle instance of the driver
102  * @param type Type of resource - WHD_RESOURCE_WLAN_FIRMWARE, WHD_RESOURCE_WLAN_NVRAM, WHD_RESOURCE_WLAN_CLM
103  * @param block_count Pointer to store block count for the resource
104  *
105  * @return WHD_SUCCESS or error code
106  *
107  */
108  uint32_t (*whd_get_resource_no_of_blocks)(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *block_count);
109 
110  /** Gets block size for the specified resource_type
111  *
112  * @param whd_drv Pointer to handle instance of the driver
113  * @param type Type of resources - WHD_RESOURCE_WLAN_FIRMWARE, WHD_RESOURCE_WLAN_NVRAM, WHD_RESOURCE_WLAN_CLM
114  * @param size_out Pointer to store size of the block
115  *
116  * @return WHD_SUCCESS or error code
117  *
118  */
119  uint32_t (*whd_get_resource_block_size)(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *size_out);
120 };
121 
122 /** @} */
123 
124 #ifdef __cplusplus
125 } /* extern "C" */
126 #endif
127 #endif /* ifndef INCLUDED_WHD_RESOURCE_API_H_ */
128 
Resource type: NVRAM file.
Provides abstract pointer type to act as instance for: driver, interface, buffer funcs, network funcs, resource funcs and bus funcs.
uint32_t(* whd_resource_size)(whd_driver_t whd_drv, whd_resource_type_t resource, uint32_t *size_out)
Gets the size of the resource for respective resource type.
Resource type: CLM_BLOB file.
uint32_t(* whd_get_resource_block)(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t blockno, const uint8_t **data, uint32_t *size_out)
Gets the resource block for specified resource type.
uint32_t(* whd_get_resource_no_of_blocks)(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *block_count)
Gets block count for the specified resource_type.
Resource type: WLAN Firmware.
uint32_t(* whd_get_resource_block_size)(whd_driver_t whd_drv, whd_resource_type_t type, uint32_t *size_out)
Gets block size for the specified resource_type.
whd_resource_type_t
Type of resources.
Interface to a data source that provides external resources to the radio driver.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.