mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 09:28:40 +08:00
CC3000 driver updates from Alan Carvalho de Assis
This commit is contained in:
@@ -1,164 +1,164 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* cc3000_common.c.c - CC3000 Host Driver Implementation.
|
* cc3000_common.c.c - CC3000 Host Driver Implementation.
|
||||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright
|
* Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the
|
* documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||||
* its contributors may be used to endorse or promote products derived
|
* its contributors may be used to endorse or promote products derived
|
||||||
* from this software without specific prior written permission.
|
* from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! \addtogroup common_api
|
//! \addtogroup common_api
|
||||||
//! @{
|
//! @{
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
*
|
*
|
||||||
* Include files
|
* Include files
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#include <nuttx/cc3000/cc3000_common.h>
|
#include <nuttx/cc3000/cc3000_common.h>
|
||||||
#include <nuttx/cc3000/socket.h>
|
#include <nuttx/cc3000/socket.h>
|
||||||
#include <nuttx/cc3000/wlan.h>
|
#include <nuttx/cc3000/wlan.h>
|
||||||
#include <nuttx/cc3000/evnt_handler.h>
|
#include <nuttx/cc3000/evnt_handler.h>
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! __error__
|
//! __error__
|
||||||
//!
|
//!
|
||||||
//! @param pcFilename - file name, where error occurred
|
//! @param pcFilename - file name, where error occurred
|
||||||
//! @param ulLine - line number, where error occurred
|
//! @param ulLine - line number, where error occurred
|
||||||
//!
|
//!
|
||||||
//! @return none
|
//! @return none
|
||||||
//!
|
//!
|
||||||
//! @brief stub function for ASSERT macro
|
//! @brief stub function for ASSERT macro
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
void
|
void
|
||||||
__error__(char *pcFilename, unsigned long ulLine)
|
__error__(char *pcFilename, unsigned long ulLine)
|
||||||
{
|
{
|
||||||
//TODO full up function
|
//TODO full up function
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! UINT32_TO_STREAM_f
|
//! UINT32_TO_STREAM_f
|
||||||
//!
|
//!
|
||||||
//! @param p pointer to the new stream
|
//! @param p pointer to the new stream
|
||||||
//! @param u32 pointer to the 32 bit
|
//! @param u32 pointer to the 32 bit
|
||||||
//!
|
//!
|
||||||
//! @return pointer to the new stream
|
//! @return pointer to the new stream
|
||||||
//!
|
//!
|
||||||
//! @brief This function is used for copying 32 bit to stream
|
//! @brief This function is used for copying 32 bit to stream
|
||||||
//! while converting to little endian format.
|
//! while converting to little endian format.
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
unsigned char* UINT32_TO_STREAM_f (unsigned char *p, unsigned long u32)
|
uint8_t* UINT32_TO_STREAM_f (uint8_t *p, unsigned long u32)
|
||||||
{
|
{
|
||||||
*(p)++ = (unsigned char)(u32);
|
*(p)++ = (uint8_t)(u32);
|
||||||
*(p)++ = (unsigned char)((u32) >> 8);
|
*(p)++ = (uint8_t)((u32) >> 8);
|
||||||
*(p)++ = (unsigned char)((u32) >> 16);
|
*(p)++ = (uint8_t)((u32) >> 16);
|
||||||
*(p)++ = (unsigned char)((u32) >> 24);
|
*(p)++ = (uint8_t)((u32) >> 24);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! UINT16_TO_STREAM_f
|
//! UINT16_TO_STREAM_f
|
||||||
//!
|
//!
|
||||||
//! @param p pointer to the new stream
|
//! @param p pointer to the new stream
|
||||||
//! @param u32 pointer to the 16 bit
|
//! @param u32 pointer to the 16 bit
|
||||||
//!
|
//!
|
||||||
//! @return pointer to the new stream
|
//! @return pointer to the new stream
|
||||||
//!
|
//!
|
||||||
//! @brief This function is used for copying 16 bit to stream
|
//! @brief This function is used for copying 16 bit to stream
|
||||||
//! while converting to little endian format.
|
//! while converting to little endian format.
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
unsigned char* UINT16_TO_STREAM_f (unsigned char *p, unsigned short u16)
|
uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16)
|
||||||
{
|
{
|
||||||
*(p)++ = (unsigned char)(u16);
|
*(p)++ = (uint8_t)(u16);
|
||||||
*(p)++ = (unsigned char)((u16) >> 8);
|
*(p)++ = (uint8_t)((u16) >> 8);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! STREAM_TO_UINT16_f
|
//! STREAM_TO_UINT16_f
|
||||||
//!
|
//!
|
||||||
//! @param p pointer to the stream
|
//! @param p pointer to the stream
|
||||||
//! @param offset offset in the stream
|
//! @param offset offset in the stream
|
||||||
//!
|
//!
|
||||||
//! @return pointer to the new 16 bit
|
//! @return pointer to the new 16 bit
|
||||||
//!
|
//!
|
||||||
//! @brief This function is used for copying received stream to
|
//! @brief This function is used for copying received stream to
|
||||||
//! 16 bit in little endian format.
|
//! 16 bit in little endian format.
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
unsigned short STREAM_TO_UINT16_f(char* p, unsigned short offset)
|
uint16_t STREAM_TO_UINT16_f(char* p, uint16_t offset)
|
||||||
{
|
{
|
||||||
return (unsigned short)((unsigned short)((unsigned short)
|
return (uint16_t)((uint16_t)((uint16_t)
|
||||||
(*(p + offset + 1)) << 8) + (unsigned short)(*(p + offset)));
|
(*(p + offset + 1)) << 8) + (uint16_t)(*(p + offset)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! STREAM_TO_UINT32_f
|
//! STREAM_TO_UINT32_f
|
||||||
//!
|
//!
|
||||||
//! @param p pointer to the stream
|
//! @param p pointer to the stream
|
||||||
//! @param offset offset in the stream
|
//! @param offset offset in the stream
|
||||||
//!
|
//!
|
||||||
//! @return pointer to the new 32 bit
|
//! @return pointer to the new 32 bit
|
||||||
//!
|
//!
|
||||||
//! @brief This function is used for copying received stream to
|
//! @brief This function is used for copying received stream to
|
||||||
//! 32 bit in little endian format.
|
//! 32 bit in little endian format.
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
unsigned long STREAM_TO_UINT32_f(char* p, unsigned short offset)
|
unsigned long STREAM_TO_UINT32_f(char* p, uint16_t offset)
|
||||||
{
|
{
|
||||||
return (unsigned long)((unsigned long)((unsigned long)
|
return (unsigned long)((unsigned long)((unsigned long)
|
||||||
(*(p + offset + 3)) << 24) + (unsigned long)((unsigned long)
|
(*(p + offset + 3)) << 24) + (unsigned long)((unsigned long)
|
||||||
(*(p + offset + 2)) << 16) + (unsigned long)((unsigned long)
|
(*(p + offset + 2)) << 16) + (unsigned long)((unsigned long)
|
||||||
(*(p + offset + 1)) << 8) + (unsigned long)(*(p + offset)));
|
(*(p + offset + 1)) << 8) + (unsigned long)(*(p + offset)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
// Close the Doxygen group.
|
// Close the Doxygen group.
|
||||||
//! @}
|
//! @}
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
+230
-230
@@ -1,230 +1,230 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* hci.c - CC3000 Host Driver Implementation.
|
* hci.c - CC3000 Host Driver Implementation.
|
||||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright
|
* Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the
|
* documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||||
* its contributors may be used to endorse or promote products derived
|
* its contributors may be used to endorse or promote products derived
|
||||||
* from this software without specific prior written permission.
|
* from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! \addtogroup hci_app
|
//! \addtogroup hci_app
|
||||||
//! @{
|
//! @{
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <nuttx/cc3000/cc3000_common.h>
|
#include <nuttx/cc3000/cc3000_common.h>
|
||||||
#include <nuttx/cc3000/hci.h>
|
#include <nuttx/cc3000/hci.h>
|
||||||
#include <nuttx/cc3000/spi.h>
|
#include <nuttx/cc3000/spi.h>
|
||||||
#include <nuttx/cc3000/evnt_handler.h>
|
#include <nuttx/cc3000/evnt_handler.h>
|
||||||
#include <nuttx/cc3000/wlan.h>
|
#include <nuttx/cc3000/wlan.h>
|
||||||
|
|
||||||
#define SL_PATCH_PORTION_SIZE (1000)
|
#define SL_PATCH_PORTION_SIZE (1000)
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! hci_command_send
|
//! hci_command_send
|
||||||
//!
|
//!
|
||||||
//! @param usOpcode command operation code
|
//! @param usOpcode command operation code
|
||||||
//! @param pucBuff pointer to the command's arguments buffer
|
//! @param pucBuff pointer to the command's arguments buffer
|
||||||
//! @param ucArgsLength length of the arguments
|
//! @param ucArgsLength length of the arguments
|
||||||
//!
|
//!
|
||||||
//! @return none
|
//! @return none
|
||||||
//!
|
//!
|
||||||
//! @brief Initiate an HCI command.
|
//! @brief Initiate an HCI command.
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
unsigned short
|
uint16_t
|
||||||
hci_command_send(unsigned short usOpcode, unsigned char *pucBuff,
|
hci_command_send(uint16_t usOpcode, uint8_t *pucBuff,
|
||||||
unsigned char ucArgsLength)
|
uint8_t ucArgsLength)
|
||||||
{
|
{
|
||||||
unsigned char *stream;
|
uint8_t *stream;
|
||||||
|
|
||||||
stream = (pucBuff + SPI_HEADER_SIZE);
|
stream = (pucBuff + SPI_HEADER_SIZE);
|
||||||
|
|
||||||
UINT8_TO_STREAM(stream, HCI_TYPE_CMND);
|
UINT8_TO_STREAM(stream, HCI_TYPE_CMND);
|
||||||
stream = UINT16_TO_STREAM(stream, usOpcode);
|
stream = UINT16_TO_STREAM(stream, usOpcode);
|
||||||
UINT8_TO_STREAM(stream, ucArgsLength);
|
UINT8_TO_STREAM(stream, ucArgsLength);
|
||||||
|
|
||||||
//Update the opcode of the event we will be waiting for
|
//Update the opcode of the event we will be waiting for
|
||||||
SpiWrite(pucBuff, ucArgsLength + SIMPLE_LINK_HCI_CMND_HEADER_SIZE);
|
SpiWrite(pucBuff, ucArgsLength + SIMPLE_LINK_HCI_CMND_HEADER_SIZE);
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! hci_data_send
|
//! hci_data_send
|
||||||
//!
|
//!
|
||||||
//! @param usOpcode command operation code
|
//! @param usOpcode command operation code
|
||||||
//! @param ucArgs pointer to the command's arguments buffer
|
//! @param ucArgs pointer to the command's arguments buffer
|
||||||
//! @param usArgsLength length of the arguments
|
//! @param usArgsLength length of the arguments
|
||||||
//! @param ucTail pointer to the data buffer
|
//! @param ucTail pointer to the data buffer
|
||||||
//! @param usTailLength buffer length
|
//! @param usTailLength buffer length
|
||||||
//!
|
//!
|
||||||
//! @return none
|
//! @return none
|
||||||
//!
|
//!
|
||||||
//! @brief Initiate an HCI data write operation
|
//! @brief Initiate an HCI data write operation
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
long
|
long
|
||||||
hci_data_send(unsigned char ucOpcode,
|
hci_data_send(uint8_t ucOpcode,
|
||||||
unsigned char *ucArgs,
|
uint8_t *ucArgs,
|
||||||
unsigned short usArgsLength,
|
uint16_t usArgsLength,
|
||||||
unsigned short usDataLength,
|
uint16_t usDataLength,
|
||||||
const unsigned char *ucTail,
|
const uint8_t *ucTail,
|
||||||
unsigned short usTailLength)
|
uint16_t usTailLength)
|
||||||
{
|
{
|
||||||
unsigned char *stream;
|
uint8_t *stream;
|
||||||
|
|
||||||
stream = ((ucArgs) + SPI_HEADER_SIZE);
|
stream = ((ucArgs) + SPI_HEADER_SIZE);
|
||||||
|
|
||||||
UINT8_TO_STREAM(stream, HCI_TYPE_DATA);
|
UINT8_TO_STREAM(stream, HCI_TYPE_DATA);
|
||||||
UINT8_TO_STREAM(stream, ucOpcode);
|
UINT8_TO_STREAM(stream, ucOpcode);
|
||||||
UINT8_TO_STREAM(stream, usArgsLength);
|
UINT8_TO_STREAM(stream, usArgsLength);
|
||||||
stream = UINT16_TO_STREAM(stream, usArgsLength + usDataLength + usTailLength);
|
stream = UINT16_TO_STREAM(stream, usArgsLength + usDataLength + usTailLength);
|
||||||
|
|
||||||
// Send the packet over the SPI
|
// Send the packet over the SPI
|
||||||
SpiWrite(ucArgs, SIMPLE_LINK_HCI_DATA_HEADER_SIZE + usArgsLength + usDataLength + usTailLength);
|
SpiWrite(ucArgs, SIMPLE_LINK_HCI_DATA_HEADER_SIZE + usArgsLength + usDataLength + usTailLength);
|
||||||
|
|
||||||
return(ESUCCESS);
|
return(ESUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! hci_data_command_send
|
//! hci_data_command_send
|
||||||
//!
|
//!
|
||||||
//! @param usOpcode command operation code
|
//! @param usOpcode command operation code
|
||||||
//! @param pucBuff pointer to the data buffer
|
//! @param pucBuff pointer to the data buffer
|
||||||
//! @param ucArgsLength arguments length
|
//! @param ucArgsLength arguments length
|
||||||
//! @param ucDataLength data length
|
//! @param ucDataLength data length
|
||||||
//!
|
//!
|
||||||
//! @return none
|
//! @return none
|
||||||
//!
|
//!
|
||||||
//! @brief Prepeare HCI header and initiate an HCI data write operation
|
//! @brief Prepeare HCI header and initiate an HCI data write operation
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
void hci_data_command_send(unsigned short usOpcode, unsigned char *pucBuff,
|
void hci_data_command_send(uint16_t usOpcode, uint8_t *pucBuff,
|
||||||
unsigned char ucArgsLength,unsigned short ucDataLength)
|
uint8_t ucArgsLength,uint16_t ucDataLength)
|
||||||
{
|
{
|
||||||
unsigned char *stream = (pucBuff + SPI_HEADER_SIZE);
|
uint8_t *stream = (pucBuff + SPI_HEADER_SIZE);
|
||||||
|
|
||||||
UINT8_TO_STREAM(stream, HCI_TYPE_DATA);
|
UINT8_TO_STREAM(stream, HCI_TYPE_DATA);
|
||||||
UINT8_TO_STREAM(stream, usOpcode);
|
UINT8_TO_STREAM(stream, usOpcode);
|
||||||
UINT8_TO_STREAM(stream, ucArgsLength);
|
UINT8_TO_STREAM(stream, ucArgsLength);
|
||||||
stream = UINT16_TO_STREAM(stream, ucArgsLength + ucDataLength);
|
stream = UINT16_TO_STREAM(stream, ucArgsLength + ucDataLength);
|
||||||
|
|
||||||
// Send the command over SPI on data channel
|
// Send the command over SPI on data channel
|
||||||
SpiWrite(pucBuff, ucArgsLength + ucDataLength + SIMPLE_LINK_HCI_DATA_CMND_HEADER_SIZE);
|
SpiWrite(pucBuff, ucArgsLength + ucDataLength + SIMPLE_LINK_HCI_DATA_CMND_HEADER_SIZE);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! hci_patch_send
|
//! hci_patch_send
|
||||||
//!
|
//!
|
||||||
//! @param usOpcode command operation code
|
//! @param usOpcode command operation code
|
||||||
//! @param pucBuff pointer to the command's arguments buffer
|
//! @param pucBuff pointer to the command's arguments buffer
|
||||||
//! @param patch pointer to patch content buffer
|
//! @param patch pointer to patch content buffer
|
||||||
//! @param usDataLength data length
|
//! @param usDataLength data length
|
||||||
//!
|
//!
|
||||||
//! @return none
|
//! @return none
|
||||||
//!
|
//!
|
||||||
//! @brief Prepeare HCI header and initiate an HCI patch write operation
|
//! @brief Prepeare HCI header and initiate an HCI patch write operation
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
void
|
void
|
||||||
hci_patch_send(unsigned char ucOpcode, unsigned char *pucBuff, char *patch, unsigned short usDataLength)
|
hci_patch_send(uint8_t ucOpcode, uint8_t *pucBuff, char *patch, uint16_t usDataLength)
|
||||||
{
|
{
|
||||||
unsigned char *data_ptr = (pucBuff + SPI_HEADER_SIZE);
|
uint8_t *data_ptr = (pucBuff + SPI_HEADER_SIZE);
|
||||||
unsigned short usTransLength;
|
uint16_t usTransLength;
|
||||||
unsigned char *stream = (pucBuff + SPI_HEADER_SIZE);
|
uint8_t *stream = (pucBuff + SPI_HEADER_SIZE);
|
||||||
|
|
||||||
UINT8_TO_STREAM(stream, HCI_TYPE_PATCH);
|
UINT8_TO_STREAM(stream, HCI_TYPE_PATCH);
|
||||||
UINT8_TO_STREAM(stream, ucOpcode);
|
UINT8_TO_STREAM(stream, ucOpcode);
|
||||||
stream = UINT16_TO_STREAM(stream, usDataLength + SIMPLE_LINK_HCI_PATCH_HEADER_SIZE);
|
stream = UINT16_TO_STREAM(stream, usDataLength + SIMPLE_LINK_HCI_PATCH_HEADER_SIZE);
|
||||||
|
|
||||||
if (usDataLength <= SL_PATCH_PORTION_SIZE)
|
if (usDataLength <= SL_PATCH_PORTION_SIZE)
|
||||||
{
|
{
|
||||||
UINT16_TO_STREAM(stream, usDataLength);
|
UINT16_TO_STREAM(stream, usDataLength);
|
||||||
stream = UINT16_TO_STREAM(stream, usDataLength);
|
stream = UINT16_TO_STREAM(stream, usDataLength);
|
||||||
memcpy((pucBuff + SPI_HEADER_SIZE) + HCI_PATCH_HEADER_SIZE, patch, usDataLength);
|
memcpy((pucBuff + SPI_HEADER_SIZE) + HCI_PATCH_HEADER_SIZE, patch, usDataLength);
|
||||||
|
|
||||||
// Update the opcode of the event we will be waiting for
|
// Update the opcode of the event we will be waiting for
|
||||||
SpiWrite(pucBuff, usDataLength + HCI_PATCH_HEADER_SIZE);
|
SpiWrite(pucBuff, usDataLength + HCI_PATCH_HEADER_SIZE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
usTransLength = (usDataLength/SL_PATCH_PORTION_SIZE);
|
usTransLength = (usDataLength/SL_PATCH_PORTION_SIZE);
|
||||||
UINT16_TO_STREAM(stream, usDataLength + SIMPLE_LINK_HCI_PATCH_HEADER_SIZE + usTransLength*SIMPLE_LINK_HCI_PATCH_HEADER_SIZE);
|
UINT16_TO_STREAM(stream, usDataLength + SIMPLE_LINK_HCI_PATCH_HEADER_SIZE + usTransLength*SIMPLE_LINK_HCI_PATCH_HEADER_SIZE);
|
||||||
stream = UINT16_TO_STREAM(stream, SL_PATCH_PORTION_SIZE);
|
stream = UINT16_TO_STREAM(stream, SL_PATCH_PORTION_SIZE);
|
||||||
memcpy(pucBuff + SPI_HEADER_SIZE + HCI_PATCH_HEADER_SIZE, patch, SL_PATCH_PORTION_SIZE);
|
memcpy(pucBuff + SPI_HEADER_SIZE + HCI_PATCH_HEADER_SIZE, patch, SL_PATCH_PORTION_SIZE);
|
||||||
usDataLength -= SL_PATCH_PORTION_SIZE;
|
usDataLength -= SL_PATCH_PORTION_SIZE;
|
||||||
patch += SL_PATCH_PORTION_SIZE;
|
patch += SL_PATCH_PORTION_SIZE;
|
||||||
|
|
||||||
// Update the opcode of the event we will be waiting for
|
// Update the opcode of the event we will be waiting for
|
||||||
SpiWrite(pucBuff, SL_PATCH_PORTION_SIZE + HCI_PATCH_HEADER_SIZE);
|
SpiWrite(pucBuff, SL_PATCH_PORTION_SIZE + HCI_PATCH_HEADER_SIZE);
|
||||||
|
|
||||||
while (usDataLength)
|
while (usDataLength)
|
||||||
{
|
{
|
||||||
if (usDataLength <= SL_PATCH_PORTION_SIZE)
|
if (usDataLength <= SL_PATCH_PORTION_SIZE)
|
||||||
{
|
{
|
||||||
usTransLength = usDataLength;
|
usTransLength = usDataLength;
|
||||||
usDataLength = 0;
|
usDataLength = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
usTransLength = SL_PATCH_PORTION_SIZE;
|
usTransLength = SL_PATCH_PORTION_SIZE;
|
||||||
usDataLength -= usTransLength;
|
usDataLength -= usTransLength;
|
||||||
}
|
}
|
||||||
|
|
||||||
*(unsigned short *)data_ptr = usTransLength;
|
*(uint16_t *)data_ptr = usTransLength;
|
||||||
memcpy(data_ptr + SIMPLE_LINK_HCI_PATCH_HEADER_SIZE, patch, usTransLength);
|
memcpy(data_ptr + SIMPLE_LINK_HCI_PATCH_HEADER_SIZE, patch, usTransLength);
|
||||||
patch += usTransLength;
|
patch += usTransLength;
|
||||||
|
|
||||||
// Update the opcode of the event we will be waiting for
|
// Update the opcode of the event we will be waiting for
|
||||||
SpiWrite((unsigned char *)data_ptr, usTransLength + sizeof(usTransLength));
|
SpiWrite((uint8_t *)data_ptr, usTransLength + sizeof(usTransLength));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
// Close the Doxygen group.
|
// Close the Doxygen group.
|
||||||
//! @}
|
//! @}
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|||||||
+459
-459
File diff suppressed because it is too large
Load Diff
+340
-340
File diff suppressed because it is too large
Load Diff
+533
-533
File diff suppressed because it is too large
Load Diff
+1169
-1169
File diff suppressed because it is too large
Load Diff
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
// This flag lets the interrupt handler know if it should respond to
|
// This flag lets the interrupt handler know if it should respond to
|
||||||
// the WL_SPI_IRQ pin going low or not
|
// the WL_SPI_IRQ pin going low or not
|
||||||
short SPIInterruptsEnabled=0;
|
int16_t SPIInterruptsEnabled=0;
|
||||||
|
|
||||||
|
|
||||||
#define READ 3
|
#define READ 3
|
||||||
@@ -117,11 +117,11 @@ typedef struct
|
|||||||
{
|
{
|
||||||
gcSpiHandleRx SPIRxHandler;
|
gcSpiHandleRx SPIRxHandler;
|
||||||
|
|
||||||
unsigned short usTxPacketLength;
|
uint16_t usTxPacketLength;
|
||||||
unsigned short usRxPacketLength;
|
uint16_t usRxPacketLength;
|
||||||
unsigned long ulSpiState;
|
unsigned long ulSpiState;
|
||||||
unsigned char *pTxPacket;
|
uint8_t *pTxPacket;
|
||||||
unsigned char *pRxPacket;
|
uint8_t *pRxPacket;
|
||||||
|
|
||||||
}tSpiInformation;
|
}tSpiInformation;
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ tSpiInformation sSpiInformation;
|
|||||||
//
|
//
|
||||||
// Static buffer for 5 bytes of SPI HEADER
|
// Static buffer for 5 bytes of SPI HEADER
|
||||||
//
|
//
|
||||||
unsigned char tSpiReadHeader[] = {READ, 0, 0, 0, 0};
|
uint8_t tSpiReadHeader[] = {READ, 0, 0, 0, 0};
|
||||||
|
|
||||||
|
|
||||||
// The magic number that resides at the end of the TX/RX buffer (1 byte after the allocated size)
|
// The magic number that resides at the end of the TX/RX buffer (1 byte after the allocated size)
|
||||||
@@ -141,11 +141,11 @@ unsigned char tSpiReadHeader[] = {READ, 0, 0, 0, 0};
|
|||||||
#define CC3000_BUFFER_MAGIC_NUMBER (0xDE)
|
#define CC3000_BUFFER_MAGIC_NUMBER (0xDE)
|
||||||
|
|
||||||
char spi_buffer[CC3000_RX_BUFFER_SIZE];
|
char spi_buffer[CC3000_RX_BUFFER_SIZE];
|
||||||
unsigned char wlan_tx_buffer[CC3000_TX_BUFFER_SIZE];
|
uint8_t wlan_tx_buffer[CC3000_TX_BUFFER_SIZE];
|
||||||
|
|
||||||
struct spi_dev_s *spi = NULL;
|
struct spi_dev_s *spi = NULL;
|
||||||
|
|
||||||
unsigned int SPIPump(unsigned char data)
|
unsigned int SPIPump(uint8_t data)
|
||||||
{
|
{
|
||||||
uint8_t rx;
|
uint8_t rx;
|
||||||
|
|
||||||
@@ -245,10 +245,10 @@ void SpiTriggerRxProcessing(void)
|
|||||||
//! \brief ...
|
//! \brief ...
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
void SpiReadDataSynchronous(unsigned char *data, unsigned short size)
|
void SpiReadDataSynchronous(uint8_t *data, uint16_t size)
|
||||||
{
|
{
|
||||||
long i = 0;
|
long i = 0;
|
||||||
unsigned char *data_to_send = tSpiReadHeader;
|
uint8_t *data_to_send = tSpiReadHeader;
|
||||||
|
|
||||||
for (i = 0; i < size; i ++) {
|
for (i = 0; i < size; i ++) {
|
||||||
data[i] = SPIPump(data_to_send[0]);
|
data[i] = SPIPump(data_to_send[0]);
|
||||||
@@ -267,7 +267,7 @@ void SpiReadDataSynchronous(unsigned char *data, unsigned short size)
|
|||||||
//! \brief ...
|
//! \brief ...
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
void SpiWriteDataSynchronous(unsigned char *data, unsigned short size)
|
void SpiWriteDataSynchronous(uint8_t *data, uint16_t size)
|
||||||
{
|
{
|
||||||
|
|
||||||
while (size)
|
while (size)
|
||||||
@@ -290,7 +290,7 @@ void SpiWriteDataSynchronous(unsigned char *data, unsigned short size)
|
|||||||
//! \brief ...
|
//! \brief ...
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
long SpiFirstWrite(unsigned char *ucBuf, unsigned short usLength)
|
long SpiFirstWrite(uint8_t *ucBuf, uint16_t usLength)
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// workaround for first transaction
|
// workaround for first transaction
|
||||||
@@ -328,9 +328,9 @@ long SpiFirstWrite(unsigned char *ucBuf, unsigned short usLength)
|
|||||||
//! \brief ...
|
//! \brief ...
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
long SpiWrite(unsigned char *pUserBuffer, unsigned short usLength)
|
long SpiWrite(uint8_t *pUserBuffer, uint16_t usLength)
|
||||||
{
|
{
|
||||||
unsigned char ucPad = 0;
|
uint8_t ucPad = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Figure out the total length of the packet in order to figure out if there is padding or not
|
// Figure out the total length of the packet in order to figure out if there is padding or not
|
||||||
@@ -442,7 +442,7 @@ long SpiWrite(unsigned char *pUserBuffer, unsigned short usLength)
|
|||||||
long SpiReadDataCont(void)
|
long SpiReadDataCont(void)
|
||||||
{
|
{
|
||||||
long data_to_recv;
|
long data_to_recv;
|
||||||
unsigned char *evnt_buff, type;
|
uint8_t *evnt_buff, type;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -644,7 +644,7 @@ void SpiOpen(gcSpiHandleRx pfRxHandler)
|
|||||||
sSpiInformation.SPIRxHandler = pfRxHandler;
|
sSpiInformation.SPIRxHandler = pfRxHandler;
|
||||||
sSpiInformation.usTxPacketLength = 0;
|
sSpiInformation.usTxPacketLength = 0;
|
||||||
sSpiInformation.pTxPacket = NULL;
|
sSpiInformation.pTxPacket = NULL;
|
||||||
sSpiInformation.pRxPacket = (unsigned char *)spi_buffer;
|
sSpiInformation.pRxPacket = (uint8_t *)spi_buffer;
|
||||||
sSpiInformation.usRxPacketLength = 0;
|
sSpiInformation.usRxPacketLength = 0;
|
||||||
spi_buffer[CC3000_RX_BUFFER_SIZE - 1] = CC3000_BUFFER_MAGIC_NUMBER;
|
spi_buffer[CC3000_RX_BUFFER_SIZE - 1] = CC3000_BUFFER_MAGIC_NUMBER;
|
||||||
wlan_tx_buffer[CC3000_TX_BUFFER_SIZE - 1] = CC3000_BUFFER_MAGIC_NUMBER;
|
wlan_tx_buffer[CC3000_TX_BUFFER_SIZE - 1] = CC3000_BUFFER_MAGIC_NUMBER;
|
||||||
|
|||||||
+1251
-1254
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+166
-166
@@ -1,166 +1,166 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* evnt_handler.h - CC3000 Host Driver Implementation.
|
* evnt_handler.h - CC3000 Host Driver Implementation.
|
||||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright
|
* Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the
|
* documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||||
* its contributors may be used to endorse or promote products derived
|
* its contributors may be used to endorse or promote products derived
|
||||||
* from this software without specific prior written permission.
|
* from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifndef __EVENT_HANDLER_H__
|
#ifndef __EVENT_HANDLER_H__
|
||||||
#define __EVENT_HANDLER_H__
|
#define __EVENT_HANDLER_H__
|
||||||
#include "hci.h"
|
#include "hci.h"
|
||||||
#include "socket.h"
|
#include "socket.h"
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
// If building with a C++ compiler, make all of the definitions in this header
|
// If building with a C++ compiler, make all of the definitions in this header
|
||||||
// have a C binding.
|
// have a C binding.
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
// Prototypes for the APIs.
|
// Prototypes for the APIs.
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! hci_event_handler
|
//! hci_event_handler
|
||||||
//!
|
//!
|
||||||
//! @param pRetParams incoming data buffer
|
//! @param pRetParams incoming data buffer
|
||||||
//! @param from from information (in case of data received)
|
//! @param from from information (in case of data received)
|
||||||
//! @param fromlen from information length (in case of data received)
|
//! @param fromlen from information length (in case of data received)
|
||||||
//!
|
//!
|
||||||
//! @return none
|
//! @return none
|
||||||
//!
|
//!
|
||||||
//! @brief Parse the incoming events packets and issues corresponding
|
//! @brief Parse the incoming events packets and issues corresponding
|
||||||
//! event handler from global array of handlers pointers
|
//! event handler from global array of handlers pointers
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
extern unsigned char *hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen);
|
extern uint8_t *hci_event_handler(void *pRetParams, uint8_t *from, uint8_t *fromlen);
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! hci_unsol_event_handler
|
//! hci_unsol_event_handler
|
||||||
//!
|
//!
|
||||||
//! @param event_hdr event header
|
//! @param event_hdr event header
|
||||||
//!
|
//!
|
||||||
//! @return 1 if event supported and handled
|
//! @return 1 if event supported and handled
|
||||||
//! 0 if event is not supported
|
//! 0 if event is not supported
|
||||||
//!
|
//!
|
||||||
//! @brief Handle unsolicited events
|
//! @brief Handle unsolicited events
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
extern long hci_unsol_event_handler(char *event_hdr);
|
extern long hci_unsol_event_handler(char *event_hdr);
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! hci_unsolicited_event_handler
|
//! hci_unsolicited_event_handler
|
||||||
//!
|
//!
|
||||||
//! @param None
|
//! @param None
|
||||||
//!
|
//!
|
||||||
//! @return ESUCCESS if successful, EFAIL if an error occurred
|
//! @return ESUCCESS if successful, EFAIL if an error occurred
|
||||||
//!
|
//!
|
||||||
//! @brief Parse the incoming unsolicited event packets and issues
|
//! @brief Parse the incoming unsolicited event packets and issues
|
||||||
//! corresponding event handler.
|
//! corresponding event handler.
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
extern long hci_unsolicited_event_handler(void);
|
extern long hci_unsolicited_event_handler(void);
|
||||||
|
|
||||||
#define M_BSD_RESP_PARAMS_OFFSET(hci_event_hdr)((char *)(hci_event_hdr) + HCI_EVENT_HEADER_SIZE)
|
#define M_BSD_RESP_PARAMS_OFFSET(hci_event_hdr)((char *)(hci_event_hdr) + HCI_EVENT_HEADER_SIZE)
|
||||||
|
|
||||||
#define SOCKET_STATUS_ACTIVE 0
|
#define SOCKET_STATUS_ACTIVE 0
|
||||||
#define SOCKET_STATUS_INACTIVE 1
|
#define SOCKET_STATUS_INACTIVE 1
|
||||||
/* Init socket_active_status = 'all ones': init all sockets with SOCKET_STATUS_INACTIVE.
|
/* Init socket_active_status = 'all ones': init all sockets with SOCKET_STATUS_INACTIVE.
|
||||||
Will be changed by 'set_socket_active_status' upon 'connect' and 'accept' calls */
|
Will be changed by 'set_socket_active_status' upon 'connect' and 'accept' calls */
|
||||||
#define SOCKET_STATUS_INIT_VAL 0xFFFF
|
#define SOCKET_STATUS_INIT_VAL 0xFFFF
|
||||||
#define M_IS_VALID_SD(sd) ((0 <= (sd)) && ((sd) <= 7))
|
#define M_IS_VALID_SD(sd) ((0 <= (sd)) && ((sd) <= 7))
|
||||||
#define M_IS_VALID_STATUS(status) (((status) == SOCKET_STATUS_ACTIVE)||((status) == SOCKET_STATUS_INACTIVE))
|
#define M_IS_VALID_STATUS(status) (((status) == SOCKET_STATUS_ACTIVE)||((status) == SOCKET_STATUS_INACTIVE))
|
||||||
|
|
||||||
extern unsigned long socket_active_status;
|
extern unsigned long socket_active_status;
|
||||||
|
|
||||||
extern void set_socket_active_status(long Sd, long Status);
|
extern void set_socket_active_status(long Sd, long Status);
|
||||||
extern long get_socket_active_status(long Sd);
|
extern long get_socket_active_status(long Sd);
|
||||||
|
|
||||||
typedef struct _bsd_accept_return_t
|
typedef struct _bsd_accept_return_t
|
||||||
{
|
{
|
||||||
long iSocketDescriptor;
|
long iSocketDescriptor;
|
||||||
long iStatus;
|
long iStatus;
|
||||||
sockaddr tSocketAddress;
|
sockaddr tSocketAddress;
|
||||||
|
|
||||||
} tBsdReturnParams;
|
} tBsdReturnParams;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _bsd_read_return_t
|
typedef struct _bsd_read_return_t
|
||||||
{
|
{
|
||||||
long iSocketDescriptor;
|
long iSocketDescriptor;
|
||||||
long iNumberOfBytes;
|
long iNumberOfBytes;
|
||||||
unsigned long uiFlags;
|
unsigned long uiFlags;
|
||||||
} tBsdReadReturnParams;
|
} tBsdReadReturnParams;
|
||||||
|
|
||||||
#define BSD_RECV_FROM_FROMLEN_OFFSET (4)
|
#define BSD_RECV_FROM_FROMLEN_OFFSET (4)
|
||||||
#define BSD_RECV_FROM_FROM_OFFSET (16)
|
#define BSD_RECV_FROM_FROM_OFFSET (16)
|
||||||
|
|
||||||
|
|
||||||
typedef struct _bsd_select_return_t
|
typedef struct _bsd_select_return_t
|
||||||
{
|
{
|
||||||
long iStatus;
|
long iStatus;
|
||||||
unsigned long uiRdfd;
|
unsigned long uiRdfd;
|
||||||
unsigned long uiWrfd;
|
unsigned long uiWrfd;
|
||||||
unsigned long uiExfd;
|
unsigned long uiExfd;
|
||||||
} tBsdSelectRecvParams;
|
} tBsdSelectRecvParams;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _bsd_getsockopt_return_t
|
typedef struct _bsd_getsockopt_return_t
|
||||||
{
|
{
|
||||||
unsigned char ucOptValue[4];
|
uint8_t ucOptValue[4];
|
||||||
char iStatus;
|
char iStatus;
|
||||||
} tBsdGetSockOptReturnParams;
|
} tBsdGetSockOptReturnParams;
|
||||||
|
|
||||||
typedef struct _bsd_gethostbyname_return_t
|
typedef struct _bsd_gethostbyname_return_t
|
||||||
{
|
{
|
||||||
long retVal;
|
long retVal;
|
||||||
long outputAddress;
|
long outputAddress;
|
||||||
} tBsdGethostbynameParams;
|
} tBsdGethostbynameParams;
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
// Mark the end of the C bindings section for C++ compilers.
|
// Mark the end of the C bindings section for C++ compilers.
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif // __EVENT_HANDLER_H__
|
#endif // __EVENT_HANDLER_H__
|
||||||
|
|
||||||
|
|||||||
+328
-328
File diff suppressed because it is too large
Load Diff
+342
-342
File diff suppressed because it is too large
Load Diff
+248
-248
@@ -1,248 +1,248 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* nvmem.h - CC3000 Host Driver Implementation.
|
* nvmem.h - CC3000 Host Driver Implementation.
|
||||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright
|
* Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the
|
* documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||||
* its contributors may be used to endorse or promote products derived
|
* its contributors may be used to endorse or promote products derived
|
||||||
* from this software without specific prior written permission.
|
* from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifndef __NVRAM_H__
|
#ifndef __NVRAM_H__
|
||||||
#define __NVRAM_H__
|
#define __NVRAM_H__
|
||||||
|
|
||||||
#include "cc3000_common.h"
|
#include "cc3000_common.h"
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
// If building with a C++ compiler, make all of the definitions in this header
|
// If building with a C++ compiler, make all of the definitions in this header
|
||||||
// have a C binding.
|
// have a C binding.
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! \addtogroup nvmem_api
|
//! \addtogroup nvmem_api
|
||||||
//! @{
|
//! @{
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
**
|
**
|
||||||
** Definitions for File IDs
|
** Definitions for File IDs
|
||||||
**
|
**
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
/* NVMEM file ID - system files*/
|
/* NVMEM file ID - system files*/
|
||||||
#define NVMEM_NVS_FILEID (0)
|
#define NVMEM_NVS_FILEID (0)
|
||||||
#define NVMEM_NVS_SHADOW_FILEID (1)
|
#define NVMEM_NVS_SHADOW_FILEID (1)
|
||||||
#define NVMEM_WLAN_CONFIG_FILEID (2)
|
#define NVMEM_WLAN_CONFIG_FILEID (2)
|
||||||
#define NVMEM_WLAN_CONFIG_SHADOW_FILEID (3)
|
#define NVMEM_WLAN_CONFIG_SHADOW_FILEID (3)
|
||||||
#define NVMEM_WLAN_DRIVER_SP_FILEID (4)
|
#define NVMEM_WLAN_DRIVER_SP_FILEID (4)
|
||||||
#define NVMEM_WLAN_FW_SP_FILEID (5)
|
#define NVMEM_WLAN_FW_SP_FILEID (5)
|
||||||
#define NVMEM_MAC_FILEID (6)
|
#define NVMEM_MAC_FILEID (6)
|
||||||
#define NVMEM_FRONTEND_VARS_FILEID (7)
|
#define NVMEM_FRONTEND_VARS_FILEID (7)
|
||||||
#define NVMEM_IP_CONFIG_FILEID (8)
|
#define NVMEM_IP_CONFIG_FILEID (8)
|
||||||
#define NVMEM_IP_CONFIG_SHADOW_FILEID (9)
|
#define NVMEM_IP_CONFIG_SHADOW_FILEID (9)
|
||||||
#define NVMEM_BOOTLOADER_SP_FILEID (10)
|
#define NVMEM_BOOTLOADER_SP_FILEID (10)
|
||||||
#define NVMEM_RM_FILEID (11)
|
#define NVMEM_RM_FILEID (11)
|
||||||
|
|
||||||
/* NVMEM file ID - user files*/
|
/* NVMEM file ID - user files*/
|
||||||
#define NVMEM_AES128_KEY_FILEID (12)
|
#define NVMEM_AES128_KEY_FILEID (12)
|
||||||
#define NVMEM_SHARED_MEM_FILEID (13)
|
#define NVMEM_SHARED_MEM_FILEID (13)
|
||||||
|
|
||||||
/* max entry in order to invalid nvmem */
|
/* max entry in order to invalid nvmem */
|
||||||
#define NVMEM_MAX_ENTRY (16)
|
#define NVMEM_MAX_ENTRY (16)
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! nvmem_read
|
//! nvmem_read
|
||||||
//!
|
//!
|
||||||
//! @param ulFileId nvmem file id:\n
|
//! @param ulFileId nvmem file id:\n
|
||||||
//! NVMEM_NVS_FILEID, NVMEM_NVS_SHADOW_FILEID,
|
//! NVMEM_NVS_FILEID, NVMEM_NVS_SHADOW_FILEID,
|
||||||
//! NVMEM_WLAN_CONFIG_FILEID, NVMEM_WLAN_CONFIG_SHADOW_FILEID,
|
//! NVMEM_WLAN_CONFIG_FILEID, NVMEM_WLAN_CONFIG_SHADOW_FILEID,
|
||||||
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
|
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
|
||||||
//! NVMEM_MAC_FILEID, NVMEM_FRONTEND_VARS_FILEID,
|
//! NVMEM_MAC_FILEID, NVMEM_FRONTEND_VARS_FILEID,
|
||||||
//! NVMEM_IP_CONFIG_FILEID, NVMEM_IP_CONFIG_SHADOW_FILEID,
|
//! NVMEM_IP_CONFIG_FILEID, NVMEM_IP_CONFIG_SHADOW_FILEID,
|
||||||
//! NVMEM_BOOTLOADER_SP_FILEID, NVMEM_RM_FILEID,
|
//! NVMEM_BOOTLOADER_SP_FILEID, NVMEM_RM_FILEID,
|
||||||
//! and user files 12-15.
|
//! and user files 12-15.
|
||||||
//! @param ulLength number of bytes to read
|
//! @param ulLength number of bytes to read
|
||||||
//! @param ulOffset ulOffset in file from where to read
|
//! @param ulOffset ulOffset in file from where to read
|
||||||
//! @param buff output buffer pointer
|
//! @param buff output buffer pointer
|
||||||
//!
|
//!
|
||||||
//! @return number of bytes read, otherwise error.
|
//! @return number of bytes read, otherwise error.
|
||||||
//!
|
//!
|
||||||
//! @brief Reads data from the file referred by the ulFileId parameter.
|
//! @brief Reads data from the file referred by the ulFileId parameter.
|
||||||
//! Reads data from file ulOffset till length. Err if the file can't
|
//! 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.
|
//! be used, is invalid, or if the read is out of bounds.
|
||||||
//!
|
//!
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
extern signed long nvmem_read(unsigned long file_id, unsigned long length, unsigned long offset, unsigned char *buff);
|
extern signed long nvmem_read(unsigned long file_id, unsigned long length, unsigned long offset, uint8_t *buff);
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! nvmem_write
|
//! nvmem_write
|
||||||
//!
|
//!
|
||||||
//! @param ulFileId nvmem file id:\n
|
//! @param ulFileId nvmem file id:\n
|
||||||
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
|
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
|
||||||
//! NVMEM_MAC_FILEID, NVMEM_BOOTLOADER_SP_FILEID,
|
//! NVMEM_MAC_FILEID, NVMEM_BOOTLOADER_SP_FILEID,
|
||||||
//! and user files 12-15.
|
//! and user files 12-15.
|
||||||
//! @param ulLength number of bytes to write
|
//! @param ulLength number of bytes to write
|
||||||
//! @param ulEntryOffset offset in file to start write operation from
|
//! @param ulEntryOffset offset in file to start write operation from
|
||||||
//! @param buff data to write
|
//! @param buff data to write
|
||||||
//!
|
//!
|
||||||
//! @return on success 0, error otherwise.
|
//! @return on success 0, error otherwise.
|
||||||
//!
|
//!
|
||||||
//! @brief Write data to nvmem.
|
//! @brief Write data to nvmem.
|
||||||
//! writes data to file referred by the ulFileId parameter.
|
//! writes data to file referred by the ulFileId parameter.
|
||||||
//! Writes data to file ulOffset till ulLength.The file id will be
|
//! Writes data to file ulOffset till ulLength.The file id will be
|
||||||
//! marked invalid till the write is done. The file entry doesn't
|
//! marked invalid till the write is done. The file entry doesn't
|
||||||
//! need to be valid - only allocated.
|
//! need to be valid - only allocated.
|
||||||
//!
|
//!
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
extern signed long nvmem_write(unsigned long ulFileId, unsigned long ulLength, unsigned long ulEntryOffset, unsigned char *buff);
|
extern signed long nvmem_write(unsigned long ulFileId, unsigned long ulLength, unsigned long ulEntryOffset, uint8_t *buff);
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! nvmem_set_mac_address
|
//! nvmem_set_mac_address
|
||||||
//!
|
//!
|
||||||
//! @param mac mac address to be set
|
//! @param mac mac address to be set
|
||||||
//!
|
//!
|
||||||
//! @return on success 0, error otherwise.
|
//! @return on success 0, error otherwise.
|
||||||
//!
|
//!
|
||||||
//! @brief Write MAC address to EEPROM.
|
//! @brief Write MAC address to EEPROM.
|
||||||
//! mac address as appears over the air (OUI first)
|
//! mac address as appears over the air (OUI first)
|
||||||
//!
|
//!
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
extern unsigned char nvmem_set_mac_address(unsigned char *mac);
|
extern uint8_t nvmem_set_mac_address(uint8_t *mac);
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! nvmem_get_mac_address
|
//! nvmem_get_mac_address
|
||||||
//!
|
//!
|
||||||
//! @param[out] mac mac address
|
//! @param[out] mac mac address
|
||||||
//!
|
//!
|
||||||
//! @return on success 0, error otherwise.
|
//! @return on success 0, error otherwise.
|
||||||
//!
|
//!
|
||||||
//! @brief Read MAC address from EEPROM.
|
//! @brief Read MAC address from EEPROM.
|
||||||
//! mac address as appears over the air (OUI first)
|
//! mac address as appears over the air (OUI first)
|
||||||
//!
|
//!
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
extern unsigned char nvmem_get_mac_address(unsigned char *mac);
|
extern uint8_t nvmem_get_mac_address(uint8_t *mac);
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! nvmem_write_patch
|
//! nvmem_write_patch
|
||||||
//!
|
//!
|
||||||
//! @param ulFileId nvmem file id:\n
|
//! @param ulFileId nvmem file id:\n
|
||||||
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
|
//! NVMEM_WLAN_DRIVER_SP_FILEID, NVMEM_WLAN_FW_SP_FILEID,
|
||||||
//! @param spLength number of bytes to write
|
//! @param spLength number of bytes to write
|
||||||
//! @param spData SP data to write
|
//! @param spData SP data to write
|
||||||
//!
|
//!
|
||||||
//! @return on success 0, error otherwise.
|
//! @return on success 0, error otherwise.
|
||||||
//!
|
//!
|
||||||
//! @brief program a patch to a specific file ID.
|
//! @brief program a patch to a specific file ID.
|
||||||
//! The SP data is assumed to be organized in 2-dimensional.
|
//! The SP data is assumed to be organized in 2-dimensional.
|
||||||
//! Each line is SP_PORTION_SIZE bytes long. Actual programming is
|
//! Each line is SP_PORTION_SIZE bytes long. Actual programming is
|
||||||
//! applied in SP_PORTION_SIZE bytes portions.
|
//! applied in SP_PORTION_SIZE bytes portions.
|
||||||
//!
|
//!
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
extern unsigned char nvmem_write_patch(unsigned long ulFileId, unsigned long spLength, const unsigned char *spData);
|
extern uint8_t nvmem_write_patch(unsigned long ulFileId, unsigned long spLength, const uint8_t *spData);
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! nvmem_read_sp_version
|
//! nvmem_read_sp_version
|
||||||
//!
|
//!
|
||||||
//! @param[out] patchVer first number indicates package ID and the second
|
//! @param[out] patchVer first number indicates package ID and the second
|
||||||
//! number indicates package build number
|
//! number indicates package build number
|
||||||
//!
|
//!
|
||||||
//! @return on success 0, error otherwise.
|
//! @return on success 0, error otherwise.
|
||||||
//!
|
//!
|
||||||
//! @brief Read patch version. read package version (WiFi FW patch,
|
//! @brief Read patch version. read package version (WiFi FW patch,
|
||||||
//! driver-supplicant-NS patch, bootloader patch)
|
//! driver-supplicant-NS patch, bootloader patch)
|
||||||
//!
|
//!
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
#ifndef CC3000_TINY_DRIVER
|
#ifndef CC3000_TINY_DRIVER
|
||||||
extern unsigned char nvmem_read_sp_version(unsigned char* patchVer);
|
extern uint8_t nvmem_read_sp_version(uint8_t* patchVer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! nvmem_create_entry
|
//! nvmem_create_entry
|
||||||
//!
|
//!
|
||||||
//! @param ulFileId nvmem file Id:\n
|
//! @param ulFileId nvmem file Id:\n
|
||||||
//! * NVMEM_AES128_KEY_FILEID: 12
|
//! * NVMEM_AES128_KEY_FILEID: 12
|
||||||
//! * NVMEM_SHARED_MEM_FILEID: 13
|
//! * NVMEM_SHARED_MEM_FILEID: 13
|
||||||
//! * and fileIDs 14 and 15
|
//! * and fileIDs 14 and 15
|
||||||
//! @param ulNewLen entry ulLength
|
//! @param ulNewLen entry ulLength
|
||||||
//!
|
//!
|
||||||
//! @return on success 0, error otherwise.
|
//! @return on success 0, error otherwise.
|
||||||
//!
|
//!
|
||||||
//! @brief Create new file entry and allocate space on the NVMEM.
|
//! @brief Create new file entry and allocate space on the NVMEM.
|
||||||
//! Applies only to user files.
|
//! Applies only to user files.
|
||||||
//! Modify the size of file.
|
//! Modify the size of file.
|
||||||
//! If the entry is unallocated - allocate it to size
|
//! If the entry is unallocated - allocate it to size
|
||||||
//! ulNewLen (marked invalid).
|
//! ulNewLen (marked invalid).
|
||||||
//! If it is allocated then deallocate it first.
|
//! If it is allocated then deallocate it first.
|
||||||
//! To just mark the file as invalid without resizing -
|
//! To just mark the file as invalid without resizing -
|
||||||
//! set ulNewLen=0.
|
//! set ulNewLen=0.
|
||||||
//!
|
//!
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
extern signed long nvmem_create_entry(unsigned long file_id, unsigned long newlen);
|
extern signed long nvmem_create_entry(unsigned long file_id, unsigned long newlen);
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
// Mark the end of the C bindings section for C++ compilers.
|
// Mark the end of the C bindings section for C++ compilers.
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
// Close the Doxygen group.
|
// Close the Doxygen group.
|
||||||
//! @}
|
//! @}
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif // __cplusplus
|
#endif // __cplusplus
|
||||||
|
|
||||||
#endif // __NVRAM_H__
|
#endif // __NVRAM_H__
|
||||||
|
|||||||
+126
-126
@@ -1,126 +1,126 @@
|
|||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
*
|
*
|
||||||
* security.h - CC3000 Host Driver Implementation.
|
* security.h - CC3000 Host Driver Implementation.
|
||||||
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* Redistributions of source code must retain the above copyright
|
* Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
*
|
*
|
||||||
* Redistributions in binary form must reproduce the above copyright
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the
|
* documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
*
|
*
|
||||||
* Neither the name of Texas Instruments Incorporated nor the names of
|
* Neither the name of Texas Instruments Incorporated nor the names of
|
||||||
* its contributors may be used to endorse or promote products derived
|
* its contributors may be used to endorse or promote products derived
|
||||||
* from this software without specific prior written permission.
|
* from this software without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
#ifndef __SECURITY__
|
#ifndef __SECURITY__
|
||||||
#define __SECURITY__
|
#define __SECURITY__
|
||||||
|
|
||||||
#include "nvmem.h"
|
#include "nvmem.h"
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
// If building with a C++ compiler, make all of the definitions in this header
|
// If building with a C++ compiler, make all of the definitions in this header
|
||||||
// have a C binding.
|
// have a C binding.
|
||||||
//
|
//
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define AES128_KEY_SIZE 16
|
#define AES128_KEY_SIZE 16
|
||||||
|
|
||||||
#ifndef CC3000_UNENCRYPTED_SMART_CONFIG
|
#ifndef CC3000_UNENCRYPTED_SMART_CONFIG
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! aes_encrypt
|
//! aes_encrypt
|
||||||
//!
|
//!
|
||||||
//! @param[in] key AES128 key of size 16 bytes
|
//! @param[in] key AES128 key of size 16 bytes
|
||||||
//! @param[in\out] state 16 bytes of plain text and cipher text
|
//! @param[in\out] state 16 bytes of plain text and cipher text
|
||||||
//!
|
//!
|
||||||
//! @return none
|
//! @return none
|
||||||
//!
|
//!
|
||||||
//! @brief AES128 encryption:
|
//! @brief AES128 encryption:
|
||||||
//! Given AES128 key and 16 bytes plain text, cipher text of 16 bytes
|
//! Given AES128 key and 16 bytes plain text, cipher text of 16 bytes
|
||||||
//! is computed. The AES implementation is in mode ECB (Electronic
|
//! is computed. The AES implementation is in mode ECB (Electronic
|
||||||
//! Code Book).
|
//! Code Book).
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
extern void aes_encrypt(unsigned char *state, unsigned char *key);
|
extern void aes_encrypt(uint8_t *state, uint8_t *key);
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! aes_decrypt
|
//! aes_decrypt
|
||||||
//!
|
//!
|
||||||
//! @param[in] key AES128 key of size 16 bytes
|
//! @param[in] key AES128 key of size 16 bytes
|
||||||
//! @param[in\out] state 16 bytes of cipher text and plain text
|
//! @param[in\out] state 16 bytes of cipher text and plain text
|
||||||
//!
|
//!
|
||||||
//! @return none
|
//! @return none
|
||||||
//!
|
//!
|
||||||
//! @brief AES128 decryption:
|
//! @brief AES128 decryption:
|
||||||
//! Given AES128 key and 16 bytes cipher text, plain text of 16 bytes
|
//! Given AES128 key and 16 bytes cipher text, plain text of 16 bytes
|
||||||
//! is computed The AES implementation is in mode ECB
|
//! is computed The AES implementation is in mode ECB
|
||||||
//! (Electronic Code Book).
|
//! (Electronic Code Book).
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
extern void aes_decrypt(unsigned char *state, unsigned char *key);
|
extern void aes_decrypt(uint8_t *state, uint8_t *key);
|
||||||
|
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! aes_read_key
|
//! aes_read_key
|
||||||
//!
|
//!
|
||||||
//! @param[out] key AES128 key of size 16 bytes
|
//! @param[out] key AES128 key of size 16 bytes
|
||||||
//!
|
//!
|
||||||
//! @return on success 0, error otherwise.
|
//! @return on success 0, error otherwise.
|
||||||
//!
|
//!
|
||||||
//! @brief Reads AES128 key from EEPROM
|
//! @brief Reads AES128 key from EEPROM
|
||||||
//! Reads the AES128 key from fileID #12 in EEPROM
|
//! Reads the AES128 key from fileID #12 in EEPROM
|
||||||
//! returns an error if the key does not exist.
|
//! returns an error if the key does not exist.
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
extern signed long aes_read_key(unsigned char *key);
|
extern signed long aes_read_key(uint8_t *key);
|
||||||
|
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
//
|
//
|
||||||
//! aes_write_key
|
//! aes_write_key
|
||||||
//!
|
//!
|
||||||
//! @param[out] key AES128 key of size 16 bytes
|
//! @param[out] key AES128 key of size 16 bytes
|
||||||
//!
|
//!
|
||||||
//! @return on success 0, error otherwise.
|
//! @return on success 0, error otherwise.
|
||||||
//!
|
//!
|
||||||
//! @brief writes AES128 key from EEPROM
|
//! @brief writes AES128 key from EEPROM
|
||||||
//! Writes the AES128 key to fileID #12 in EEPROM
|
//! Writes the AES128 key to fileID #12 in EEPROM
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
//*****************************************************************************
|
//*****************************************************************************
|
||||||
extern signed long aes_write_key(unsigned char *key);
|
extern signed long aes_write_key(uint8_t *key);
|
||||||
|
|
||||||
#endif //CC3000_UNENCRYPTED_SMART_CONFIG
|
#endif //CC3000_UNENCRYPTED_SMART_CONFIG
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+664
-664
File diff suppressed because it is too large
Load Diff
@@ -34,12 +34,12 @@ void SpiOpen(gcSpiHandleRx pfRxHandler);
|
|||||||
|
|
||||||
void SpiClose(void);
|
void SpiClose(void);
|
||||||
|
|
||||||
long SpiWrite(unsigned char *pUserBuffer, unsigned short usLength);
|
long SpiWrite(uint8_t *pUserBuffer, uint16_t usLength);
|
||||||
|
|
||||||
void SpiResumeSpi(void);
|
void SpiResumeSpi(void);
|
||||||
|
|
||||||
int CC3000InterruptHandler(int irq, void *context);
|
int CC3000InterruptHandler(int irq, void *context);
|
||||||
|
|
||||||
short SPIInterruptsEnabled;
|
int16_t SPIInterruptsEnabled;
|
||||||
|
|
||||||
unsigned char wlan_tx_buffer[];
|
uint8_t wlan_tx_buffer[];
|
||||||
|
|||||||
+517
-517
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user