CC3000HostDriver for device TI CC3000 some changes were made due to mbed compiler and the use of void*
Embed:
(wiki syntax)
Show/hide line numbers
nvmem.h
00001 /***************************************************************************** 00002 * 00003 * nvmem.h - CC3000 Host Driver Implementation. 00004 * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/ 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 00010 * Redistributions of source code must retain the above copyright 00011 * notice, this list of conditions and the following disclaimer. 00012 * 00013 * Redistributions in binary form must reproduce the above copyright 00014 * notice, this list of conditions and the following disclaimer in the 00015 * documentation and/or other materials provided with the 00016 * distribution. 00017 * 00018 * Neither the name of Texas Instruments Incorporated nor the names of 00019 * its contributors may be used to endorse or promote products derived 00020 * from this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00023 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00024 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00025 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00026 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00027 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00028 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00029 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00030 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00031 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00032 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 * 00034 *****************************************************************************/ 00035 #ifndef __NVRAM_H__ 00036 #define __NVRAM_H__ 00037 00038 #include "cc3000_common.h" 00039 00040 00041 //***************************************************************************** 00042 // 00043 // If building with a C++ compiler, make all of the definitions in this header 00044 // have a C binding. 00045 // 00046 //***************************************************************************** 00047 #ifdef __cplusplus 00048 extern "C" { 00049 #endif 00050 00051 00052 //***************************************************************************** 00053 // 00054 //! \addtogroup nvmem_api 00055 //! @{ 00056 // 00057 //***************************************************************************** 00058 00059 /**************************************************************************** 00060 ** 00061 ** Definitions for File IDs 00062 ** 00063 ****************************************************************************/ 00064 /* NVMEM file ID - system files*/ 00065 #define NVMEM_NVS_FILEID (0) 00066 #define NVMEM_NVS_SHADOW_FILEID (1) 00067 #define NVMEM_WLAN_CONFIG_FILEID (2) 00068 #define NVMEM_WLAN_CONFIG_SHADOW_FILEID (3) 00069 #define NVMEM_WLAN_DRIVER_SP_FILEID (4) 00070 #define NVMEM_WLAN_FW_SP_FILEID (5) 00071 #define NVMEM_MAC_FILEID (6) 00072 #define NVMEM_FRONTEND_VARS_FILEID (7) 00073 #define NVMEM_IP_CONFIG_FILEID (8) 00074 #define NVMEM_IP_CONFIG_SHADOW_FILEID (9) 00075 #define NVMEM_BOOTLOADER_SP_FILEID (10) 00076 #define NVMEM_RM_FILEID (11) 00077 00078 /* NVMEM file ID - user files*/ 00079 #define NVMEM_AES128_KEY_FILEID (12) 00080 #define NVMEM_SHARED_MEM_FILEID (13) 00081 00082 /* max entry in order to invalid nvmem */ 00083 #define NVMEM_MAX_ENTRY (16) 00084 00085 00086 //***************************************************************************** 00087 // 00088 //! nvmem_read 00089 //! 00090 //! @param ulFileId nvmem file id:\n 00091 //! NVMEM_NVS_FILEID, NVMEM_NVS_SHADOW_FILEID, 00092 //! NVMEM_WLAN_CONFIG_FILEID, NVMEM_WLAN_CONFIG_SHADOW_FILEID, 00093 //! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID, 00094 //! NVMEM_MAC_FILEID, NVMEM_FRONTEND_VARS_FILEID, 00095 //! NVMEM_IP_CONFIG_FILEID, NVMEM_IP_CONFIG_SHADOW_FILEID, 00096 //! NVMEM_BOOTLOADER_SP_FILEID, NVMEM_RM_FILEID, 00097 //! and user files 12-15. 00098 //! @param ulLength number of bytes to read 00099 //! @param ulOffset ulOffset in file from where to read 00100 //! @param buff output buffer pointer 00101 //! 00102 //! @return number of bytes read, otherwise error. 00103 //! 00104 //! @brief Reads data from the file referred by the ulFileId parameter. 00105 //! Reads data from file ulOffset till length. Err if the file can't 00106 //! be used, is invalid, or if the read is out of bounds. 00107 //! 00108 //***************************************************************************** 00109 00110 extern signed long nvmem_read(unsigned long file_id, unsigned long length, unsigned long offset, unsigned char *buff); 00111 00112 //***************************************************************************** 00113 // 00114 //! nvmem_write 00115 //! 00116 //! @param ulFileId nvmem file id:\n 00117 //! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID, 00118 //! NVMEM_MAC_FILEID, NVMEM_BOOTLOADER_SP_FILEID, 00119 //! and user files 12-15. 00120 //! @param ulLength number of bytes to write 00121 //! @param ulEntryOffset offset in file to start write operation from 00122 //! @param buff data to write 00123 //! 00124 //! @return on success 0, error otherwise. 00125 //! 00126 //! @brief Write data to nvmem. 00127 //! writes data to file referred by the ulFileId parameter. 00128 //! Writes data to file ulOffset till ulLength.The file id will be 00129 //! marked invalid till the write is done. The file entry doesn't 00130 //! need to be valid - only allocated. 00131 //! 00132 //***************************************************************************** 00133 00134 extern signed long nvmem_write(unsigned long ulFileId, unsigned long ulLength, unsigned long ulEntryOffset, unsigned char *buff); 00135 00136 00137 //***************************************************************************** 00138 // 00139 //! nvmem_set_mac_address 00140 //! 00141 //! @param mac mac address to be set 00142 //! 00143 //! @return on success 0, error otherwise. 00144 //! 00145 //! @brief Write MAC address to EEPROM. 00146 //! mac address as appears over the air (OUI first) 00147 //! 00148 //***************************************************************************** 00149 extern unsigned char nvmem_set_mac_address(unsigned char *mac); 00150 00151 00152 //***************************************************************************** 00153 // 00154 //! nvmem_get_mac_address 00155 //! 00156 //! @param[out] mac mac address 00157 //! 00158 //! @return on success 0, error otherwise. 00159 //! 00160 //! @brief Read MAC address from EEPROM. 00161 //! mac address as appears over the air (OUI first) 00162 //! 00163 //***************************************************************************** 00164 extern unsigned char nvmem_get_mac_address(unsigned char *mac); 00165 00166 00167 //***************************************************************************** 00168 // 00169 //! nvmem_write_patch 00170 //! 00171 //! @param ulFileId nvmem file id:\n 00172 //! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID, 00173 //! @param spLength number of bytes to write 00174 //! @param spData SP data to write 00175 //! 00176 //! @return on success 0, error otherwise. 00177 //! 00178 //! @brief program a patch to a specific file ID. 00179 //! The SP data is assumed to be organized in 2-dimensional. 00180 //! Each line is SP_PORTION_SIZE bytes long. Actual programming is 00181 //! applied in SP_PORTION_SIZE bytes portions. 00182 //! 00183 //***************************************************************************** 00184 extern unsigned char nvmem_write_patch(unsigned long ulFileId, unsigned long spLength, const unsigned char *spData); 00185 00186 00187 //***************************************************************************** 00188 // 00189 //! nvmem_read_sp_version 00190 //! 00191 //! @param[out] patchVer first number indicates package ID and the second 00192 //! number indicates package build number 00193 //! 00194 //! @return on success 0, error otherwise. 00195 //! 00196 //! @brief Read patch version. read package version (WiFi FW patch, 00197 //! driver-supplicant-NS patch, bootloader patch) 00198 //! 00199 //***************************************************************************** 00200 #ifndef CC3000_TINY_DRIVER 00201 extern unsigned char nvmem_read_sp_version(unsigned char* patchVer); 00202 #endif 00203 00204 //***************************************************************************** 00205 // 00206 //! nvmem_create_entry 00207 //! 00208 //! @param ulFileId nvmem file Id:\n 00209 //! * NVMEM_AES128_KEY_FILEID: 12 00210 //! * NVMEM_SHARED_MEM_FILEID: 13 00211 //! * and fileIDs 14 and 15 00212 //! @param ulNewLen entry ulLength 00213 //! 00214 //! @return on success 0, error otherwise. 00215 //! 00216 //! @brief Create new file entry and allocate space on the NVMEM. 00217 //! Applies only to user files. 00218 //! Modify the size of file. 00219 //! If the entry is unallocated - allocate it to size 00220 //! ulNewLen (marked invalid). 00221 //! If it is allocated then deallocate it first. 00222 //! To just mark the file as invalid without resizing - 00223 //! set ulNewLen=0. 00224 //! 00225 //***************************************************************************** 00226 extern signed long nvmem_create_entry(unsigned long file_id, unsigned long newlen); 00227 00228 00229 //***************************************************************************** 00230 // 00231 // Mark the end of the C bindings section for C++ compilers. 00232 // 00233 //***************************************************************************** 00234 00235 00236 //***************************************************************************** 00237 // 00238 // Close the Doxygen group. 00239 //! @} 00240 // 00241 //***************************************************************************** 00242 00243 00244 #ifdef __cplusplus 00245 } 00246 #endif // __cplusplus 00247 00248 #endif // __NVRAM_H__ 00249
Generated on Tue Jul 12 2022 19:26:44 by 1.7.2