Skip to content

Commit

Permalink
#23 Upgraded CC3000 Host Driver to 1.12 (but retained 1.11 changes)
Browse files Browse the repository at this point in the history
  • Loading branch information
satishgn committed Apr 24, 2014
1 parent 2522bb8 commit c27a16d
Show file tree
Hide file tree
Showing 19 changed files with 2,025 additions and 1,904 deletions.
103 changes: 51 additions & 52 deletions CC3000_Host_Driver/cc3000_common.c
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
/*****************************************************************************
*
* cc3000_common.c.c - 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.
*
*****************************************************************************/
*
* cc3000_common.c.c - 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.
*
*****************************************************************************/
//*****************************************************************************
//
//! \addtogroup common_api
Expand Down Expand Up @@ -60,10 +60,9 @@
//! @brief stub function for ASSERT macro
//
//*****************************************************************************
void
__error__(char *pcFilename, unsigned long ulLine)
void __error__(CHAR *pcFilename, UINT32 ulLine)
{
//TODO full up function
//TODO full up function
}


Expand All @@ -82,12 +81,12 @@ __error__(char *pcFilename, unsigned long ulLine)
//
//*****************************************************************************

unsigned char* UINT32_TO_STREAM_f (unsigned char *p, unsigned long u32)
UINT8* UINT32_TO_STREAM_f (UINT8 *p, UINT32 u32)
{
*(p)++ = (unsigned char)(u32);
*(p)++ = (unsigned char)((u32) >> 8);
*(p)++ = (unsigned char)((u32) >> 16);
*(p)++ = (unsigned char)((u32) >> 24);
*(p)++ = (UINT8)(u32);
*(p)++ = (UINT8)((u32) >> 8);
*(p)++ = (UINT8)((u32) >> 16);
*(p)++ = (UINT8)((u32) >> 24);
return p;
}

Expand All @@ -105,10 +104,10 @@ unsigned char* UINT32_TO_STREAM_f (unsigned char *p, unsigned long u32)
//
//*****************************************************************************

unsigned char* UINT16_TO_STREAM_f (unsigned char *p, unsigned short u16)
UINT8* UINT16_TO_STREAM_f (UINT8 *p, UINT16 u16)
{
*(p)++ = (unsigned char)(u16);
*(p)++ = (unsigned char)((u16) >> 8);
*(p)++ = (UINT8)(u16);
*(p)++ = (UINT8)((u16) >> 8);
return p;
}

Expand All @@ -126,10 +125,10 @@ unsigned char* UINT16_TO_STREAM_f (unsigned char *p, unsigned short u16)
//
//*****************************************************************************

unsigned short STREAM_TO_UINT16_f(char* p, unsigned short offset)
UINT16 STREAM_TO_UINT16_f(CHAR* p, UINT16 offset)
{
return (unsigned short)((unsigned short)((unsigned short)
(*(p + offset + 1)) << 8) + (unsigned short)(*(p + offset)));
return (UINT16)((UINT16)((UINT16)
(*(p + offset + 1)) << 8) + (UINT16)(*(p + offset)));
}

//*****************************************************************************
Expand All @@ -146,12 +145,12 @@ unsigned short STREAM_TO_UINT16_f(char* p, unsigned short offset)
//
//*****************************************************************************

unsigned long STREAM_TO_UINT32_f(char* p, unsigned short offset)
UINT32 STREAM_TO_UINT32_f(CHAR* p, UINT16 offset)
{
return (unsigned long)((unsigned long)((unsigned long)
(*(p + offset + 3)) << 24) + (unsigned long)((unsigned long)
(*(p + offset + 2)) << 16) + (unsigned long)((unsigned long)
(*(p + offset + 1)) << 8) + (unsigned long)(*(p + offset)));
return (UINT32)((UINT32)((UINT32)
(*(p + offset + 3)) << 24) + (UINT32)((UINT32)
(*(p + offset + 2)) << 16) + (UINT32)((UINT32)
(*(p + offset + 1)) << 8) + (UINT32)(*(p + offset)));
}


Expand Down
65 changes: 34 additions & 31 deletions CC3000_Host_Driver/cc3000_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#ifndef __COMMON_H__
#define __COMMON_H__

#include "data_types.h"

//******************************************************************************
// Include files
//******************************************************************************
Expand Down Expand Up @@ -157,9 +159,9 @@ extern "C" {
//*****************************************************************************
// Compound Types
//*****************************************************************************
typedef long time_t;
typedef unsigned long clock_t;
typedef long suseconds_t;
typedef INT32 time_t;
typedef UINT32 clock_t;
typedef INT32 suseconds_t;

typedef struct timeval timeval;

Expand All @@ -169,28 +171,28 @@ struct timeval
suseconds_t tv_usec; /* microseconds */
};

typedef char *(*tFWPatches)(unsigned long *usLength);
typedef CHAR *(*tFWPatches)(UINT32 *usLength);

typedef char *(*tDriverPatches)(unsigned long *usLength);
typedef CHAR *(*tDriverPatches)(UINT32 *usLength);

typedef char *(*tBootLoaderPatches)(unsigned long *usLength);
typedef CHAR *(*tBootLoaderPatches)(UINT32 *usLength);

typedef void (*tWlanCB)(long event_type, char * data, unsigned char length );
typedef void (*tWlanCB)(INT32 event_type, CHAR * data, UINT8 length );

typedef long (*tWlanReadInteruptPin)(void);
typedef INT32 (*tWlanReadInteruptPin)(void);

typedef void (*tWlanInterruptEnable)(void);

typedef void (*tWlanInterruptDisable)(void);

typedef void (*tWriteWlanPin)(unsigned char val);
typedef void (*tWriteWlanPin)(UINT8 val);

typedef struct
{
unsigned short usRxEventOpcode;
unsigned short usEventOrDataReceived;
unsigned char *pucReceivedData;
unsigned char *pucTxCommandBuffer;
UINT16 usRxEventOpcode;
UINT16 usEventOrDataReceived;
UINT8 *pucReceivedData;
UINT8 *pucTxCommandBuffer;

tFWPatches sFWPatches;
tDriverPatches sDriverPatches;
Expand All @@ -201,21 +203,22 @@ typedef struct
tWlanInterruptDisable WlanInterruptDisable;
tWriteWlanPin WriteWlanPin;

signed long slTransmitDataError;
unsigned short usNumberOfFreeBuffers;
unsigned short usSlBufferLength;
unsigned short usBufferSize;
unsigned short usRxDataPending;
INT32 slTransmitDataError;
UINT16 usNumberOfFreeBuffers;
UINT16 usSlBufferLength;
UINT16 usBufferSize;
UINT16 usRxDataPending;

unsigned long NumberOfSentPackets;
unsigned long NumberOfReleasedPackets;
UINT32 NumberOfSentPackets;
UINT32 NumberOfReleasedPackets;

unsigned char InformHostOnTxComplete;
unsigned char solicitedResponse;
UINT8 InformHostOnTxComplete;
UINT8 solicitedResponse;
}sSimplLinkInformation;

extern volatile sSimplLinkInformation tSLInformation;


//*****************************************************************************
// Prototypes for the APIs.
//*****************************************************************************
Expand All @@ -236,7 +239,7 @@ extern volatile sSimplLinkInformation tSLInformation;
//
//*****************************************************************************

extern void SimpleLinkWaitEvent(unsigned short usOpcode, void *pRetParams);
extern void SimpleLinkWaitEvent(UINT16 usOpcode, void *pRetParams);

//*****************************************************************************
//
Expand All @@ -254,7 +257,7 @@ extern void SimpleLinkWaitEvent(unsigned short usOpcode, void *pRetParams);
//
//*****************************************************************************

extern void SimpleLinkWaitData(unsigned char *pBuf, unsigned char *from, long *fromlen);
extern void SimpleLinkWaitData(UINT8 *pBuf, UINT8 *from, UINT8 *fromlen);

//*****************************************************************************
//
Expand All @@ -270,7 +273,7 @@ extern void SimpleLinkWaitData(unsigned char *pBuf, unsigned char *from, long *f
//
//*****************************************************************************

extern unsigned char* UINT32_TO_STREAM_f (unsigned char *p, unsigned long u32);
extern UINT8* UINT32_TO_STREAM_f (UINT8 *p, UINT32 u32);

//*****************************************************************************
//
Expand All @@ -286,7 +289,7 @@ extern unsigned char* UINT32_TO_STREAM_f (unsigned char *p, unsigned long u32);
//
//*****************************************************************************

extern unsigned char* UINT16_TO_STREAM_f (unsigned char *p, unsigned short u16);
extern UINT8* UINT16_TO_STREAM_f (UINT8 *p, UINT16 u16);

//*****************************************************************************
//
Expand All @@ -302,7 +305,7 @@ extern unsigned char* UINT16_TO_STREAM_f (unsigned char *p, unsigned short u16);
//
//*****************************************************************************

extern unsigned short STREAM_TO_UINT16_f(char* p, unsigned short offset);
extern UINT16 STREAM_TO_UINT16_f(CHAR* p, UINT16 offset);

//*****************************************************************************
//
Expand All @@ -318,7 +321,7 @@ extern unsigned short STREAM_TO_UINT16_f(char* p, unsigned short offset);
//
//*****************************************************************************

extern unsigned long STREAM_TO_UINT32_f(char* p, unsigned short offset);
extern UINT32 STREAM_TO_UINT32_f(CHAR* p, UINT16 offset);


//*****************************************************************************
Expand All @@ -333,14 +336,14 @@ extern unsigned long STREAM_TO_UINT32_f(char* p, unsigned short offset);
//This macro is used for copying 32 bit to stream while converting to little endian format.
#define UINT32_TO_STREAM(_p, _u32) (UINT32_TO_STREAM_f(_p, _u32))
//This macro is used for copying a specified value length bits (l) to stream while converting to little endian format.
#define ARRAY_TO_STREAM(p, a, l) {register short _i; for (_i = 0; _i < l; _i++) *(p)++ = ((unsigned char *) a)[_i];}
#define ARRAY_TO_STREAM(p, a, l) {register INT16 _i; for (_i = 0; _i < l; _i++) *(p)++ = ((UINT8 *) a)[_i];}
//This macro is used for copying received stream to 8 bit in little endian format.
#define STREAM_TO_UINT8(_p, _offset, _u8) {_u8 = (unsigned char)(*(_p + _offset));}
#define STREAM_TO_UINT8(_p, _offset, _u8) {_u8 = (UINT8)(*(_p + _offset));}
//This macro is used for copying received stream to 16 bit in little endian format.
#define STREAM_TO_UINT16(_p, _offset, _u16) {_u16 = STREAM_TO_UINT16_f(_p, _offset);}
//This macro is used for copying received stream to 32 bit in little endian format.
#define STREAM_TO_UINT32(_p, _offset, _u32) {_u32 = STREAM_TO_UINT32_f(_p, _offset);}
#define STREAM_TO_STREAM(p, a, l) {register short _i; for (_i = 0; _i < l; _i++) *(a)++= ((unsigned char *) p)[_i];}
#define STREAM_TO_STREAM(p, a, l) {register INT16 _i; for (_i = 0; _i < l; _i++) *(a)++= ((UINT8 *) p)[_i];}



Expand Down
Loading

0 comments on commit c27a16d

Please sign in to comment.