Commit a7a1a38d authored by Damien George's avatar Damien George
Browse files

stmhal: Update CC3000 driver to newer version.

Still not working properly.
parent 50073ed5
......@@ -3,14 +3,6 @@
* cc3000_common.c.c - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
......@@ -60,7 +52,6 @@
#include "socket.h"
#include "wlan.h"
#include "evnt_handler.h"
#include "ccdebug.h"
//*****************************************************************************
//
......@@ -96,12 +87,12 @@ __error__(char *pcFilename, unsigned long ulLine)
//
//*****************************************************************************
uint8_t* UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32)
unsigned char* UINT32_TO_STREAM_f (unsigned char *p, unsigned long u32)
{
*(p)++ = (uint8_t)(u32);
*(p)++ = (uint8_t)((u32) >> 8);
*(p)++ = (uint8_t)((u32) >> 16);
*(p)++ = (uint8_t)((u32) >> 24);
*(p)++ = (unsigned char)(u32);
*(p)++ = (unsigned char)((u32) >> 8);
*(p)++ = (unsigned char)((u32) >> 16);
*(p)++ = (unsigned char)((u32) >> 24);
return p;
}
......@@ -119,10 +110,10 @@ uint8_t* UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32)
//
//*****************************************************************************
uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16)
unsigned char* UINT16_TO_STREAM_f (unsigned char *p, unsigned short u16)
{
*(p)++ = (uint8_t)(u16);
*(p)++ = (uint8_t)((u16) >> 8);
*(p)++ = (unsigned char)(u16);
*(p)++ = (unsigned char)((u16) >> 8);
return p;
}
......@@ -140,20 +131,10 @@ uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16)
//
//*****************************************************************************
uint16_t STREAM_TO_UINT16_f(char* cp, uint16_t offset)
unsigned short STREAM_TO_UINT16_f(char* p, unsigned short offset)
{
uint8_t *p = (uint8_t *)cp;
/*
DEBUGPRINT_F("Stream2u16: ");
DEBUGPRINT_HEX(cp[offset+1]);
DEBUGPRINT_F(" + ");
DEBUGPRINT_HEX(cp[offset]);
DEBUGPRINT_F("\n\r");
*/
return (uint16_t)((uint16_t)
((uint16_t)(*(p + offset + 1)) << 8) +
(uint16_t)(*(p + offset)));
return (unsigned short)((unsigned short)((unsigned short)
(*(p + offset + 1)) << 8) + (unsigned short)(*(p + offset)));
}
//*****************************************************************************
......@@ -170,23 +151,12 @@ uint16_t STREAM_TO_UINT16_f(char* cp, uint16_t offset)
//
//*****************************************************************************
uint32_t STREAM_TO_UINT32_f(char * cp, uint16_t offset)
unsigned long STREAM_TO_UINT32_f(char* p, unsigned short offset)
{
uint8_t *p = (uint8_t *)cp;
/*
DEBUGPRINT_F("\tStream2u32: ");
DEBUGPRINT_HEX(cp[offset+3]); DEBUGPRINT_F(" + ");
DEBUGPRINT_HEX(cp[offset+2]); DEBUGPRINT_F(" + ");
DEBUGPRINT_HEX(cp[offset+1]); DEBUGPRINT_F(" + ");
DEBUGPRINT_HEX(cp[offset]);
DEBUGPRINT_F("\n\r");
*/
return (uint32_t)((uint32_t)((uint32_t)
(*(p + offset + 3)) << 24) + (uint32_t)((uint32_t)
(*(p + offset + 2)) << 16) + (uint32_t)((uint32_t)
(*(p + offset + 1)) << 8) + (uint32_t)(*(p + 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)));
}
......
......@@ -3,14 +3,6 @@
* cc3000_common.h - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
......@@ -46,9 +38,6 @@
//******************************************************************************
// Include files
//******************************************************************************
//#include <stdlib.h>
//#include <errno.h>
//#include <stdint.h>
//*****************************************************************************
//
......@@ -167,11 +156,7 @@ extern "C" {
//*****************************************************************************
// Compound Types
//*****************************************************************************
#ifdef __AVR__
typedef unsigned long time_t; /* KTown: Updated to be compatible with Arduino Time.h */
#else
typedef long time_t;
#endif
typedef unsigned long clock_t;
typedef long suseconds_t;
......@@ -268,7 +253,7 @@ extern void SimpleLinkWaitEvent(unsigned short usOpcode, void *pRetParams);
//
//*****************************************************************************
extern void SimpleLinkWaitData(uint8_t *pBuf, uint8_t *from, uint8_t *fromlen);
extern void SimpleLinkWaitData(unsigned char *pBuf, unsigned char *from, unsigned char *fromlen);
//*****************************************************************************
//
......@@ -284,7 +269,7 @@ extern void SimpleLinkWaitData(uint8_t *pBuf, uint8_t *from, uint8_t *fromlen);
//
//*****************************************************************************
extern uint8_t* UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32);
extern unsigned char* UINT32_TO_STREAM_f (unsigned char *p, unsigned long u32);
//*****************************************************************************
//
......@@ -300,7 +285,7 @@ extern uint8_t* UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32);
//
//*****************************************************************************
extern uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16);
extern unsigned char* UINT16_TO_STREAM_f (unsigned char *p, unsigned short u16);
//*****************************************************************************
//
......@@ -316,7 +301,7 @@ extern uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16);
//
//*****************************************************************************
extern uint16_t STREAM_TO_UINT16_f(char* p, uint16_t offset);
extern unsigned short STREAM_TO_UINT16_f(char* p, unsigned short offset);
//*****************************************************************************
//
......@@ -332,7 +317,7 @@ extern uint16_t STREAM_TO_UINT16_f(char* p, uint16_t offset);
//
//*****************************************************************************
extern uint32_t STREAM_TO_UINT32_f(char* p, uint16_t offset);
extern unsigned long STREAM_TO_UINT32_f(char* p, unsigned short offset);
//*****************************************************************************
......@@ -361,14 +346,14 @@ extern void cc3k_int_poll();
//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)++ = ((uint8_t *) a)[_i];}
#define ARRAY_TO_STREAM(p, a, l) {register short _i; for (_i = 0; _i < l; _i++) *(p)++ = ((unsigned char *) 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 = (uint8_t)(*(_p + _offset));}
#define STREAM_TO_UINT8(_p, _offset, _u8) {_u8 = (unsigned char)(*(_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)++= ((uint8_t *) p)[_i];}
#define STREAM_TO_STREAM(p, a, l) {register short _i; for (_i = 0; _i < l; _i++) *(a)++= ((unsigned char *) p)[_i];}
......
/**************************************************************************/
/*!
@file Adafruit_CC3000.cpp
@author KTOWN (Kevin Townsend for Adafruit Industries)
@license BSD (see license.txt)
This is a library for the Adafruit CC3000 WiFi breakout board
This library works with the Adafruit CC3000 breakout
----> https://www.adafruit.com/products/1469
Check out the links above for our tutorials and wiring diagrams
These chips use SPI to communicate.
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
@section HISTORY
v1.0 - Initial release
*/
/**************************************************************************/
//#include <Arduino.h>
#ifndef _CC3000_DEBUG
#define _CC3000_DEBUG
#define DEBUG_MODE (0)
#define PRINT_F(__s) DEBUGPRINT(FLASHIFY(__s))
#if (DEBUG_MODE != 0)
#define DEBUGPRINT_F(__s) DEBUGPRINT(FLASHIFY(__s))
#define DEBUGPRINT_DEC(x) printDec(x)
#define DEBUGPRINT_DEC16(x) printDec16(x)
#define DEBUGPRINT_HEX(x) printHex(x)
#define DEBUGPRINT_HEX16(x) printHex16(x)
#else
#define DEBUGPRINT_F(__s) /* do nothing! */
#define DEBUGPRINT_DEC(x)
#define DEBUGPRINT_DEC16(x)
#define DEBUGPRINT_HEX(x)
#define DEBUGPRINT_HEX16(x)
#endif
#if 1 // print debugging info
#define DEBUG_PRINT (1)
#define DEBUG_printf(args...) printf(args)
#else // don't print debugging info
#define DEBUG_printf(args...) (void)0
#endif
int printf(const char *fmt, ...);
#endif
......@@ -51,9 +51,14 @@
#include "netapp.h"
#include "evnt_handler.h"
#include "cc3000_common.h"
#include "ccdebug.h"
#include "pybcc3k.h"
#if 0 // print debugging info
#define DEBUG_printf(args...) printf(args)
#else // don't print debugging info
#define DEBUG_printf(args...) (void)0
#endif
#define READ (3)
#define WRITE (1)
#define HI(value) (((value) & 0xFF00) >> 8)
......@@ -140,7 +145,7 @@ void SpiInit(void)
/**************************************************************************/
void SpiClose(void)
{
DEBUGPRINT_F("\tCC3000: SpiClose");
DEBUG_printf("\tCC3000: SpiClose");
if (sSpiInformation.pRxPacket)
{
......@@ -158,7 +163,7 @@ void SpiClose(void)
/**************************************************************************/
void SpiOpen(gcSpiHandleRx pfRxHandler)
{
DEBUGPRINT_F("\tCC3000: SpiOpen");
DEBUG_printf("\tCC3000: SpiOpen");
sSpiInformation.ulSpiState = eSPI_STATE_POWERUP;
......@@ -177,7 +182,7 @@ void SpiOpen(gcSpiHandleRx pfRxHandler)
/* Enable interrupt on the GPIO pin of WLAN IRQ */
tSLInformation.WlanInterruptEnable();
DEBUGPRINT_F("\tCC3000: Finished SpiOpen\n\r");
DEBUG_printf("\tCC3000: Finished SpiOpen\n\r");
}
/**************************************************************************/
......@@ -191,7 +196,7 @@ extern uint8_t g_csPin, g_irqPin, g_vbatPin, g_IRQnum, g_SPIspeed;
int init_spi(void)
{
DEBUGPRINT_F("\tCC3000: init_spi\n\r");
DEBUG_printf("\tCC3000: init_spi\n\r");
/* Set POWER_EN pin to output and disable the CC3000 by default */
pinMode(g_vbatPin, OUTPUT);
......@@ -222,7 +227,7 @@ int init_spi(void)
/* ToDo: Configure IRQ interrupt! */
DEBUGPRINT_F("\tCC3000: Finished init_spi\n\r");
DEBUG_printf("\tCC3000: Finished init_spi\n\r");
return(ESUCCESS);
}
......@@ -235,7 +240,7 @@ int init_spi(void)
/**************************************************************************/
long SpiFirstWrite(unsigned char *ucBuf, unsigned short usLength)
{
DEBUGPRINT_F("\tCC3000: SpiWriteFirst\n\r");
DEBUG_printf("\tCC3000: SpiWriteFirst\n\r");
/* Workaround for the first transaction */
CC3000_ASSERT_CS();
......@@ -267,7 +272,7 @@ long SpiWrite(unsigned char *pUserBuffer, unsigned short usLength)
{
unsigned char ucPad = 0;
DEBUGPRINT_F("\tCC3000: SpiWrite\n\r");
DEBUG_printf("\tCC3000: SpiWrite\n\r");
/* Figure out the total length of the packet in order to figure out if there is padding or not */
if(!(usLength & 0x0001))
......@@ -288,7 +293,7 @@ long SpiWrite(unsigned char *pUserBuffer, unsigned short usLength)
* occurred - and we will be stuck here forever! */
if (wlan_tx_buffer[CC3000_TX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER)
{
DEBUGPRINT_F("\tCC3000: Error - No magic number found in SpiWrite\n\r");
DEBUG_printf("\tCC3000: Error - No magic number found in SpiWrite\n\r");
while (1);
}
......@@ -383,7 +388,7 @@ void SpiReadDataSynchronous(unsigned char *data, unsigned short size)
/**************************************************************************/
void SpiReadHeader(void)
{
DEBUGPRINT_F("\tCC3000: SpiReadHeader\n\r");
DEBUG_printf("\tCC3000: SpiReadHeader\n\r");
SpiReadDataSynchronous(sSpiInformation.pRxPacket, HEADERS_SIZE_EVNT);
}
......@@ -398,7 +403,7 @@ long SpiReadDataCont(void)
long data_to_recv;
unsigned char *evnt_buff, type;
DEBUGPRINT_F("\tCC3000: SpiReadDataCont\n\r");
DEBUG_printf("\tCC3000: SpiReadDataCont\n\r");
/* Determine what type of packet we have */
evnt_buff = sSpiInformation.pRxPacket;
......@@ -454,7 +459,7 @@ long SpiReadDataCont(void)
/**************************************************************************/
void SpiPauseSpi(void)
{
DEBUGPRINT_F("\tCC3000: SpiPauseSpi\n\r");
DEBUG_printf("\tCC3000: SpiPauseSpi\n\r");
ccspi_int_enabled = 0;
pyb_cc3000_pause_spi();
......@@ -467,7 +472,7 @@ void SpiPauseSpi(void)
/**************************************************************************/
void SpiResumeSpi(void)
{
DEBUGPRINT_F("\tCC3000: SpiResumeSpi\n\r");
DEBUG_printf("\tCC3000: SpiResumeSpi\n\r");
ccspi_int_enabled = 1;
pyb_cc3000_resume_spi();
......@@ -480,24 +485,24 @@ void SpiResumeSpi(void)
/**************************************************************************/
void SpiTriggerRxProcessing(void)
{
DEBUGPRINT_F("\tCC3000: SpiTriggerRxProcessing\n\r");
DEBUG_printf("\tCC3000: SpiTriggerRxProcessing\n\r");
/* Trigger Rx processing */
SpiPauseSpi();
CC3000_DEASSERT_CS();
//DEBUGPRINT_F("Magic?\n\r");
//DEBUG_printf("Magic?\n\r");
/* The magic number that resides at the end of the TX/RX buffer (1 byte after the allocated size)
* for the purpose of detection of the overrun. If the magic number is overriten - buffer overrun
* occurred - and we will stuck here forever! */
if (sSpiInformation.pRxPacket[CC3000_RX_BUFFER_SIZE - 1] != CC3000_BUFFER_MAGIC_NUMBER)
{
/* You've got problems if you're here! */
DEBUGPRINT_F("\tCC3000: ERROR - magic number missing!\n\r");
DEBUG_printf("\tCC3000: ERROR - magic number missing!\n\r");
while (1);
}
//DEBUGPRINT_F("OK!\n\r");
//DEBUG_printf("OK!\n\r");
sSpiInformation.ulSpiState = eSPI_STATE_IDLE;
sSpiInformation.SPIRxHandler(sSpiInformation.pRxPacket + SPI_HEADER_SIZE);
}
......@@ -509,14 +514,14 @@ void SpiTriggerRxProcessing(void)
/**************************************************************************/
void SSIContReadOperation(void)
{
DEBUGPRINT_F("\tCC3000: SpiContReadOperation\n\r");
DEBUG_printf("\tCC3000: SpiContReadOperation\n\r");
/* The header was read - continue with the payload read */
if (!SpiReadDataCont())
{
/* All the data was read - finalize handling by switching to teh task
* and calling from task Event Handler */
//DEBUGPRINT_F("SPItrig\n\r");
//DEBUG_printf("SPItrig\n\r");
SpiTriggerRxProcessing();
}
}
......@@ -528,23 +533,6 @@ void SSIContReadOperation(void)
/**************************************************************************/
void WriteWlanPin( unsigned char val )
{
#if 0
if (DEBUG_MODE)
{
DEBUGPRINT_F("\tCC3000: WriteWlanPin - ");
DEBUGPRINT_DEC(val);
DEBUGPRINT_F("\n\r");
delay(1);
}
if (val)
{
digitalWrite(g_vbatPin, HIGH);
}
else
{
digitalWrite(g_vbatPin, LOW);
}
#endif
pyb_cc3000_set_en(val == WLAN_ENABLE);
}
......@@ -555,9 +543,7 @@ void WriteWlanPin( unsigned char val )
/**************************************************************************/
long ReadWlanInterruptPin(void)
{
DEBUGPRINT_F("\tCC3000: ReadWlanInterruptPin - ");
DEBUGPRINT_DEC(digitalRead(g_irqPin));
DEBUGPRINT_F("\n\r");
DEBUG_printf("CC3000: ReadWlanInterruptPin\n");
return pyb_cc3000_get_irq();
}
......@@ -569,7 +555,7 @@ long ReadWlanInterruptPin(void)
/**************************************************************************/
void WlanInterruptEnable()
{
DEBUGPRINT_F("\tCC3000: WlanInterruptEnable.\n\r");
DEBUG_printf("\tCC3000: WlanInterruptEnable.\n\r");
// delay(100);
ccspi_int_enabled = 1;
pyb_cc3000_enable_irq();
......@@ -582,7 +568,7 @@ void WlanInterruptEnable()
/**************************************************************************/
void WlanInterruptDisable()
{
DEBUGPRINT_F("\tCC3000: WlanInterruptDisable\n\r");
DEBUG_printf("\tCC3000: WlanInterruptDisable\n\r");
ccspi_int_enabled = 0;
pyb_cc3000_disable_irq();
}
......@@ -687,7 +673,7 @@ void SPI_IRQ(void)
{
ccspi_is_in_irq = 1;
DEBUGPRINT_F("\tCC3000: Entering SPI_IRQ\n\r");
DEBUG_printf("\tCC3000: Entering SPI_IRQ\n\r");
if (sSpiInformation.ulSpiState == eSPI_STATE_POWERUP)
{
......@@ -696,7 +682,7 @@ void SPI_IRQ(void)
}
else if (sSpiInformation.ulSpiState == eSPI_STATE_IDLE)
{
//DEBUGPRINT_F("IDLE\n\r");
//DEBUG_printf("IDLE\n\r");
sSpiInformation.ulSpiState = eSPI_STATE_READ_IRQ;
/* IRQ line goes down - start reception */
......@@ -705,7 +691,7 @@ void SPI_IRQ(void)
// Wait for TX/RX Compete which will come as DMA interrupt
SpiReadHeader();
sSpiInformation.ulSpiState = eSPI_STATE_READ_EOT;
//DEBUGPRINT_F("SSICont\n\r");
//DEBUG_printf("SSICont\n\r");
SSIContReadOperation();
}
else if (sSpiInformation.ulSpiState == eSPI_STATE_WRITE_IRQ)
......@@ -715,7 +701,7 @@ void SPI_IRQ(void)
CC3000_DEASSERT_CS();
}
DEBUGPRINT_F("\tCC3000: Leaving SPI_IRQ\n\r");
DEBUG_printf("\tCC3000: Leaving SPI_IRQ\n\r");
ccspi_is_in_irq = 0;
return;
......
......@@ -3,14 +3,6 @@
* evnt_handler.c - CC3000 Host Driver Implementation.
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
*
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
* & Limor Fried for Adafruit Industries
* This library works with the Adafruit CC3000 breakout
* ----> https://www.adafruit.com/products/1469
* Adafruit invests time and resources providing this open source code,
* please support Adafruit and open-source hardware by purchasing
* products from Adafruit!
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
......@@ -64,7 +56,6 @@
#include "socket.h"
#include "netapp.h"
#include "ccspi.h"
#include "ccdebug.h"
......@@ -251,22 +242,17 @@ hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
while (1)
{
cc3k_int_poll();
if (tSLInformation.usEventOrDataReceived != 0)
{
pucReceivedData = (tSLInformation.pucReceivedData);
if (*pucReceivedData == HCI_TYPE_EVNT)
{
// Event Received
STREAM_TO_UINT16((char *)pucReceivedData,
HCI_EVENT_OPCODE_OFFSET,
usReceivedEventOpcode);
STREAM_TO_UINT16((char *)pucReceivedData, HCI_EVENT_OPCODE_OFFSET, usReceivedEventOpcode);
pucReceivedParams = pucReceivedData + HCI_EVENT_HEADER_SIZE;
RecvParams = pucReceivedParams;
RetParams = (unsigned char *)pRetParams;
RetParams = pRetParams;
// In case unsolicited event received - here the handling finished
if (hci_unsol_event_handler((char *)pucReceivedData) == 0)
......@@ -277,10 +263,8 @@ hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
{
case HCI_CMND_READ_BUFFER_SIZE:
{
STREAM_TO_UINT8((char *)pucReceivedParams, 0,
tSLInformation.usNumberOfFreeBuffers);
STREAM_TO_UINT16((char *)pucReceivedParams, 1,
tSLInformation.usSlBufferLength);
STREAM_TO_UINT8((char *)pucReceivedParams, 0, tSLInformation.usNumberOfFreeBuffers);
STREAM_TO_UINT16((char *)pucReceivedParams, 1, tSLInformation.usSlBufferLength);
}
break;
......@@ -297,8 +281,7 @@ hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
case HCI_NETAPP_PING_REPORT:
case HCI_EVNT_MDNS_ADVERTISE:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET
,*(unsigned char *)pRetParams);
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET ,*(unsigned char *)pRetParams);
break;
case HCI_CMND_SETSOCKOPT:
......@@ -320,14 +303,12 @@ hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
case HCI_EVNT_CONNECT:
case HCI_EVNT_NVMEM_WRITE:
STREAM_TO_UINT32((char *)pucReceivedParams,0
,*(unsigned long *)pRetParams);
STREAM_TO_UINT32((char *)pucReceivedParams,0 ,*(unsigned long *)pRetParams);
break;
case HCI_EVNT_READ_SP_VERSION:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET
,*(unsigned char *)pRetParams);
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET ,*(unsigned char *)pRetParams);
pRetParams = ((char *)pRetParams) + 1;
STREAM_TO_UINT32((char *)pucReceivedParams, 0, retValue32);
UINT32_TO_STREAM((unsigned char *)pRetParams, retValue32);
......@@ -365,7 +346,7 @@ hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
STREAM_TO_UINT32((char *)pucReceivedParams,SL_RECEIVE_NUM_BYTES_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 4;
STREAM_TO_UINT32((char *)pucReceivedParams,SL_RECEIVE__FLAGS__OFFSET,*(unsigned long *)pRetParams);
//tBsdReadReturnParams *tread = (tBsdReadReturnParams *)pRetParams; // unused
if(((tBsdReadReturnParams *)pRetParams)->iNumberOfBytes == ERROR_SOCKET_INACTIVE)
{
set_socket_active_status(((tBsdReadReturnParams *)pRetParams)->iSocketDescriptor,SOCKET_STATUS_INACTIVE);
......@@ -447,7 +428,7 @@ hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
//Read SSID
STREAM_TO_STREAM(RecvParams,RetParams,NETAPP_IPCONFIG_SSID_LENGTH);
break;
}
}
......@@ -520,9 +501,6 @@ hci_unsol_event_handler(char *event_hdr)
STREAM_TO_UINT16(event_hdr, HCI_EVENT_OPCODE_OFFSET,event_type);
DEBUGPRINT_F("\tHCI_UNSOL_EVT: ");
DEBUGPRINT_HEX16(event_type);
if (event_type & HCI_EVNT_UNSOL_BASE)
{
switch(event_type)
......@@ -614,22 +592,13 @@ hci_unsol_event_handler(char *event_hdr)
break;
case HCI_EVNT_BSD_TCP_CLOSE_WAIT:
{
DEBUGPRINT_F("\tTCP Close Wait\n\r");
uint8_t socketnum;
data = (char*)(event_hdr) + HCI_EVENT_HEADER_SIZE;
/*
printHex(data[0]); PRINT_F("\t");
printHex(data[1]); PRINT_F("\t");
printHex(data[2]); PRINT_F("\t");
printHex(data[3]); PRINT_F("\t");
printHex(data[4]); PRINT_F("\t");
printHex(data[5]); PRINT_F("\t");