mirror of
https://github.com/apache/nuttx.git
synced 2026-05-23 14:58:13 +08:00
CC3000 driver changes from David Sidrane
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -32,11 +32,11 @@
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __EVENT_HANDLER_H__
|
||||
#define __EVENT_HANDLER_H__
|
||||
#ifndef _INCLUDE_NUTTX_WIRELESS_CC3000_EVENT_HANDLER_H
|
||||
#define _INCLUDE_NUTTX_WIRELESS_CC3000_EVENT_HANDLER_H
|
||||
|
||||
#include <nuttx/wireless/cc3000/hci.h>
|
||||
#include <nuttx/wireless/cc3000/socket.h>
|
||||
#include <nuttx/wireless/cc3000/include/sys/socket.h>
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
@@ -163,5 +163,5 @@ typedef struct _bsd_gethostbyname_return_t
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __EVENT_HANDLER_H__
|
||||
#endif // _INCLUDE_NUTTX_WIRELESS_CC3000_EVENT_HANDLER_H
|
||||
|
||||
|
||||
+278
-308
File diff suppressed because it is too large
Load Diff
@@ -1,55 +0,0 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* host_driver_version.h - CC3000 Host Driver Implementation.
|
||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __HOST_DRIVER_VERSION_H__
|
||||
#define __HOST_DRIVER_VERSION_H__
|
||||
|
||||
#define DRIVER_VERSION_NUMBER 13
|
||||
|
||||
|
||||
|
||||
#endif // __VERSION_H__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
* CC30000 from Texas Instruments http://processors.wiki.ti.com/index.php/CC3000
|
||||
*
|
||||
* See also:
|
||||
* http://processors.wiki.ti.com/index.php/CC3000_Host_Driver_Porting_Guide
|
||||
* http://processors.wiki.ti.com/index.php/CC3000_Host_Programming_Guide
|
||||
* http://processors.wiki.ti.com/index.php/CC3000_Host_Driver_Porting_Guide
|
||||
* http://processors.wiki.ti.com/index.php/CC3000_Host_Programming_Guide
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -44,8 +44,8 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __INCLUDE_NUTTX_WIRELESS_CC3000_CC3000_INTERNAL_H
|
||||
#define __INCLUDE_NUTTX_WIRELESS_CC3000_CC3000_INTERNAL_H
|
||||
#ifndef __INCLUDE_NUTTX_WIRELESS_CC3000_INCLUDE_CC3000_UPIFL_H
|
||||
#define __INCLUDE_NUTTX_WIRELESS_CC3000_INCLUDE_CC3000_UPIFL_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
@@ -76,12 +76,13 @@
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_CC3000_SPIMODE
|
||||
// CPOL = 0, CPHA = 1 Sample Data Falling Edge of Clock
|
||||
// See http://processors.wiki.ti.com/index.php/CC3000_Serial_Port_Interface_(SPI)
|
||||
/* CPOL = 0, CPHA = 1 Sample Data Falling Edge of Clock
|
||||
* See http://processors.wiki.ti.com/index.php/CC3000_Serial_Port_Interface_(SPI)
|
||||
*/
|
||||
|
||||
# define CONFIG_CC3000_SPIMODE SPIDEV_MODE0
|
||||
#endif
|
||||
|
||||
|
||||
/* Check for some required settings. This can save the user a lot of time
|
||||
* in getting the right configuration.
|
||||
*/
|
||||
@@ -113,7 +114,7 @@ struct cc3000_config_s
|
||||
/* Device characterization */
|
||||
|
||||
uint32_t spi_frequency; /* SPI frequency */
|
||||
uint32_t spi_mode; /* SPI mode */
|
||||
uint32_t spi_mode; /* SPI mode */
|
||||
|
||||
/* If multiple CC3000 devices are supported, then an IRQ number must
|
||||
* be provided for each so that their interrupts can be distinguished.
|
||||
@@ -131,12 +132,12 @@ struct cc3000_config_s
|
||||
* CC3000 to host, indicating that the CC3000 core module is ready to accept data.
|
||||
* T2 duration is approximately 7 ms.
|
||||
*
|
||||
* irq_attach - Attach the CC3000 interrupt handler to the GPIO interrupt
|
||||
* irq_enable - Enable or disable the GPIO interrupt
|
||||
* clear_irq - Acknowledge/clear any pending GPIO interrupt
|
||||
* irq_attach - Attach the CC3000 interrupt handler to the GPIO interrupt
|
||||
* irq_enable - Enable or disable the GPIO interrupt
|
||||
* clear_irq - Acknowledge/clear any pending GPIO interrupt
|
||||
* power_enable - Enable or disable Module enable.
|
||||
* chip_select - The Chip Select
|
||||
* busy - Return the state of the interrupt GPIO input
|
||||
* busy - Return the state of the interrupt GPIO input
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -178,11 +179,8 @@ extern "C" {
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
EXTERN int CC3000_register(FAR struct spi_dev_s *spi,
|
||||
FAR struct cc3000_config_s *config,
|
||||
int minor);
|
||||
|
||||
|
||||
int CC3000_register(FAR struct spi_dev_s *spi,
|
||||
FAR struct cc3000_config_s *config, int minor);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
@@ -190,4 +188,4 @@ EXTERN int CC3000_register(FAR struct spi_dev_s *spi,
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_WIRELESS && CONFIG_INPUT_CC3000 */
|
||||
#endif /* __INCLUDE_NUTTX_WIRELESS_CC3000_CC3000_INTERNAL_H */
|
||||
#endif /* __INCLUDE_NUTTX_WIRELESS_CC3000_INCLUDE_CC3000_UPIFL_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,248 +1,244 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* nvmem.h - CC3000 Host Driver Implementation.
|
||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __NVRAM_H__
|
||||
#define __NVRAM_H__
|
||||
* nvmem.h - CC3000 Host Driver Implementation.
|
||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <nuttx/wireless/cc3000/cc3000_common.h>
|
||||
#ifndef _INCLUDE_NUTTX_WIRELESS_CC3000_NVMEM_H
|
||||
#define _INCLUDE_NUTTX_WIRELESS_CC3000_NVMEM_H
|
||||
|
||||
/*****************************************************************************
|
||||
* Included Files
|
||||
*****************************************************************************/
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "cc3000_common.h"
|
||||
|
||||
/*****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! \addtogroup nvmem_api
|
||||
//! @{
|
||||
//
|
||||
//*****************************************************************************
|
||||
|
||||
/****************************************************************************
|
||||
**
|
||||
** Definitions for File IDs
|
||||
**
|
||||
****************************************************************************/
|
||||
/* NVMEM file ID - system files*/
|
||||
#define NVMEM_NVS_FILEID (0)
|
||||
#define NVMEM_NVS_SHADOW_FILEID (1)
|
||||
#define NVMEM_WLAN_CONFIG_FILEID (2)
|
||||
#define NVMEM_WLAN_CONFIG_SHADOW_FILEID (3)
|
||||
#define NVMEM_WLAN_DRIVER_SP_FILEID (4)
|
||||
#define NVMEM_WLAN_FW_SP_FILEID (5)
|
||||
#define NVMEM_MAC_FILEID (6)
|
||||
#define NVMEM_FRONTEND_VARS_FILEID (7)
|
||||
#define NVMEM_IP_CONFIG_FILEID (8)
|
||||
#define NVMEM_IP_CONFIG_SHADOW_FILEID (9)
|
||||
#define NVMEM_BOOTLOADER_SP_FILEID (10)
|
||||
#define NVMEM_RM_FILEID (11)
|
||||
|
||||
#define NVMEM_NVS_FILEID (0)
|
||||
#define NVMEM_NVS_SHADOW_FILEID (1)
|
||||
#define NVMEM_WLAN_CONFIG_FILEID (2)
|
||||
#define NVMEM_WLAN_CONFIG_SHADOW_FILEID (3)
|
||||
#define NVMEM_WLAN_DRIVER_SP_FILEID (4)
|
||||
#define NVMEM_WLAN_FW_SP_FILEID (5)
|
||||
#define NVMEM_MAC_FILEID (6)
|
||||
#define NVMEM_FRONTEND_VARS_FILEID (7)
|
||||
#define NVMEM_IP_CONFIG_FILEID (8)
|
||||
#define NVMEM_IP_CONFIG_SHADOW_FILEID (9)
|
||||
#define NVMEM_BOOTLOADER_SP_FILEID (10)
|
||||
#define NVMEM_RM_FILEID (11)
|
||||
|
||||
/* NVMEM file ID - user files*/
|
||||
#define NVMEM_AES128_KEY_FILEID (12)
|
||||
#define NVMEM_SHARED_MEM_FILEID (13)
|
||||
|
||||
/* max entry in order to invalid nvmem */
|
||||
#define NVMEM_MAX_ENTRY (16)
|
||||
#define NVMEM_AES128_KEY_FILEID (12)
|
||||
#define NVMEM_SHARED_MEM_FILEID (13)
|
||||
|
||||
/* max entry in order to invalid nvmem */
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! nvmem_read
|
||||
//!
|
||||
//! @param ulFileId nvmem file id:\n
|
||||
//! NVMEM_NVS_FILEID, NVMEM_NVS_SHADOW_FILEID,
|
||||
//! NVMEM_WLAN_CONFIG_FILEID, NVMEM_WLAN_CONFIG_SHADOW_FILEID,
|
||||
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
|
||||
//! NVMEM_MAC_FILEID, NVMEM_FRONTEND_VARS_FILEID,
|
||||
//! NVMEM_IP_CONFIG_FILEID, NVMEM_IP_CONFIG_SHADOW_FILEID,
|
||||
//! NVMEM_BOOTLOADER_SP_FILEID, NVMEM_RM_FILEID,
|
||||
//! and user files 12-15.
|
||||
//! @param ulLength number of bytes to read
|
||||
//! @param ulOffset ulOffset in file from where to read
|
||||
//! @param buff output buffer pointer
|
||||
//!
|
||||
//! @return number of bytes read, otherwise error.
|
||||
//!
|
||||
//! @brief Reads data from the file referred by the ulFileId parameter.
|
||||
//! Reads data from file ulOffset till length. Err if the file can't
|
||||
//! be used, is invalid, or if the read is out of bounds.
|
||||
//!
|
||||
//*****************************************************************************
|
||||
#define NVMEM_MAX_ENTRY (16)
|
||||
|
||||
extern signed long nvmem_read(unsigned long file_id, unsigned long length, unsigned long offset, uint8_t *buff);
|
||||
/*****************************************************************************
|
||||
* Public Data
|
||||
*****************************************************************************/
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! nvmem_write
|
||||
//!
|
||||
//! @param ulFileId nvmem file id:\n
|
||||
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
|
||||
//! NVMEM_MAC_FILEID, NVMEM_BOOTLOADER_SP_FILEID,
|
||||
//! and user files 12-15.
|
||||
//! @param ulLength number of bytes to write
|
||||
//! @param ulEntryOffset offset in file to start write operation from
|
||||
//! @param buff data to write
|
||||
//!
|
||||
//! @return on success 0, error otherwise.
|
||||
//!
|
||||
//! @brief Write data to nvmem.
|
||||
//! writes data to file referred by the ulFileId parameter.
|
||||
//! Writes data to file ulOffset till ulLength.The file id will be
|
||||
//! marked invalid till the write is done. The file entry doesn't
|
||||
//! need to be valid - only allocated.
|
||||
//!
|
||||
//*****************************************************************************
|
||||
|
||||
extern signed long nvmem_write(unsigned long ulFileId, unsigned long ulLength, unsigned long ulEntryOffset, uint8_t *buff);
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! nvmem_set_mac_address
|
||||
//!
|
||||
//! @param mac mac address to be set
|
||||
//!
|
||||
//! @return on success 0, error otherwise.
|
||||
//!
|
||||
//! @brief Write MAC address to EEPROM.
|
||||
//! mac address as appears over the air (OUI first)
|
||||
//!
|
||||
//*****************************************************************************
|
||||
extern uint8_t nvmem_set_mac_address(uint8_t *mac);
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! nvmem_get_mac_address
|
||||
//!
|
||||
//! @param[out] mac mac address
|
||||
//!
|
||||
//! @return on success 0, error otherwise.
|
||||
//!
|
||||
//! @brief Read MAC address from EEPROM.
|
||||
//! mac address as appears over the air (OUI first)
|
||||
//!
|
||||
//*****************************************************************************
|
||||
extern uint8_t nvmem_get_mac_address(uint8_t *mac);
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! nvmem_write_patch
|
||||
//!
|
||||
//! @param ulFileId nvmem file id:\n
|
||||
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
|
||||
//! @param spLength number of bytes to write
|
||||
//! @param spData SP data to write
|
||||
//!
|
||||
//! @return on success 0, error otherwise.
|
||||
//!
|
||||
//! @brief program a patch to a specific file ID.
|
||||
//! The SP data is assumed to be organized in 2-dimensional.
|
||||
//! Each line is SP_PORTION_SIZE bytes long. Actual programming is
|
||||
//! applied in SP_PORTION_SIZE bytes portions.
|
||||
//!
|
||||
//*****************************************************************************
|
||||
extern uint8_t nvmem_write_patch(unsigned long ulFileId, unsigned long spLength, const uint8_t *spData);
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! nvmem_read_sp_version
|
||||
//!
|
||||
//! @param[out] patchVer first number indicates package ID and the second
|
||||
//! number indicates package build number
|
||||
//!
|
||||
//! @return on success 0, error otherwise.
|
||||
//!
|
||||
//! @brief Read patch version. read package version (WiFi FW patch,
|
||||
//! driver-supplicant-NS patch, bootloader patch)
|
||||
//!
|
||||
//*****************************************************************************
|
||||
#ifndef CC3000_TINY_DRIVER
|
||||
extern uint8_t nvmem_read_sp_version(uint8_t* patchVer);
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! nvmem_create_entry
|
||||
//!
|
||||
//! @param ulFileId nvmem file Id:\n
|
||||
//! * NVMEM_AES128_KEY_FILEID: 12
|
||||
//! * NVMEM_SHARED_MEM_FILEID: 13
|
||||
//! * and fileIDs 14 and 15
|
||||
//! @param ulNewLen entry ulLength
|
||||
//!
|
||||
//! @return on success 0, error otherwise.
|
||||
//!
|
||||
//! @brief Create new file entry and allocate space on the NVMEM.
|
||||
//! Applies only to user files.
|
||||
//! Modify the size of file.
|
||||
//! If the entry is unallocated - allocate it to size
|
||||
//! ulNewLen (marked invalid).
|
||||
//! If it is allocated then deallocate it first.
|
||||
//! To just mark the file as invalid without resizing -
|
||||
//! set ulNewLen=0.
|
||||
//!
|
||||
//*****************************************************************************
|
||||
extern signed long nvmem_create_entry(unsigned long file_id, unsigned long newlen);
|
||||
/*****************************************************************************
|
||||
* Public Function Prototypes
|
||||
*****************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
* Name: nvmem_read
|
||||
*
|
||||
* Description:
|
||||
* Reads data from the file referred by the ulFileId parameter. Reads data
|
||||
* from file ulOffset till length. Err if the file can't be used, is
|
||||
* invalid, or if the read is out of bounds.
|
||||
*
|
||||
* Input Parameters:
|
||||
* ulFileId nvmem file id:
|
||||
* NVMEM_NVS_FILEID, NVMEM_NVS_SHADOW_FILEID,
|
||||
* NVMEM_WLAN_CONFIG_FILEID, NVMEM_WLAN_CONFIG_SHADOW_FILEID,
|
||||
* NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
|
||||
* NVMEM_MAC_FILEID, NVMEM_FRONTEND_VARS_FILEID,
|
||||
* NVMEM_IP_CONFIG_FILEID, NVMEM_IP_CONFIG_SHADOW_FILEID,
|
||||
* NVMEM_BOOTLOADER_SP_FILEID, NVMEM_RM_FILEID,
|
||||
* and user files 12-15.
|
||||
* ulLength number of bytes to read
|
||||
* ulOffset ulOffset in file from where to read
|
||||
* buff output buffer pointer
|
||||
*
|
||||
* Returned Value:
|
||||
* Number of bytes read, otherwise error.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Mark the end of the C bindings section for C++ compilers.
|
||||
//
|
||||
//*****************************************************************************
|
||||
signed long nvmem_read(unsigned long ulFileId, unsigned long ulLength,
|
||||
unsigned long ulOffset, uint8_t *buff);
|
||||
|
||||
/******************************************************************************
|
||||
* Name: nvmem_write
|
||||
*
|
||||
* Description:
|
||||
* Write data to nvmem. Writes data to file referred by the ulFileId
|
||||
* parameter. Writes data to file ulOffset till ulLength. The file id will be
|
||||
* marked invalid till the write is done. The file entry doesn't need to be
|
||||
* valid - only allocated.
|
||||
*
|
||||
* Input Parameters:
|
||||
* ulFileId nvmem file id:
|
||||
* NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
|
||||
* NVMEM_MAC_FILEID, NVMEM_BOOTLOADER_SP_FILEID,
|
||||
* and user files 12-15.
|
||||
* ulLength number of bytes to write
|
||||
* ulEntryOffset offset in file to start write operation from
|
||||
* buff data to write
|
||||
*
|
||||
* Returned Value:
|
||||
* On success 0, error otherwise.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// Close the Doxygen group.
|
||||
//! @}
|
||||
//
|
||||
//*****************************************************************************
|
||||
signed long nvmem_write(unsigned long ulFileId, unsigned long ulLength,
|
||||
unsigned long ulEntryOffset, uint8_t *buff);
|
||||
|
||||
/******************************************************************************
|
||||
* Name: nvmem_set_mac_address
|
||||
*
|
||||
* Description:
|
||||
* Write MAC address to EEPROM. mac address as appears over the air (OUI
|
||||
* first)
|
||||
*
|
||||
* Input Parameters:
|
||||
* mac mac address to be set
|
||||
*
|
||||
* Returned Value:
|
||||
* On success 0, error otherwise.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
uint8_t nvmem_set_mac_address(uint8_t *mac);
|
||||
|
||||
/******************************************************************************
|
||||
* Name: nvmem_get_mac_address
|
||||
*
|
||||
* Description:
|
||||
* Read MAC address from EEPROM. mac address as appears over the air (OUI
|
||||
* first)
|
||||
*
|
||||
* Input Parameters:
|
||||
* mac mac address
|
||||
*
|
||||
* Returned Value:
|
||||
* On success 0, error otherwise.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
uint8_t nvmem_get_mac_address(uint8_t *mac);
|
||||
|
||||
/******************************************************************************
|
||||
* Name: nvmem_write_patch
|
||||
*
|
||||
* Description:
|
||||
* Program a patch to a specific file ID. The SP data is assumed to be
|
||||
* organized in 2-dimensional. Each line is SP_PORTION_SIZE bytes long.
|
||||
* Actual programming is applied in SP_PORTION_SIZE bytes portions.
|
||||
*
|
||||
* Input Parameters:
|
||||
* ulFileId nvmem file id:
|
||||
* NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
|
||||
* spLength number of bytes to write
|
||||
* spData SP data to write
|
||||
*
|
||||
* Returned Value:
|
||||
* On success 0, error otherwise.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
uint8_t nvmem_write_patch(unsigned long ulFileId, unsigned long spLength,
|
||||
const uint8_t *spData);
|
||||
|
||||
/******************************************************************************
|
||||
* Name: nvmem_read_sp_version
|
||||
*
|
||||
* Description:
|
||||
* Read patch version. read package version (WiFi FW patch,
|
||||
* driver-supplicant-NS patch, bootloader patch)
|
||||
*
|
||||
* Input Parameters:
|
||||
* patchVer first number indicates package ID and the second
|
||||
* number indicates package build number
|
||||
*
|
||||
* Returned Value:
|
||||
* On success 0, error otherwise.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef CC3000_TINY_DRIVER
|
||||
uint8_t nvmem_read_sp_version(uint8_t *patchVer);
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* Name: nvmem_create_entry
|
||||
*
|
||||
* Description:
|
||||
* Create new file entry and allocate space on the NVMEM. Applies only to
|
||||
* user files. Modify the size of file. If the entry is unallocated -
|
||||
* allocate it to size ulNewLen (marked invalid). If it is allocated then
|
||||
* deallocate it first. To just mark the file as invalid without resizing -
|
||||
* Set ulNewLen=0.
|
||||
*
|
||||
* Input Parameters:
|
||||
* ulFileId nvmem file Id:
|
||||
* * NVMEM_AES128_KEY_FILEID: 12
|
||||
* * NVMEM_SHARED_MEM_FILEID: 13
|
||||
* * and fileIDs 14 and 15
|
||||
* ulNewLen entry ulLength
|
||||
*
|
||||
* Returned Value:
|
||||
* On success 0, error otherwise.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
signed long nvmem_create_entry(unsigned long ulFileId, unsigned long ulNewLen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // __NVRAM_H__
|
||||
#endif // _INCLUDE_NUTTX_WIRELESS_CC3000_NVMEM_H
|
||||
|
||||
@@ -1,126 +1,138 @@
|
||||
/*****************************************************************************
|
||||
*
|
||||
* security.h - CC3000 Host Driver Implementation.
|
||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
#ifndef __SECURITY__
|
||||
#define __SECURITY__
|
||||
* security.h - CC3000 Host Driver Implementation.
|
||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||
* its contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#include <nuttx/wireless/cc3000/nvmem.h>
|
||||
#ifndef _INCLUDE_NUTTX_WIRELESS_CC3000_SECURITY_H
|
||||
#define _INCLUDE_NUTTX_WIRELESS_CC3000_SECURITY_H
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
// If building with a C++ compiler, make all of the definitions in this header
|
||||
// have a C binding.
|
||||
//
|
||||
//*****************************************************************************
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/*****************************************************************************
|
||||
* Included Files
|
||||
*****************************************************************************/
|
||||
|
||||
#include "nvmem.h"
|
||||
|
||||
#define AES128_KEY_SIZE 16
|
||||
/*****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
*****************************************************************************/
|
||||
|
||||
#define AES128_KEY_SIZE 16
|
||||
|
||||
#ifndef CC3000_UNENCRYPTED_SMART_CONFIG
|
||||
|
||||
/*****************************************************************************
|
||||
* Public Data
|
||||
*****************************************************************************/
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! aes_encrypt
|
||||
//!
|
||||
//! @param[in] key AES128 key of size 16 bytes
|
||||
//! @param[in\out] state 16 bytes of plain text and cipher text
|
||||
//!
|
||||
//! @return none
|
||||
//!
|
||||
//! @brief AES128 encryption:
|
||||
//! Given AES128 key and 16 bytes plain text, cipher text of 16 bytes
|
||||
//! is computed. The AES implementation is in mode ECB (Electronic
|
||||
//! Code Book).
|
||||
//!
|
||||
//!
|
||||
//*****************************************************************************
|
||||
extern void aes_encrypt(uint8_t *state, uint8_t *key);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! aes_decrypt
|
||||
//!
|
||||
//! @param[in] key AES128 key of size 16 bytes
|
||||
//! @param[in\out] state 16 bytes of cipher text and plain text
|
||||
//!
|
||||
//! @return none
|
||||
//!
|
||||
//! @brief AES128 decryption:
|
||||
//! Given AES128 key and 16 bytes cipher text, plain text of 16 bytes
|
||||
//! is computed The AES implementation is in mode ECB
|
||||
//! (Electronic Code Book).
|
||||
//!
|
||||
//!
|
||||
//*****************************************************************************
|
||||
extern void aes_decrypt(uint8_t *state, uint8_t *key);
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! aes_read_key
|
||||
//!
|
||||
//! @param[out] key AES128 key of size 16 bytes
|
||||
//!
|
||||
//! @return on success 0, error otherwise.
|
||||
//!
|
||||
//! @brief Reads AES128 key from EEPROM
|
||||
//! Reads the AES128 key from fileID #12 in EEPROM
|
||||
//! returns an error if the key does not exist.
|
||||
//!
|
||||
//!
|
||||
//*****************************************************************************
|
||||
extern signed long aes_read_key(uint8_t *key);
|
||||
|
||||
//*****************************************************************************
|
||||
//
|
||||
//! aes_write_key
|
||||
//!
|
||||
//! @param[out] key AES128 key of size 16 bytes
|
||||
//!
|
||||
//! @return on success 0, error otherwise.
|
||||
//!
|
||||
//! @brief writes AES128 key from EEPROM
|
||||
//! Writes the AES128 key to fileID #12 in EEPROM
|
||||
//!
|
||||
//!
|
||||
//*****************************************************************************
|
||||
extern signed long aes_write_key(uint8_t *key);
|
||||
|
||||
#endif //CC3000_UNENCRYPTED_SMART_CONFIG
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* Public Function Prototypes
|
||||
/*****************************************************************************
|
||||
|
||||
/*****************************************************************************
|
||||
* Name: aes_encrypt
|
||||
*
|
||||
* Description:
|
||||
* AES128 encryption: Given AES128 key and 16 bytes plain text, cipher
|
||||
* text of 16 bytes is computed. The AES implementation is in mode ECB
|
||||
* (Electronic Code Book).
|
||||
*
|
||||
* Input Parameters:
|
||||
* key AES128 key of size 16 bytes
|
||||
* state 16 bytes of plain text and cipher text
|
||||
*
|
||||
* Returned Value
|
||||
* None
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void aes_encrypt(uint8_t *state, uint8_t *key);
|
||||
|
||||
/*****************************************************************************
|
||||
* Name: aes_decrypt
|
||||
*
|
||||
* Description:
|
||||
* AES128 decryption: Given AES128 key and 16 bytes cipher text, plain
|
||||
* text of 16 bytes is computed The AES implementation is in mode ECB
|
||||
* (Electronic Code Book).
|
||||
*
|
||||
* Input Parameters:
|
||||
* key AES128 key of size 16 bytes
|
||||
* state 16 bytes of plain text and cipher text
|
||||
*
|
||||
* Returned Value
|
||||
* None
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
void aes_decrypt(uint8_t *state, uint8_t *key);
|
||||
|
||||
/*****************************************************************************
|
||||
* Name: aes_read_key
|
||||
*
|
||||
* Description:
|
||||
* Reads AES128 key from EEPROM. Reads the AES128 key from fileID #12 in
|
||||
* EEPROM returns an error if the key does not exist.
|
||||
*
|
||||
* Input Parameters:
|
||||
* key AES128 key of size 16 bytes
|
||||
*
|
||||
* Returned Value
|
||||
* On success 0, error otherwise.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
signed long aes_read_key(uint8_t *key);
|
||||
|
||||
/*****************************************************************************
|
||||
* Name: aes_write_key
|
||||
*
|
||||
* Description:
|
||||
* Writes AES128 key from EEPROM Writes the AES128 key to fileID #12 in
|
||||
* EEPROM
|
||||
*
|
||||
* Input Parameters:
|
||||
* key AES128 key of size 16 bytes
|
||||
*
|
||||
* Returned Value
|
||||
* On success 0, error otherwise.
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
signed long aes_write_key(uint8_t *key);
|
||||
|
||||
#endif /* CC3000_UNENCRYPTED_SMART_CONFIG */
|
||||
#endif /* _INCLUDE_NUTTX_WIRELESS_CC3000_SECURITY_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user