Skip to content

Commit a7a1a38

Browse files
committed
stmhal: Update CC3000 driver to newer version.
Still not working properly.
1 parent 50073ed commit a7a1a38

19 files changed

+200
-434
lines changed

stmhal/cc3k/cc3000_common.c

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
* cc3000_common.c.c - CC3000 Host Driver Implementation.
44
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
55
*
6-
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
7-
* & Limor Fried for Adafruit Industries
8-
* This library works with the Adafruit CC3000 breakout
9-
* ----> https://www.adafruit.com/products/1469
10-
* Adafruit invests time and resources providing this open source code,
11-
* please support Adafruit and open-source hardware by purchasing
12-
* products from Adafruit!
13-
*
146
* Redistribution and use in source and binary forms, with or without
157
* modification, are permitted provided that the following conditions
168
* are met:
@@ -60,7 +52,6 @@
6052
#include "socket.h"
6153
#include "wlan.h"
6254
#include "evnt_handler.h"
63-
#include "ccdebug.h"
6455

6556
//*****************************************************************************
6657
//
@@ -96,12 +87,12 @@ __error__(char *pcFilename, unsigned long ulLine)
9687
//
9788
//*****************************************************************************
9889

99-
uint8_t* UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32)
90+
unsigned char* UINT32_TO_STREAM_f (unsigned char *p, unsigned long u32)
10091
{
101-
*(p)++ = (uint8_t)(u32);
102-
*(p)++ = (uint8_t)((u32) >> 8);
103-
*(p)++ = (uint8_t)((u32) >> 16);
104-
*(p)++ = (uint8_t)((u32) >> 24);
92+
*(p)++ = (unsigned char)(u32);
93+
*(p)++ = (unsigned char)((u32) >> 8);
94+
*(p)++ = (unsigned char)((u32) >> 16);
95+
*(p)++ = (unsigned char)((u32) >> 24);
10596
return p;
10697
}
10798

@@ -119,10 +110,10 @@ uint8_t* UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32)
119110
//
120111
//*****************************************************************************
121112

122-
uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16)
113+
unsigned char* UINT16_TO_STREAM_f (unsigned char *p, unsigned short u16)
123114
{
124-
*(p)++ = (uint8_t)(u16);
125-
*(p)++ = (uint8_t)((u16) >> 8);
115+
*(p)++ = (unsigned char)(u16);
116+
*(p)++ = (unsigned char)((u16) >> 8);
126117
return p;
127118
}
128119

@@ -140,20 +131,10 @@ uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16)
140131
//
141132
//*****************************************************************************
142133

143-
uint16_t STREAM_TO_UINT16_f(char* cp, uint16_t offset)
134+
unsigned short STREAM_TO_UINT16_f(char* p, unsigned short offset)
144135
{
145-
uint8_t *p = (uint8_t *)cp;
146-
/*
147-
DEBUGPRINT_F("Stream2u16: ");
148-
DEBUGPRINT_HEX(cp[offset+1]);
149-
DEBUGPRINT_F(" + ");
150-
DEBUGPRINT_HEX(cp[offset]);
151-
DEBUGPRINT_F("\n\r");
152-
*/
153-
154-
return (uint16_t)((uint16_t)
155-
((uint16_t)(*(p + offset + 1)) << 8) +
156-
(uint16_t)(*(p + offset)));
136+
return (unsigned short)((unsigned short)((unsigned short)
137+
(*(p + offset + 1)) << 8) + (unsigned short)(*(p + offset)));
157138
}
158139

159140
//*****************************************************************************
@@ -170,23 +151,12 @@ uint16_t STREAM_TO_UINT16_f(char* cp, uint16_t offset)
170151
//
171152
//*****************************************************************************
172153

173-
uint32_t STREAM_TO_UINT32_f(char * cp, uint16_t offset)
154+
unsigned long STREAM_TO_UINT32_f(char* p, unsigned short offset)
174155
{
175-
uint8_t *p = (uint8_t *)cp;
176-
177-
/*
178-
DEBUGPRINT_F("\tStream2u32: ");
179-
DEBUGPRINT_HEX(cp[offset+3]); DEBUGPRINT_F(" + ");
180-
DEBUGPRINT_HEX(cp[offset+2]); DEBUGPRINT_F(" + ");
181-
DEBUGPRINT_HEX(cp[offset+1]); DEBUGPRINT_F(" + ");
182-
DEBUGPRINT_HEX(cp[offset]);
183-
DEBUGPRINT_F("\n\r");
184-
*/
185-
186-
return (uint32_t)((uint32_t)((uint32_t)
187-
(*(p + offset + 3)) << 24) + (uint32_t)((uint32_t)
188-
(*(p + offset + 2)) << 16) + (uint32_t)((uint32_t)
189-
(*(p + offset + 1)) << 8) + (uint32_t)(*(p + offset)));
156+
return (unsigned long)((unsigned long)((unsigned long)
157+
(*(p + offset + 3)) << 24) + (unsigned long)((unsigned long)
158+
(*(p + offset + 2)) << 16) + (unsigned long)((unsigned long)
159+
(*(p + offset + 1)) << 8) + (unsigned long)(*(p + offset)));
190160
}
191161

192162

stmhal/cc3k/cc3000_common.h

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
* cc3000_common.h - CC3000 Host Driver Implementation.
44
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
55
*
6-
* Adapted for use with the Arduino/AVR by KTOWN (Kevin Townsend)
7-
* & Limor Fried for Adafruit Industries
8-
* This library works with the Adafruit CC3000 breakout
9-
* ----> https://www.adafruit.com/products/1469
10-
* Adafruit invests time and resources providing this open source code,
11-
* please support Adafruit and open-source hardware by purchasing
12-
* products from Adafruit!
13-
*
146
* Redistribution and use in source and binary forms, with or without
157
* modification, are permitted provided that the following conditions
168
* are met:
@@ -46,9 +38,6 @@
4638
//******************************************************************************
4739
// Include files
4840
//******************************************************************************
49-
//#include <stdlib.h>
50-
//#include <errno.h>
51-
//#include <stdint.h>
5241

5342
//*****************************************************************************
5443
//
@@ -167,11 +156,7 @@ extern "C" {
167156
//*****************************************************************************
168157
// Compound Types
169158
//*****************************************************************************
170-
#ifdef __AVR__
171-
typedef unsigned long time_t; /* KTown: Updated to be compatible with Arduino Time.h */
172-
#else
173159
typedef long time_t;
174-
#endif
175160
typedef unsigned long clock_t;
176161
typedef long suseconds_t;
177162

@@ -268,7 +253,7 @@ extern void SimpleLinkWaitEvent(unsigned short usOpcode, void *pRetParams);
268253
//
269254
//*****************************************************************************
270255

271-
extern void SimpleLinkWaitData(uint8_t *pBuf, uint8_t *from, uint8_t *fromlen);
256+
extern void SimpleLinkWaitData(unsigned char *pBuf, unsigned char *from, unsigned char *fromlen);
272257

273258
//*****************************************************************************
274259
//
@@ -284,7 +269,7 @@ extern void SimpleLinkWaitData(uint8_t *pBuf, uint8_t *from, uint8_t *fromlen);
284269
//
285270
//*****************************************************************************
286271

287-
extern uint8_t* UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32);
272+
extern unsigned char* UINT32_TO_STREAM_f (unsigned char *p, unsigned long u32);
288273

289274
//*****************************************************************************
290275
//
@@ -300,7 +285,7 @@ extern uint8_t* UINT32_TO_STREAM_f (uint8_t *p, uint32_t u32);
300285
//
301286
//*****************************************************************************
302287

303-
extern uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16);
288+
extern unsigned char* UINT16_TO_STREAM_f (unsigned char *p, unsigned short u16);
304289

305290
//*****************************************************************************
306291
//
@@ -316,7 +301,7 @@ extern uint8_t* UINT16_TO_STREAM_f (uint8_t *p, uint16_t u16);
316301
//
317302
//*****************************************************************************
318303

319-
extern uint16_t STREAM_TO_UINT16_f(char* p, uint16_t offset);
304+
extern unsigned short STREAM_TO_UINT16_f(char* p, unsigned short offset);
320305

321306
//*****************************************************************************
322307
//
@@ -332,7 +317,7 @@ extern uint16_t STREAM_TO_UINT16_f(char* p, uint16_t offset);
332317
//
333318
//*****************************************************************************
334319

335-
extern uint32_t STREAM_TO_UINT32_f(char* p, uint16_t offset);
320+
extern unsigned long STREAM_TO_UINT32_f(char* p, unsigned short offset);
336321

337322

338323
//*****************************************************************************
@@ -361,14 +346,14 @@ extern void cc3k_int_poll();
361346
//This macro is used for copying 32 bit to stream while converting to little endian format.
362347
#define UINT32_TO_STREAM(_p, _u32) (UINT32_TO_STREAM_f(_p, _u32))
363348
//This macro is used for copying a specified value length bits (l) to stream while converting to little endian format.
364-
#define ARRAY_TO_STREAM(p, a, l) {register short _i; for (_i = 0; _i < l; _i++) *(p)++ = ((uint8_t *) a)[_i];}
349+
#define ARRAY_TO_STREAM(p, a, l) {register short _i; for (_i = 0; _i < l; _i++) *(p)++ = ((unsigned char *) a)[_i];}
365350
//This macro is used for copying received stream to 8 bit in little endian format.
366-
#define STREAM_TO_UINT8(_p, _offset, _u8) {_u8 = (uint8_t)(*(_p + _offset));}
351+
#define STREAM_TO_UINT8(_p, _offset, _u8) {_u8 = (unsigned char)(*(_p + _offset));}
367352
//This macro is used for copying received stream to 16 bit in little endian format.
368353
#define STREAM_TO_UINT16(_p, _offset, _u16) {_u16 = STREAM_TO_UINT16_f(_p, _offset);}
369354
//This macro is used for copying received stream to 32 bit in little endian format.
370355
#define STREAM_TO_UINT32(_p, _offset, _u32) {_u32 = STREAM_TO_UINT32_f(_p, _offset);}
371-
#define STREAM_TO_STREAM(p, a, l) {register short _i; for (_i = 0; _i < l; _i++) *(a)++= ((uint8_t *) p)[_i];}
356+
#define STREAM_TO_STREAM(p, a, l) {register short _i; for (_i = 0; _i < l; _i++) *(a)++= ((unsigned char *) p)[_i];}
372357

373358

374359

stmhal/cc3k/ccdebug.h

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)