CC3000 driver updates from Alan Carvalho de Assis

This commit is contained in:
Gregory Nutt
2013-09-04 09:45:59 -06:00
parent a9a8801472
commit 64f1c78367
18 changed files with 7758 additions and 7762 deletions
+12 -12
View File
@@ -82,12 +82,12 @@ __error__(char *pcFilename, unsigned long ulLine)
// //
//***************************************************************************** //*****************************************************************************
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;
} }
@@ -105,10 +105,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_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;
} }
@@ -126,10 +126,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_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)));
} }
//***************************************************************************** //*****************************************************************************
@@ -146,7 +146,7 @@ unsigned short STREAM_TO_UINT16_f(char* p, unsigned short offset)
// //
//***************************************************************************** //*****************************************************************************
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)
+23 -24
View File
@@ -224,16 +224,16 @@ void hci_unsol_handle_patch_request(char *event_hdr)
//***************************************************************************** //*****************************************************************************
unsigned char * uint8_t *
hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen) hci_event_handler(void *pRetParams, uint8_t *from, uint8_t *fromlen)
{ {
unsigned char *pucReceivedData, ucArgsize; uint8_t *pucReceivedData, ucArgsize;
unsigned short usLength; uint16_t usLength;
unsigned char *pucReceivedParams; uint8_t *pucReceivedParams;
unsigned short usReceivedEventOpcode = 0; uint16_t usReceivedEventOpcode = 0;
unsigned long retValue32; unsigned long retValue32;
unsigned char * RecvParams; uint8_t * RecvParams;
unsigned char *RetParams; uint8_t *RetParams;
while (1) while (1)
@@ -249,7 +249,7 @@ hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
usReceivedEventOpcode); usReceivedEventOpcode);
pucReceivedParams = pucReceivedData + HCI_EVENT_HEADER_SIZE; pucReceivedParams = pucReceivedData + HCI_EVENT_HEADER_SIZE;
RecvParams = pucReceivedParams; RecvParams = pucReceivedParams;
RetParams = (unsigned char *)pRetParams; RetParams = (uint8_t *)pRetParams;
// In case unsolicited event received - here the handling finished // In case unsolicited event received - here the handling finished
if (hci_unsol_event_handler((char *)pucReceivedData) == 0) if (hci_unsol_event_handler((char *)pucReceivedData) == 0)
@@ -281,7 +281,7 @@ hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
case HCI_EVNT_MDNS_ADVERTISE: case HCI_EVNT_MDNS_ADVERTISE:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET
,*(unsigned char *)pRetParams); ,*(uint8_t *)pRetParams);
break; break;
case HCI_CMND_SETSOCKOPT: case HCI_CMND_SETSOCKOPT:
@@ -310,10 +310,10 @@ hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
case HCI_EVNT_READ_SP_VERSION: case HCI_EVNT_READ_SP_VERSION:
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET
,*(unsigned char *)pRetParams); ,*(uint8_t *)pRetParams);
pRetParams = ((char *)pRetParams) + 1; pRetParams = ((char *)pRetParams) + 1;
STREAM_TO_UINT32((char *)pucReceivedParams, 0, retValue32); STREAM_TO_UINT32((char *)pucReceivedParams, 0, retValue32);
UINT32_TO_STREAM((unsigned char *)pRetParams, retValue32); UINT32_TO_STREAM((uint8_t *)pRetParams, retValue32);
break; break;
case HCI_EVNT_BSD_GETHOSTBYNAME: case HCI_EVNT_BSD_GETHOSTBYNAME:
@@ -335,7 +335,7 @@ hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
pRetParams = ((char *)pRetParams) + 4; pRetParams = ((char *)pRetParams) + 4;
//This argument returns in network order //This argument returns in network order
memcpy((unsigned char *)pRetParams, memcpy((uint8_t *)pRetParams,
pucReceivedParams + ACCEPT_ADDRESS__OFFSET, sizeof(sockaddr)); pucReceivedParams + ACCEPT_ADDRESS__OFFSET, sizeof(sockaddr));
break; break;
} }
@@ -383,7 +383,7 @@ hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET,((tBsdGetSockOptReturnParams *)pRetParams)->iStatus); STREAM_TO_UINT8(pucReceivedData, HCI_EVENT_STATUS_OFFSET,((tBsdGetSockOptReturnParams *)pRetParams)->iStatus);
//This argument returns in network order //This argument returns in network order
memcpy((unsigned char *)pRetParams, pucReceivedParams, 4); memcpy((uint8_t *)pRetParams, pucReceivedParams, 4);
break; break;
case HCI_CMND_WLAN_IOCTL_GET_SCAN_RESULTS: case HCI_CMND_WLAN_IOCTL_GET_SCAN_RESULTS:
@@ -396,7 +396,7 @@ hci_event_handler(void *pRetParams, unsigned char *from, unsigned char *fromlen)
pRetParams = ((char *)pRetParams) + 2; pRetParams = ((char *)pRetParams) + 2;
STREAM_TO_UINT16((char *)pucReceivedParams,GET_SCAN_RESULTS_FRAME_TIME_OFFSET,*(unsigned long *)pRetParams); STREAM_TO_UINT16((char *)pucReceivedParams,GET_SCAN_RESULTS_FRAME_TIME_OFFSET,*(unsigned long *)pRetParams);
pRetParams = ((char *)pRetParams) + 2; pRetParams = ((char *)pRetParams) + 2;
memcpy((unsigned char *)pRetParams, memcpy((uint8_t *)pRetParams,
(char *)(pucReceivedParams + GET_SCAN_RESULTS_FRAME_TIME_OFFSET + 2), (char *)(pucReceivedParams + GET_SCAN_RESULTS_FRAME_TIME_OFFSET + 2),
GET_SCAN_RESULTS_SSID_MAC_LENGTH); GET_SCAN_RESULTS_SSID_MAC_LENGTH);
break; break;
@@ -548,8 +548,8 @@ hci_unsol_event_handler(char *event_hdr)
case HCI_EVNT_WLAN_UNSOL_DHCP: case HCI_EVNT_WLAN_UNSOL_DHCP:
{ {
unsigned char params[NETAPP_IPCONFIG_MAC_OFFSET + 1]; // extra byte is for the status uint8_t params[NETAPP_IPCONFIG_MAC_OFFSET + 1]; // extra byte is for the status
unsigned char *recParams = params; uint8_t *recParams = params;
data = (char*)(event_hdr) + HCI_EVENT_HEADER_SIZE; data = (char*)(event_hdr) + HCI_EVENT_HEADER_SIZE;
@@ -652,7 +652,7 @@ long
hci_unsolicited_event_handler(void) hci_unsolicited_event_handler(void)
{ {
unsigned long res = 0; unsigned long res = 0;
unsigned char *pucReceivedData; uint8_t *pucReceivedData;
if (tSLInformation.usEventOrDataReceived != 0) if (tSLInformation.usEventOrDataReceived != 0)
{ {
@@ -718,8 +718,8 @@ hci_event_unsol_flowcontrol_handler(char *pEvent)
{ {
long temp, value; long temp, value;
unsigned short i; uint16_t i;
unsigned short pusNumberOfHandles=0; uint16_t pusNumberOfHandles=0;
char *pReadPayload; char *pReadPayload;
STREAM_TO_UINT16((char *)pEvent,HCI_EVENT_HEADER_SIZE,pusNumberOfHandles); STREAM_TO_UINT16((char *)pEvent,HCI_EVENT_HEADER_SIZE,pusNumberOfHandles);
@@ -801,12 +801,11 @@ update_socket_active_status(char *resp_params)
//***************************************************************************** //*****************************************************************************
void void
SimpleLinkWaitEvent(unsigned short usOpcode, void *pRetParams) SimpleLinkWaitEvent(uint16_t usOpcode, void *pRetParams)
{ {
// In the blocking implementation the control to caller will be returned only // In the blocking implementation the control to caller will be returned only
// after the end of current transaction // after the end of current transaction
tSLInformation.usRxEventOpcode = usOpcode; tSLInformation.usRxEventOpcode = usOpcode;
printf("Going to call hci_event_handler...\n");
hci_event_handler(pRetParams, 0, 0); hci_event_handler(pRetParams, 0, 0);
} }
@@ -827,8 +826,8 @@ SimpleLinkWaitEvent(unsigned short usOpcode, void *pRetParams)
//***************************************************************************** //*****************************************************************************
void void
SimpleLinkWaitData(unsigned char *pBuf, unsigned char *from, SimpleLinkWaitData(uint8_t *pBuf, uint8_t *from,
unsigned char *fromlen) uint8_t *fromlen)
{ {
// In the blocking implementation the control to caller will be returned only // In the blocking implementation the control to caller will be returned only
// after the end of current transaction, i.e. only after data will be received // after the end of current transaction, i.e. only after data will be received
+20 -20
View File
@@ -63,11 +63,11 @@
//! @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);
@@ -97,14 +97,14 @@ hci_command_send(unsigned short usOpcode, unsigned char *pucBuff,
// //
//***************************************************************************** //*****************************************************************************
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);
@@ -134,10 +134,10 @@ hci_data_send(unsigned char ucOpcode,
//! @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);
@@ -165,11 +165,11 @@ void hci_data_command_send(unsigned short usOpcode, unsigned char *pucBuff,
// //
//***************************************************************************** //*****************************************************************************
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);
@@ -211,12 +211,12 @@ hci_patch_send(unsigned char ucOpcode, unsigned char *pucBuff, char *patch, unsi
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));
} }
} }
} }
+18 -18
View File
@@ -66,7 +66,7 @@
//! over resets. //! over resets.
// //
//***************************************************************************** //*****************************************************************************
long netapp_config_mac_adrress(unsigned char * mac) long netapp_config_mac_adrress(uint8_t * mac)
{ {
return nvmem_set_mac_address(mac); return nvmem_set_mac_address(mac);
} }
@@ -99,9 +99,9 @@ long netapp_config_mac_adrress(unsigned char * mac)
//***************************************************************************** //*****************************************************************************
long netapp_dhcp(unsigned long *aucIP, unsigned long *aucSubnetMask,unsigned long *aucDefaultGateway, unsigned long *aucDNSServer) long netapp_dhcp(unsigned long *aucIP, unsigned long *aucSubnetMask,unsigned long *aucDefaultGateway, unsigned long *aucDNSServer)
{ {
signed char scRet; int8_t scRet;
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
scRet = EFAIL; scRet = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -178,9 +178,9 @@ long netapp_dhcp(unsigned long *aucIP, unsigned long *aucSubnetMask,unsigned lon
long long
netapp_timeout_values(unsigned long *aucDHCP, unsigned long *aucARP,unsigned long *aucKeepalive, unsigned long *aucInactivity) netapp_timeout_values(unsigned long *aucDHCP, unsigned long *aucARP,unsigned long *aucKeepalive, unsigned long *aucInactivity)
{ {
signed char scRet; int8_t scRet;
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
scRet = EFAIL; scRet = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -234,8 +234,8 @@ netapp_timeout_values(unsigned long *aucDHCP, unsigned long *aucARP,unsigned lon
long long
netapp_ping_send(unsigned long *ip, unsigned long ulPingAttempts, unsigned long ulPingSize, unsigned long ulPingTimeout) netapp_ping_send(unsigned long *ip, unsigned long ulPingAttempts, unsigned long ulPingSize, unsigned long ulPingTimeout)
{ {
signed char scRet; int8_t scRet;
unsigned char *ptr, *args; uint8_t *ptr, *args;
scRet = EFAIL; scRet = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -284,9 +284,9 @@ netapp_ping_send(unsigned long *ip, unsigned long ulPingAttempts, unsigned long
#ifndef CC3000_TINY_DRIVER #ifndef CC3000_TINY_DRIVER
void netapp_ping_report(void) void netapp_ping_report(void)
{ {
unsigned char *ptr; uint8_t *ptr;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
signed char scRet; int8_t scRet;
scRet = EFAIL; scRet = EFAIL;
@@ -314,8 +314,8 @@ void netapp_ping_report(void)
#ifndef CC3000_TINY_DRIVER #ifndef CC3000_TINY_DRIVER
long netapp_ping_stop(void) long netapp_ping_stop(void)
{ {
signed char scRet; int8_t scRet;
unsigned char *ptr; uint8_t *ptr;
scRet = EFAIL; scRet = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -359,7 +359,7 @@ long netapp_ping_stop(void)
#ifndef CC3000_TINY_DRIVER #ifndef CC3000_TINY_DRIVER
void netapp_ipconfig( tNetappIpconfigRetArgs * ipconfig ) void netapp_ipconfig( tNetappIpconfigRetArgs * ipconfig )
{ {
unsigned char *ptr; uint8_t *ptr;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -392,8 +392,8 @@ void netapp_ipconfig( tNetappIpconfigRetArgs * ipconfig )
#ifndef CC3000_TINY_DRIVER #ifndef CC3000_TINY_DRIVER
long netapp_arp_flush(void) long netapp_arp_flush(void)
{ {
signed char scRet; int8_t scRet;
unsigned char *ptr; uint8_t *ptr;
scRet = EFAIL; scRet = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -430,8 +430,8 @@ long netapp_arp_flush(void)
#ifndef CC3000_TINY_DRIVER #ifndef CC3000_TINY_DRIVER
long netapp_set_debug_level(unsigned long ulLevel) long netapp_set_debug_level(unsigned long ulLevel)
{ {
signed char scRet; int8_t scRet;
unsigned char *ptr, *args; uint8_t *ptr, *args;
scRet = EFAIL; scRet = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
+19 -19
View File
@@ -82,11 +82,11 @@
//***************************************************************************** //*****************************************************************************
signed long signed long
nvmem_read(unsigned long ulFileId, unsigned long ulLength, unsigned long ulOffset, unsigned char *buff) nvmem_read(unsigned long ulFileId, unsigned long ulLength, unsigned long ulOffset, uint8_t *buff)
{ {
unsigned char ucStatus = 0xFF; uint8_t ucStatus = 0xFF;
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD); args = (ptr + HEADERS_SIZE_CMD);
@@ -135,11 +135,11 @@ nvmem_read(unsigned long ulFileId, unsigned long ulLength, unsigned long ulOffse
signed long signed long
nvmem_write(unsigned long ulFileId, unsigned long ulLength, unsigned long nvmem_write(unsigned long ulFileId, unsigned long ulLength, unsigned long
ulEntryOffset, unsigned char *buff) ulEntryOffset, uint8_t *buff)
{ {
long iRes; long iRes;
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
iRes = EFAIL; iRes = EFAIL;
@@ -178,7 +178,7 @@ nvmem_write(unsigned long ulFileId, unsigned long ulLength, unsigned long
//! //!
//***************************************************************************** //*****************************************************************************
unsigned char nvmem_set_mac_address(unsigned char *mac) uint8_t nvmem_set_mac_address(uint8_t *mac)
{ {
return nvmem_write(NVMEM_MAC_FILEID, MAC_ADDR_LEN, 0, mac); return nvmem_write(NVMEM_MAC_FILEID, MAC_ADDR_LEN, 0, mac);
} }
@@ -196,7 +196,7 @@ unsigned char nvmem_set_mac_address(unsigned char *mac)
//! //!
//***************************************************************************** //*****************************************************************************
unsigned char nvmem_get_mac_address(unsigned char *mac) uint8_t nvmem_get_mac_address(uint8_t *mac)
{ {
return nvmem_read(NVMEM_MAC_FILEID, MAC_ADDR_LEN, 0, mac); return nvmem_read(NVMEM_MAC_FILEID, MAC_ADDR_LEN, 0, mac);
} }
@@ -219,11 +219,11 @@ unsigned char nvmem_get_mac_address(unsigned char *mac)
//! //!
//***************************************************************************** //*****************************************************************************
unsigned char nvmem_write_patch(unsigned long ulFileId, unsigned long spLength, const unsigned char *spData) uint8_t nvmem_write_patch(unsigned long ulFileId, unsigned long spLength, const uint8_t *spData)
{ {
unsigned char status = 0; uint8_t status = 0;
unsigned short offset = 0; uint16_t offset = 0;
unsigned char* spDataPtr = (unsigned char*)spData; uint8_t* spDataPtr = (uint8_t*)spData;
while ((status == 0) && (spLength >= SP_PORTION_SIZE)) while ((status == 0) && (spLength >= SP_PORTION_SIZE))
{ {
@@ -263,11 +263,11 @@ unsigned char nvmem_write_patch(unsigned long ulFileId, unsigned long spLength,
//***************************************************************************** //*****************************************************************************
#ifndef CC3000_TINY_DRIVER #ifndef CC3000_TINY_DRIVER
unsigned char nvmem_read_sp_version(unsigned char* patchVer) uint8_t nvmem_read_sp_version(uint8_t* patchVer)
{ {
unsigned char *ptr; uint8_t *ptr;
// 1st byte is the status and the rest is the SP version // 1st byte is the status and the rest is the SP version
unsigned char retBuf[5]; uint8_t retBuf[5];
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -310,9 +310,9 @@ unsigned char nvmem_read_sp_version(unsigned char* patchVer)
signed long signed long
nvmem_create_entry(unsigned long ulFileId, unsigned long ulNewLen) nvmem_create_entry(unsigned long ulFileId, unsigned long ulNewLen)
{ {
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
unsigned short retval; uint16_t retval;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD); args = (ptr + HEADERS_SIZE_CMD);
+19 -19
View File
@@ -44,7 +44,7 @@
#ifndef CC3000_UNENCRYPTED_SMART_CONFIG #ifndef CC3000_UNENCRYPTED_SMART_CONFIG
// foreward sbox // foreward sbox
const unsigned char sbox[256] = { const uint8_t sbox[256] = {
//0 1 2 3 4 5 6 7 8 9 A B C D E F //0 1 2 3 4 5 6 7 8 9 A B C D E F
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, //0 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, //0
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, //1 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, //1
@@ -63,7 +63,7 @@ const unsigned char sbox[256] = {
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, //E 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, //E
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; //F 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16 }; //F
// inverse sbox // inverse sbox
const unsigned char rsbox[256] = const uint8_t rsbox[256] =
{ 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb { 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb
, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb , 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb
, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e , 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e
@@ -81,11 +81,11 @@ const unsigned char rsbox[256] =
, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61 , 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61
, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d }; , 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d };
// round constant // round constant
const unsigned char Rcon[11] = { const uint8_t Rcon[11] = {
0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36}; 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36};
unsigned char aexpandedKey[176]; uint8_t aexpandedKey[176];
//***************************************************************************** //*****************************************************************************
// //
@@ -100,10 +100,10 @@ unsigned char aexpandedKey[176];
//! //!
//***************************************************************************** //*****************************************************************************
void expandKey(unsigned char *expandedKey, void expandKey(uint8_t *expandedKey,
unsigned char *key) uint8_t *key)
{ {
unsigned short ii, buf1; uint16_t ii, buf1;
for (ii=0;ii<16;ii++) for (ii=0;ii<16;ii++)
expandedKey[ii] = key[ii]; expandedKey[ii] = key[ii];
for (ii=1;ii<11;ii++){ for (ii=1;ii<11;ii++){
@@ -140,7 +140,7 @@ void expandKey(unsigned char *expandedKey,
//! //!
//***************************************************************************** //*****************************************************************************
unsigned char galois_mul2(unsigned char value) uint8_t galois_mul2(uint8_t value)
{ {
if (value>>7) if (value>>7)
{ {
@@ -174,9 +174,9 @@ unsigned char galois_mul2(unsigned char value)
//! //!
//***************************************************************************** //*****************************************************************************
void aes_encr(unsigned char *state, unsigned char *expandedKey) void aes_encr(uint8_t *state, uint8_t *expandedKey)
{ {
unsigned char buf1, buf2, buf3, round; uint8_t buf1, buf2, buf3, round;
for (round = 0; round < 9; round ++){ for (round = 0; round < 9; round ++){
// addroundkey, sbox and shiftrows // addroundkey, sbox and shiftrows
@@ -301,10 +301,10 @@ void aes_encr(unsigned char *state, unsigned char *expandedKey)
//! //!
//***************************************************************************** //*****************************************************************************
void aes_decr(unsigned char *state, unsigned char *expandedKey) void aes_decr(uint8_t *state, uint8_t *expandedKey)
{ {
unsigned char buf1, buf2, buf3; uint8_t buf1, buf2, buf3;
signed char round; int8_t round;
round = 9; round = 9;
// initial addroundkey // initial addroundkey
@@ -444,8 +444,8 @@ void aes_decr(unsigned char *state, unsigned char *expandedKey)
//! //!
//***************************************************************************** //*****************************************************************************
void aes_encrypt(unsigned char *state, void aes_encrypt(uint8_t *state,
unsigned char *key) uint8_t *key)
{ {
// expand the key into 176 bytes // expand the key into 176 bytes
expandKey(aexpandedKey, key); expandKey(aexpandedKey, key);
@@ -469,8 +469,8 @@ void aes_encrypt(unsigned char *state,
//! //!
//***************************************************************************** //*****************************************************************************
void aes_decrypt(unsigned char *state, void aes_decrypt(uint8_t *state,
unsigned char *key) uint8_t *key)
{ {
expandKey(aexpandedKey, key); // expand the key into 176 bytes expandKey(aexpandedKey, key); // expand the key into 176 bytes
aes_decr(state, aexpandedKey); aes_decr(state, aexpandedKey);
@@ -491,7 +491,7 @@ void aes_decrypt(unsigned char *state,
//! //!
//***************************************************************************** //*****************************************************************************
signed long aes_read_key(unsigned char *key) signed long aes_read_key(uint8_t *key)
{ {
signed long returnValue; signed long returnValue;
@@ -514,7 +514,7 @@ signed long aes_read_key(unsigned char *key)
//! //!
//***************************************************************************** //*****************************************************************************
signed long aes_write_key(unsigned char *key) signed long aes_write_key(uint8_t *key)
{ {
signed long returnValue; signed long returnValue;
+24 -24
View File
@@ -188,7 +188,7 @@ int
socket(long domain, long type, long protocol) socket(long domain, long type, long protocol)
{ {
long ret; long ret;
unsigned char *ptr, *args; uint8_t *ptr, *args;
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -229,7 +229,7 @@ long
closesocket(long sd) closesocket(long sd)
{ {
long ret; long ret;
unsigned char *ptr, *args; uint8_t *ptr, *args;
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -302,7 +302,7 @@ long
accept(long sd, sockaddr *addr, socklen_t *addrlen) accept(long sd, sockaddr *addr, socklen_t *addrlen)
{ {
long ret; long ret;
unsigned char *ptr, *args; uint8_t *ptr, *args;
tBsdReturnParams tAcceptReturnArguments; tBsdReturnParams tAcceptReturnArguments;
ret = EFAIL; ret = EFAIL;
@@ -366,7 +366,7 @@ long
bind(long sd, const sockaddr *addr, long addrlen) bind(long sd, const sockaddr *addr, long addrlen)
{ {
long ret; long ret;
unsigned char *ptr, *args; uint8_t *ptr, *args;
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -378,7 +378,7 @@ bind(long sd, const sockaddr *addr, long addrlen)
args = UINT32_TO_STREAM(args, sd); args = UINT32_TO_STREAM(args, sd);
args = UINT32_TO_STREAM(args, 0x00000008); args = UINT32_TO_STREAM(args, 0x00000008);
args = UINT32_TO_STREAM(args, addrlen); args = UINT32_TO_STREAM(args, addrlen);
ARRAY_TO_STREAM(args, ((unsigned char *)addr), addrlen); ARRAY_TO_STREAM(args, ((uint8_t *)addr), addrlen);
// Initiate a HCI command // Initiate a HCI command
hci_command_send(HCI_CMND_BIND, hci_command_send(HCI_CMND_BIND,
@@ -419,7 +419,7 @@ long
listen(long sd, long backlog) listen(long sd, long backlog)
{ {
long ret; long ret;
unsigned char *ptr, *args; uint8_t *ptr, *args;
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -461,11 +461,11 @@ listen(long sd, long backlog)
#ifndef CC3000_TINY_DRIVER #ifndef CC3000_TINY_DRIVER
int int
gethostbyname(char * hostname, unsigned short usNameLen, gethostbyname(char * hostname, uint16_t usNameLen,
unsigned long* out_ip_addr) unsigned long* out_ip_addr)
{ {
tBsdGethostbynameParams ret; tBsdGethostbynameParams ret;
unsigned char *ptr, *args; uint8_t *ptr, *args;
errno = EFAIL; errno = EFAIL;
@@ -531,7 +531,7 @@ long
connect(long sd, const sockaddr *addr, long addrlen) connect(long sd, const sockaddr *addr, long addrlen)
{ {
long int ret; long int ret;
unsigned char *ptr, *args; uint8_t *ptr, *args;
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -542,7 +542,7 @@ connect(long sd, const sockaddr *addr, long addrlen)
args = UINT32_TO_STREAM(args, sd); args = UINT32_TO_STREAM(args, sd);
args = UINT32_TO_STREAM(args, 0x00000008); args = UINT32_TO_STREAM(args, 0x00000008);
args = UINT32_TO_STREAM(args, addrlen); args = UINT32_TO_STREAM(args, addrlen);
ARRAY_TO_STREAM(args, ((unsigned char *)addr), addrlen); ARRAY_TO_STREAM(args, ((uint8_t *)addr), addrlen);
// Initiate a HCI command // Initiate a HCI command
hci_command_send(HCI_CMND_CONNECT, hci_command_send(HCI_CMND_CONNECT,
@@ -599,7 +599,7 @@ int
select(long nfds, TICC3000fd_set *readsds, TICC3000fd_set *writesds, TICC3000fd_set *exceptsds, select(long nfds, TICC3000fd_set *readsds, TICC3000fd_set *writesds, TICC3000fd_set *exceptsds,
struct timeval *timeout) struct timeval *timeout)
{ {
unsigned char *ptr, *args; uint8_t *ptr, *args;
tBsdSelectRecvParams tParams; tBsdSelectRecvParams tParams;
unsigned long is_blocking; unsigned long is_blocking;
@@ -725,7 +725,7 @@ setsockopt(long sd, long level, long optname, const void *optval,
socklen_t optlen) socklen_t optlen)
{ {
int ret; int ret;
unsigned char *ptr, *args; uint8_t *ptr, *args;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD); args = (ptr + HEADERS_SIZE_CMD);
@@ -736,7 +736,7 @@ setsockopt(long sd, long level, long optname, const void *optval,
args = UINT32_TO_STREAM(args, optname); args = UINT32_TO_STREAM(args, optname);
args = UINT32_TO_STREAM(args, 0x00000008); args = UINT32_TO_STREAM(args, 0x00000008);
args = UINT32_TO_STREAM(args, optlen); args = UINT32_TO_STREAM(args, optlen);
ARRAY_TO_STREAM(args, ((unsigned char *)optval), optlen); ARRAY_TO_STREAM(args, ((uint8_t *)optval), optlen);
// Initiate a HCI command // Initiate a HCI command
hci_command_send(HCI_CMND_SETSOCKOPT, hci_command_send(HCI_CMND_SETSOCKOPT,
@@ -807,7 +807,7 @@ setsockopt(long sd, long level, long optname, const void *optval,
int int
getsockopt (long sd, long level, long optname, void *optval, socklen_t *optlen) getsockopt (long sd, long level, long optname, void *optval, socklen_t *optlen)
{ {
unsigned char *ptr, *args; uint8_t *ptr, *args;
tBsdGetSockOptReturnParams tRetParams; tBsdGetSockOptReturnParams tRetParams;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -825,7 +825,7 @@ getsockopt (long sd, long level, long optname, void *optval, socklen_t *optlen)
// Since we are in blocking state - wait for event complete // Since we are in blocking state - wait for event complete
SimpleLinkWaitEvent(HCI_CMND_GETSOCKOPT, &tRetParams); SimpleLinkWaitEvent(HCI_CMND_GETSOCKOPT, &tRetParams);
if (((signed char)tRetParams.iStatus) >= 0) if (((int8_t)tRetParams.iStatus) >= 0)
{ {
*optlen = 4; *optlen = 4;
memcpy(optval, tRetParams.ucOptValue, 4); memcpy(optval, tRetParams.ucOptValue, 4);
@@ -863,7 +863,7 @@ int
simple_link_recv(long sd, void *buf, long len, long flags, sockaddr *from, simple_link_recv(long sd, void *buf, long len, long flags, sockaddr *from,
socklen_t *fromlen, long opcode) socklen_t *fromlen, long opcode)
{ {
unsigned char *ptr, *args; uint8_t *ptr, *args;
tBsdReadReturnParams tSocketReadEvent; tBsdReadReturnParams tSocketReadEvent;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -885,7 +885,7 @@ simple_link_recv(long sd, void *buf, long len, long flags, sockaddr *from,
{ {
// Wait for the data in a synchronous way. Here we assume that the bug is // Wait for the data in a synchronous way. Here we assume that the bug is
// big enough to store also parameters of receive from too.... // big enough to store also parameters of receive from too....
SimpleLinkWaitData((unsigned char *)buf, (unsigned char *)from, (unsigned char *)fromlen); SimpleLinkWaitData((uint8_t *)buf, (uint8_t *)from, (uint8_t *)fromlen);
} }
errno = tSocketReadEvent.iNumberOfBytes; errno = tSocketReadEvent.iNumberOfBytes;
@@ -981,8 +981,8 @@ int
simple_link_send(long sd, const void *buf, long len, long flags, simple_link_send(long sd, const void *buf, long len, long flags,
const sockaddr *to, long tolen, long opcode) const sockaddr *to, long tolen, long opcode)
{ {
unsigned char uArgSize = 0, addrlen; uint8_t uArgSize = 0, addrlen;
unsigned char *ptr, *pDataPtr = NULL, *args; uint8_t *ptr, *pDataPtr = NULL, *args;
unsigned long addr_offset = 0; unsigned long addr_offset = 0;
int res; int res;
tBsdReadReturnParams tSocketSendEvent; tBsdReadReturnParams tSocketSendEvent;
@@ -1040,16 +1040,16 @@ simple_link_send(long sd, const void *buf, long len, long flags,
} }
// Copy the data received from user into the TX Buffer // Copy the data received from user into the TX Buffer
ARRAY_TO_STREAM(pDataPtr, ((unsigned char *)buf), len); ARRAY_TO_STREAM(pDataPtr, ((uint8_t *)buf), len);
// In case we are using SendTo, copy the to parameters // In case we are using SendTo, copy the to parameters
if (opcode == HCI_CMND_SENDTO) if (opcode == HCI_CMND_SENDTO)
{ {
ARRAY_TO_STREAM(pDataPtr, ((unsigned char *)to), tolen); ARRAY_TO_STREAM(pDataPtr, ((uint8_t *)to), tolen);
} }
// Initiate a HCI command // Initiate a HCI command
hci_data_send(opcode, ptr, uArgSize, len,(unsigned char*)to, tolen); hci_data_send(opcode, ptr, uArgSize, len,(uint8_t*)to, tolen);
if (opcode == HCI_CMND_SENDTO) if (opcode == HCI_CMND_SENDTO)
SimpleLinkWaitEvent(HCI_EVNT_SENDTO, &tSocketSendEvent); SimpleLinkWaitEvent(HCI_EVNT_SENDTO, &tSocketSendEvent);
@@ -1139,10 +1139,10 @@ sendto(long sd, const void *buf, long len, long flags, const sockaddr *to,
//***************************************************************************** //*****************************************************************************
int int
mdnsAdvertiser(unsigned short mdnsEnabled, char * deviceServiceName, unsigned short deviceServiceNameLength) mdnsAdvertiser(uint16_t mdnsEnabled, char * deviceServiceName, uint16_t deviceServiceNameLength)
{ {
int ret; int ret;
unsigned char *pTxBuffer, *pArgs; uint8_t *pTxBuffer, *pArgs;
if (deviceServiceNameLength > MDNS_DEVICE_SERVICE_MAX_LENGTH) if (deviceServiceNameLength > MDNS_DEVICE_SERVICE_MAX_LENGTH)
{ {
+16 -16
View File
@@ -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;
+54 -57
View File
@@ -54,8 +54,8 @@ volatile sSimplLinkInformation tSLInformation;
#define SMART_CONFIG_PROFILE_SIZE 67 // 67 = 32 (max ssid) + 32 (max key) + 1 (SSID length) + 1 (security type) + 1 (key length) #define SMART_CONFIG_PROFILE_SIZE 67 // 67 = 32 (max ssid) + 32 (max key) + 1 (SSID length) + 1 (security type) + 1 (key length)
#ifndef CC3000_UNENCRYPTED_SMART_CONFIG #ifndef CC3000_UNENCRYPTED_SMART_CONFIG
unsigned char akey[AES128_KEY_SIZE]; uint8_t akey[AES128_KEY_SIZE];
unsigned char profileArray[SMART_CONFIG_PROFILE_SIZE]; uint8_t profileArray[SMART_CONFIG_PROFILE_SIZE];
#endif //CC3000_UNENCRYPTED_SMART_CONFIG #endif //CC3000_UNENCRYPTED_SMART_CONFIG
/* patches type */ /* patches type */
@@ -111,20 +111,19 @@ unsigned char profileArray[SMART_CONFIG_PROFILE_SIZE];
//! @brief Send HCI_CMND_SIMPLE_LINK_START to CC3000 //! @brief Send HCI_CMND_SIMPLE_LINK_START to CC3000
// //
//***************************************************************************** //*****************************************************************************
static void SimpleLink_Init_Start(unsigned short usPatchesAvailableAtHost) static void SimpleLink_Init_Start(uint16_t usPatchesAvailableAtHost)
{ {
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
args = (unsigned char *)(ptr + HEADERS_SIZE_CMD); args = (uint8_t *)(ptr + HEADERS_SIZE_CMD);
UINT8_TO_STREAM(args, ((usPatchesAvailableAtHost) ? SL_PATCHES_REQUEST_FORCE_HOST : SL_PATCHES_REQUEST_DEFAULT)); UINT8_TO_STREAM(args, ((usPatchesAvailableAtHost) ? SL_PATCHES_REQUEST_FORCE_HOST : SL_PATCHES_REQUEST_DEFAULT));
// IRQ Line asserted - send HCI_CMND_SIMPLE_LINK_START to CC3000 // IRQ Line asserted - send HCI_CMND_SIMPLE_LINK_START to CC3000
hci_command_send(HCI_CMND_SIMPLE_LINK_START, ptr, WLAN_SL_INIT_START_PARAMS_LEN); hci_command_send(HCI_CMND_SIMPLE_LINK_START, ptr, WLAN_SL_INIT_START_PARAMS_LEN);
printf ("Goind to call SimpleLinkWaitEvent...\n");
SimpleLinkWaitEvent(HCI_CMND_SIMPLE_LINK_START, 0); SimpleLinkWaitEvent(HCI_CMND_SIMPLE_LINK_START, 0);
} }
@@ -220,7 +219,7 @@ void wlan_init( tWlanCB sWlanCB,
void SpiReceiveHandler(void *pvBuffer) void SpiReceiveHandler(void *pvBuffer)
{ {
tSLInformation.usEventOrDataReceived = 1; tSLInformation.usEventOrDataReceived = 1;
tSLInformation.pucReceivedData = (unsigned char *)pvBuffer; tSLInformation.pucReceivedData = (uint8_t *)pvBuffer;
hci_unsolicited_event_handler(); hci_unsolicited_event_handler();
} }
@@ -254,7 +253,7 @@ void SpiReceiveHandler(void *pvBuffer)
//***************************************************************************** //*****************************************************************************
void void
wlan_start(unsigned short usPatchesAvailableAtHost) wlan_start(uint16_t usPatchesAvailableAtHost)
{ {
unsigned long ulSpiIRQState; unsigned long ulSpiIRQState;
@@ -271,7 +270,7 @@ wlan_start(unsigned short usPatchesAvailableAtHost)
tSLInformation.pucReceivedData = 0; tSLInformation.pucReceivedData = 0;
// Allocate the memory for the RX/TX data transactions // Allocate the memory for the RX/TX data transactions
tSLInformation.pucTxCommandBuffer = (unsigned char *)wlan_tx_buffer; tSLInformation.pucTxCommandBuffer = (uint8_t *)wlan_tx_buffer;
// init spi // init spi
SpiOpen(SpiReceiveHandler); SpiOpen(SpiReceiveHandler);
@@ -301,9 +300,7 @@ wlan_start(unsigned short usPatchesAvailableAtHost)
} }
} }
printf("Going to call SimpleLink_Init_Start...\n");
SimpleLink_Init_Start(usPatchesAvailableAtHost); SimpleLink_Init_Start(usPatchesAvailableAtHost);
printf("Returned from SimpleLink_Init_Start...\n");
// Read Buffer's size and finish // Read Buffer's size and finish
hci_command_send(HCI_CMND_READ_BUFFER_SIZE, tSLInformation.pucTxCommandBuffer, 0); hci_command_send(HCI_CMND_READ_BUFFER_SIZE, tSLInformation.pucTxCommandBuffer, 0);
@@ -380,12 +377,12 @@ wlan_stop(void)
#ifndef CC3000_TINY_DRIVER #ifndef CC3000_TINY_DRIVER
long long
wlan_connect(unsigned long ulSecType, char *ssid, long ssid_len, wlan_connect(unsigned long ulSecType, char *ssid, long ssid_len,
unsigned char *bssid, unsigned char *key, long key_len) uint8_t *bssid, uint8_t *key, long key_len)
{ {
long ret; long ret;
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
unsigned char bssid_zero[] = {0, 0, 0, 0, 0, 0}; uint8_t bssid_zero[] = {0, 0, 0, 0, 0, 0};
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -431,9 +428,9 @@ long
wlan_connect(char *ssid, long ssid_len) wlan_connect(char *ssid, long ssid_len)
{ {
long ret; long ret;
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
unsigned char bssid_zero[] = {0, 0, 0, 0, 0, 0}; uint8_t bssid_zero[] = {0, 0, 0, 0, 0, 0};
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -479,7 +476,7 @@ long
wlan_disconnect() wlan_disconnect()
{ {
long ret; long ret;
unsigned char *ptr; uint8_t *ptr;
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -531,12 +528,12 @@ wlan_ioctl_set_connection_policy(unsigned long should_connect_to_open_ap,
unsigned long ulUseProfiles) unsigned long ulUseProfiles)
{ {
long ret; long ret;
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
args = (unsigned char *)(ptr + HEADERS_SIZE_CMD); args = (uint8_t *)(ptr + HEADERS_SIZE_CMD);
// Fill in HCI packet structure // Fill in HCI packet structure
args = UINT32_TO_STREAM(args, should_connect_to_open_ap); args = UINT32_TO_STREAM(args, should_connect_to_open_ap);
@@ -584,22 +581,22 @@ wlan_ioctl_set_connection_policy(unsigned long should_connect_to_open_ap,
#ifndef CC3000_TINY_DRIVER #ifndef CC3000_TINY_DRIVER
long long
wlan_add_profile(unsigned long ulSecType, wlan_add_profile(unsigned long ulSecType,
unsigned char* ucSsid, uint8_t* ucSsid,
unsigned long ulSsidLen, unsigned long ulSsidLen,
unsigned char *ucBssid, uint8_t *ucBssid,
unsigned long ulPriority, unsigned long ulPriority,
unsigned long ulPairwiseCipher_Or_TxKeyLen, unsigned long ulPairwiseCipher_Or_TxKeyLen,
unsigned long ulGroupCipher_TxKeyIndex, unsigned long ulGroupCipher_TxKeyIndex,
unsigned long ulKeyMgmt, unsigned long ulKeyMgmt,
unsigned char* ucPf_OrKey, uint8_t* ucPf_OrKey,
unsigned long ulPassPhraseLen) unsigned long ulPassPhraseLen)
{ {
unsigned short arg_len = 0; uint16_t arg_len = 0;
long ret; long ret;
unsigned char *ptr; uint8_t *ptr;
long i = 0; long i = 0;
unsigned char *args; uint8_t *args;
unsigned char bssid_zero[] = {0, 0, 0, 0, 0, 0}; uint8_t bssid_zero[] = {0, 0, 0, 0, 0, 0};
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD); args = (ptr + HEADERS_SIZE_CMD);
@@ -652,7 +649,7 @@ wlan_add_profile(unsigned long ulSecType,
for(i = 0; i < 4; i++) for(i = 0; i < 4; i++)
{ {
unsigned char *p = &ucPf_OrKey[i * ulPairwiseCipher_Or_TxKeyLen]; uint8_t *p = &ucPf_OrKey[i * ulPairwiseCipher_Or_TxKeyLen];
ARRAY_TO_STREAM(args, p, ulPairwiseCipher_Or_TxKeyLen); ARRAY_TO_STREAM(args, p, ulPairwiseCipher_Or_TxKeyLen);
} }
@@ -706,14 +703,14 @@ wlan_add_profile(unsigned long ulSecType,
#else #else
long long
wlan_add_profile(unsigned long ulSecType, wlan_add_profile(unsigned long ulSecType,
unsigned char* ucSsid, uint8_t * ucSsid,
unsigned long ulSsidLen, uint8_t ulSsidLen,
unsigned char *ucBssid, uint8_t *ucBssid,
unsigned long ulPriority, unsigned long ulPriority,
unsigned long ulPairwiseCipher_Or_TxKeyLen, unsigned long ulPairwiseCipher_Or_TxKeyLen,
unsigned long ulGroupCipher_TxKeyIndex, unsigned long ulGroupCipher_TxKeyIndex,
unsigned long ulKeyMgmt, unsigned long ulKeyMgmt,
unsigned char* ucPf_OrKey, uint8_t * ucPf_OrKey,
unsigned long ulPassPhraseLen) unsigned long ulPassPhraseLen)
{ {
return -1; return -1;
@@ -740,11 +737,11 @@ long
wlan_ioctl_del_profile(unsigned long ulIndex) wlan_ioctl_del_profile(unsigned long ulIndex)
{ {
long ret; long ret;
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
args = (unsigned char *)(ptr + HEADERS_SIZE_CMD); args = (uint8_t *)(ptr + HEADERS_SIZE_CMD);
// Fill in HCI packet structure // Fill in HCI packet structure
args = UINT32_TO_STREAM(args, ulIndex); args = UINT32_TO_STREAM(args, ulIndex);
@@ -797,10 +794,10 @@ wlan_ioctl_del_profile(unsigned long ulIndex)
#ifndef CC3000_TINY_DRIVER #ifndef CC3000_TINY_DRIVER
long long
wlan_ioctl_get_scan_results(unsigned long ulScanTimeout, wlan_ioctl_get_scan_results(unsigned long ulScanTimeout,
unsigned char *ucResults) uint8_t *ucResults)
{ {
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD); args = (ptr + HEADERS_SIZE_CMD);
@@ -867,8 +864,8 @@ wlan_ioctl_set_scan_params(unsigned long uiEnable, unsigned long uiMinDwellTime,
unsigned long *aiIntervalList) unsigned long *aiIntervalList)
{ {
unsigned long uiRes; unsigned long uiRes;
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD); args = (ptr + HEADERS_SIZE_CMD);
@@ -923,8 +920,8 @@ long
wlan_set_event_mask(unsigned long ulMask) wlan_set_event_mask(unsigned long ulMask)
{ {
long ret; long ret;
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
if ((ulMask & HCI_EVNT_WLAN_TX_COMPLETE) == HCI_EVNT_WLAN_TX_COMPLETE) if ((ulMask & HCI_EVNT_WLAN_TX_COMPLETE) == HCI_EVNT_WLAN_TX_COMPLETE)
@@ -948,7 +945,7 @@ wlan_set_event_mask(unsigned long ulMask)
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
args = (unsigned char *)(ptr + HEADERS_SIZE_CMD); args = (uint8_t *)(ptr + HEADERS_SIZE_CMD);
// Fill in HCI packet structure // Fill in HCI packet structure
args = UINT32_TO_STREAM(args, ulMask); args = UINT32_TO_STREAM(args, ulMask);
@@ -981,7 +978,7 @@ long
wlan_ioctl_statusget(void) wlan_ioctl_statusget(void)
{ {
long ret; long ret;
unsigned char *ptr; uint8_t *ptr;
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -1021,12 +1018,12 @@ long
wlan_smart_config_start(unsigned long algoEncryptedFlag) wlan_smart_config_start(unsigned long algoEncryptedFlag)
{ {
long ret; long ret;
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
args = (unsigned char *)(ptr + HEADERS_SIZE_CMD); args = (uint8_t *)(ptr + HEADERS_SIZE_CMD);
// Fill in HCI packet structure // Fill in HCI packet structure
args = UINT32_TO_STREAM(args, algoEncryptedFlag); args = UINT32_TO_STREAM(args, algoEncryptedFlag);
@@ -1059,7 +1056,7 @@ long
wlan_smart_config_stop(void) wlan_smart_config_stop(void)
{ {
long ret; long ret;
unsigned char *ptr; uint8_t *ptr;
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -1093,8 +1090,8 @@ long
wlan_smart_config_set_prefix(char* cNewPrefix) wlan_smart_config_set_prefix(char* cNewPrefix)
{ {
long ret; long ret;
unsigned char *ptr; uint8_t *ptr;
unsigned char *args; uint8_t *args;
ret = EFAIL; ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer; ptr = tSLInformation.pucTxCommandBuffer;
@@ -1142,8 +1139,8 @@ wlan_smart_config_process()
{ {
signed long returnValue; signed long returnValue;
unsigned long ssidLen, keyLen; unsigned long ssidLen, keyLen;
unsigned char *decKeyPtr; uint8_t *decKeyPtr;
unsigned char *ssidPtr; uint8_t *ssidPtr;
// read the key from EEPROM - fileID 12 // read the key from EEPROM - fileID 12
returnValue = aes_read_key(akey); returnValue = aes_read_key(akey);
@@ -1173,9 +1170,9 @@ wlan_smart_config_process()
aes_decrypt(decKeyPtr, akey); aes_decrypt(decKeyPtr, akey);
if (profileArray[profileArray[0] + 1] > 16) if (profileArray[profileArray[0] + 1] > 16)
aes_decrypt((unsigned char *)(decKeyPtr + 16), akey); aes_decrypt((uint8_t *)(decKeyPtr + 16), akey);
if (*(unsigned char *)(decKeyPtr +31) != 0) if (*(uint8_t *)(decKeyPtr +31) != 0)
{ {
if (*decKeyPtr == 31) if (*decKeyPtr == 31)
{ {
+20 -20
View File
@@ -177,7 +177,7 @@ typedef char *(*tDriverPatches)(unsigned long *usLength);
typedef char *(*tBootLoaderPatches)(unsigned long *usLength); typedef char *(*tBootLoaderPatches)(unsigned long *usLength);
typedef void (*tWlanCB)(long event_type, char * data, unsigned char length ); typedef void (*tWlanCB)(long event_type, char * data, uint8_t length );
typedef long (*tWlanReadInteruptPin)(void); typedef long (*tWlanReadInteruptPin)(void);
@@ -185,14 +185,14 @@ typedef void (*tWlanInterruptEnable)(void);
typedef void (*tWlanInterruptDisable)(void); typedef void (*tWlanInterruptDisable)(void);
typedef void (*tWriteWlanPin)(unsigned char val); typedef void (*tWriteWlanPin)(uint8_t val);
typedef struct typedef struct
{ {
unsigned short usRxEventOpcode; uint16_t usRxEventOpcode;
unsigned short usEventOrDataReceived; uint16_t usEventOrDataReceived;
unsigned char *pucReceivedData; uint8_t *pucReceivedData;
unsigned char *pucTxCommandBuffer; uint8_t *pucTxCommandBuffer;
tFWPatches sFWPatches; tFWPatches sFWPatches;
tDriverPatches sDriverPatches; tDriverPatches sDriverPatches;
@@ -204,15 +204,15 @@ typedef struct
tWriteWlanPin WriteWlanPin; tWriteWlanPin WriteWlanPin;
signed long slTransmitDataError; signed long slTransmitDataError;
unsigned short usNumberOfFreeBuffers; uint16_t usNumberOfFreeBuffers;
unsigned short usSlBufferLength; uint16_t usSlBufferLength;
unsigned short usBufferSize; uint16_t usBufferSize;
unsigned short usRxDataPending; uint16_t usRxDataPending;
unsigned long NumberOfSentPackets; unsigned long NumberOfSentPackets;
unsigned long NumberOfReleasedPackets; unsigned long NumberOfReleasedPackets;
unsigned char InformHostOnTxComplete; uint8_t InformHostOnTxComplete;
}sSimplLinkInformation; }sSimplLinkInformation;
extern volatile sSimplLinkInformation tSLInformation; extern volatile sSimplLinkInformation tSLInformation;
@@ -238,7 +238,7 @@ extern volatile sSimplLinkInformation tSLInformation;
// //
//***************************************************************************** //*****************************************************************************
extern void SimpleLinkWaitEvent(unsigned short usOpcode, void *pRetParams); extern void SimpleLinkWaitEvent(uint16_t usOpcode, void *pRetParams);
//***************************************************************************** //*****************************************************************************
// //
@@ -256,7 +256,7 @@ extern void SimpleLinkWaitEvent(unsigned short usOpcode, void *pRetParams);
// //
//***************************************************************************** //*****************************************************************************
extern void SimpleLinkWaitData(unsigned char *pBuf, unsigned char *from, unsigned char *fromlen); extern void SimpleLinkWaitData(uint8_t *pBuf, uint8_t *from, uint8_t *fromlen);
//***************************************************************************** //*****************************************************************************
// //
@@ -272,7 +272,7 @@ extern void SimpleLinkWaitData(unsigned char *pBuf, unsigned char *from, unsigne
// //
//***************************************************************************** //*****************************************************************************
extern unsigned char* UINT32_TO_STREAM_f (unsigned char *p, unsigned long u32); extern uint8_t* UINT32_TO_STREAM_f (uint8_t *p, unsigned long u32);
//***************************************************************************** //*****************************************************************************
// //
@@ -288,7 +288,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_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16);
//***************************************************************************** //*****************************************************************************
// //
@@ -304,7 +304,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_t STREAM_TO_UINT16_f(char* p, uint16_t offset);
//***************************************************************************** //*****************************************************************************
// //
@@ -320,7 +320,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 unsigned long STREAM_TO_UINT32_f(char* p, uint16_t offset);
//***************************************************************************** //*****************************************************************************
@@ -335,14 +335,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. //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)) #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. //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_t _i; for (_i = 0; _i < l; _i++) *(p)++ = ((uint8_t *) a)[_i];}
//This macro is used for copying received stream to 8 bit in little endian format. //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_t)(*(_p + _offset));}
//This macro is used for copying received stream to 16 bit in little endian format. //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);} #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. //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_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_t _i; for (_i = 0; _i < l; _i++) *(a)++= ((uint8_t *) p)[_i];}
+2 -2
View File
@@ -67,7 +67,7 @@ extern "C" {
//! 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);
//***************************************************************************** //*****************************************************************************
// //
@@ -143,7 +143,7 @@ typedef struct _bsd_select_return_t
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;
+12 -12
View File
@@ -253,9 +253,9 @@ extern "C" {
//! @brief Initiate an HCI command. //! @brief Initiate an HCI command.
// //
//***************************************************************************** //*****************************************************************************
extern unsigned short hci_command_send(unsigned short usOpcode, extern uint16_t hci_command_send(uint16_t usOpcode,
unsigned char *ucArgs, uint8_t *ucArgs,
unsigned char ucArgsLength); uint8_t ucArgsLength);
//***************************************************************************** //*****************************************************************************
@@ -273,12 +273,12 @@ extern unsigned short hci_command_send(unsigned short usOpcode,
//! @brief Initiate an HCI data write operation //! @brief Initiate an HCI data write operation
// //
//***************************************************************************** //*****************************************************************************
extern long hci_data_send(unsigned char ucOpcode, extern long 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);
//***************************************************************************** //*****************************************************************************
@@ -295,8 +295,8 @@ extern long hci_data_send(unsigned char ucOpcode,
//! @brief Prepare HCI header and initiate an HCI data write operation //! @brief Prepare HCI header and initiate an HCI data write operation
// //
//***************************************************************************** //*****************************************************************************
extern void hci_data_command_send(unsigned short usOpcode, unsigned char *pucBuff, extern void hci_data_command_send(uint16_t usOpcode, uint8_t *pucBuff,
unsigned char ucArgsLength, unsigned short ucDataLength); uint8_t ucArgsLength, uint16_t ucDataLength);
//***************************************************************************** //*****************************************************************************
// //
@@ -312,7 +312,7 @@ extern void hci_data_command_send(unsigned short usOpcode, unsigned char *pucBuf
//! @brief Prepare HCI header and initiate an HCI patch write operation //! @brief Prepare HCI header and initiate an HCI patch write operation
// //
//***************************************************************************** //*****************************************************************************
extern void hci_patch_send(unsigned char ucOpcode, unsigned char *pucBuff, char *patch, unsigned short usDataLength); extern void hci_patch_send(uint8_t ucOpcode, uint8_t *pucBuff, char *patch, uint16_t usDataLength);
+13 -13
View File
@@ -55,22 +55,22 @@ extern "C" {
typedef struct _netapp_dhcp_ret_args_t typedef struct _netapp_dhcp_ret_args_t
{ {
unsigned char aucIP[4]; uint8_t aucIP[4];
unsigned char aucSubnetMask[4]; uint8_t aucSubnetMask[4];
unsigned char aucDefaultGateway[4]; uint8_t aucDefaultGateway[4];
unsigned char aucDHCPServer[4]; uint8_t aucDHCPServer[4];
unsigned char aucDNSServer[4]; uint8_t aucDNSServer[4];
}tNetappDhcpParams; }tNetappDhcpParams;
typedef struct _netapp_ipconfig_ret_args_t typedef struct _netapp_ipconfig_ret_args_t
{ {
unsigned char aucIP[4]; uint8_t aucIP[4];
unsigned char aucSubnetMask[4]; uint8_t aucSubnetMask[4];
unsigned char aucDefaultGateway[4]; uint8_t aucDefaultGateway[4];
unsigned char aucDHCPServer[4]; uint8_t aucDHCPServer[4];
unsigned char aucDNSServer[4]; uint8_t aucDNSServer[4];
unsigned char uaMacAddr[6]; uint8_t uaMacAddr[6];
unsigned char uaSSID[32]; uint8_t uaSSID[32];
}tNetappIpconfigRetArgs; }tNetappIpconfigRetArgs;
@@ -99,7 +99,7 @@ typedef struct _netapp_pingreport_args
//! over resets. //! over resets.
// //
//***************************************************************************** //*****************************************************************************
extern long netapp_config_mac_adrress( unsigned char *mac ); extern long netapp_config_mac_adrress( uint8_t *mac );
//***************************************************************************** //*****************************************************************************
// //
+6 -6
View File
@@ -107,7 +107,7 @@ extern "C" {
//! //!
//***************************************************************************** //*****************************************************************************
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);
//***************************************************************************** //*****************************************************************************
// //
@@ -131,7 +131,7 @@ extern signed long nvmem_read(unsigned long file_id, unsigned long length, unsig
//! //!
//***************************************************************************** //*****************************************************************************
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);
//***************************************************************************** //*****************************************************************************
@@ -146,7 +146,7 @@ extern signed long nvmem_write(unsigned long ulFileId, unsigned long ulLength, u
//! 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);
//***************************************************************************** //*****************************************************************************
@@ -161,7 +161,7 @@ extern unsigned char nvmem_set_mac_address(unsigned char *mac);
//! 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);
//***************************************************************************** //*****************************************************************************
@@ -181,7 +181,7 @@ extern unsigned char nvmem_get_mac_address(unsigned char *mac);
//! 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);
//***************************************************************************** //*****************************************************************************
@@ -198,7 +198,7 @@ extern unsigned char nvmem_write_patch(unsigned long ulFileId, unsigned long spL
//! //!
//***************************************************************************** //*****************************************************************************
#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
//***************************************************************************** //*****************************************************************************
+4 -4
View File
@@ -69,7 +69,7 @@ extern "C" {
//! //!
//! //!
//***************************************************************************** //*****************************************************************************
extern void aes_encrypt(unsigned char *state, unsigned char *key); extern void aes_encrypt(uint8_t *state, uint8_t *key);
//***************************************************************************** //*****************************************************************************
// //
@@ -87,7 +87,7 @@ extern void aes_encrypt(unsigned char *state, unsigned char *key);
//! //!
//! //!
//***************************************************************************** //*****************************************************************************
extern void aes_decrypt(unsigned char *state, unsigned char *key); extern void aes_decrypt(uint8_t *state, uint8_t *key);
//***************************************************************************** //*****************************************************************************
@@ -104,7 +104,7 @@ extern void aes_decrypt(unsigned char *state, unsigned char *key);
//! //!
//! //!
//***************************************************************************** //*****************************************************************************
extern signed long aes_read_key(unsigned char *key); extern signed long aes_read_key(uint8_t *key);
//***************************************************************************** //*****************************************************************************
// //
@@ -119,7 +119,7 @@ extern signed long aes_read_key(unsigned char *key);
//! //!
//! //!
//***************************************************************************** //*****************************************************************************
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
+6 -6
View File
@@ -118,14 +118,14 @@ typedef struct _in_addr_t
typedef struct _sockaddr_t typedef struct _sockaddr_t
{ {
unsigned short int sa_family; uint16_t sa_family;
unsigned char sa_data[14]; uint8_t sa_data[14];
} sockaddr; } sockaddr;
typedef struct _sockaddr_in_t typedef struct _sockaddr_in_t
{ {
short sin_family; // e.g. AF_INET int16_t sin_family; // e.g. AF_INET
unsigned short sin_port; // e.g. htons(3490) uint16_t sin_port; // e.g. htons(3490)
in_addr sin_addr; // see struct in_addr, below in_addr sin_addr; // see struct in_addr, below
char sin_zero[8]; // zero this if you want to char sin_zero[8]; // zero this if you want to
} sockaddr_in; } sockaddr_in;
@@ -346,7 +346,7 @@ extern long listen(long sd, long backlog);
// //
//***************************************************************************** //*****************************************************************************
#ifndef CC3000_TINY_DRIVER #ifndef CC3000_TINY_DRIVER
extern int gethostbyname(char * hostname, unsigned short usNameLen, unsigned long* out_ip_addr); extern int gethostbyname(char * hostname, uint16_t usNameLen, unsigned long* out_ip_addr);
#endif #endif
@@ -642,7 +642,7 @@ extern int sendto(long sd, const void *buf, long len, long flags,
//! @brief Set CC3000 in mDNS advertiser mode in order to advertise itself. //! @brief Set CC3000 in mDNS advertiser mode in order to advertise itself.
// //
//***************************************************************************** //*****************************************************************************
extern int mdnsAdvertiser(unsigned short mdnsEnabled, char * deviceServiceName, unsigned short deviceServiceNameLength); extern int mdnsAdvertiser(uint16_t mdnsEnabled, char * deviceServiceName, uint16_t deviceServiceNameLength);
//***************************************************************************** //*****************************************************************************
// //
+3 -3
View File
@@ -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[];
+6 -6
View File
@@ -141,7 +141,7 @@ extern void wlan_init( tWlanCB sWlanCB,
//! //!
// //
//***************************************************************************** //*****************************************************************************
extern void wlan_start(unsigned short usPatchesAvailableAtHost); extern void wlan_start(uint16_t usPatchesAvailableAtHost);
//***************************************************************************** //*****************************************************************************
// //
@@ -190,7 +190,7 @@ extern void wlan_stop(void);
//***************************************************************************** //*****************************************************************************
#ifndef CC3000_TINY_DRIVER #ifndef CC3000_TINY_DRIVER
extern long wlan_connect(unsigned long ulSecType, char *ssid, long ssid_len, extern long wlan_connect(unsigned long ulSecType, char *ssid, long ssid_len,
unsigned char *bssid, unsigned char *key, long key_len); uint8_t *bssid, uint8_t *key, long key_len);
#else #else
extern long wlan_connect(char *ssid, long ssid_len); extern long wlan_connect(char *ssid, long ssid_len);
@@ -238,14 +238,14 @@ extern long wlan_disconnect(void);
// //
//***************************************************************************** //*****************************************************************************
extern long wlan_add_profile(unsigned long ulSecType, unsigned char* ucSsid, extern long wlan_add_profile(unsigned long ulSecType, uint8_t* ucSsid,
unsigned long ulSsidLen, unsigned long ulSsidLen,
unsigned char *ucBssid, uint8_t *ucBssid,
unsigned long ulPriority, unsigned long ulPriority,
unsigned long ulPairwiseCipher_Or_Key, unsigned long ulPairwiseCipher_Or_Key,
unsigned long ulGroupCipher_TxKeyLen, unsigned long ulGroupCipher_TxKeyLen,
unsigned long ulKeyMgmt, unsigned long ulKeyMgmt,
unsigned char* ucPf_OrKey, uint8_t* ucPf_OrKey,
unsigned long ulPassPhraseLen); unsigned long ulPassPhraseLen);
@@ -377,7 +377,7 @@ extern long wlan_ioctl_set_connection_policy(
extern long wlan_ioctl_get_scan_results(unsigned long ulScanTimeout, extern long wlan_ioctl_get_scan_results(unsigned long ulScanTimeout,
unsigned char *ucResults); uint8_t *ucResults);
//***************************************************************************** //*****************************************************************************
// //