mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-19 13:54:23 +01:00
Merged 1.0.5
Merge remote-tracking branch 'arduino/master' into ide-1.5.x Conflicts: app/src/processing/app/Base.java build/shared/revisions.txt hardware/arduino/avr/cores/arduino/malloc.c hardware/arduino/cores/arduino/avr-libc/malloc.c hardware/arduino/cores/arduino/malloc.c todo.txt
This commit is contained in:
commit
62b723357c
@ -27,7 +27,6 @@ int ledPins[] = {
|
||||
int pinCount = 6; // the number of pins (i.e. the length of the array)
|
||||
|
||||
void setup() {
|
||||
int thisPin;
|
||||
// the array elements are numbered from 0 to (pinCount - 1).
|
||||
// use a for loop to initialize each pin as an output:
|
||||
for (int thisPin = 0; thisPin < pinCount; thisPin++) {
|
||||
|
@ -96,7 +96,23 @@ ARDUINO 1.5 BETA - 2012.10.22
|
||||
* For more info refer to this press release:
|
||||
http://arduino.cc/blog/2012/10/22/arduino-1-5-support-for-the-due-and-other-processors-easier-library-installation-simplified-board-menu-etc/
|
||||
|
||||
ARDUINO 1.0.4 - Not yet released.
|
||||
ARDUINO 1.0.5 - 2013.03.29
|
||||
|
||||
[core]
|
||||
|
||||
* [avr] malloc bug: backported avr-libc 1.8.0 implementation
|
||||
* [avr] removed deprecated interrupt handlers causing compiler issues
|
||||
with newer avr-gcc.
|
||||
|
||||
[libraries]
|
||||
|
||||
* Upgrades to WiFi library
|
||||
|
||||
[firmwares]
|
||||
|
||||
* Upgrades to WiFi firmwares
|
||||
|
||||
ARDUINO 1.0.4 - 2013.03.11
|
||||
|
||||
[core]
|
||||
|
||||
@ -107,6 +123,7 @@ ARDUINO 1.0.4 - Not yet released.
|
||||
* Fixed memory leak when calling Ethernet.begin() multiple times.
|
||||
* Fixed SD example listfiles.ino
|
||||
* Fixed a lot of Esplora examples
|
||||
* Added GSM library
|
||||
|
||||
[environment]
|
||||
|
||||
@ -115,6 +132,11 @@ ARDUINO 1.0.4 - Not yet released.
|
||||
* Fixed NPE due to permissions IO error
|
||||
* Updated drivers for Windows (all-in-one, signature for Win8)
|
||||
|
||||
[bootloaders]
|
||||
|
||||
* Fixed a bunch of bugs on Mega2560's bootloader (Mark Sproul)
|
||||
(https://github.com/arduino/Arduino/pull/1183)
|
||||
|
||||
ARDUINO 1.0.3 - 2012.12.10
|
||||
|
||||
[hardware]
|
||||
|
@ -71,9 +71,9 @@ regarding the usefulness of including (by default) a Tool that mangles code.)
|
||||
|
||||
The folder should be called Mangler (note the capitalization), and contain:
|
||||
|
||||
sketchbook/Mangler -> tool folder
|
||||
sketchbook/Mangler/tool -> location for code
|
||||
sketchbook/Mangler/tool/mangle.jar -> jar with one or more classes
|
||||
sketchbook/tools/Mangler -> tool folder
|
||||
sketchbook/tools/Mangler/tool -> location for code
|
||||
sketchbook/tools/Mangler/tool/mangle.jar -> jar with one or more classes
|
||||
|
||||
The naming of jar and zip files in the tool/* directory doesn't matter.
|
||||
|
||||
|
BIN
build/windows/dist/drivers/arduino.cat
vendored
BIN
build/windows/dist/drivers/arduino.cat
vendored
Binary file not shown.
1
build/windows/dist/drivers/arduino.inf
vendored
1
build/windows/dist/drivers/arduino.inf
vendored
@ -13,6 +13,7 @@ leonardo.bootloader.name="Arduino Leonardo bootloader"
|
||||
leonardo.sketch.name="Arduino Leonardo"
|
||||
lilypadUSB.bootloader.name="Arduino LilyPad USB bootloader"
|
||||
lilypadUSB.sketch.name="Arduino LilyPad USB"
|
||||
mega2560.name="Arduino Mega 2560"
|
||||
mega2560rev3.name="Arduino Mega 2560"
|
||||
megaADK.name="Arduino Mega ADK"
|
||||
megaADKrev3.name="Arduino Mega ADK"
|
||||
|
@ -124,7 +124,7 @@ CINCS =
|
||||
CFLAGS = -g$(DEBUG)
|
||||
CFLAGS += $(CDEFS) $(CINCS)
|
||||
CFLAGS += -O$(OPT)
|
||||
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -mno-tablejump
|
||||
CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -fno-jump-tables
|
||||
CFLAGS += -Wall -Wstrict-prototypes
|
||||
CFLAGS += -Wa,-adhlns=$(<:.c=.lst)
|
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
|
||||
|
0
hardware/arduino/avr/bootloaders/stk500v2/STK500V2.pnproj
Executable file → Normal file
0
hardware/arduino/avr/bootloaders/stk500v2/STK500V2.pnproj
Executable file → Normal file
0
hardware/arduino/avr/bootloaders/stk500v2/STK500V2.pnps
Executable file → Normal file
0
hardware/arduino/avr/bootloaders/stk500v2/STK500V2.pnps
Executable file → Normal file
189
hardware/arduino/avr/bootloaders/stk500v2/avr_cpunames.h
Normal file
189
hardware/arduino/avr/bootloaders/stk500v2/avr_cpunames.h
Normal file
@ -0,0 +1,189 @@
|
||||
//**************************************************************************************************
|
||||
//*
|
||||
//* Atmel AVR CPU name strings
|
||||
//*
|
||||
//**************************************************************************************************
|
||||
//* Sep 19, 2010 <MLS> Started on avr_cpunames.h
|
||||
//**************************************************************************************************
|
||||
|
||||
//#include "avr_cpunames.h"
|
||||
|
||||
//**************************************************************************************************
|
||||
|
||||
|
||||
#if defined (__AVR_AT94K__)
|
||||
#define _AVR_CPU_NAME_ "AT94k"
|
||||
#elif defined (__AVR_AT43USB320__)
|
||||
#elif defined (__AVR_AT43USB355__)
|
||||
#elif defined (__AVR_AT76C711__)
|
||||
#elif defined (__AVR_AT86RF401__)
|
||||
#elif defined (__AVR_AT90PWM1__)
|
||||
#elif defined (__AVR_AT90PWM2__)
|
||||
#elif defined (__AVR_AT90PWM2B__)
|
||||
#elif defined (__AVR_AT90PWM3__)
|
||||
#elif defined (__AVR_AT90PWM3B__)
|
||||
#elif defined (__AVR_AT90PWM216__)
|
||||
#elif defined (__AVR_AT90PWM316__)
|
||||
#elif defined (__AVR_ATmega32C1__)
|
||||
#elif defined (__AVR_ATmega32M1__)
|
||||
#elif defined (__AVR_ATmega32U4__)
|
||||
#define _AVR_CPU_NAME_ "ATmega32U4"
|
||||
#elif defined (__AVR_ATmega32U6__)
|
||||
#define _AVR_CPU_NAME_ "ATmega32U6"
|
||||
#elif defined (__AVR_ATmega128__)
|
||||
#define _AVR_CPU_NAME_ "Atmega128"
|
||||
#elif defined (__AVR_ATmega1280__)
|
||||
#define _AVR_CPU_NAME_ "ATmega1280"
|
||||
#elif defined (__AVR_ATmega1281__)
|
||||
#define _AVR_CPU_NAME_ "ATmega1281"
|
||||
#elif defined (__AVR_ATmega1284P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega1284"
|
||||
#elif defined (__AVR_ATmega128RFA1__)
|
||||
#define _AVR_CPU_NAME_ "ATmega128RFA1"
|
||||
#elif defined (__AVR_ATmega2560__)
|
||||
#define _AVR_CPU_NAME_ "ATmega2560"
|
||||
#elif defined (__AVR_ATmega2561__)
|
||||
#define _AVR_CPU_NAME_ "ATmega2561"
|
||||
#elif defined (__AVR_AT90CAN32__)
|
||||
#define _AVR_CPU_NAME_ "AT90CAN32"
|
||||
#elif defined (__AVR_AT90CAN64__)
|
||||
#define _AVR_CPU_NAME_ "AT90CAN64"
|
||||
#elif defined (__AVR_AT90CAN128__)
|
||||
#define _AVR_CPU_NAME_ "AT90CAN128"
|
||||
#elif defined (__AVR_AT90USB82__)
|
||||
#define _AVR_CPU_NAME_ "AT90USB82"
|
||||
#elif defined (__AVR_AT90USB162__)
|
||||
#define _AVR_CPU_NAME_ "AT90USB162"
|
||||
#elif defined (__AVR_AT90USB646__)
|
||||
#define _AVR_CPU_NAME_ "AT90USB646"
|
||||
#elif defined (__AVR_AT90USB647__)
|
||||
#define _AVR_CPU_NAME_ "AT90USB647"
|
||||
#elif defined (__AVR_AT90USB1286__)
|
||||
#define _AVR_CPU_NAME_ "AT90USB1286"
|
||||
#elif defined (__AVR_AT90USB1287__)
|
||||
#define _AVR_CPU_NAME_ "AT90USB1287"
|
||||
#elif defined (__AVR_ATmega64__)
|
||||
#define _AVR_CPU_NAME_ "ATmega64"
|
||||
#elif defined (__AVR_ATmega640__)
|
||||
#define _AVR_CPU_NAME_ "ATmega640"
|
||||
#elif defined (__AVR_ATmega644__)
|
||||
#define _AVR_CPU_NAME_ "ATmega644"
|
||||
#elif defined (__AVR_ATmega644P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega644P"
|
||||
#elif defined (__AVR_ATmega645__)
|
||||
#define _AVR_CPU_NAME_ "ATmega645"
|
||||
#elif defined (__AVR_ATmega6450__)
|
||||
#define _AVR_CPU_NAME_ "ATmega6450"
|
||||
#elif defined (__AVR_ATmega649__)
|
||||
#define _AVR_CPU_NAME_ "ATmega649"
|
||||
#elif defined (__AVR_ATmega6490__)
|
||||
#define _AVR_CPU_NAME_ "ATmega6490"
|
||||
#elif defined (__AVR_ATmega103__)
|
||||
#define _AVR_CPU_NAME_ "ATmega103"
|
||||
#elif defined (__AVR_ATmega32__)
|
||||
#define _AVR_CPU_NAME_ "Atmega32"
|
||||
#elif defined (__AVR_ATmega323__)
|
||||
#define _AVR_CPU_NAME_ "ATmega323"
|
||||
#elif defined (__AVR_ATmega324P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega324P"
|
||||
#elif defined (__AVR_ATmega325__)
|
||||
#define _AVR_CPU_NAME_ "ATmega325"
|
||||
#elif defined (__AVR_ATmega325P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega325P"
|
||||
#elif defined (__AVR_ATmega3250__)
|
||||
#define _AVR_CPU_NAME_ "ATmega3250"
|
||||
#elif defined (__AVR_ATmega3250P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega3250P"
|
||||
#elif defined (__AVR_ATmega328P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega328P"
|
||||
#elif defined (__AVR_ATmega329__)
|
||||
#define _AVR_CPU_NAME_ "ATmega329"
|
||||
#elif defined (__AVR_ATmega329P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega329P"
|
||||
#elif defined (__AVR_ATmega3290__)
|
||||
#define _AVR_CPU_NAME_ "ATmega3290"
|
||||
#elif defined (__AVR_ATmega3290P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega3290P"
|
||||
#elif defined (__AVR_ATmega32HVB__)
|
||||
#define _AVR_CPU_NAME_ "ATmega32HVB"
|
||||
#elif defined (__AVR_ATmega406__)
|
||||
#define _AVR_CPU_NAME_ "ATmega406"
|
||||
#elif defined (__AVR_ATmega16__)
|
||||
#define _AVR_CPU_NAME_ "Atmega16"
|
||||
#elif defined (__AVR_ATmega161__)
|
||||
#define _AVR_CPU_NAME_ "ATmega161"
|
||||
#elif defined (__AVR_ATmega162__)
|
||||
#define _AVR_CPU_NAME_ "ATmega162"
|
||||
#elif defined (__AVR_ATmega163__)
|
||||
#define _AVR_CPU_NAME_ "ATmega163"
|
||||
#elif defined (__AVR_ATmega164P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega164P"
|
||||
#elif defined (__AVR_ATmega165__)
|
||||
#define _AVR_CPU_NAME_ "ATmega165"
|
||||
#elif defined (__AVR_ATmega165P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega165P"
|
||||
#elif defined (__AVR_ATmega168__)
|
||||
#define _AVR_CPU_NAME_ "ATmega168"
|
||||
#elif defined (__AVR_ATmega168P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega168P"
|
||||
#elif defined (__AVR_ATmega169__)
|
||||
#define _AVR_CPU_NAME_ "Atmega169"
|
||||
#elif defined (__AVR_ATmega169P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega169P"
|
||||
#elif defined (__AVR_ATmega8HVA__)
|
||||
#define _AVR_CPU_NAME_ "ATmega8HVA"
|
||||
#elif defined (__AVR_ATmega16HVA__)
|
||||
#define _AVR_CPU_NAME_ "ATmega16HVA"
|
||||
#elif defined (__AVR_ATmega8__)
|
||||
#define _AVR_CPU_NAME_ "ATmega8"
|
||||
#elif defined (__AVR_ATmega48__)
|
||||
#define _AVR_CPU_NAME_ "ATmega48"
|
||||
#elif defined (__AVR_ATmega48P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega48P"
|
||||
#elif defined (__AVR_ATmega88__)
|
||||
#define _AVR_CPU_NAME_ "ATmega88"
|
||||
#elif defined (__AVR_ATmega88P__)
|
||||
#define _AVR_CPU_NAME_ "ATmega88P"
|
||||
#elif defined (__AVR_ATmega8515__)
|
||||
#define _AVR_CPU_NAME_ "ATmega8515"
|
||||
#elif defined (__AVR_ATmega8535__)
|
||||
#define _AVR_CPU_NAME_ "ATmega8535"
|
||||
#elif defined (__AVR_AT90S8535__)
|
||||
#elif defined (__AVR_AT90C8534__)
|
||||
#elif defined (__AVR_AT90S8515__)
|
||||
#elif defined (__AVR_AT90S4434__)
|
||||
#elif defined (__AVR_AT90S4433__)
|
||||
#elif defined (__AVR_AT90S4414__)
|
||||
#elif defined (__AVR_ATtiny22__)
|
||||
#elif defined (__AVR_ATtiny26__)
|
||||
#elif defined (__AVR_AT90S2343__)
|
||||
#elif defined (__AVR_AT90S2333__)
|
||||
#elif defined (__AVR_AT90S2323__)
|
||||
#elif defined (__AVR_AT90S2313__)
|
||||
#elif defined (__AVR_ATtiny2313__)
|
||||
#define _AVR_CPU_NAME_ "ATtiny2313"
|
||||
#elif defined (__AVR_ATtiny13__)
|
||||
#elif defined (__AVR_ATtiny13A__)
|
||||
#elif defined (__AVR_ATtiny25__)
|
||||
#elif defined (__AVR_ATtiny45__)
|
||||
#elif defined (__AVR_ATtiny85__)
|
||||
#elif defined (__AVR_ATtiny24__)
|
||||
#elif defined (__AVR_ATtiny44__)
|
||||
#elif defined (__AVR_ATtiny84__)
|
||||
#elif defined (__AVR_ATtiny261__)
|
||||
#elif defined (__AVR_ATtiny461__)
|
||||
#elif defined (__AVR_ATtiny861__)
|
||||
#elif defined (__AVR_ATtiny43U__)
|
||||
#elif defined (__AVR_ATtiny48__)
|
||||
#elif defined (__AVR_ATtiny88__)
|
||||
#elif defined (__AVR_ATtiny167__)
|
||||
#elif defined (__AVR_ATmega8U2__)
|
||||
#define _AVR_CPU_NAME_ "ATmega8U2"
|
||||
#else
|
||||
#error cpu not defined
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined (_AVR_CPU_NAME_)
|
||||
// #define _AVR_CPU_NAME_ "UNKNOWN"
|
||||
#endif
|
@ -13,6 +13,7 @@
|
||||
//* Jul 4, 2010 <MLS> Started using vector defs for #ifdefs as defined in <avr/io.h>
|
||||
//* Jul 13, 2010 <MLS> Added support for __AVR_ATmega128__
|
||||
//* Aug 26, 2010 <MLS> Added support for __AVR_ATmega2561__
|
||||
//* Sep 13, 2010 <MLS> Added support for __AVR_AT90CAN32__ __AVR_AT90CAN64__ __AVR_AT90CAN128__
|
||||
//**************************************************************************************************
|
||||
|
||||
//#include "avrinterruptnames.h"
|
||||
@ -253,13 +254,69 @@
|
||||
prog_char gAvrInt_LCD_StartFrame[] PROGMEM = "LCD Start of Frame";
|
||||
#endif
|
||||
|
||||
//* these are for the chips with CAN bus support
|
||||
#ifdef CANIT_vect
|
||||
prog_char gAvrInt_CAN_TrafnsferCE[] PROGMEM = "CAN Transfer Complete or Error";
|
||||
#endif
|
||||
#ifdef OVRIT_vect
|
||||
prog_char gAvrInt_CAN_TimerOverRun[] PROGMEM = "CAN Timer Overrun";
|
||||
#endif
|
||||
|
||||
//* these are for __AVR_ATmega128RFA1__
|
||||
#ifdef TRX24_PLL_LOCK_vect
|
||||
prog_char gAvrInt_TRN_PLL_LOCK[] PROGMEM = "TRX24_PLL_LOCK";
|
||||
#endif
|
||||
#ifdef TRX24_PLL_UNLOCK_vect
|
||||
prog_char gAvrInt_TRN_PLL_UNLOCK[] PROGMEM = "TRX24_PLL_UNLOCK";
|
||||
#endif
|
||||
#ifdef TRX24_RX_START_vect
|
||||
prog_char gAvrInt_TRN_RX_START[] PROGMEM = "TRX24_RX_START";
|
||||
#endif
|
||||
#ifdef TRX24_RX_END_vect
|
||||
prog_char gAvrInt_TRN_RX_END[] PROGMEM = "TRX24_RX_END";
|
||||
#endif
|
||||
#ifdef TRX24_CCA_ED_DONE_vect
|
||||
prog_char gAvrInt_TRN_CAAED_DONE[] PROGMEM = "TRX24_CCA_ED_DONE";
|
||||
#endif
|
||||
#ifdef TRX24_XAH_AMI_vect
|
||||
prog_char gAvrInt_TRN_FRAME_MATCH[] PROGMEM = "TRX24_FRAME_ADDRESS_MATCH";
|
||||
#endif
|
||||
#ifdef TRX24_TX_END_vect
|
||||
prog_char gAvrInt_TRN_TX_END[] PROGMEM = "TRX24_TX_END";
|
||||
#endif
|
||||
#ifdef TRX24_AWAKE_vect
|
||||
prog_char gAvrInt_TRN_AWAKE[] PROGMEM = "TRX24_AWAKE";
|
||||
#endif
|
||||
#ifdef SCNT_CMP1_vect
|
||||
prog_char gAvrInt_SCNT_CMP1[] PROGMEM = "SCNT_CMP1";
|
||||
#endif
|
||||
#ifdef SCNT_CMP2_vect
|
||||
prog_char gAvrInt_SCNT_CMP2[] PROGMEM = "SCNT_CMP2";
|
||||
#endif
|
||||
#ifdef SCNT_CMP3_vect
|
||||
prog_char gAvrInt_SCNT_CMP3[] PROGMEM = "SCNT_CMP3";
|
||||
#endif
|
||||
#ifdef SCNT_OVFL_vect
|
||||
prog_char gAvrInt_SCNT_OVFL[] PROGMEM = "SCNT_OVFL";
|
||||
#endif
|
||||
#ifdef SCNT_BACKOFF_vect
|
||||
prog_char gAvrInt_SCNT_BACKOFF[] PROGMEM = "SCNT_BACKOFF";
|
||||
#endif
|
||||
#ifdef AES_READY_vect
|
||||
prog_char gAvrInt_AES_READY[] PROGMEM = "AES_READY";
|
||||
#endif
|
||||
#ifdef BAT_LOW_vect
|
||||
prog_char gAvrInt_BAT_LOW[] PROGMEM = "BAT_LOW";
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
//**************************************************************************************************
|
||||
//* these do not have vector defs and have to be done by CPU type
|
||||
#if defined(__AVR_ATmega645__ ) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega2561__)
|
||||
prog_char gAvrInt_NOT_USED[] PROGMEM = "NOT_USED";
|
||||
#endif
|
||||
#if defined(__AVR_ATmega32U4__)
|
||||
#if defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega128RFA1__)
|
||||
prog_char gAvrInt_RESERVED[] PROGMEM = "Reserved";
|
||||
#endif
|
||||
|
||||
@ -309,8 +366,8 @@ PGM_P gInterruptNameTable[] PROGMEM =
|
||||
#endif
|
||||
|
||||
//**************************************************************************************************
|
||||
#pragma mark __AVR_ATmega169__
|
||||
#if defined(__AVR_ATmega169__)
|
||||
#pragma mark __AVR_ATmega169__
|
||||
|
||||
#define _INTERRUPT_NAMES_DEFINED_
|
||||
|
||||
@ -439,8 +496,8 @@ PGM_P gInterruptNameTable[] PROGMEM =
|
||||
|
||||
|
||||
//**************************************************************************************************
|
||||
#if defined(__AVR_ATmega324P__ ) || defined(__AVR_ATmega644__ ) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)
|
||||
#pragma mark __AVR_ATmega324P__ __AVR_ATmega644__ __AVR_ATmega644P__ __AVR_ATmega1284P__
|
||||
#if defined(__AVR_ATmega324P__ ) || defined(__AVR_ATmega644__ ) || defined(__AVR_ATmega644P__)
|
||||
#pragma mark __AVR_ATmega324P__ __AVR_ATmega644__ __AVR_ATmega644P__
|
||||
|
||||
#define _INTERRUPT_NAMES_DEFINED_
|
||||
|
||||
@ -487,6 +544,61 @@ PGM_P gInterruptNameTable[] PROGMEM =
|
||||
|
||||
#endif
|
||||
|
||||
//**************************************************************************************************
|
||||
#if defined(__AVR_ATmega1284P__ )
|
||||
#pragma mark __AVR_ATmega1284P__
|
||||
|
||||
#define _INTERRUPT_NAMES_DEFINED_
|
||||
|
||||
PGM_P gInterruptNameTable[] PROGMEM =
|
||||
{
|
||||
|
||||
gAvrInt_RESET, // 1
|
||||
gAvrInt_INT0, // 2
|
||||
gAvrInt_INT1, // 3
|
||||
gAvrInt_INT2, // 4
|
||||
gAvrInt_PCINT0, // 5
|
||||
gAvrInt_PCINT1, // 6
|
||||
gAvrInt_PCINT2, // 7
|
||||
gAvrInt_PCINT3, // 8
|
||||
gAvrInt_WDT, // 9
|
||||
gAvrInt_TIMER2_COMPA, // 10
|
||||
gAvrInt_TIMER2_COMPB, // 11
|
||||
gAvrInt_TIMER2_OVF, // 12
|
||||
gAvrInt_TIMER1_CAPT, // 13
|
||||
gAvrInt_TIMER1_COMPA, // 14
|
||||
gAvrInt_TIMER1_COMPB, // 15
|
||||
gAvrInt_TIMER1_OVF, // 16
|
||||
gAvrInt_TIMER0_COMPA, // 17
|
||||
gAvrInt_TIMER0_COMPB, // 18
|
||||
gAvrInt_TIMER0_OVF, // 19
|
||||
gAvrInt_SPI_STC, // 20
|
||||
gAvrInt_USART0_RX, // 21
|
||||
gAvrInt_USART0_UDRE, // 22
|
||||
gAvrInt_USART0_TX, // 23
|
||||
gAvrInt_ANALOG_COMP, // 24
|
||||
gAvrInt_ADC, // 25
|
||||
gAvrInt_EE_READY, // 26
|
||||
gAvrInt_TWI, // 27
|
||||
gAvrInt_SPM_READY, // 28
|
||||
|
||||
gAvrInt_USART1_RX, // 29
|
||||
gAvrInt_USART1_UDRE, // 30
|
||||
gAvrInt_USART1_TX, // 31
|
||||
//* these are NOT documented in doc8272.pdf
|
||||
//* they are in iom1284p.h
|
||||
gAvrInt_TIMER3_CAPT, // 32
|
||||
gAvrInt_TIMER3_COMPA, // 33
|
||||
gAvrInt_TIMER3_COMPB, // 34
|
||||
gAvrInt_TIMER3_OVF, // 35
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
//**************************************************************************************************
|
||||
#if defined(__AVR_ATmega645__ )
|
||||
#pragma mark __AVR_ATmega645__
|
||||
@ -529,6 +641,41 @@ PGM_P gInterruptNameTable[] PROGMEM =
|
||||
|
||||
#endif
|
||||
|
||||
//**************************************************************************************************
|
||||
#if defined(__AVR_ATmega16__ )
|
||||
#pragma mark __AVR_ATmega16__
|
||||
|
||||
#define _INTERRUPT_NAMES_DEFINED_
|
||||
|
||||
PGM_P gInterruptNameTable[] PROGMEM =
|
||||
{
|
||||
|
||||
gAvrInt_RESET, // 1
|
||||
gAvrInt_INT0, // 2
|
||||
gAvrInt_INT1, // 3
|
||||
gAvrInt_TIMER2_COMP, // 4
|
||||
gAvrInt_TIMER2_OVF, // 5
|
||||
gAvrInt_TIMER1_CAPT, // 6
|
||||
gAvrInt_TIMER1_COMPA, // 7
|
||||
gAvrInt_TIMER1_COMPB, // 8
|
||||
gAvrInt_TIMER1_OVF, // 9
|
||||
gAvrInt_TIMER0_OVF, // 10
|
||||
gAvrInt_SPI_STC, // 11
|
||||
gAvrInt_USART_RX, // 12
|
||||
gAvrInt_USART_UDRE, // 13
|
||||
gAvrInt_USART_TX, // 14
|
||||
gAvrInt_ADC, // 15
|
||||
gAvrInt_EE_READY, // 16
|
||||
gAvrInt_ANALOG_COMP, // 17
|
||||
gAvrInt_TWI, // 18
|
||||
gAvrInt_INT2, // 19
|
||||
gAvrInt_TIMER0_COMP, // 20
|
||||
gAvrInt_SPM_READY, // 21
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
//**************************************************************************************************
|
||||
#if defined(__AVR_ATmega32__ )
|
||||
@ -629,7 +776,7 @@ PGM_P gInterruptNameTable[] PROGMEM =
|
||||
#endif
|
||||
|
||||
//**************************************************************************************************
|
||||
#if defined(__AVR_AT90USB1286__)
|
||||
#if defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__)
|
||||
#pragma mark __AVR_AT90USB1286__
|
||||
//* teensy++ 2.0
|
||||
//* http://www.pjrc.com/teensy/pinout.html
|
||||
@ -689,8 +836,8 @@ PGM_P gInterruptNameTable[] PROGMEM =
|
||||
|
||||
|
||||
//**************************************************************************************************
|
||||
#if defined(__AVR_ATmega128__)
|
||||
#pragma mark __AVR_ATmega128__
|
||||
#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega64__)
|
||||
#pragma mark __AVR_ATmega64__ __AVR_ATmega128__
|
||||
#define _INTERRUPT_NAMES_DEFINED_
|
||||
|
||||
|
||||
@ -737,6 +884,157 @@ PGM_P gInterruptNameTable[] PROGMEM =
|
||||
|
||||
#endif
|
||||
|
||||
//**************************************************************************************************
|
||||
#if defined(__AVR_AT90CAN32__) || defined(__AVR_AT90CAN64__) || defined(__AVR_AT90CAN128__)
|
||||
#pragma mark __AVR_AT90CAN32__ __AVR_AT90CAN64__ __AVR_AT90CAN128__
|
||||
|
||||
#define _INTERRUPT_NAMES_DEFINED_
|
||||
|
||||
PGM_P gInterruptNameTable[] PROGMEM =
|
||||
{
|
||||
|
||||
gAvrInt_RESET, // 1
|
||||
gAvrInt_INT0, // 2
|
||||
gAvrInt_INT1, // 3
|
||||
gAvrInt_INT2, // 4
|
||||
gAvrInt_INT3, // 5
|
||||
gAvrInt_INT4, // 6
|
||||
gAvrInt_INT5, // 7
|
||||
gAvrInt_INT6, // 8
|
||||
gAvrInt_INT7, // 9
|
||||
gAvrInt_TIMER2_COMP, // 10
|
||||
gAvrInt_TIMER2_OVF, // 11
|
||||
gAvrInt_TIMER1_CAPT, // 12
|
||||
gAvrInt_TIMER1_COMPA, // 13
|
||||
gAvrInt_TIMER1_COMPB, // 14
|
||||
gAvrInt_TIMER1_COMPC, // 15
|
||||
gAvrInt_TIMER1_OVF, // 16
|
||||
gAvrInt_TIMER0_COMP, // 17
|
||||
gAvrInt_TIMER0_OVF, // 18
|
||||
gAvrInt_CAN_TrafnsferCE, // 19
|
||||
gAvrInt_CAN_TimerOverRun, // 20
|
||||
gAvrInt_SPI_STC, // 21
|
||||
gAvrInt_USART0_RX, // 22
|
||||
gAvrInt_USART0_UDRE, // 23
|
||||
gAvrInt_USART0_TX, // 24
|
||||
gAvrInt_ANALOG_COMP, // 25
|
||||
gAvrInt_ADC, // 26
|
||||
gAvrInt_EE_READY, // 27
|
||||
gAvrInt_TIMER3_CAPT, // 28
|
||||
gAvrInt_TIMER3_COMPA, // 29
|
||||
gAvrInt_TIMER3_COMPB, // 30
|
||||
gAvrInt_TIMER3_COMPC, // 31
|
||||
gAvrInt_TIMER3_OVF, // 32
|
||||
gAvrInt_USART1_RX, // 33
|
||||
gAvrInt_USART1_UDRE, // 34
|
||||
gAvrInt_USART1_TX, // 35
|
||||
gAvrInt_TWI, // 36
|
||||
gAvrInt_SPM_READY, // 37
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
//**************************************************************************************************
|
||||
#if defined (__AVR_ATmega128RFA1__)
|
||||
#pragma mark __AVR_ATmega128RFA1__
|
||||
#define _INTERRUPT_NAMES_DEFINED_
|
||||
|
||||
PGM_P gInterruptNameTable[] PROGMEM =
|
||||
{
|
||||
//* Atmel changed the number scheme for interrupt vectors
|
||||
gAvrInt_RESET, // 0
|
||||
gAvrInt_INT0, // 1
|
||||
gAvrInt_INT1, // 2
|
||||
gAvrInt_INT2, // 3
|
||||
gAvrInt_INT3, // 4
|
||||
gAvrInt_INT4, // 5
|
||||
gAvrInt_INT5, // 6
|
||||
gAvrInt_INT6, // 7
|
||||
gAvrInt_INT7, // 8
|
||||
gAvrInt_PCINT0, // 9
|
||||
gAvrInt_PCINT1, // 10
|
||||
gAvrInt_PCINT2, // 11
|
||||
gAvrInt_WDT, // 12
|
||||
gAvrInt_TIMER2_COMPA, // 13
|
||||
gAvrInt_TIMER2_COMPB, // 14
|
||||
gAvrInt_TIMER2_OVF, // 15
|
||||
gAvrInt_TIMER1_CAPT, // 16
|
||||
gAvrInt_TIMER1_COMPA, // 17
|
||||
gAvrInt_TIMER1_COMPB, // 18
|
||||
gAvrInt_TIMER1_COMPC, // 19
|
||||
gAvrInt_TIMER1_OVF, // 20
|
||||
gAvrInt_TIMER0_COMPA, // 21
|
||||
gAvrInt_TIMER0_COMPB, // 22
|
||||
gAvrInt_TIMER0_OVF, // 23
|
||||
gAvrInt_SPI_STC, // 24
|
||||
gAvrInt_USART0_RX, // 25
|
||||
gAvrInt_USART0_UDRE, // 26
|
||||
gAvrInt_USART0_TX, // 27
|
||||
gAvrInt_ANALOG_COMP, // 28
|
||||
gAvrInt_ADC, // 29
|
||||
gAvrInt_EE_READY, // 30
|
||||
gAvrInt_TIMER3_CAPT, // 31
|
||||
gAvrInt_TIMER3_COMPA, // 32
|
||||
gAvrInt_TIMER3_COMPB, // 33
|
||||
gAvrInt_TIMER3_COMPC, // 34
|
||||
gAvrInt_TIMER3_OVF, // 35
|
||||
gAvrInt_USART1_RX, // 36
|
||||
gAvrInt_USART1_UDRE, // 37
|
||||
gAvrInt_USART1_TX, // 38
|
||||
gAvrInt_TWI, // 39
|
||||
gAvrInt_SPM_READY, // 40
|
||||
gAvrInt_TIMER4_CAPT, // 41
|
||||
gAvrInt_TIMER4_COMPA, // 42
|
||||
gAvrInt_TIMER4_COMPB, // 43
|
||||
gAvrInt_TIMER4_COMPC, // 44
|
||||
gAvrInt_TIMER4_OVF, // 45
|
||||
gAvrInt_TIMER5_CAPT, // 46
|
||||
gAvrInt_TIMER5_COMPA, // 47
|
||||
gAvrInt_TIMER5_COMPB, // 48
|
||||
gAvrInt_TIMER5_COMPC, // 49
|
||||
gAvrInt_TIMER5_OVF, // 50
|
||||
#if 1
|
||||
gAvrInt_RESERVED, // 51
|
||||
gAvrInt_RESERVED, // 52
|
||||
gAvrInt_RESERVED, // 53
|
||||
|
||||
gAvrInt_RESERVED, // 54
|
||||
gAvrInt_RESERVED, // 55
|
||||
gAvrInt_RESERVED, // 56
|
||||
|
||||
#else
|
||||
gAvrInt_USART2_RX, // 51
|
||||
gAvrInt_USART2_UDRE, // 52
|
||||
gAvrInt_USART2_TX, // 53
|
||||
|
||||
gAvrInt_USART3_RX, // 54
|
||||
gAvrInt_USART3_UDRE, // 55
|
||||
gAvrInt_USART3_TX, // 56
|
||||
#endif
|
||||
gAvrInt_TRN_PLL_LOCK, // 57
|
||||
gAvrInt_TRN_PLL_UNLOCK, // 58
|
||||
gAvrInt_TRN_RX_START, // 59
|
||||
gAvrInt_TRN_RX_END, // 60
|
||||
gAvrInt_TRN_CAAED_DONE, // 61
|
||||
gAvrInt_TRN_FRAME_MATCH,// 62
|
||||
gAvrInt_TRN_TX_END, // 63
|
||||
gAvrInt_TRN_AWAKE, // 64
|
||||
|
||||
gAvrInt_SCNT_CMP1, // 65
|
||||
gAvrInt_SCNT_CMP2, // 66
|
||||
gAvrInt_SCNT_CMP3, // 67
|
||||
gAvrInt_SCNT_OVFL, // 68
|
||||
gAvrInt_SCNT_BACKOFF, // 69
|
||||
gAvrInt_AES_READY, // 70
|
||||
gAvrInt_BAT_LOW, // 71
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(_INTERRUPT_NAMES_DEFINED_)
|
||||
#warning No interrupt string defs for this cpu
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -79,9 +79,27 @@ LICENSE:
|
||||
//* Jul 29, 2010 <MLS> Added recchar_timeout for timing out on bootloading
|
||||
//* Aug 23, 2010 <MLS> Added support for atmega2561
|
||||
//* Aug 26, 2010 <MLS> Removed support for BOOT_BY_SWITCH
|
||||
//* Sep 8, 2010 <MLS> Added support for atmega16
|
||||
//* Nov 9, 2010 <MLS> Issue 392:Fixed bug that 3 !!! in code would cause it to jump to monitor
|
||||
//* Jun 24, 2011 <MLS> Removed analogRead (was not used)
|
||||
//* Dec 29, 2011 <MLS> Issue 181: added watch dog timmer support
|
||||
//* Dec 29, 2011 <MLS> Issue 505: bootloader is comparing the seqNum to 1 or the current sequence
|
||||
//* Jan 1, 2012 <MLS> Issue 543: CMD_CHIP_ERASE_ISP now returns STATUS_CMD_FAILED instead of STATUS_CMD_OK
|
||||
//* Jan 1, 2012 <MLS> Issue 543: Write EEPROM now does something (NOT TESTED)
|
||||
//* Jan 1, 2012 <MLS> Issue 544: stk500v2 bootloader doesn't support reading fuses
|
||||
//************************************************************************
|
||||
|
||||
|
||||
//************************************************************************
|
||||
//* these are used to test issues
|
||||
//* http://code.google.com/p/arduino/issues/detail?id=505
|
||||
//* Reported by mark.stubbs, Mar 14, 2011
|
||||
//* The STK500V2 bootloader is comparing the seqNum to 1 or the current sequence
|
||||
//* (IE: Requiring the sequence to be 1 or match seqNum before continuing).
|
||||
//* The correct behavior is for the STK500V2 to accept the PC's sequence number, and echo it back for the reply message.
|
||||
#define _FIX_ISSUE_505_
|
||||
//************************************************************************
|
||||
//* Issue 181: added watch dog timmer support
|
||||
#define _FIX_ISSUE_181_
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <avr/io.h>
|
||||
@ -95,11 +113,20 @@ LICENSE:
|
||||
#include "command.h"
|
||||
|
||||
|
||||
#if defined(_MEGA_BOARD_) || defined(_BOARD_AMBER128_) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega2561__)
|
||||
#if defined(_MEGA_BOARD_) || defined(_BOARD_AMBER128_) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) \
|
||||
|| defined(__AVR_ATmega2561__) || defined(__AVR_ATmega1284P__) || defined(ENABLE_MONITOR)
|
||||
#undef ENABLE_MONITOR
|
||||
#define ENABLE_MONITOR
|
||||
static void RunMonitor(void);
|
||||
#endif
|
||||
|
||||
#ifndef EEWE
|
||||
#define EEWE 1
|
||||
#endif
|
||||
#ifndef EEMWE
|
||||
#define EEMWE 2
|
||||
#endif
|
||||
|
||||
//#define _DEBUG_SERIAL_
|
||||
//#define _DEBUG_WITH_LEDS_
|
||||
|
||||
@ -131,8 +158,8 @@ LICENSE:
|
||||
#define PROGLED_PORT PORTD
|
||||
#define PROGLED_DDR DDRD
|
||||
#define PROGLED_PIN PINE7
|
||||
#elif defined( _CEREBOTPLUS_BOARD_ )
|
||||
//* this is for the Cerebot 2560 board
|
||||
#elif defined( _CEREBOTPLUS_BOARD_ ) || defined(_CEREBOT_II_BOARD_)
|
||||
//* this is for the Cerebot 2560 board and the Cerebot-ii
|
||||
//* onbarod leds are on PORTE4-7
|
||||
#define PROGLED_PORT PORTE
|
||||
#define PROGLED_DDR DDRE
|
||||
@ -149,6 +176,47 @@ LICENSE:
|
||||
#define PROGLED_PORT PORTA
|
||||
#define PROGLED_DDR DDRA
|
||||
#define PROGLED_PIN PINA3
|
||||
#elif defined( _BOARD_MEGA16 )
|
||||
//* onbarod led is PORTA7
|
||||
#define PROGLED_PORT PORTA
|
||||
#define PROGLED_DDR DDRA
|
||||
#define PROGLED_PIN PINA7
|
||||
#define UART_BAUDRATE_DOUBLE_SPEED 0
|
||||
|
||||
#elif defined( _BOARD_BAHBOT_ )
|
||||
//* dosent have an onboard LED but this is what will probably be added to this port
|
||||
#define PROGLED_PORT PORTB
|
||||
#define PROGLED_DDR DDRB
|
||||
#define PROGLED_PIN PINB0
|
||||
|
||||
#elif defined( _BOARD_ROBOTX_ )
|
||||
#define PROGLED_PORT PORTB
|
||||
#define PROGLED_DDR DDRB
|
||||
#define PROGLED_PIN PINB6
|
||||
#elif defined( _BOARD_CUSTOM1284_BLINK_B0_ )
|
||||
#define PROGLED_PORT PORTB
|
||||
#define PROGLED_DDR DDRB
|
||||
#define PROGLED_PIN PINB0
|
||||
#elif defined( _BOARD_CUSTOM1284_ )
|
||||
#define PROGLED_PORT PORTD
|
||||
#define PROGLED_DDR DDRD
|
||||
#define PROGLED_PIN PIND5
|
||||
#elif defined( _AVRLIP_ )
|
||||
#define PROGLED_PORT PORTB
|
||||
#define PROGLED_DDR DDRB
|
||||
#define PROGLED_PIN PINB5
|
||||
#elif defined( _BOARD_STK500_ )
|
||||
#define PROGLED_PORT PORTA
|
||||
#define PROGLED_DDR DDRA
|
||||
#define PROGLED_PIN PINA7
|
||||
#elif defined( _BOARD_STK502_ )
|
||||
#define PROGLED_PORT PORTB
|
||||
#define PROGLED_DDR DDRB
|
||||
#define PROGLED_PIN PINB5
|
||||
#elif defined( _BOARD_STK525_ )
|
||||
#define PROGLED_PORT PORTB
|
||||
#define PROGLED_DDR DDRB
|
||||
#define PROGLED_PIN PINB7
|
||||
#else
|
||||
#define PROGLED_PORT PORTG
|
||||
#define PROGLED_DDR DDRG
|
||||
@ -164,6 +232,7 @@ LICENSE:
|
||||
#define F_CPU 16000000UL
|
||||
#endif
|
||||
|
||||
#define _BLINK_LOOP_COUNT_ (F_CPU / 2250)
|
||||
/*
|
||||
* UART Baudrate, AVRStudio AVRISP only accepts 115200 bps
|
||||
*/
|
||||
@ -228,12 +297,33 @@ LICENSE:
|
||||
#define SIGNATURE_BYTES 0x1E9801
|
||||
#elif defined (__AVR_ATmega2561__)
|
||||
#define SIGNATURE_BYTES 0x1e9802
|
||||
#elif defined (__AVR_ATmega1284P__)
|
||||
#define SIGNATURE_BYTES 0x1e9705
|
||||
#elif defined (__AVR_ATmega640__)
|
||||
#define SIGNATURE_BYTES 0x1e9608
|
||||
#elif defined (__AVR_ATmega64__)
|
||||
#define SIGNATURE_BYTES 0x1E9602
|
||||
#elif defined (__AVR_ATmega169__)
|
||||
#define SIGNATURE_BYTES 0x1e9405
|
||||
#elif defined (__AVR_AT90USB1287__)
|
||||
#define SIGNATURE_BYTES 0x1e9782
|
||||
#else
|
||||
#error "no signature definition for MCU available"
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__AVR_ATmega8__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) \
|
||||
#if defined(_BOARD_ROBOTX_) || defined(__AVR_AT90USB1287__) || defined(__AVR_AT90USB1286__)
|
||||
#define UART_BAUD_RATE_LOW UBRR1L
|
||||
#define UART_STATUS_REG UCSR1A
|
||||
#define UART_CONTROL_REG UCSR1B
|
||||
#define UART_ENABLE_TRANSMITTER TXEN1
|
||||
#define UART_ENABLE_RECEIVER RXEN1
|
||||
#define UART_TRANSMIT_COMPLETE TXC1
|
||||
#define UART_RECEIVE_COMPLETE RXC1
|
||||
#define UART_DATA_REG UDR1
|
||||
#define UART_DOUBLE_SPEED U2X1
|
||||
|
||||
#elif defined(__AVR_ATmega8__) || defined(__AVR_ATmega16__) || defined(__AVR_ATmega32__) \
|
||||
|| defined(__AVR_ATmega8515__) || defined(__AVR_ATmega8535__)
|
||||
/* ATMega8 with one USART */
|
||||
#define UART_BAUD_RATE_LOW UBRRL
|
||||
@ -258,6 +348,28 @@ LICENSE:
|
||||
#define UART_RECEIVE_COMPLETE RXC0
|
||||
#define UART_DATA_REG UDR0
|
||||
#define UART_DOUBLE_SPEED U2X0
|
||||
#elif defined(UBRR0L) && defined(UCSR0A) && defined(TXEN0)
|
||||
/* ATMega with two USART, use UART0 */
|
||||
#define UART_BAUD_RATE_LOW UBRR0L
|
||||
#define UART_STATUS_REG UCSR0A
|
||||
#define UART_CONTROL_REG UCSR0B
|
||||
#define UART_ENABLE_TRANSMITTER TXEN0
|
||||
#define UART_ENABLE_RECEIVER RXEN0
|
||||
#define UART_TRANSMIT_COMPLETE TXC0
|
||||
#define UART_RECEIVE_COMPLETE RXC0
|
||||
#define UART_DATA_REG UDR0
|
||||
#define UART_DOUBLE_SPEED U2X0
|
||||
#elif defined(UBRRL) && defined(UCSRA) && defined(UCSRB) && defined(TXEN) && defined(RXEN)
|
||||
//* catch all
|
||||
#define UART_BAUD_RATE_LOW UBRRL
|
||||
#define UART_STATUS_REG UCSRA
|
||||
#define UART_CONTROL_REG UCSRB
|
||||
#define UART_ENABLE_TRANSMITTER TXEN
|
||||
#define UART_ENABLE_RECEIVER RXEN
|
||||
#define UART_TRANSMIT_COMPLETE TXC
|
||||
#define UART_RECEIVE_COMPLETE RXC
|
||||
#define UART_DATA_REG UDR
|
||||
#define UART_DOUBLE_SPEED U2X
|
||||
#else
|
||||
#error "no UART definition for MCU available"
|
||||
#endif
|
||||
@ -323,26 +435,16 @@ void __jumpMain(void)
|
||||
|
||||
asm volatile ( ".set __stack, %0" :: "i" (RAMEND) );
|
||||
|
||||
// ldi r16,high(RAMEND)
|
||||
// out SPH,r16 ; Set stack pointer to top of RAM
|
||||
//* set stack pointer to top of RAM
|
||||
|
||||
// asm volatile ( "ldi 16, 0x10");
|
||||
asm volatile ( "ldi 16, %0" :: "i" (RAMEND >> 8) );
|
||||
// asm volatile ( "out 0x3E,16");
|
||||
// asm volatile ( "out %0,16" :: "i" (SPH_REG) );
|
||||
asm volatile ( "out %0,16" :: "i" (AVR_STACK_POINTER_HI_ADDR) );
|
||||
|
||||
// asm volatile ( "ldi 16, 0x00");
|
||||
asm volatile ( "ldi 16, %0" :: "i" (RAMEND & 0x0ff) );
|
||||
// asm volatile ( "out 0x3d,16");
|
||||
// asm volatile ( "out %0,16" :: "i" (SPL_REG) );
|
||||
asm volatile ( "out %0,16" :: "i" (AVR_STACK_POINTER_LO_ADDR) );
|
||||
|
||||
|
||||
|
||||
asm volatile ( "clr __zero_reg__" ); // GCC depends on register r1 set to 0
|
||||
asm volatile ( "out %0, __zero_reg__" :: "I" (_SFR_IO_ADDR(SREG)) ); // set SREG to 0
|
||||
// asm volatile ( "rjmp main"); // jump to main()
|
||||
asm volatile ( "jmp main"); // jump to main()
|
||||
}
|
||||
|
||||
@ -403,7 +505,7 @@ uint32_t count = 0;
|
||||
if (count > MAX_TIME_COUNT)
|
||||
{
|
||||
unsigned int data;
|
||||
#if (FLASHEND > 0x0FFFF)
|
||||
#if (FLASHEND > 0x10000)
|
||||
data = pgm_read_word_far(0); //* get the first word of the user program
|
||||
#else
|
||||
data = pgm_read_word_near(0); //* get the first word of the user program
|
||||
@ -422,6 +524,8 @@ uint32_t count = 0;
|
||||
return UART_DATA_REG;
|
||||
}
|
||||
|
||||
//* for watch dog timer startup
|
||||
void (*app_start)(void) = 0x0000;
|
||||
|
||||
|
||||
//*****************************************************************************
|
||||
@ -442,7 +546,36 @@ int main(void)
|
||||
unsigned long boot_timer;
|
||||
unsigned int boot_state;
|
||||
#ifdef ENABLE_MONITOR
|
||||
unsigned int exPointCntr = 0;
|
||||
unsigned int exPointCntr = 0;
|
||||
unsigned int rcvdCharCntr = 0;
|
||||
#endif
|
||||
|
||||
//* some chips dont set the stack properly
|
||||
asm volatile ( ".set __stack, %0" :: "i" (RAMEND) );
|
||||
asm volatile ( "ldi 16, %0" :: "i" (RAMEND >> 8) );
|
||||
asm volatile ( "out %0,16" :: "i" (AVR_STACK_POINTER_HI_ADDR) );
|
||||
asm volatile ( "ldi 16, %0" :: "i" (RAMEND & 0x0ff) );
|
||||
asm volatile ( "out %0,16" :: "i" (AVR_STACK_POINTER_LO_ADDR) );
|
||||
|
||||
#ifdef _FIX_ISSUE_181_
|
||||
//************************************************************************
|
||||
//* Dec 29, 2011 <MLS> Issue #181, added watch dog timmer support
|
||||
//* handle the watch dog timer
|
||||
uint8_t mcuStatusReg;
|
||||
mcuStatusReg = MCUSR;
|
||||
|
||||
__asm__ __volatile__ ("cli");
|
||||
__asm__ __volatile__ ("wdr");
|
||||
MCUSR = 0;
|
||||
WDTCSR |= _BV(WDCE) | _BV(WDE);
|
||||
WDTCSR = 0;
|
||||
__asm__ __volatile__ ("sei");
|
||||
// check if WDT generated the reset, if so, go straight to app
|
||||
if (mcuStatusReg & _BV(WDRF))
|
||||
{
|
||||
app_start();
|
||||
}
|
||||
//************************************************************************
|
||||
#endif
|
||||
|
||||
|
||||
@ -450,8 +583,9 @@ int main(void)
|
||||
boot_state = 0;
|
||||
|
||||
#ifdef BLINK_LED_WHILE_WAITING
|
||||
boot_timeout = 20000; //* should be about 1 second
|
||||
// boot_timeout = 90000; //* should be about 4 seconds
|
||||
// boot_timeout = 170000;
|
||||
boot_timeout = 20000; //* should be about 1 second
|
||||
#else
|
||||
boot_timeout = 3500000; // 7 seconds , approx 2us per step when optimize "s"
|
||||
#endif
|
||||
@ -516,7 +650,7 @@ int main(void)
|
||||
boot_state = 1; // (after ++ -> boot_state=2 bootloader timeout, jump to main 0x00000 )
|
||||
}
|
||||
#ifdef BLINK_LED_WHILE_WAITING
|
||||
if ((boot_timer % 7000) == 0)
|
||||
if ((boot_timer % _BLINK_LOOP_COUNT_) == 0)
|
||||
{
|
||||
//* toggle the LED
|
||||
PROGLED_PORT ^= (1<<PROGLED_PIN); // turn LED ON
|
||||
@ -547,10 +681,13 @@ int main(void)
|
||||
{
|
||||
// c = recchar();
|
||||
c = recchar_timeout();
|
||||
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MONITOR
|
||||
if (c == '!')
|
||||
rcvdCharCntr++;
|
||||
|
||||
if ((c == '!') && (rcvdCharCntr < 10))
|
||||
{
|
||||
exPointCntr++;
|
||||
if (exPointCntr == 3)
|
||||
@ -579,6 +716,11 @@ int main(void)
|
||||
break;
|
||||
|
||||
case ST_GET_SEQ_NUM:
|
||||
#ifdef _FIX_ISSUE_505_
|
||||
seqNum = c;
|
||||
msgParseState = ST_MSG_SIZE_1;
|
||||
checksum ^= c;
|
||||
#else
|
||||
if ( (c == 1) || (c == seqNum) )
|
||||
{
|
||||
seqNum = c;
|
||||
@ -589,6 +731,7 @@ int main(void)
|
||||
{
|
||||
msgParseState = ST_START;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
||||
case ST_MSG_SIZE_1:
|
||||
@ -655,20 +798,41 @@ int main(void)
|
||||
unsigned char signatureIndex = msgBuffer[6];
|
||||
|
||||
if ( signatureIndex == 0 )
|
||||
answerByte = (SIGNATURE_BYTES >>16) & 0x000000FF;
|
||||
{
|
||||
answerByte = (SIGNATURE_BYTES >> 16) & 0x000000FF;
|
||||
}
|
||||
else if ( signatureIndex == 1 )
|
||||
{
|
||||
answerByte = (SIGNATURE_BYTES >> 8) & 0x000000FF;
|
||||
}
|
||||
else
|
||||
{
|
||||
answerByte = SIGNATURE_BYTES & 0x000000FF;
|
||||
}
|
||||
}
|
||||
else if ( msgBuffer[4] & 0x50 )
|
||||
{
|
||||
answerByte = 0; //read fuse/lock bits not implemented, return dummy value
|
||||
//* Issue 544: stk500v2 bootloader doesn't support reading fuses
|
||||
//* I cant find the docs that say what these are supposed to be but this was figured out by trial and error
|
||||
// answerByte = boot_lock_fuse_bits_get(GET_LOW_FUSE_BITS);
|
||||
// answerByte = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS);
|
||||
// answerByte = boot_lock_fuse_bits_get(GET_EXTENDED_FUSE_BITS);
|
||||
if (msgBuffer[4] == 0x50)
|
||||
{
|
||||
answerByte = boot_lock_fuse_bits_get(GET_LOW_FUSE_BITS);
|
||||
}
|
||||
else if (msgBuffer[4] == 0x58)
|
||||
{
|
||||
answerByte = boot_lock_fuse_bits_get(GET_HIGH_FUSE_BITS);
|
||||
}
|
||||
else
|
||||
{
|
||||
answerByte = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
answerByte = 0; // for all others command are not implemented, return dummy value for AVRDUDE happy <Worapoht>
|
||||
// flag = 1; // Remark this line for AVRDUDE <Worapoht>
|
||||
}
|
||||
if ( !flag )
|
||||
{
|
||||
@ -804,7 +968,8 @@ int main(void)
|
||||
case CMD_CHIP_ERASE_ISP:
|
||||
eraseAddress = 0;
|
||||
msgLength = 2;
|
||||
msgBuffer[1] = STATUS_CMD_OK;
|
||||
// msgBuffer[1] = STATUS_CMD_OK;
|
||||
msgBuffer[1] = STATUS_CMD_FAILED; //* isue 543, return FAILED instead of OK
|
||||
break;
|
||||
|
||||
case CMD_LOAD_ADDRESS:
|
||||
@ -855,23 +1020,17 @@ int main(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if (!defined(__AVR_ATmega1280__) && !defined(__AVR_ATmega2560__) && !defined(__AVR_ATmega2561__))
|
||||
//* issue 543, this should work, It has not been tested.
|
||||
uint16_t ii = address >> 1;
|
||||
/* write EEPROM */
|
||||
do {
|
||||
EEARL = address; // Setup EEPROM address
|
||||
EEARH = (address >> 8);
|
||||
address++; // Select next EEPROM byte
|
||||
|
||||
EEDR = *p++; // get byte from buffer
|
||||
EECR |= (1<<EEMWE); // Write data into EEPROM
|
||||
EECR |= (1<<EEWE);
|
||||
|
||||
while (EECR & (1<<EEWE)); // Wait for write operation to finish
|
||||
size--; // Decrease number of bytes to write
|
||||
} while (size); // Loop until all bytes written
|
||||
#endif
|
||||
while (size) {
|
||||
eeprom_write_byte((uint8_t*)ii, *p++);
|
||||
address+=2; // Select next EEPROM byte
|
||||
ii++;
|
||||
size--;
|
||||
}
|
||||
}
|
||||
msgLength = 2;
|
||||
msgLength = 2;
|
||||
msgBuffer[1] = STATUS_CMD_OK;
|
||||
}
|
||||
break;
|
||||
@ -890,11 +1049,12 @@ int main(void)
|
||||
|
||||
// Read FLASH
|
||||
do {
|
||||
#if defined(RAMPZ)
|
||||
//#if defined(RAMPZ)
|
||||
#if (FLASHEND > 0x10000)
|
||||
data = pgm_read_word_far(address);
|
||||
#else
|
||||
#else
|
||||
data = pgm_read_word_near(address);
|
||||
#endif
|
||||
#endif
|
||||
*p++ = (unsigned char)data; //LSB
|
||||
*p++ = (unsigned char)(data >> 8); //MSB
|
||||
address += 2; // Select next word in memory
|
||||
@ -1056,16 +1216,10 @@ unsigned long gEepromIndex;
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#if defined(__AVR_ATmega128__)
|
||||
#define kCPU_NAME "ATmega128"
|
||||
#elif defined(__AVR_ATmega1280__)
|
||||
#define kCPU_NAME "ATmega1280"
|
||||
#elif defined(__AVR_ATmega1281__)
|
||||
#define kCPU_NAME "ATmega1281"
|
||||
#elif defined(__AVR_ATmega2560__)
|
||||
#define kCPU_NAME "ATmega2560"
|
||||
#elif defined(__AVR_ATmega2561__)
|
||||
#define kCPU_NAME "ATmega2561"
|
||||
#include "avr_cpunames.h"
|
||||
|
||||
#ifndef _AVR_CPU_NAME_
|
||||
#error cpu name not defined
|
||||
#endif
|
||||
|
||||
#ifdef _VECTORS_SIZE
|
||||
@ -1077,78 +1231,79 @@ unsigned long gEepromIndex;
|
||||
|
||||
void PrintDecInt(int theNumber, int digitCnt);
|
||||
|
||||
#ifdef kCPU_NAME
|
||||
prog_char gTextMsg_CPU_Name[] PROGMEM = kCPU_NAME;
|
||||
#ifdef _AVR_CPU_NAME_
|
||||
const char gTextMsg_CPU_Name[] PROGMEM = _AVR_CPU_NAME_;
|
||||
#else
|
||||
prog_char gTextMsg_CPU_Name[] PROGMEM = "UNKNOWN";
|
||||
const char gTextMsg_CPU_Name[] PROGMEM = "UNKNOWN";
|
||||
#endif
|
||||
|
||||
prog_char gTextMsg_Explorer[] PROGMEM = "Arduino explorer stk500V2 by MLS";
|
||||
prog_char gTextMsg_Prompt[] PROGMEM = "Bootloader>";
|
||||
prog_char gTextMsg_HUH[] PROGMEM = "Huh?";
|
||||
prog_char gTextMsg_COMPILED_ON[] PROGMEM = "Compiled on = ";
|
||||
prog_char gTextMsg_CPU_Type[] PROGMEM = "CPU Type = ";
|
||||
prog_char gTextMsg_AVR_ARCH[] PROGMEM = "__AVR_ARCH__ = ";
|
||||
prog_char gTextMsg_AVR_LIBC[] PROGMEM = "AVR LibC Ver = ";
|
||||
prog_char gTextMsg_GCC_VERSION[] PROGMEM = "GCC Version = ";
|
||||
prog_char gTextMsg_CPU_SIGNATURE[] PROGMEM = "CPU signature= ";
|
||||
prog_char gTextMsg_FUSE_BYTE_LOW[] PROGMEM = "Low fuse = ";
|
||||
prog_char gTextMsg_FUSE_BYTE_HIGH[] PROGMEM = "High fuse = ";
|
||||
prog_char gTextMsg_FUSE_BYTE_EXT[] PROGMEM = "Ext fuse = ";
|
||||
prog_char gTextMsg_FUSE_BYTE_LOCK[] PROGMEM = "Lock fuse = ";
|
||||
prog_char gTextMsg_GCC_DATE_STR[] PROGMEM = __DATE__;
|
||||
prog_char gTextMsg_AVR_LIBC_VER_STR[] PROGMEM = __AVR_LIBC_VERSION_STRING__;
|
||||
prog_char gTextMsg_GCC_VERSION_STR[] PROGMEM = __VERSION__;
|
||||
prog_char gTextMsg_VECTOR_HEADER[] PROGMEM = "V# ADDR op code instruction addr Interrupt";
|
||||
prog_char gTextMsg_noVector[] PROGMEM = "no vector";
|
||||
prog_char gTextMsg_rjmp[] PROGMEM = "rjmp ";
|
||||
prog_char gTextMsg_jmp[] PROGMEM = "jmp ";
|
||||
prog_char gTextMsg_WHAT_PORT[] PROGMEM = "What port:";
|
||||
prog_char gTextMsg_PortNotSupported[] PROGMEM = "Port not supported";
|
||||
prog_char gTextMsg_MustBeLetter[] PROGMEM = "Must be a letter";
|
||||
prog_char gTextMsg_SPACE[] PROGMEM = " ";
|
||||
prog_char gTextMsg_WriteToEEprom[] PROGMEM = "Writting EE";
|
||||
prog_char gTextMsg_ReadingEEprom[] PROGMEM = "Reading EE";
|
||||
prog_char gTextMsg_EEPROMerrorCnt[] PROGMEM = "eeprom error count=";
|
||||
prog_char gTextMsg_PORT[] PROGMEM = "PORT";
|
||||
const char gTextMsg_Explorer[] PROGMEM = "Arduino explorer stk500V2 by MLS";
|
||||
const char gTextMsg_Prompt[] PROGMEM = "Bootloader>";
|
||||
const char gTextMsg_HUH[] PROGMEM = "Huh?";
|
||||
const char gTextMsg_COMPILED_ON[] PROGMEM = "Compiled on = ";
|
||||
const char gTextMsg_CPU_Type[] PROGMEM = "CPU Type = ";
|
||||
const char gTextMsg_AVR_ARCH[] PROGMEM = "__AVR_ARCH__= ";
|
||||
const char gTextMsg_AVR_LIBC[] PROGMEM = "AVR LibC Ver= ";
|
||||
const char gTextMsg_GCC_VERSION[] PROGMEM = "GCC Version = ";
|
||||
const char gTextMsg_CPU_SIGNATURE[] PROGMEM = "CPU ID = ";
|
||||
const char gTextMsg_FUSE_BYTE_LOW[] PROGMEM = "Low fuse = ";
|
||||
const char gTextMsg_FUSE_BYTE_HIGH[] PROGMEM = "High fuse = ";
|
||||
const char gTextMsg_FUSE_BYTE_EXT[] PROGMEM = "Ext fuse = ";
|
||||
const char gTextMsg_FUSE_BYTE_LOCK[] PROGMEM = "Lock fuse = ";
|
||||
const char gTextMsg_GCC_DATE_STR[] PROGMEM = __DATE__;
|
||||
const char gTextMsg_AVR_LIBC_VER_STR[] PROGMEM = __AVR_LIBC_VERSION_STRING__;
|
||||
const char gTextMsg_GCC_VERSION_STR[] PROGMEM = __VERSION__;
|
||||
const char gTextMsg_VECTOR_HEADER[] PROGMEM = "V# ADDR op code instruction addr Interrupt";
|
||||
const char gTextMsg_noVector[] PROGMEM = "no vector";
|
||||
const char gTextMsg_rjmp[] PROGMEM = "rjmp ";
|
||||
const char gTextMsg_jmp[] PROGMEM = "jmp ";
|
||||
const char gTextMsg_WHAT_PORT[] PROGMEM = "What port:";
|
||||
const char gTextMsg_PortNotSupported[] PROGMEM = "Port not supported";
|
||||
const char gTextMsg_MustBeLetter[] PROGMEM = "Must be a letter";
|
||||
const char gTextMsg_SPACE[] PROGMEM = " ";
|
||||
const char gTextMsg_WriteToEEprom[] PROGMEM = "Writting EE";
|
||||
const char gTextMsg_ReadingEEprom[] PROGMEM = "Reading EE";
|
||||
const char gTextMsg_EEPROMerrorCnt[] PROGMEM = "EE err cnt=";
|
||||
const char gTextMsg_PORT[] PROGMEM = "PORT";
|
||||
|
||||
|
||||
//************************************************************************
|
||||
//* Help messages
|
||||
prog_char gTextMsg_HELP_MSG_0[] PROGMEM = "0=Zero address ctrs";
|
||||
prog_char gTextMsg_HELP_MSG_QM[] PROGMEM = "?=CPU stats";
|
||||
prog_char gTextMsg_HELP_MSG_AT[] PROGMEM = "@=EEPROM test";
|
||||
prog_char gTextMsg_HELP_MSG_B[] PROGMEM = "B=Blink LED";
|
||||
prog_char gTextMsg_HELP_MSG_E[] PROGMEM = "E=Dump EEPROM";
|
||||
prog_char gTextMsg_HELP_MSG_F[] PROGMEM = "F=Dump FLASH";
|
||||
prog_char gTextMsg_HELP_MSG_H[] PROGMEM = "H=Help";
|
||||
prog_char gTextMsg_HELP_MSG_L[] PROGMEM = "L=List I/O Ports";
|
||||
prog_char gTextMsg_HELP_MSG_Q[] PROGMEM = "Q=Quit & jump to user pgm";
|
||||
prog_char gTextMsg_HELP_MSG_R[] PROGMEM = "R=Dump RAM";
|
||||
prog_char gTextMsg_HELP_MSG_V[] PROGMEM = "V=show interrupt Vectors";
|
||||
prog_char gTextMsg_HELP_MSG_Y[] PROGMEM = "Y=Port blink";
|
||||
const char gTextMsg_HELP_MSG_0[] PROGMEM = "0=Zero addr";
|
||||
const char gTextMsg_HELP_MSG_QM[] PROGMEM = "?=CPU stats";
|
||||
const char gTextMsg_HELP_MSG_AT[] PROGMEM = "@=EEPROM test";
|
||||
const char gTextMsg_HELP_MSG_B[] PROGMEM = "B=Blink LED";
|
||||
const char gTextMsg_HELP_MSG_E[] PROGMEM = "E=Dump EEPROM";
|
||||
const char gTextMsg_HELP_MSG_F[] PROGMEM = "F=Dump FLASH";
|
||||
const char gTextMsg_HELP_MSG_H[] PROGMEM = "H=Help";
|
||||
const char gTextMsg_HELP_MSG_L[] PROGMEM = "L=List I/O Ports";
|
||||
// const char gTextMsg_HELP_MSG_Q[] PROGMEM = "Q=Quit & jump to user pgm";
|
||||
const char gTextMsg_HELP_MSG_Q[] PROGMEM = "Q=Quit";
|
||||
const char gTextMsg_HELP_MSG_R[] PROGMEM = "R=Dump RAM";
|
||||
const char gTextMsg_HELP_MSG_V[] PROGMEM = "V=show interrupt Vectors";
|
||||
const char gTextMsg_HELP_MSG_Y[] PROGMEM = "Y=Port blink";
|
||||
|
||||
prog_char gTextMsg_END[] PROGMEM = "*";
|
||||
const char gTextMsg_END[] PROGMEM = "*";
|
||||
|
||||
|
||||
//************************************************************************
|
||||
void PrintFromPROGMEM(void *dataPtr, unsigned char offset)
|
||||
void PrintFromPROGMEM(const void *dataPtr, unsigned char offset)
|
||||
{
|
||||
uint8_t ii;
|
||||
char theChar;
|
||||
|
||||
ii = offset;
|
||||
theChar = 1;
|
||||
dataPtr += offset;
|
||||
|
||||
while (theChar != 0)
|
||||
{
|
||||
theChar = pgm_read_byte_far((uint32_t)dataPtr + ii);
|
||||
do {
|
||||
#if (FLASHEND > 0x10000)
|
||||
theChar = pgm_read_byte_far((uint16_t)dataPtr++);
|
||||
#else
|
||||
theChar = pgm_read_byte_near((uint16_t)dataPtr++);
|
||||
#endif
|
||||
if (theChar != 0)
|
||||
{
|
||||
sendchar(theChar);
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
} while (theChar != 0);
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
@ -1160,7 +1315,7 @@ void PrintNewLine(void)
|
||||
|
||||
|
||||
//************************************************************************
|
||||
void PrintFromPROGMEMln(void *dataPtr, unsigned char offset)
|
||||
void PrintFromPROGMEMln(const void *dataPtr, unsigned char offset)
|
||||
{
|
||||
PrintFromPROGMEM(dataPtr, offset);
|
||||
|
||||
@ -1293,46 +1448,6 @@ unsigned char fuseByte;
|
||||
|
||||
}
|
||||
|
||||
#ifndef sbi
|
||||
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
|
||||
#endif
|
||||
|
||||
//************************************************************************
|
||||
int analogRead(uint8_t pin)
|
||||
{
|
||||
uint8_t low, high;
|
||||
|
||||
// set the analog reference (high two bits of ADMUX) and select the
|
||||
// channel (low 4 bits). this also sets ADLAR (left-adjust result)
|
||||
// to 0 (the default).
|
||||
// ADMUX = (analog_reference << 6) | (pin & 0x07);
|
||||
ADMUX = (1 << 6) | (pin & 0x07);
|
||||
|
||||
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
|
||||
// the MUX5 bit of ADCSRB selects whether we're reading from channels
|
||||
// 0 to 7 (MUX5 low) or 8 to 15 (MUX5 high).
|
||||
ADCSRB = (ADCSRB & ~(1 << MUX5)) | (((pin >> 3) & 0x01) << MUX5);
|
||||
#endif
|
||||
|
||||
// without a delay, we seem to read from the wrong channel
|
||||
//delay(1);
|
||||
|
||||
// start the conversion
|
||||
sbi(ADCSRA, ADSC);
|
||||
|
||||
// ADSC is cleared when the conversion finishes
|
||||
while (bit_is_set(ADCSRA, ADSC));
|
||||
|
||||
// we have to read ADCL first; doing so locks both ADCL
|
||||
// and ADCH until ADCH is read. reading ADCL second would
|
||||
// cause the results of each conversion to be discarded,
|
||||
// as ADCL and ADCH would be locked when it completed.
|
||||
low = ADCL;
|
||||
high = ADCH;
|
||||
|
||||
// combine the two bytes
|
||||
return (high << 8) | low;
|
||||
}
|
||||
|
||||
//************************************************************************
|
||||
static void BlinkLED(void)
|
||||
@ -1388,11 +1503,15 @@ unsigned char *ramPtr;
|
||||
switch(dumpWhat)
|
||||
{
|
||||
case kDUMP_FLASH:
|
||||
#if (FLASHEND > 0x10000)
|
||||
theValue = pgm_read_byte_far(myAddressPointer);
|
||||
#else
|
||||
theValue = pgm_read_byte_near(myAddressPointer);
|
||||
#endif
|
||||
break;
|
||||
|
||||
case kDUMP_EEPROM:
|
||||
theValue = eeprom_read_byte((void *)myAddressPointer);
|
||||
theValue = eeprom_read_byte((uint8_t *)(uint16_t)myAddressPointer);
|
||||
break;
|
||||
|
||||
case kDUMP_RAM:
|
||||
@ -1435,7 +1554,11 @@ int errorCount;
|
||||
PrintFromPROGMEMln(gTextMsg_WriteToEEprom, 0);
|
||||
PrintNewLine();
|
||||
ii = 0;
|
||||
while (((theChar = pgm_read_byte_far(gTextMsg_Explorer + ii)) != '*') && (ii < 512))
|
||||
#if (FLASHEND > 0x10000)
|
||||
while (((theChar = pgm_read_byte_far(((uint16_t)gTextMsg_Explorer) + ii)) != '*') && (ii < 512))
|
||||
#else
|
||||
while (((theChar = pgm_read_byte_near(((uint16_t)gTextMsg_Explorer) + ii)) != '*') && (ii < 512))
|
||||
#endif
|
||||
{
|
||||
eeprom_write_byte((uint8_t *)ii, theChar);
|
||||
if (theChar == 0)
|
||||
@ -1456,7 +1579,11 @@ int errorCount;
|
||||
PrintNewLine();
|
||||
errorCount = 0;
|
||||
ii = 0;
|
||||
while (((theChar = pgm_read_byte_far(gTextMsg_Explorer + ii)) != '*') && (ii < 512))
|
||||
#if (FLASHEND > 0x10000)
|
||||
while (((theChar = pgm_read_byte_far((uint16_t)gTextMsg_Explorer + ii)) != '*') && (ii < 512))
|
||||
#else
|
||||
while (((theChar = pgm_read_byte_near((uint16_t)gTextMsg_Explorer + ii)) != '*') && (ii < 512))
|
||||
#endif
|
||||
{
|
||||
theEEPROMchar = eeprom_read_byte((uint8_t *)ii);
|
||||
if (theEEPROMchar == 0)
|
||||
@ -1487,10 +1614,12 @@ int errorCount;
|
||||
|
||||
|
||||
#if (FLASHEND > 0x08000)
|
||||
#include "avrinterruptnames.h"
|
||||
#ifndef _INTERRUPT_NAMES_DEFINED_
|
||||
#warning Interrupt vectors not defined
|
||||
#endif
|
||||
//* this includes the interrupt names for the monitor portion. There is no longer enough
|
||||
//* memory to include this
|
||||
// #include "avrinterruptnames.h"
|
||||
// #ifndef _INTERRUPT_NAMES_DEFINED_
|
||||
// #warning Interrupt vectors not defined
|
||||
// #endif
|
||||
#endif
|
||||
|
||||
//************************************************************************
|
||||
@ -1534,12 +1663,18 @@ unsigned long absoluteAddr;
|
||||
|
||||
|
||||
//* the AVR is LITTLE ENDIAN, swap the byte order
|
||||
#if (FLASHEND > 0x10000)
|
||||
byte1 = pgm_read_byte_far(myMemoryPtr++);
|
||||
byte2 = pgm_read_byte_far(myMemoryPtr++);
|
||||
word1 = (byte2 << 8) + byte1;
|
||||
|
||||
byte3 = pgm_read_byte_far(myMemoryPtr++);
|
||||
byte4 = pgm_read_byte_far(myMemoryPtr++);
|
||||
#else
|
||||
byte1 = pgm_read_byte_near(myMemoryPtr++);
|
||||
byte2 = pgm_read_byte_near(myMemoryPtr++);
|
||||
byte3 = pgm_read_byte_near(myMemoryPtr++);
|
||||
byte4 = pgm_read_byte_near(myMemoryPtr++);
|
||||
#endif
|
||||
word1 = (byte2 << 8) + byte1;
|
||||
word2 = (byte4 << 8) + byte3;
|
||||
|
||||
|
||||
@ -1596,7 +1731,11 @@ unsigned long absoluteAddr;
|
||||
|
||||
#if defined(_INTERRUPT_NAMES_DEFINED_)
|
||||
sendchar(0x20);
|
||||
#if (FLASHEND > 0x10000)
|
||||
stringPointer = pgm_read_word_far(&(gInterruptNameTable[vectorIndex]));
|
||||
#else
|
||||
stringPointer = pgm_read_word_near(&(gInterruptNameTable[vectorIndex]));
|
||||
#endif
|
||||
PrintFromPROGMEM((char *)stringPointer, 0);
|
||||
#endif
|
||||
PrintNewLine();
|
||||
@ -1895,13 +2034,7 @@ int ii, jj;
|
||||
{
|
||||
theChar = theChar & 0x5F;
|
||||
}
|
||||
#if defined( _CEREBOTPLUS_BOARD_ )
|
||||
if (theChar == 0x5F)
|
||||
{
|
||||
|
||||
}
|
||||
else
|
||||
#endif
|
||||
|
||||
if (theChar >= 0x20)
|
||||
{
|
||||
sendchar(theChar);
|
||||
@ -1979,12 +2112,6 @@ int ii, jj;
|
||||
AVR_PortOutput();
|
||||
break;
|
||||
|
||||
#if defined( _CEREBOTPLUS_BOARD_ )
|
||||
case 0x5F:
|
||||
//* do nothing
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
PrintFromPROGMEMln(gTextMsg_HUH, 0);
|
||||
break;
|
||||
|
0
hardware/arduino/avr/bootloaders/stk500v2/stk500boot.ppg
Executable file → Normal file
0
hardware/arduino/avr/bootloaders/stk500v2/stk500boot.ppg
Executable file → Normal file
@ -1,513 +1,469 @@
|
||||
:020000023000CC
|
||||
:10E000000D94F6F20D941FF30D941FF30D941FF36E
|
||||
:10E010000D941FF30D941FF30D941FF30D941FF334
|
||||
:10E020000D941FF30D941FF30D941FF30D941FF324
|
||||
:10E030000D941FF30D941FF30D941FF30D941FF314
|
||||
:10E040000D941FF30D941FF30D941FF30D941FF304
|
||||
:10E050000D941FF30D941FF30D941FF30D941FF3F4
|
||||
:10E060000D941FF30D941FF30D941FF30D941FF3E4
|
||||
:10E070000D941FF30D941FF30D941FF30D941FF3D4
|
||||
:10E080000D941FF30D941FF30D941FF30D941FF3C4
|
||||
:10E090000D941FF30D941FF30D941FF30D941FF3B4
|
||||
:10E0A0000D941FF30D941FF30D941FF30D941FF3A4
|
||||
:10E0B0000D941FF30D941FF30D941FF30D941FF394
|
||||
:10E0C0000D941FF30D941FF30D941FF30D941FF384
|
||||
:10E0D0000D941FF30D941FF30D941FF30D941FF374
|
||||
:10E0E0000D941FF341546D65676132353630004140
|
||||
:10E000000D9489F10D94B2F10D94B2F10D94B2F129
|
||||
:10E010000D94B2F10D94B2F10D94B2F10D94B2F1F0
|
||||
:10E020000D94B2F10D94B2F10D94B2F10D94B2F1E0
|
||||
:10E030000D94B2F10D94B2F10D94B2F10D94B2F1D0
|
||||
:10E040000D94B2F10D94B2F10D94B2F10D94B2F1C0
|
||||
:10E050000D94B2F10D94B2F10D94B2F10D94B2F1B0
|
||||
:10E060000D94B2F10D94B2F10D94B2F10D94B2F1A0
|
||||
:10E070000D94B2F10D94B2F10D94B2F10D94B2F190
|
||||
:10E080000D94B2F10D94B2F10D94B2F10D94B2F180
|
||||
:10E090000D94B2F10D94B2F10D94B2F10D94B2F170
|
||||
:10E0A0000D94B2F10D94B2F10D94B2F10D94B2F160
|
||||
:10E0B0000D94B2F10D94B2F10D94B2F10D94B2F150
|
||||
:10E0C0000D94B2F10D94B2F10D94B2F10D94B2F140
|
||||
:10E0D0000D94B2F10D94B2F10D94B2F10D94B2F130
|
||||
:10E0E0000D94B2F141546D656761323536300041AF
|
||||
:10E0F000726475696E6F206578706C6F72657220DE
|
||||
:10E1000073746B3530305632206279204D4C530099
|
||||
:10E11000426F6F746C6F616465723E004875683F52
|
||||
:10E1200000436F6D70696C6564206F6E20203D2028
|
||||
:10E1300000435055205479706520202020203D2038
|
||||
:10E14000005F5F4156525F415243485F5F203D2070
|
||||
:10E1500000415652204C69624320566572203D2092
|
||||
:10E16000004743432056657273696F6E20203D203F
|
||||
:10E1700000435055207369676E61747572653D2068
|
||||
:10E18000004C6F77206675736520202020203D208D
|
||||
:10E1900000486967682066757365202020203D204F
|
||||
:10E1A00000457874206675736520202020203D206E
|
||||
:10E1B000004C6F636B2066757365202020203D2026
|
||||
:10E1C00000536570202039203230313000312E3636
|
||||
:10E1D0002E3700342E332E33005623202020414486
|
||||
:10E1E00044522020206F7020636F6465202020201F
|
||||
:10E1F00020696E737472756374696F6E20616464F4
|
||||
:10E2000072202020496E74657272757074006E6F92
|
||||
:10E2100020766563746F7200726A6D702020006AE8
|
||||
:10E220006D7020005768617420706F72743A0050EE
|
||||
:10E230006F7274206E6F7420737570706F72746576
|
||||
:10E2400064004D7573742062652061206C65747480
|
||||
:10E2500065720020005772697474696E67204545C5
|
||||
:10E260000052656164696E6720454500656570729E
|
||||
:10E270006F6D206572726F7220636F756E743D00F2
|
||||
:10E28000504F525400303D5A65726F206164647281
|
||||
:10E290006573732063747273003F3D435055207360
|
||||
:10E2A0007461747300403D454550524F4D20746574
|
||||
:10E2B000737400423D426C696E6B204C45440045CE
|
||||
:10E2C0003D44756D7020454550524F4D00463D44CC
|
||||
:10E2D000756D7020464C41534800483D48656C7050
|
||||
:10E2E000004C3D4C69737420492F4F20506F72745D
|
||||
:10E2F0007300513D517569742026206A756D702038
|
||||
:10E30000746F20757365722070676D00523D44759F
|
||||
:10E310006D702052414D00563D73686F7720696ED5
|
||||
:10E320007465727275707420566563746F727300D1
|
||||
:10E33000593D506F727420626C696E6B002A0052F6
|
||||
:10E340004553455400494E543000494E543100491C
|
||||
:10E350004E543200494E543300494E543400494E15
|
||||
:10E36000543500494E543600494E54370050434905
|
||||
:10E370004E5430005043494E5431005043494E549E
|
||||
:10E3800032005744540054494D45523020434F4DBC
|
||||
:10E3900050410054494D45523020434F4D504200AA
|
||||
:10E3A00054494D455230204F56460054494D455230
|
||||
:10E3B0003120434150540054494D45523120434F80
|
||||
:10E3C0004D50410054494D45523120434F4D50422C
|
||||
:10E3D0000054494D45523120434F4D50430054495C
|
||||
:10E3E0004D455231204F56460054494D455232203A
|
||||
:10E3F000434F4D50410054494D45523220434F4DFB
|
||||
:10E4000050420054494D455232204F56460054491F
|
||||
:10E410004D45523320434150540054494D455233E9
|
||||
:10E4200020434F4D50410054494D45523320434FF6
|
||||
:10E430004D50420054494D45523320434F4D5043B7
|
||||
:10E440000054494D455233204F56460054494D45DE
|
||||
:10E45000523420434150540054494D4552342043D6
|
||||
:10E460004F4D50410054494D45523420434F4D507B
|
||||
:10E47000420054494D45523420434F4D50430054BF
|
||||
:10E48000494D455234204F56460054494D4552356A
|
||||
:10E4900020434150540054494D45523520434F4D7F
|
||||
:10E4A00050410054494D45523520434F4D50420094
|
||||
:10E4B00054494D45523520434F4D50430054494D2A
|
||||
:10E4C000455235204F564600555341525430205244
|
||||
:10E4D000580055534152543020554452450055532D
|
||||
:10E4E0004152543020545800555341525431205217
|
||||
:10E4F000580055534152543120554452450055530C
|
||||
:10E5000041525431205458005553415254322052F4
|
||||
:10E5100058005553415254322055445245005553EA
|
||||
:10E5200041525432205458005553415254332052D2
|
||||
:10E5300058005553415254332055445245005553C9
|
||||
:10E5400041525433205458005350492053544300EF
|
||||
:10E5500041444300414E414C4F4720434F4D5000F2
|
||||
:10E560004545205245414459005457490053504DA8
|
||||
:10E57000205245414459002A003FE345E34AE34F16
|
||||
:10E58000E354E359E35EE363E368E36DE374E37B41
|
||||
:10E59000E382E3E9E3F6E303E4ABE3B7E3C4E3D107
|
||||
:10E5A000E3DEE386E393E3A0E348E5C8E4D2E4DEF8
|
||||
:10E5B000E454E550E560E50EE41AE427E434E44170
|
||||
:10E5C000E4E8E4F2E4FEE469E56DE54CE458E46572
|
||||
:10E5D000E472E47FE48AE496E4A3E4B0E4BDE408F2
|
||||
:10E5E000E512E51EE528E532E53EE50011241FBEF3
|
||||
:10E5F000CFEFD1E2DEBFCDBF01E00CBF12E0A0E063
|
||||
:10E60000B2E0EAEDFFEF03E00BBF02C007900D920E
|
||||
:10E61000A030B107D9F712E0A0E0B2E001C01D922E
|
||||
:10E62000AC30B107E1F70F94FBF40D94EBFF01E27E
|
||||
:10E630000EBF0FEF0DBF11241FBE0D94FBF40D9400
|
||||
:10E6400000F020E030E040ED57E005C0FA013197DE
|
||||
:10E65000F1F72F5F3F4F28173907C0F308959C014A
|
||||
:10E66000442737FD4095542FDA01C901860F911DCB
|
||||
:10E67000A11DB11DABBFFC018791882369F0809378
|
||||
:10E68000C6008091C00086FFFCCF8091C0008064EE
|
||||
:10E690008093C0006F5FE8CF08958DE08093C6003F
|
||||
:10E6A0008091C00086FFFCCF8091C0008064809381
|
||||
:10E6B000C0008AE08093C6008091C00086FFFCCF36
|
||||
:10E6C0008091C00080648093C00008950F942FF360
|
||||
:10E6D0000F944DF30895FC019081992359F0909384
|
||||
:10E6E000C6008091C00086FFFCCF8091C00080648E
|
||||
:10E6F0008093C0003196992379F70895282F982F99
|
||||
:10E7000092959F70892F805D8A3308F0895F80938E
|
||||
:10E71000C6008091C00086FFFCCF8091C00080645D
|
||||
:10E720008093C000822F8F70982F905D9A3308F0ED
|
||||
:10E73000995F9093C6008091C00086FFFCCF8091C6
|
||||
:10E74000C00080648093C00008959C01FB01853661
|
||||
:10E7500091051CF46330710594F0C90164E670E022
|
||||
:10E760000F948CFF605D7F4F6093C6008091C00066
|
||||
:10E7700086FFFCCF8091C00080648093C0002B3066
|
||||
:10E78000310514F43297B4F0C90164E670E00F94D7
|
||||
:10E790008CFF6AE070E00F948CFF605D7F4F6093A8
|
||||
:10E7A000C6008091C00086FFFCCF8091C0008064CD
|
||||
:10E7B0008093C000C9016AE070E00F948CFFC0969E
|
||||
:10E7C0008093C6008091C00086FFFCCF8091C0007E
|
||||
:10E7D00080648093C0000895282F277020642093C0
|
||||
:10E7E0007C0020917B0086958695869590E08170CF
|
||||
:10E7F000907033E0880F991F3A95E1F7277F282B17
|
||||
:10E8000020937B0080917A00806480937A008091CD
|
||||
:10E810007A0086FDFCCF2091780040917900942FFA
|
||||
:10E8200080E030E0282B392BC90108951F93182F61
|
||||
:10E8300080E892EE60E00F942FF31093C600809171
|
||||
:10E84000C00086FFFCCF8091C00080648093C00030
|
||||
:10E850000F944DF31F9108952F923F924F925F9224
|
||||
:10E860006F927F928F929F92AF92BF92CF92DF92E0
|
||||
:10E87000EF92FF920F931F93DF93CF93CDB7DEB745
|
||||
:10E8800062970FB6F894DEBF0FBECDBF382E622E52
|
||||
:10E89000CA01DB015C016D01772460E2262E2E01A6
|
||||
:10E8A0000894411C511C8BC081E0A81680E0B8067A
|
||||
:10E8B00081E0C80680E0D80628F0C601AA27BB2759
|
||||
:10E8C0000F947EF3BB27AD2D9C2D8B2D0F947EF3E3
|
||||
:10E8D0008A2D0F947EF32092C6008091C00086FF9F
|
||||
:10E8E000FCCF8091C00080648093C0009DE2909333
|
||||
:10E8F000C6008091C00086FFFCCF8091C00080647C
|
||||
:10E900008093C0002092C6008091C00086FFFCCF9B
|
||||
:10E910008091C00080648093C000198286017501D7
|
||||
:10E9200088249924A1E03A1651F03A1620F0B2E07A
|
||||
:10E930003B1661F409C00BBFF701779007C0C70110
|
||||
:10E940000F94D5FF782E02C0F7017080872D0F94A9
|
||||
:10E950007EF32092C6008091C00086FFFCCF80919C
|
||||
:10E96000C00080648093C000872D8052F401EF7056
|
||||
:10E97000F0708F3520F4E40DF51D708204C0E40DB5
|
||||
:10E98000F51D8EE280830894E11CF11C011D111D10
|
||||
:10E990000894811C911C90E18916910409F0C2CF62
|
||||
:10E9A00080E190E0A0E0B0E0A80EB91ECA1EDB1E18
|
||||
:10E9B000198AC2010F946BF30F944DF36A94662089
|
||||
:10E9C00009F072CF62960FB6F894DEBF0FBECDBFCE
|
||||
:10E9D000CF91DF911F910F91FF90EF90DF90CF903B
|
||||
:10E9E000BF90AF909F908F907F906F905F904F906F
|
||||
:10E9F0003F902F9008952F923F924F925F926F9287
|
||||
:10EA00007F928F929F92AF92BF92CF92DF92EF92BE
|
||||
:10EA1000FF920F931F93DF93CF93CDB7DEB7CD5304
|
||||
:10EA2000D1400FB6F894DEBF0FBECDBF279A2F9A04
|
||||
:10EA30008091C00082608093C00080E18093C40018
|
||||
:10EA400088E18093C1000000EE24FF248701B4E038
|
||||
:10EA5000AB2EB12CCC24DD2424C0C5010197F1F7E5
|
||||
:10EA60000894E11CF11C011D111D21E2E2162EE4A7
|
||||
:10EA7000F20620E0020720E0120718F0A1E0CA2EFB
|
||||
:10EA8000D12CC801B70128E53BE140E050E00F94EC
|
||||
:10EA90009FFF611571058105910519F485B18058B5
|
||||
:10EAA00085B98091C00087FD03C0C114D104A9F2CB
|
||||
:10EAB000A6014F5F5F4FC25EDE4F59834883CE5140
|
||||
:10EAC000D140C25EDE4F68817981CE51D140613044
|
||||
:10EAD000710511F00D946EFFC05DDE4F1982188232
|
||||
:10EAE000C053D14060E0C15DDE4F1882CF52D140AB
|
||||
:10EAF000AA24BB24C05EDE4F188219821A821B82B0
|
||||
:10EB0000C052D140CE5CDE4F188219821A821B821D
|
||||
:10EB1000C253D14080E090E0A0E0B0E0ABBFFC0188
|
||||
:10EB2000A791B691C45CDE4FB983A883CC53D14082
|
||||
:10EB30000D9469FFC25EDE4FE881F981CE51D1406C
|
||||
:10EB4000319709F52091C600C25EDE4F1982188206
|
||||
:10EB5000CE51D14022C02F5F3F4F4F4F5F4F2130EA
|
||||
:10EB6000F2E13F07FAE74F07F0E05F0780F0C45C8F
|
||||
:10EB7000DE4F08811981CC53D1400F5F1F4F19F030
|
||||
:10EB8000EE27FF27099420E030E040E050E080913C
|
||||
:10EB9000C00087FFE0CF2091C600213209F094C663
|
||||
:10EBA0000894A11CB11C33E0A316B10409F08EC671
|
||||
:10EBB00000E010E018C041E24093C6008091C00020
|
||||
:10EBC00086FFFCCF8091C00080648093C0002F5FDF
|
||||
:10EBD0003F4F2931310579F70F944DF30F5F1F4FE8
|
||||
:10EBE0000530110519F020E030E0E5CF1092080261
|
||||
:10EBF0001092090210920A0210920B021092040263
|
||||
:10EC00001092050210920602109207021092000262
|
||||
:10EC10001092010210920202109203028FEE90EE07
|
||||
:10EC200060E00F9466F380E191EE60E00F942FF3C3
|
||||
:10EC30008091C00087FFFCCF9091C600903608F00D
|
||||
:10EC40009F759032B8F09093C6008091C00086FF07
|
||||
:10EC5000FCCF8091C00080648093C00080E28093EC
|
||||
:10EC6000C6008091C00086FFFCCF8091C000806408
|
||||
:10EC70008093C000983409F4DBC19934B8F492341D
|
||||
:10EC800009F45DC1933458F4903319F1903308F4CA
|
||||
:10EC900018C69F33A1F1903409F013C6BDC0953456
|
||||
:10ECA00009F474C1963409F00CC69CC1923509F47C
|
||||
:10ECB0002FC2933538F49C3409F4F9C1913509F029
|
||||
:10ECC00000C61CC2963509F449C2993509F0F9C548
|
||||
:10ECD0009CC485E892EE62E00F9466F31092040201
|
||||
:10ECE000109205021092060210920702109208027A
|
||||
:10ECF0001092090210920A0210920B0217C189E9C0
|
||||
:10ED000092EE62E00F9466F38FEE90EE60E00F9467
|
||||
:10ED100066F381E291EE60E00F942FF381EC91EEC7
|
||||
:10ED200060E00F9466F381E391EE60E00F942FF3BF
|
||||
:10ED300084EE90EE60E00F9466F381E491EE60E083
|
||||
:10ED40000F942FF386E090E061E070E00F94A5F35C
|
||||
:10ED50000F944DF381E691EE60E00F942FF383ED75
|
||||
:10ED600091EE60E00F9466F381E591EE60E00F9420
|
||||
:10ED70002FF38DEC91EE60E00F9466F381E791EE56
|
||||
:10ED800060E00F942FF38EE10F947EF388E90F94E7
|
||||
:10ED90007EF381E00F947EF30F944DF381E891EEC2
|
||||
:10EDA00060E00F942FF319E0E0E0F0E010935700DB
|
||||
:10EDB000E4918E2F0F947EF30F944DF381E991EE41
|
||||
:10EDC00060E00F942FF3E3E0F0E010935700E4913C
|
||||
:10EDD0008E2F0F947EF30F944DF381EA91EE60E055
|
||||
:10EDE0000F942FF3E2E0F0E010935700E4918E2FA0
|
||||
:10EDF0000F947EF30F944DF381EB91EE60E00F944E
|
||||
:10EE00002FF3E1E0F0E0109357001491812F0F945D
|
||||
:10EE10007EF30F944DF307CF85EA92EE62E00F94F4
|
||||
:10EE200066F385E592EE60E00F9466F30F944DF380
|
||||
:10EE300000E010E019C0C8016F2D0F94DDFFFF2026
|
||||
:10EE400031F483E592EE60E00F942FF30BC0F09263
|
||||
:10EE5000C6008091C00086FFFCCF8091C000806416
|
||||
:10EE60008093C0000F5F1F4FC80181519F41AA27A7
|
||||
:10EE700097FDA095BA2FABBFFC01F7905AE2F516AB
|
||||
:10EE800021F062E000301607B1F60F944DF30F94B5
|
||||
:10EE90004DF381E692EE60E00F9466F30F944DF32C
|
||||
:10EEA000CC24DD2400E010E01EC0C8010F94D5FF83
|
||||
:10EEB000F82E882331F483E592EE60E00F942FF36F
|
||||
:10EEC0000BC08093C6008091C00086FFFCCF80916C
|
||||
:10EED000C00080648093C000FE1419F00894C11C27
|
||||
:10EEE000D11C0F5F1F4FC80181519F41AA2797FD79
|
||||
:10EEF000A095BA2FABBFFC01E7907AE2E71621F0AC
|
||||
:10EF000082E00030180789F60F944DF30F944DF30B
|
||||
:10EF10008CE692EE60E00F942FF3C60161E070E0A2
|
||||
:10EF20000F94A5F30F944DF30F944DF3109200023C
|
||||
:10EF300010920102109202021092030274CE83EB2F
|
||||
:10EF400092EE62E00F9466F3279A2F9A16C02F98DC
|
||||
:10EF500080E090E0E0EDF7E03197F1F7019684363C
|
||||
:10EF60009105C1F72F9A80E090E0E0EDF7E031974E
|
||||
:10EF7000F1F7019684369105C1F78091C00087FFB3
|
||||
:10EF8000E6CF8091C00087FFFCCF95C48FEB92EE57
|
||||
:10EF900062E00F9466F3409100025091010260918B
|
||||
:10EFA00002027091030281E020E10F942CF4809121
|
||||
:10EFB000000290910102A0910202B09103028050E0
|
||||
:10EFC0009F4FAF4FBF4F8093000290930102A093D9
|
||||
:10EFD0000202B093030280509041A040B04008F478
|
||||
:10EFE00022CEA4CF8DEC92EE62E00F9466F34091B6
|
||||
:10EFF000040250910502609106027091070280E0C0
|
||||
:10F0000020E10F942CF48091040290910502A091CC
|
||||
:10F010000602B091070280509F4FAF4FBF4F8093C1
|
||||
:10F02000040290930502A0930602B0930702FBCD61
|
||||
:10F030008AED92EE62E00F9466F385E892EE60E06E
|
||||
:10F040000F9466F389E992EE60E00F9466F385EA27
|
||||
:10F0500092EE60E00F9466F383EB92EE60E00F9423
|
||||
:10F0600066F38FEB92EE60E00F9466F38DEC92EE18
|
||||
:10F0700060E00F9466F38AED92EE60E00F9466F321
|
||||
:10F0800081EE92EE60E00F9466F382EF92EE60E024
|
||||
:10F090000F9466F38CE093EE60E00F9466F387E1E3
|
||||
:10F0A00093EE60E00F9466F380E393EEB9CD81EECA
|
||||
:10F0B00092EE62E00F9466F381E40F9416F482E41A
|
||||
:10F0C0000F9416F483E40F9416F484E40F9416F46A
|
||||
:10F0D00085E40F9416F486E40F9416F487E40F94F5
|
||||
:10F0E00016F488E40F9416F48AE40F9416F48BE473
|
||||
:10F0F0000F9416F48CE40F9416F495CD82EF92EEF3
|
||||
:10F1000062E00F9466F399249394AA24BB2445C427
|
||||
:10F110008CE093EE62E00F9466F340910802509108
|
||||
:10F12000090260910A0270910B0282E020E10F94C3
|
||||
:10F130002CF48091080290910902A0910A02B091EA
|
||||
:10F140000B0280509F4FAF4FBF4F809308029093A8
|
||||
:10F150000902A0930A02B0930B0265CD87E193EEFA
|
||||
:10F1600062E00F9466F384EE90EE60E00F9466F335
|
||||
:10F1700089ED91EE60E00F9466F309E715EECC5D42
|
||||
:10F18000DE4F19830883C452D1406624772443019B
|
||||
:10F19000CA5DDE4F19821882C652D140A401930184
|
||||
:10F1A0005695479537952795C85DDE4F2883398357
|
||||
:10F1B0004A835B83C852D140CA5DDE4F4881598182
|
||||
:10F1C000C652D1404F5F5F4FCA5DDE4F59834883BF
|
||||
:10F1D000C652D140CA0162E070E00F94A5F350E23C
|
||||
:10F1E0005093C6008091C00086FFFCCF8091C00084
|
||||
:10F1F00080648093C0006DE26093C6008091C0007F
|
||||
:10F2000086FFFCCF8091C00080648093C00070E2D4
|
||||
:10F210007093C6008091C00086FFFCCF8091C00033
|
||||
:10F2200080648093C000C85DDE4FE880F9800A8169
|
||||
:10F230001B81C852D140BB27A12F902F8F2D0F9437
|
||||
:10F240007EF3C85DDE4F8881C852D1400F947EF3B3
|
||||
:10F2500070E2F72EF092C6008091C00086FFFCCFCE
|
||||
:10F260008091C00080648093C0000DE30093C600CD
|
||||
:10F270008091C00086FFFCCF8091C00080648093A5
|
||||
:10F28000C00010E21093C6008091C00086FFFCCF42
|
||||
:10F290008091C00080648093C0008BBEF3012791F1
|
||||
:10F2A000C45DDE4F2883CC52D140A22EBB24CC2497
|
||||
:10F2B000DD240894611C711C811C911C8BBEF30120
|
||||
:10F2C0008791282E332444245524142D032DF22C09
|
||||
:10F2D000EE24EA0CFB1C0C1D1D1D0894611C711C06
|
||||
:10F2E000811C911C8BBEF3013791C35DDE4F3883C7
|
||||
:10F2F000CD52D1400894611C711C811C911C8BBEA5
|
||||
:10F30000F3014791C25DDE4F4883CE52D1402DEFCD
|
||||
:10F310003FEF4FEF5FEF620E731E841E951E0F943A
|
||||
:10F320007EF330E23093C6008091C00086FFFCCFB0
|
||||
:10F330008091C00080648093C000C45DDE4F8881EE
|
||||
:10F34000CC52D1400F947EF340E24093C6008091AE
|
||||
:10F35000C00086FFFCCF8091C00080648093C00015
|
||||
:10F36000C25DDE4F8881CE52D1400F947EF350E2D1
|
||||
:10F370005093C6008091C00086FFFCCF8091C000F2
|
||||
:10F3800080648093C000C35DDE4F8881CD52D14040
|
||||
:10F390000F947EF360E26093C6008091C00086FF08
|
||||
:10F3A000FCCF8091C00080648093C0007FEFE7169F
|
||||
:10F3B0007FEFF70670E0070770E0170731F48EE083
|
||||
:10F3C00092EE60E00F942FF3DFC0D801C701807088
|
||||
:10F3D000907CA070B0708050904CA040B040D1F5AF
|
||||
:10F3E0002FEF3FE340E050E0E222F3220423152315
|
||||
:10F3F000C85DDE4FA880B980CA80DB80C852D1408A
|
||||
:10F40000AE0CBF1CC01ED11EAA0CBB1CCC1CDD1C2C
|
||||
:10F4100088E192EE60E00F942FF3BB27A12F902F8D
|
||||
:10F420008F2D0F947EF38E2D0F947EF330E2309368
|
||||
:10F43000C6008091C00086FFFCCF8091C000806430
|
||||
:10F440008093C0004EE34093C6008091C00086FFC9
|
||||
:10F45000FCCF87C06EE07EEF80E090E0E622F722EE
|
||||
:10F46000082319237CE0E71674E9F70670E0070724
|
||||
:10F4700070E0170709F088C0C25DDE4F8881CE5268
|
||||
:10F48000D140E82EFF2400E010E0102F0F2DFE2CBD
|
||||
:10F49000EE24C35DDE4F9881CD52D140E90EF11CC0
|
||||
:10F4A000011D111DD601C50181709070A070B07052
|
||||
:10F4B000DC0199278827E80EF91E0A1F1B1F20EF81
|
||||
:10F4C00030E040E050E0A222B322C422D522F1E194
|
||||
:10F4D000AA0CBB1CCC1CDD1CFA95D1F7EA0CFB1C5A
|
||||
:10F4E0000C1D1D1D41E050E060E070E0242235223B
|
||||
:10F4F00046225722E5E1220C331C441C551CEA9598
|
||||
:10F50000D1F7E20CF31C041D151D57016801AA0C6C
|
||||
:10F51000BB1CCC1CDD1C8FE192EE60E00F942FF33E
|
||||
:10F52000C801AA27BB270F947EF3BB27A12F902FDA
|
||||
:10F530008F2D0F947EF38E2D0F947EF350E2509317
|
||||
:10F54000C6008091C00086FFFCCF8091C00080641F
|
||||
:10F550008093C0006EE36093C6008091C00086FF78
|
||||
:10F56000FCCF8091C00080648093C000C601AA27B0
|
||||
:10F57000BB270F947EF3BB27AD2D9C2D8B2D0F94B5
|
||||
:10F580007EF38A2D0F947EF370E27093C600809113
|
||||
:10F59000C00086FFFCCF8091C00080648093C000D3
|
||||
:10F5A000CC5DDE4FE881F981C452D140CF01AA275A
|
||||
:10F5B00097FDA095BA2FABBFFC018791969160E0B3
|
||||
:10F5C0000F942FF30F944DF3CC5DDE4F088119811A
|
||||
:10F5D000C452D1400E5F1F4FCC5DDE4F19830883AC
|
||||
:10F5E000C452D140CA5DDE4F28813981C652D14014
|
||||
:10F5F0002933310509F417CB44E050E060E070E0B6
|
||||
:10F60000640E751E861E971EC9CD80E393EE62E0E0
|
||||
:10F610000F9466F384E292EE60E00F942FF38091F2
|
||||
:10F62000C00087FFFCCF1091C6001F751093C60065
|
||||
:10F630008091C00086FFFCCF8091C00080648093E1
|
||||
:10F64000C0000F944DF3812F81548A3108F036C1E8
|
||||
:10F65000163409F495C0173490F4133409F44EC0ED
|
||||
:10F66000143430F41134F1F0123409F01DC130C0FB
|
||||
:10F67000143409F459C0153409F016C16BC01A349A
|
||||
:10F6800009F4C4C01B3438F4173409F48FC018349B
|
||||
:10F6900009F00AC1A1C01B3409F4D2C01C3409F01E
|
||||
:10F6A00003C1E8C08FEF81B90DC082B1809582B9E6
|
||||
:10F6B00080E090E0E0EDF7E03197F1F70196883CCB
|
||||
:10F6C0009105C1F78091C00087FFEFCF12B8EFC05E
|
||||
:10F6D0008FEF84B90DC085B1809585B980E090E049
|
||||
:10F6E000E0EDF7E03197F1F70196883C9105C1F71D
|
||||
:10F6F0008091C00087FFEFCF15B8D9C08FEF87B9D1
|
||||
:10F700000DC088B1809588B980E090E0E0EDF7E029
|
||||
:10F710003197F1F70196883C9105C1F78091C000BF
|
||||
:10F7200087FFEFCF18B8C3C08FEF8AB90DC08BB178
|
||||
:10F7300080958BB980E090E0E0EDF7E03197F1F74C
|
||||
:10F740000196883C9105C1F78091C00087FFEFCFFB
|
||||
:10F750001BB8ADC08FEF8DB90DC08EB180958EB93D
|
||||
:10F7600080E090E0E0EDF7E03197F1F70196883C1A
|
||||
:10F770009105C1F78091C00087FFEFCF1EB897C0F9
|
||||
:10F780008FEF80BB0DC081B3809581BB80E090E09E
|
||||
:10F79000E0EDF7E03197F1F70196883C9105C1F76C
|
||||
:10F7A0008091C00087FFEFCF11BA81C08FEF83BB7C
|
||||
:10F7B0000DC084B3809584BB80E090E0E0EDF7E07D
|
||||
:10F7C0003197F1F70196883C9105C1F78091C0000F
|
||||
:10F7D00087FFEFCF14BA6BC08FEF809301010FC08A
|
||||
:10F7E0008091020180958093020180E090E0E0ED3D
|
||||
:10F7F000F7E03197F1F70196883C9105C1F78091C8
|
||||
:10F80000C00087FFEDCF1092020151C08FEF8093AF
|
||||
:10F8100004010FC08091050180958093050180E06F
|
||||
:10F8200090E0E0EDF7E03197F1F70196883C910523
|
||||
:10F83000C1F78091C00087FFEDCF1092050137C05E
|
||||
:10F840008FEF809307010FC080910801809580930E
|
||||
:10F85000080180E090E0E0EDF7E03197F1F70196E4
|
||||
:10F86000883C9105C1F78091C00087FFEDCF1092D1
|
||||
:10F8700008011DC08FEF80930A010FC080910B011A
|
||||
:10F88000809580930B0180E090E0E0EDF7E0319708
|
||||
:10F89000F1F70196883C9105C1F78091C00087FF80
|
||||
:10F8A000EDCF10920B0103C08FE292EEB9C98091A7
|
||||
:10F8B000C00087FFFCCF8091C600B5C982E492EEFC
|
||||
:10F8C000AFC98CE191EEACC9AA24BB24933061F19D
|
||||
:10F8D000943028F4913089F0923008F508C09530C2
|
||||
:10F8E000B1F1953040F1963009F053C04EC02B3144
|
||||
:10F8F00009F020C991E06BE11DC9213041F0C15DE3
|
||||
:10F90000DE4F5881CF52D140251709F002C362273C
|
||||
:10F91000C15DDE4F2883CF52D14092E00BC9B22F98
|
||||
:10F92000A0E0622793E006C9822F90E0A82BB92BB4
|
||||
:10F93000622794E0FFC82E3009F0EBC2622795E001
|
||||
:10F94000C05DDE4F19821882C053D140F3C8E1E098
|
||||
:10F95000F0E0EC0FFD1FC05DDE4FE880F980C05382
|
||||
:10F96000D140EE0DFF1D208387010F5F1F4FC05D4B
|
||||
:10F97000DE4F19830883C053D14062270A171B0743
|
||||
:10F9800009F0D8C8D80196E0D5C8261709F0C1C239
|
||||
:10F9900003C0973009F0CEC899248981833109F4D6
|
||||
:10F9A000FCC08431C8F4863009F4C2C0873050F4FA
|
||||
:10F9B000823009F4F0C0833009F458C0813009F076
|
||||
:10F9C0000AC23EC0813109F462C0823108F0A6C08B
|
||||
:10F9D000803109F000C2DFC0883109F472C089317A
|
||||
:10F9E00050F4853109F4D9C0853108F477C18631E6
|
||||
:10F9F00009F0F1C173C18A3109F457C08A3108F4A2
|
||||
:10FA00007CC08B3109F446C08D3109F0E4C18D8191
|
||||
:10FA1000803311F090E00AC08F81882311F49EE1B9
|
||||
:10FA200005C0813011F091E001C098E91A821B8273
|
||||
:10FA30008D818C831D829E831F8227E030E0CFC1A1
|
||||
:10FA40001A8288E08B8381E48C8386E58D8382E54E
|
||||
:10FA50008E8389E48F8383E5888780E589878FE5B6
|
||||
:10FA60008A8782E38B872BE030E0B9C18A818139B4
|
||||
:10FA700041F0823941F0803911F48FE005C080E017
|
||||
:10FA800003C082E001C08AE01A828B8344C09924BB
|
||||
:10FA9000939481C08D81882311F48EE12CC0813034
|
||||
:10FAA00011F081E028C088E926C01A82E1E0F0E088
|
||||
:10FAB00089E08093570084918B831C8224E030E09E
|
||||
:10FAC0008EC18B81803589F48C81883039F4E2E0F5
|
||||
:10FAD000F0E089E08093570084910DC0E0E0F0E011
|
||||
:10FAE00089E080935700849106C0E3E0F0E089E06C
|
||||
:10FAF0008093570084911A82DFCF8D81836C99E0C7
|
||||
:10FB0000E1E0F0E0082E90935700E89507B600FC7E
|
||||
:10FB1000FDCF1A821B8223E030E061C11A82CE5CE5
|
||||
:10FB2000DE4F188219821A821B82C253D14055C1FE
|
||||
:10FB30008A8190E0A0E0B0E0582F442733272227A5
|
||||
:10FB40008B8190E0A0E0B0E0DC0199278827282B8A
|
||||
:10FB5000392B4A2B5B2B8D8190E0A0E0B0E0282B65
|
||||
:10FB6000392B4A2B5B2B8C8190E0A0E0B0E0BA2FC0
|
||||
:10FB7000A92F982F8827282B392B4A2B5B2B220F54
|
||||
:10FB8000331F441F551FC05EDE4F288339834A83CD
|
||||
:10FB90005B83C052D1401A8220C19A812B8183316C
|
||||
:10FBA00049F0C05EDE4F488159816A817B81C05235
|
||||
:10FBB000D1408AC0CE5CDE4F488159816A817B8109
|
||||
:10FBC000C253D140403080EC580783E0680780E0A2
|
||||
:10FBD0007807F0F483E0FA0160935B0080935700AC
|
||||
:10FBE000E89507B600FCFDCFCE5CDE4F4881598119
|
||||
:10FBF0006A817B81C253D14040505F4F6F4F7F4F2E
|
||||
:10FC0000CE5CDE4F488359836A837B83C253D140E5
|
||||
:10FC1000C95CDE4F9883C753D140CA5CDE4F18825F
|
||||
:10FC2000C653D140022F10E0CA5CDE4F6881798153
|
||||
:10FC3000C653D140062B172BC05EDE4F4881598139
|
||||
:10FC40006A817B81C052D140DE011B9631E08C91EC
|
||||
:10FC500011962C9111971296C75CDE4F2883C953D9
|
||||
:10FC6000D140C85CDE4F1882C853D14090E0C85CD8
|
||||
:10FC7000DE4FE881F981C853D1408E2B9F2B0C01B8
|
||||
:10FC8000FA0160935B0030935700E89511244E5FB2
|
||||
:10FC90005F4F6F4F7F4F02501040C9F685E0C05E46
|
||||
:10FCA000DE4FE880F9800A811B81C052D140F70104
|
||||
:10FCB00000935B0080935700E89507B600FCFDCFEA
|
||||
:10FCC00081E180935700E8951A82C05EDE4F488339
|
||||
:10FCD00059836A837B83C052D1407FC0FA80C55C60
|
||||
:10FCE000DE4FF882CB53D140C65CDE4F1882CA5338
|
||||
:10FCF000D1408B81C82EDD24C65CDE4F088119817E
|
||||
:10FD0000CA53D140C02AD12A1A828981BE016D5FAF
|
||||
:10FD10007F4F843121F59601C05EDE4FE880F98087
|
||||
:10FD20000A811B81C052D1400BBFF7018791969188
|
||||
:10FD3000DB018C9311969C936E5F7F4FD801C701B6
|
||||
:10FD40000296A11DB11DC05EDE4F88839983AA83F0
|
||||
:10FD5000BB83C052D14022503040F1F636C0C05E65
|
||||
:10FD6000DE4F288139814A815B81C052D14008949D
|
||||
:10FD7000C108D108760100E010E00894C11CD11C34
|
||||
:10FD80000894E11CF11C011D111DE20EF31E041F5D
|
||||
:10FD9000151F21BDBB27A52F942F832F82BD2F5F59
|
||||
:10FDA0003F4F4F4F5F4FF89A80B5DB018D93BD01F8
|
||||
:10FDB0002E153F054007510761F7C05EDE4F2883CF
|
||||
:10FDC00039834A835B83C052D14096012D5F3F4FF8
|
||||
:10FDD000FB01108204C080EC8A8322E030E08BE1DA
|
||||
:10FDE0008093C6008091C00086FFFCCF8091C00048
|
||||
:10FDF00080648093C000C15DDE4FF881CF52D14056
|
||||
:10FE0000F093C6008091C00086FFFCCF8091C000B7
|
||||
:10FE100080648093C000432F3093C6008091C0005F
|
||||
:10FE200086FFFCCF8091C00080648093C000922F39
|
||||
:10FE30002093C6008091C00086FFFCCF8091C00057
|
||||
:10FE400080648093C0008EE08093C6008091C000E3
|
||||
:10FE500086FFFCCF8091C00080648093C00065E184
|
||||
:10FE6000C15DDE4FE880CF52D1406E2569276427FF
|
||||
:10FE7000FE01319610C090819093C6008091C00021
|
||||
:10FE800086FFFCCF31968091C00080648093C000D3
|
||||
:10FE90006927215030402115310569F76093C6006C
|
||||
:10FEA0008091C00086FFFCCF8091C0008064809369
|
||||
:10FEB000C00085B1805885B9992081F4C15DDE4FBD
|
||||
:10FEC0000881CF52D1400F5FC15DDE4F0883CF5212
|
||||
:10FED000D14090E0A0E0B0E00D949AF527982F98DB
|
||||
:10FEE00080E090E020ED37E0F9013197F1F70196DD
|
||||
:10FEF00084369105C9F700008091C0008D7F809302
|
||||
:10FF0000C00081E180935700E895EE27FF27099410
|
||||
:10FF1000FFCF90E00D949AF597FB092E07260AD0A3
|
||||
:10FF200077FD04D02ED006D000201AF4709561958C
|
||||
:10FF30007F4F0895F6F7909581959F4F0895A1E220
|
||||
:10FF40001A2EAA1BBB1BFD010DC0AA1FBB1FEE1F53
|
||||
:10FF5000FF1FA217B307E407F50720F0A21BB30B9E
|
||||
:10FF6000E40BF50B661F771F881F991F1A9469F71A
|
||||
:10FF700060957095809590959B01AC01BD01CF0176
|
||||
:10FF80000895AA1BBB1B51E107C0AA1FBB1FA617E0
|
||||
:10FF9000B70710F0A61BB70B881F991F5A95A9F732
|
||||
:10FFA00080959095BC01CD010895F999FECF92BD41
|
||||
:10FFB00081BDF89A992780B50895262FF999FECF2B
|
||||
:10FFC0001FBA92BD81BD20BD0FB6F894FA9AF99A76
|
||||
:0AFFD0000FBE01960895F894FFCFCC
|
||||
:10E1200000436F6D70696C6564206F6E203D200048
|
||||
:10E130004350552054797065202020203D20005FF9
|
||||
:10E140005F4156525F415243485F5F3D2000415658
|
||||
:10E1500052204C696243205665723D20004743437C
|
||||
:10E160002056657273696F6E203D20004350552024
|
||||
:10E1700049442020202020203D20004C6F7720663D
|
||||
:10E18000757365202020203D20004869676820665F
|
||||
:10E190007573652020203D200045787420667573D6
|
||||
:10E1A00065202020203D20004C6F636B2066757336
|
||||
:10E1B000652020203D20004D617220203720323024
|
||||
:10E1C000313300312E362E3800342E332E350056A2
|
||||
:10E1D00023202020414444522020206F7020636F70
|
||||
:10E1E00064652020202020696E73747275637469E1
|
||||
:10E1F0006F6E2061646472202020496E74657272B3
|
||||
:10E20000757074006E6F20766563746F7200726A49
|
||||
:10E210006D702020006A6D70200057686174207056
|
||||
:10E220006F72743A00506F7274206E6F7420737541
|
||||
:10E2300070706F72746564004D7573742062652030
|
||||
:10E2400061206C6574746572002000577269747483
|
||||
:10E25000696E672045450052656164696E672045B7
|
||||
:10E26000450045452065727220636E743D00504F35
|
||||
:10E27000525400303D5A65726F2061646472003FF1
|
||||
:10E280003D43505520737461747300403D454550C3
|
||||
:10E29000524F4D207465737400423D426C696E6B41
|
||||
:10E2A000204C454400453D44756D70204545505215
|
||||
:10E2B0004F4D00463D44756D7020464C415348001B
|
||||
:10E2C000483D48656C70004C3D4C69737420492F83
|
||||
:10E2D0004F20506F72747300513D51756974005234
|
||||
:10E2E0003D44756D702052414D00563D73686F7707
|
||||
:10E2F00020696E7465727275707420566563746FF0
|
||||
:10E30000727300593D506F727420626C696E6B00BD
|
||||
:10E310002A0011241FBECFEFD1E2DEBFCDBF01E046
|
||||
:10E320000CBF12E0A0E0B2E0EEE1FDEF03E00BBFB6
|
||||
:10E3300002C007900D92A030B107D9F712E0A0E01B
|
||||
:10E34000B2E001C01D92AE30B107E1F70F9460F367
|
||||
:10E350000D948DFE01E20EBF0FEF0DBF11241FBE05
|
||||
:10E360000D9460F30D9400F020E030E040ED57E0B4
|
||||
:10E3700005C0FA013197F1F72F5F3F4F2817390792
|
||||
:10E38000C0F308959C01260F311DC901A0E0B0E043
|
||||
:10E390002F5F3F4FABBFFC018791882361F08093D3
|
||||
:10E3A000C6008091C00086FFFCCF8091C0008064D1
|
||||
:10E3B0008093C000EACF08958DE08093C6008091DD
|
||||
:10E3C000C00086FFFCCF8091C00080648093C000B5
|
||||
:10E3D0008AE08093C6008091C00086FFFCCF8091C8
|
||||
:10E3E000C00080648093C00008950F94C2F10F9420
|
||||
:10E3F000DCF10895FC019081992359F09093C600B7
|
||||
:10E400008091C00086FFFCCF8091C0008064809323
|
||||
:10E41000C0003196992379F70895282F982F929567
|
||||
:10E420009F70892F805D8A3308F0895F8093C600D2
|
||||
:10E430008091C00086FFFCCF8091C00080648093F3
|
||||
:10E44000C000822F8F70982F905D9A3308F0995FEB
|
||||
:10E450009093C6008091C00086FFFCCF8091C000E1
|
||||
:10E4600080648093C00008959C01FB01853691056E
|
||||
:10E470001CF46330710594F0C90164E670E00F94F8
|
||||
:10E480002EFE605D7F4F6093C6008091C00086FFC6
|
||||
:10E49000FCCF8091C00080648093C0002B30310598
|
||||
:10E4A00014F43297B4F0C90164E670E00F942EFEC4
|
||||
:10E4B0006AE070E00F942EFE605D7F4F6093C600AF
|
||||
:10E4C0008091C00086FFFCCF8091C0008064809363
|
||||
:10E4D000C000C9016AE070E00F942EFEC0968093E0
|
||||
:10E4E000C6008091C00086FFFCCF8091C000806490
|
||||
:10E4F0008093C00008951F93182F8EE692EE60E07F
|
||||
:10E500000F94C2F11093C6008091C00086FFFCCF2B
|
||||
:10E510008091C00080648093C0000F94DCF11F9153
|
||||
:10E5200008952F923F924F925F926F927F928F92B7
|
||||
:10E530009F92AF92BF92CF92DF92EF92FF920F9392
|
||||
:10E540001F93DF93CF93CDB7DEB762970FB6F894E2
|
||||
:10E55000DEBF0FBECDBF382E622ECA01DB015C01CB
|
||||
:10E560006D01772420E2222E2E010894411C511CBB
|
||||
:10E570008BC081E0A81680E0B80681E0C80680E084
|
||||
:10E58000D80628F0C601AA27BB270F940DF2BB2797
|
||||
:10E59000AD2D9C2D8B2D0F940DF28A2D0F940DF225
|
||||
:10E5A0002092C6008091C00086FFFCCF8091C00001
|
||||
:10E5B00080648093C0009DE29093C6008091C0006B
|
||||
:10E5C00086FFFCCF8091C00080648093C0002092C1
|
||||
:10E5D000C6008091C00086FFFCCF8091C00080649F
|
||||
:10E5E0008093C00019828601750188249924A1E0D6
|
||||
:10E5F0003A1651F03A1620F0B2E03B1661F409C029
|
||||
:10E600000BBFF701779007C0C7010F9477FE782EF4
|
||||
:10E6100002C0F7017080872D0F940DF22092C60082
|
||||
:10E620008091C00086FFFCCF8091C0008064809301
|
||||
:10E63000C000872D8052F401EF70F0708F3520F408
|
||||
:10E64000E40DF51D708204C0E40DF51D8EE280839B
|
||||
:10E650000894E11CF11C011D111D0894811C911CE2
|
||||
:10E6600090E18916910409F0C2CF80E190E0A0E02A
|
||||
:10E67000B0E0A80EB91ECA1EDB1E198AC2010F9493
|
||||
:10E68000FAF10F94DCF16A94662009F072CF629679
|
||||
:10E690000FB6F894DEBF0FBECDBFCF91DF911F91B3
|
||||
:10E6A0000F91FF90EF90DF90CF90BF90AF909F9031
|
||||
:10E6B0008F907F906F905F904F903F902F90089534
|
||||
:10E6C0002F923F924F925F926F927F928F929F9282
|
||||
:10E6D000AF92BF92CF92DF92EF92FF920F931F9370
|
||||
:10E6E000DF93CF93CDB7DEB7CD53D1400FB6F894BB
|
||||
:10E6F000DEBF0FBECDBF01E20EBF0FEF0DBF94B75F
|
||||
:10E70000F894A89514BE80916000886180936000A1
|
||||
:10E7100010926000789493FF05C0E0910002F091A0
|
||||
:10E7200001021995279A2F9A8091C00082608093E8
|
||||
:10E73000C00080E18093C40088E18093C1000000A4
|
||||
:10E74000EE24FF24870144E0A42EB12CCC24DD2448
|
||||
:10E7500024C0C5010197F1F70894E11CF11C011DCB
|
||||
:10E76000111D21E2E2162EE4F20620E0020720E06D
|
||||
:10E77000120718F031E0C32ED12CC801B70127ECE5
|
||||
:10E780003BE140E050E00F9441FE611571058105C9
|
||||
:10E79000910519F485B1805885B98091C00087FD35
|
||||
:10E7A00003C0C114D104A9F2A6014F5F5F4FC25E3E
|
||||
:10E7B000DE4F59834883CE51D140C25EDE4F8881FF
|
||||
:10E7C0009981CE51D140019711F00D9410FEC05D9A
|
||||
:10E7D000DE4F19821882C053D14060E0C15DDE4F28
|
||||
:10E7E0001882CF52D14088249924C35DDE4F19820C
|
||||
:10E7F0001882CD52D140C05EDE4F188219821A8233
|
||||
:10E800001B82C052D140CE5CDE4F188219821A8220
|
||||
:10E810001B82C253D140EE24FF2487010BBFF701B6
|
||||
:10E8200007911691C45CDE4F19830883CC53D14005
|
||||
:10E830000D940BFEC25EDE4F28813981CE51D1404E
|
||||
:10E840002130310509F52091C600C25EDE4F1982E4
|
||||
:10E850001882CE51D14022C02F5F3F4F4F4F5F4FA4
|
||||
:10E86000213082E138078AE7480780E0580780F0C6
|
||||
:10E87000C45CDE4FE881F981CC53D140EF5FFF4F9C
|
||||
:10E8800019F0EE27FF27099420E030E040E050E047
|
||||
:10E890008091C00087FFE0CF2091C600C35DDE4FAE
|
||||
:10E8A00048815981CD52D1404F5F5F4FC35DDE4FEC
|
||||
:10E8B00059834883CD52D140213209F063C64A3092
|
||||
:10E8C000510508F05FC60894811C911C53E0851621
|
||||
:10E8D000910409F059C600E010E018C081E280936D
|
||||
:10E8E000C6008091C00086FFFCCF8091C00080648C
|
||||
:10E8F0008093C0002F5F3F4F2931310579F70F9486
|
||||
:10E90000DCF10F5F1F4F0530110519F020E030E0FA
|
||||
:10E91000E5CF10920A0210920B0210920C02109294
|
||||
:10E920000D02109206021092070210920802109235
|
||||
:10E930000902109202021092030210920402109235
|
||||
:10E9400005028FEE90EE60E00F94F5F180E191EE1C
|
||||
:10E9500060E00F94C2F18091C00087FFFCCF9091DE
|
||||
:10E96000C600903608F09F759032B8F09093C600BC
|
||||
:10E970008091C00086FFFCCF8091C00080648093AE
|
||||
:10E98000C000A0E2A093C6008091C00086FFFCCF2B
|
||||
:10E990008091C00080648093C000983409F4D7C18E
|
||||
:10E9A0009934B8F4923409F459C1933458F490333B
|
||||
:10E9B00019F1903308F4E3C59F33A1F1903409F0C5
|
||||
:10E9C000DEC5BDC0953409F470C1963409F0D7C5D1
|
||||
:10E9D00098C1923509F42BC2933538F49C3409F46C
|
||||
:10E9E000F5C1913509F0CBC518C2963509F445C279
|
||||
:10E9F000993509F0C4C567C483E792EE62E00F94CD
|
||||
:10EA0000F5F110920602109207021092080210927D
|
||||
:10EA1000090210920A0210920B0210920C0210923C
|
||||
:10EA20000D0213C18FE792EE62E00F94F5F18FEEC5
|
||||
:10EA300090EE60E00F94F5F181E291EE60E00F94CA
|
||||
:10EA4000C2F187EB91EE60E00F94F5F180E391EE77
|
||||
:10EA500060E00F94C2F184EE90EE60E00F94F5F167
|
||||
:10EA60008FE391EE60E00F94C2F186E090E061E008
|
||||
:10EA700070E00F9434F20F94DCF18DE591EE60E0DC
|
||||
:10EA80000F94C2F189EC91EE60E00F94F5F18EE401
|
||||
:10EA900091EE60E00F94C2F183EC91EE60E00F9490
|
||||
:10EAA000F5F18CE691EE60E00F94C2F18EE10F94E7
|
||||
:10EAB0000DF288E90F940DF281E00F940DF20F949E
|
||||
:10EAC000DCF18BE791EE60E00F94C2F119E0E0E039
|
||||
:10EAD000F0E010935700E4918E2F0F940DF20F94F5
|
||||
:10EAE000DCF18AE891EE60E00F94C2F1E3E0F0E03F
|
||||
:10EAF00010935700E4918E2F0F940DF20F94DCF1D8
|
||||
:10EB000089E991EE60E00F94C2F1E2E0F0E0109349
|
||||
:10EB10005700E4918E2F0F940DF20F94DCF188EAE8
|
||||
:10EB200091EE60E00F94C2F1E1E0F0E01093570045
|
||||
:10EB30001491812F0F940DF20F94DCF107CF8BE825
|
||||
:10EB400092EE62E00F94F5F18BE492EE60E00F94A8
|
||||
:10EB5000F5F10F94DCF100E010E019C0C8016F2D51
|
||||
:10EB60000F947FFEFF2031F489E492EE60E00F9471
|
||||
:10EB7000C2F10BC0F092C6008091C00086FFFCCFAE
|
||||
:10EB80008091C00080648093C0000F5F1F4FC80158
|
||||
:10EB900081519F41A0E0B0E0ABBFFC01F790BAE229
|
||||
:10EBA000FB1621F0E2E000301E07C1F60F94DCF105
|
||||
:10EBB0000F94DCF187E592EE60E00F94F5F10F948D
|
||||
:10EBC000DCF1CC24DD2400E010E01EC0C8010F946D
|
||||
:10EBD00077FEF82E882331F489E492EE60E00F94FA
|
||||
:10EBE000C2F10BC08093C6008091C00086FFFCCFAD
|
||||
:10EBF0008091C00080648093C000FE1419F00894D6
|
||||
:10EC0000C11CD11C0F5F1F4FC80181519F41A0E063
|
||||
:10EC1000B0E0ABBFFC01E790FAE2EF1621F022E092
|
||||
:10EC20000030120799F60F94DCF10F94DCF182E6C4
|
||||
:10EC300092EE60E00F94C2F1C60161E070E00F94C3
|
||||
:10EC400034F20F94DCF10F94DCF110920202109276
|
||||
:10EC50000302109204021092050278CE89E992EE26
|
||||
:10EC600062E00F94F5F1279A2F9A16C02F9880E052
|
||||
:10EC700090E0E0EDF7E03197F1F7019684369105E9
|
||||
:10EC8000C1F72F9A80E090E0E0EDF7E03197F1F7DF
|
||||
:10EC9000019684369105C1F78091C00087FFE6CFC9
|
||||
:10ECA0008091C00087FFFCCF64C485EA92EE62E0E9
|
||||
:10ECB0000F94F5F140910202509103026091040219
|
||||
:10ECC0007091050281E020E10F9491F2809102029F
|
||||
:10ECD00090910302A0910402B091050280509F4FD1
|
||||
:10ECE000AF4FBF4F8093020290930302A0930402A0
|
||||
:10ECF000B093050280509041A040B04008F426CE69
|
||||
:10ED0000A4CF83EB92EE62E00F94F5F140910602FE
|
||||
:10ED100050910702609108027091090280E020E1A1
|
||||
:10ED20000F9491F28091060290910702A09108023F
|
||||
:10ED3000B091090280509F4FAF4FBF4F80930602A2
|
||||
:10ED400090930702A0930802B0930902FFCD80ECD4
|
||||
:10ED500092EE62E00F94F5F183E792EE60E00F949B
|
||||
:10ED6000F5F18FE792EE60E00F94F5F18BE892EE0B
|
||||
:10ED700060E00F94F5F189E992EE60E00F94F5F10F
|
||||
:10ED800085EA92EE60E00F94F5F183EB92EE60E09D
|
||||
:10ED90000F94F5F180EC92EE60E00F94F5F187ECC2
|
||||
:10EDA00092EE60E00F94F5F188ED92EE60E00F9442
|
||||
:10EDB000F5F18FED92EE60E00F94F5F18AEE92EEB0
|
||||
:10EDC00060E00F94F5F183E093EEBDCD87EC92EE19
|
||||
:10EDD00062E00F94F5F181E40F947BF282E40F94EA
|
||||
:10EDE0007BF283E40F947BF284E40F947BF285E45E
|
||||
:10EDF0000F947BF286E40F947BF287E40F947BF20E
|
||||
:10EE000088E40F947BF28AE40F947BF28BE40F94F6
|
||||
:10EE10007BF28CE40F947BF299CD88ED92EE62E068
|
||||
:10EE20000F94F5F1772473948824992409C48FED05
|
||||
:10EE300092EE62E00F94F5F140910A0250910B02BC
|
||||
:10EE400060910C0270910D0282E020E10F9491F22A
|
||||
:10EE500080910A0290910B02A0910C02B0910D02D8
|
||||
:10EE600080509F4FAF4FBF4F80930A0290930B0289
|
||||
:10EE7000A0930C02B0930D0269CD8AEE92EE62E08F
|
||||
:10EE80000F94F5F184EE90EE60E00F94F5F18FECC5
|
||||
:10EE900091EE60E00F94F5F1662477244301CC5D98
|
||||
:10EEA000DE4F19821882C452D140D401C301B695F5
|
||||
:10EEB000A79597958795CA5DDE4F88839983AA8326
|
||||
:10EEC000BB83C652D140CC5DDE4FA881B981C4520C
|
||||
:10EED000D1401196CC5DDE4FB983A883C452D14096
|
||||
:10EEE000CD0162E070E00F9434F2B0E2B093C6005E
|
||||
:10EEF0008091C00086FFFCCF8091C0008064809329
|
||||
:10EF0000C000EDE2E093C6008091C00086FFFCCF18
|
||||
:10EF10008091C00080648093C000F0E2F093C6004E
|
||||
:10EF20008091C00086FFFCCF8091C00080648093F8
|
||||
:10EF3000C000CA5DDE4FE880F9800A811B81C6529D
|
||||
:10EF4000D140BB27A12F902F8F2D0F940DF2CA5DBA
|
||||
:10EF5000DE4F8881C652D1400F940DF2B0E2FB2EF5
|
||||
:10EF6000F092C6008091C00086FFFCCF8091C00067
|
||||
:10EF700080648093C0000DE30093C6008091C000C0
|
||||
:10EF800086FFFCCF8091C00080648093C00010E2B7
|
||||
:10EF90001093C6008091C00086FFFCCF8091C00016
|
||||
:10EFA00080648093C0008BBEF3012791C65DDE4F65
|
||||
:10EFB0002883CA52D140A22EBB24CC24DD2408943D
|
||||
:10EFC000611C711C811C911C8BBEF3018791282E42
|
||||
:10EFD0003324442455240894611C711C811C911C09
|
||||
:10EFE0008BBEF3013791C55DDE4F3883CB52D140E4
|
||||
:10EFF0000894611C711C811C911C8BBEF30147910C
|
||||
:10F00000C45DDE4F4883CC52D140ADEFEA2EAFEF66
|
||||
:10F01000FA2EAFEF0A2FAFEF1A2F6E0C7F1C801E57
|
||||
:10F02000911E142D032DF22CEE24EA0CFB1C0C1D5A
|
||||
:10F030001D1D0F940DF220E22093C6008091C000A8
|
||||
:10F0400086FFFCCF8091C00080648093C000C65DC5
|
||||
:10F05000DE4F8881CA52D1400F940DF230E23093D6
|
||||
:10F06000C6008091C00086FFFCCF8091C000806404
|
||||
:10F070008093C000C45DDE4F8881CC52D1400F9494
|
||||
:10F080000DF240E24093C6008091C00086FFFCCFA5
|
||||
:10F090008091C00080648093C000C55DDE4F888190
|
||||
:10F0A000CB52D1400F940DF250E25093C6008091A4
|
||||
:10F0B000C00086FFFCCF8091C00080648093C000B8
|
||||
:10F0C0008FEFE8168FEFF80680E0080780E018075A
|
||||
:10F0D00031F484E092EE60E00F94C2F1DFC0D80119
|
||||
:10F0E000C7018070907CA070B0708050904CA040A0
|
||||
:10F0F000B040D1F52FEF3FE340E050E0E222F322B1
|
||||
:10F1000004231523CA5DDE4FA880B980CA80DB8046
|
||||
:10F11000C652D140AE0CBF1CC01ED11EAA0CBB1CD7
|
||||
:10F12000CC1CDD1C8EE092EE60E00F94C2F1BB2798
|
||||
:10F13000A12F902F8F2D0F940DF28E2D0F940DF285
|
||||
:10F1400030E23093C6008091C00086FFFCCF8091F2
|
||||
:10F15000C00080648093C0004EE34093C60080915D
|
||||
:10F16000C00086FFFCCF87C08EE09EEFA0E0B0E03D
|
||||
:10F17000E822F9220A231B239CE0E91694E9F90608
|
||||
:10F1800090E0090790E0190709F088C0C45DDE4FE0
|
||||
:10F19000A881CC52D140EA2EFF2400E010E0102FCD
|
||||
:10F1A0000F2DFE2CEE24C55DDE4FB881CB52D14031
|
||||
:10F1B000EB0EF11C011D111DD601C501817090706F
|
||||
:10F1C000A070B070DC0199278827E80EF91E0A1F8D
|
||||
:10F1D0001B1F20EF30E040E050E0A222B322C42207
|
||||
:10F1E000D52241E1AA0CBB1CCC1CDD1C4A95D1F7F1
|
||||
:10F1F000EA0CFB1C0C1D1D1D81E090E0A0E0B0E0BE
|
||||
:10F20000282239224A225B2235E1220C331C441C7D
|
||||
:10F21000551C3A95D1F7E20CF31C041D151D57013E
|
||||
:10F220006801AA0CBB1CCC1CDD1C85E192EE60E0E1
|
||||
:10F230000F94C2F1C801AA27BB270F940DF2BB2778
|
||||
:10F24000A12F902F8F2D0F940DF28E2D0F940DF274
|
||||
:10F2500090E29093C6008091C00086FFFCCF809121
|
||||
:10F26000C00080648093C000AEE3A093C60080918C
|
||||
:10F27000C00086FFFCCF8091C00080648093C000F6
|
||||
:10F28000C601AA27BB270F940DF2BB27AD2D9C2DDD
|
||||
:10F290008B2D0F940DF28A2D0F940DF20F94DCF14B
|
||||
:10F2A000CC5DDE4FE881F981C452D140F99709F471
|
||||
:10F2B0004DCBF4E0EF2EF12C012D112D6E0C7F1CA7
|
||||
:10F2C000801E911EF2CD83E093EE62E00F94F5F183
|
||||
:10F2D0008AE192EE60E00F94C2F18091C00087FF56
|
||||
:10F2E000FCCF1091C6001F751093C6008091C0001E
|
||||
:10F2F00086FFFCCF8091C00080648093C0000F9493
|
||||
:10F30000DCF1812F81548A3108F036C1163409F4BA
|
||||
:10F3100095C0173490F4133409F44EC0143430F40B
|
||||
:10F320001134F1F0123409F01DC130C0143409F465
|
||||
:10F3300059C0153409F016C16BC01A3409F4C4C0A1
|
||||
:10F340001B3438F4173409F48FC0183409F00AC19B
|
||||
:10F35000A1C01B3409F4D2C01C3409F003C1E8C0B9
|
||||
:10F360008FEF81B90DC082B1809582B980E090E0C5
|
||||
:10F37000E0EDF7E03197F1F70196883C9105C1F790
|
||||
:10F380008091C00087FFEFCF12B8EFC08FEF84B934
|
||||
:10F390000DC085B1809585B980E090E0E0EDF7E0A3
|
||||
:10F3A0003197F1F70196883C9105C1F78091C00033
|
||||
:10F3B00087FFEFCF15B8D9C08FEF87B90DC088B1DF
|
||||
:10F3C000809588B980E090E0E0EDF7E03197F1F7C3
|
||||
:10F3D0000196883C9105C1F78091C00087FFEFCF6F
|
||||
:10F3E00018B8C3C08FEF8AB90DC08BB180958BB9A7
|
||||
:10F3F00080E090E0E0EDF7E03197F1F70196883C8E
|
||||
:10F400009105C1F78091C00087FFEFCF1BB8ADC059
|
||||
:10F410008FEF8DB90DC08EB180958EB980E090E0F0
|
||||
:10F42000E0EDF7E03197F1F70196883C9105C1F7DF
|
||||
:10F430008091C00087FFEFCF1EB897C08FEF80BBD1
|
||||
:10F440000DC081B3809581BB80E090E0E0EDF7E0F6
|
||||
:10F450003197F1F70196883C9105C1F78091C00082
|
||||
:10F4600087FFEFCF11BA81C08FEF83BB0DC084B38C
|
||||
:10F47000809584BB80E090E0E0EDF7E03197F1F714
|
||||
:10F480000196883C9105C1F78091C00087FFEFCFBE
|
||||
:10F4900014BA6BC08FEF809301010FC080910201FD
|
||||
:10F4A00080958093020180E090E0E0EDF7E03197F5
|
||||
:10F4B000F1F70196883C9105C1F78091C00087FF64
|
||||
:10F4C000EDCF1092020151C08FEF809304010FC065
|
||||
:10F4D0008091050180958093050180E090E0E0ED4A
|
||||
:10F4E000F7E03197F1F70196883C9105C1F78091DB
|
||||
:10F4F000C00087FFEDCF1092050137C08FEF8093DA
|
||||
:10F5000007010FC08091080180958093080180E079
|
||||
:10F5100090E0E0EDF7E03197F1F70196883C910536
|
||||
:10F52000C1F78091C00087FFEDCF109208011DC088
|
||||
:10F530008FEF80930A010FC080910B01809580931B
|
||||
:10F540000B0180E090E0E0EDF7E03197F1F70196F4
|
||||
:10F55000883C9105C1F78091C00087FFEDCF1092E4
|
||||
:10F560000B0103C085E292EEEEC98091C00087FFD7
|
||||
:10F57000FCCF8091C600EAC988E392EEE4C98CE131
|
||||
:10F5800091EEE1C988249924933011F1943028F444
|
||||
:10F59000913089F09230B8F408C0953061F195301F
|
||||
:10F5A000F0F0963009F048C043C02B3109F042C951
|
||||
:10F5B00091E06BE13FC96227C15DDE4F2883CF52E6
|
||||
:10F5C000D14092E037C9B22FA0E0622793E032C960
|
||||
:10F5D000822F90E0A82BB92B622794E02BC92E3004
|
||||
:10F5E00009F039C3622795E0C05DDE4F19821882A9
|
||||
:10F5F000C053D1401FC9E1E0F0E0EC0FFD1FC05D3A
|
||||
:10F60000DE4F08811981C053D140E00FF11F2083E4
|
||||
:10F610000F5F1F4FC05DDE4F19830883C053D14079
|
||||
:10F6200062270A171B0709F005C9D80196E002C92D
|
||||
:10F63000261709F010C303C0973009F0FBC87724E0
|
||||
:10F640009981933109F412C19431C8F4963009F4C8
|
||||
:10F65000D8C0973050F4923009F406C1933009F4C1
|
||||
:10F660006DC0913009F059C253C0913109F477C08F
|
||||
:10F67000923108F0BBC0903109F04FC2F5C098310B
|
||||
:10F6800009F487C0993150F4953109F4EFC09531F0
|
||||
:10F6900008F4C6C1963109F040C2C2C19A3109F4DA
|
||||
:10F6A0006CC09A3108F491C09B3109F45BC09D3164
|
||||
:10F6B00009F033C29D81903359F48F81882311F46E
|
||||
:10F6C0009EE11CC0813011F091E018C098E916C08D
|
||||
:10F6D000892F807591F0903539F4E0E0F0E089E011
|
||||
:10F6E0008093570094910AC0983539F4E3E0F0E034
|
||||
:10F6F00089E080935700949101C090E01A821B82A8
|
||||
:10F700008D818C831D829E831F8227E030E009C299
|
||||
:10F710001A8288E08B8381E48C8386E58D8382E581
|
||||
:10F720008E8389E48F8383E5888780E589878FE5E9
|
||||
:10F730008A8782E38B872BE030E0F3C18A818139AD
|
||||
:10F7400041F0823941F0803911F48FE005C080E04A
|
||||
:10F7500003C082E001C08AE01A828B8344C0772410
|
||||
:10F76000739482C08D81882311F48EE12CC0813086
|
||||
:10F7700011F081E028C088E926C01A82E1E0F0E0BB
|
||||
:10F7800089E08093570084918B831C8224E030E0D1
|
||||
:10F79000C8C18B81803589F48C81883039F4E2E0EE
|
||||
:10F7A000F0E089E08093570084910DC0E0E0F0E044
|
||||
:10F7B00089E080935700849106C0E3E0F0E089E09F
|
||||
:10F7C0008093570084911A82DFCF8D81836C99E0FA
|
||||
:10F7D000E1E0F0E0082E90935700E89507B600FCB2
|
||||
:10F7E000FDCF1A821B8223E030E09BC180EC8A832C
|
||||
:10F7F000CE5CDE4F188219821A821B82C253D1401E
|
||||
:10F800008EC18A8190E0A0E0B0E0582F44273327D2
|
||||
:10F8100022278B8190E0A0E0B0E0DC0199278827C7
|
||||
:10F82000282B392B4A2B5B2B8D8190E0A0E0B0E098
|
||||
:10F83000282B392B4A2B5B2B8C8190E0A0E0B0E089
|
||||
:10F84000BA2FA92F982F8827282B392B4A2B5B2BCF
|
||||
:10F85000220F331F441F551FC05EDE4F288339839C
|
||||
:10F860004A835B83C052D1401A8259C13A81C95C34
|
||||
:10F87000DE4F3883C753D140CA5CDE4F1882C6536F
|
||||
:10F88000D1408B81C82EDD24CA5CDE4F488159816E
|
||||
:10F89000C653D140C42AD52A933109F082C0CE5C28
|
||||
:10F8A000DE4F88819981AA81BB81C253D1408050AB
|
||||
:10F8B000904CA340B04030F583E0CE5CDE4FE88052
|
||||
:10F8C000F9800A811B81C253D140F70100935B008C
|
||||
:10F8D00080935700E89507B600FCFDCFCE5CDE4F65
|
||||
:10F8E000088119812A813B81C253D14000501F4FAA
|
||||
:10F8F0002F4F3F4FCE5CDE4F088319832A833B8313
|
||||
:10F90000C253D140C05EDE4F488159816A817B81FC
|
||||
:10F91000C052D140DE011B9631E08C9111962C91A2
|
||||
:10F9200011971296C75CDE4F2883C953D140C85C3B
|
||||
:10F93000DE4F1882C853D14090E0C85CDE4FE881AA
|
||||
:10F94000F981C853D1408E2B9F2B0C01FA01609393
|
||||
:10F950005B0030935700E89511244E5F5F4F6F4F67
|
||||
:10F960007F4F0EEFE02E0FEFF02ECE0CDF1CC114F8
|
||||
:10F97000D10499F685E0C05EDE4F088119812A81A5
|
||||
:10F980003B81C052D140F80120935B008093570027
|
||||
:10F99000E89507B600FCFDCF81E180935700E8951C
|
||||
:10F9A00035C0C05EDE4F88819981AA81BB81C0527B
|
||||
:10F9B000D140B695A795979587957C018601ABE0D8
|
||||
:10F9C000AA2EB12CAC0EBD1E0BC0D5016D915D01F0
|
||||
:10F9D000C7010F947FFE0894E11CF11C01501040F8
|
||||
:10F9E0000115110591F7A60160E070E0440F551F65
|
||||
:10F9F000661F771FC05EDE4FE880F9800A811B8199
|
||||
:10FA0000C052D1404E0D5F1D601F711F1A82C05E33
|
||||
:10FA1000DE4F488359836A837B83C052D1407FC0C5
|
||||
:10FA2000FA80C55CDE4FF882CB53D140C65CDE4F16
|
||||
:10FA30001882CA53D1408B81C82EDD24C65CDE4FAC
|
||||
:10FA400008811981CA53D140C02AD12A1A828981DA
|
||||
:10FA5000BE016D5F7F4F843121F59601C05EDE4FA0
|
||||
:10FA6000E880F9800A811B81C052D1400BBFF701A9
|
||||
:10FA700087919691DB018C9311969C936E5F7F4FDB
|
||||
:10FA8000D801C7010296A11DB11DC05EDE4F88835B
|
||||
:10FA90009983AA83BB83C052D14022503040F1F6F3
|
||||
:10FAA00036C0C05EDE4F288139814A815B81C052F9
|
||||
:10FAB000D1400894C108D108760100E010E0089414
|
||||
:10FAC000C11CD11C0894E11CF11C011D111DE20E8A
|
||||
:10FAD000F31E041F151F21BDBB27A52F942F832FB5
|
||||
:10FAE00082BD2F5F3F4F4F4F5F4FF89A80B5DB01CC
|
||||
:10FAF0008D93BD012E153F054007510761F7C05E8C
|
||||
:10FB0000DE4F288339834A835B83C052D1409601FC
|
||||
:10FB10002D5F3F4FFB01108204C080EC8A8322E0FE
|
||||
:10FB200030E08BE18093C6008091C00086FFFCCF5F
|
||||
:10FB30008091C00080648093C000C15DDE4FF88179
|
||||
:10FB4000CF52D140F093C6008091C00086FFFCCF19
|
||||
:10FB50008091C00080648093C000432F3093C60022
|
||||
:10FB60008091C00086FFFCCF8091C00080648093AC
|
||||
:10FB7000C000922F2093C6008091C00086FFFCCF6A
|
||||
:10FB80008091C00080648093C0008EE08093C600A6
|
||||
:10FB90008091C00086FFFCCF8091C000806480937C
|
||||
:10FBA000C00065E1C15DDE4FE880CF52D1406E25D7
|
||||
:10FBB00069276427FE01319610C090819093C6009A
|
||||
:10FBC0008091C00086FFFCCF31968091C000806498
|
||||
:10FBD0008093C0006927215030402115310569F715
|
||||
:10FBE0006093C6008091C00086FFFCCF8091C0006A
|
||||
:10FBF00080648093C00085B1805885B9772081F4F6
|
||||
:10FC0000C15DDE4F0881CF52D1400F5FC15DDE4F35
|
||||
:10FC10000883CF52D14090E0A0E0B0E00D941AF4F8
|
||||
:10FC200027982F9880E090E020ED37E0F901319798
|
||||
:10FC3000F1F7019684369105C9F700008091C00064
|
||||
:10FC40008D7F8093C00081E180935700E895EE2777
|
||||
:10FC5000FF270994FFCF90E00D941AF497FB092E2B
|
||||
:10FC600007260AD077FD04D02ED006D000201AF443
|
||||
:10FC7000709561957F4F0895F6F7909581959F4F08
|
||||
:10FC80000895A1E21A2EAA1BBB1BFD010DC0AA1FDD
|
||||
:10FC9000BB1FEE1FFF1FA217B307E407F50720F0F5
|
||||
:10FCA000A21BB30BE40BF50B661F771F881F991F70
|
||||
:10FCB0001A9469F760957095809590959B01AC01B9
|
||||
:10FCC000BD01CF010895AA1BBB1B51E107C0AA1FAC
|
||||
:10FCD000BB1FA617B70710F0A61BB70B881F991FED
|
||||
:10FCE0005A95A9F780959095BC01CD010895F99991
|
||||
:10FCF000FECF92BD81BDF89A992780B50895262F31
|
||||
:10FD0000F999FECF1FBA92BD81BD20BD0FB6F89400
|
||||
:0EFD1000FA9AF99A0FBE01960895F894FFCF63
|
||||
:040000033000E000E9
|
||||
:00000001FF
|
||||
|
@ -104,24 +104,19 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
|
||||
#if !defined(USART0_RX_vect) && defined(USART1_RX_vect)
|
||||
// do nothing - on the 32u4 the first USART is USART1
|
||||
#else
|
||||
#if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \
|
||||
!defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \
|
||||
!defined(SIG_UART_RECV)
|
||||
#if !defined(USART_RX_vect) && !defined(USART0_RX_vect) && \
|
||||
!defined(USART_RXC_vect)
|
||||
#error "Don't know what the Data Received vector is called for the first UART"
|
||||
#else
|
||||
void serialEvent() __attribute__((weak));
|
||||
void serialEvent() {}
|
||||
#define serialEvent_implemented
|
||||
#if defined(USART_RX_vect)
|
||||
SIGNAL(USART_RX_vect)
|
||||
#elif defined(SIG_USART0_RECV)
|
||||
SIGNAL(SIG_USART0_RECV)
|
||||
#elif defined(SIG_UART0_RECV)
|
||||
SIGNAL(SIG_UART0_RECV)
|
||||
ISR(USART_RX_vect)
|
||||
#elif defined(USART0_RX_vect)
|
||||
SIGNAL(USART0_RX_vect)
|
||||
#elif defined(SIG_UART_RECV)
|
||||
SIGNAL(SIG_UART_RECV)
|
||||
ISR(USART0_RX_vect)
|
||||
#elif defined(USART_RXC_vect)
|
||||
ISR(USART_RXC_vect) // ATmega8
|
||||
#endif
|
||||
{
|
||||
#if defined(UDR0)
|
||||
@ -149,7 +144,7 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
|
||||
void serialEvent1() __attribute__((weak));
|
||||
void serialEvent1() {}
|
||||
#define serialEvent1_implemented
|
||||
SIGNAL(USART1_RX_vect)
|
||||
ISR(USART1_RX_vect)
|
||||
{
|
||||
if (bit_is_clear(UCSR1A, UPE1)) {
|
||||
unsigned char c = UDR1;
|
||||
@ -158,15 +153,13 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
|
||||
unsigned char c = UDR1;
|
||||
};
|
||||
}
|
||||
#elif defined(SIG_USART1_RECV)
|
||||
#error SIG_USART1_RECV
|
||||
#endif
|
||||
|
||||
#if defined(USART2_RX_vect) && defined(UDR2)
|
||||
void serialEvent2() __attribute__((weak));
|
||||
void serialEvent2() {}
|
||||
#define serialEvent2_implemented
|
||||
SIGNAL(USART2_RX_vect)
|
||||
ISR(USART2_RX_vect)
|
||||
{
|
||||
if (bit_is_clear(UCSR2A, UPE2)) {
|
||||
unsigned char c = UDR2;
|
||||
@ -175,15 +168,13 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
|
||||
unsigned char c = UDR2;
|
||||
};
|
||||
}
|
||||
#elif defined(SIG_USART2_RECV)
|
||||
#error SIG_USART2_RECV
|
||||
#endif
|
||||
|
||||
#if defined(USART3_RX_vect) && defined(UDR3)
|
||||
void serialEvent3() __attribute__((weak));
|
||||
void serialEvent3() {}
|
||||
#define serialEvent3_implemented
|
||||
SIGNAL(USART3_RX_vect)
|
||||
ISR(USART3_RX_vect)
|
||||
{
|
||||
if (bit_is_clear(UCSR3A, UPE3)) {
|
||||
unsigned char c = UDR3;
|
||||
@ -192,8 +183,6 @@ inline void store_char(unsigned char c, ring_buffer *buffer)
|
||||
unsigned char c = UDR3;
|
||||
};
|
||||
}
|
||||
#elif defined(SIG_USART3_RECV)
|
||||
#error SIG_USART3_RECV
|
||||
#endif
|
||||
|
||||
void serialEventRun(void)
|
||||
|
@ -230,82 +230,82 @@ void attachInterruptTwi(void (*userFunc)(void) ) {
|
||||
*/
|
||||
|
||||
#if defined(__AVR_ATmega32U4__)
|
||||
SIGNAL(INT0_vect) {
|
||||
ISR(INT0_vect) {
|
||||
if(intFunc[EXTERNAL_INT_0])
|
||||
intFunc[EXTERNAL_INT_0]();
|
||||
}
|
||||
|
||||
SIGNAL(INT1_vect) {
|
||||
ISR(INT1_vect) {
|
||||
if(intFunc[EXTERNAL_INT_1])
|
||||
intFunc[EXTERNAL_INT_1]();
|
||||
}
|
||||
|
||||
SIGNAL(INT2_vect) {
|
||||
ISR(INT2_vect) {
|
||||
if(intFunc[EXTERNAL_INT_2])
|
||||
intFunc[EXTERNAL_INT_2]();
|
||||
}
|
||||
|
||||
SIGNAL(INT3_vect) {
|
||||
ISR(INT3_vect) {
|
||||
if(intFunc[EXTERNAL_INT_3])
|
||||
intFunc[EXTERNAL_INT_3]();
|
||||
}
|
||||
|
||||
#elif defined(EICRA) && defined(EICRB)
|
||||
|
||||
SIGNAL(INT0_vect) {
|
||||
ISR(INT0_vect) {
|
||||
if(intFunc[EXTERNAL_INT_2])
|
||||
intFunc[EXTERNAL_INT_2]();
|
||||
}
|
||||
|
||||
SIGNAL(INT1_vect) {
|
||||
ISR(INT1_vect) {
|
||||
if(intFunc[EXTERNAL_INT_3])
|
||||
intFunc[EXTERNAL_INT_3]();
|
||||
}
|
||||
|
||||
SIGNAL(INT2_vect) {
|
||||
ISR(INT2_vect) {
|
||||
if(intFunc[EXTERNAL_INT_4])
|
||||
intFunc[EXTERNAL_INT_4]();
|
||||
}
|
||||
|
||||
SIGNAL(INT3_vect) {
|
||||
ISR(INT3_vect) {
|
||||
if(intFunc[EXTERNAL_INT_5])
|
||||
intFunc[EXTERNAL_INT_5]();
|
||||
}
|
||||
|
||||
SIGNAL(INT4_vect) {
|
||||
ISR(INT4_vect) {
|
||||
if(intFunc[EXTERNAL_INT_0])
|
||||
intFunc[EXTERNAL_INT_0]();
|
||||
}
|
||||
|
||||
SIGNAL(INT5_vect) {
|
||||
ISR(INT5_vect) {
|
||||
if(intFunc[EXTERNAL_INT_1])
|
||||
intFunc[EXTERNAL_INT_1]();
|
||||
}
|
||||
|
||||
SIGNAL(INT6_vect) {
|
||||
ISR(INT6_vect) {
|
||||
if(intFunc[EXTERNAL_INT_6])
|
||||
intFunc[EXTERNAL_INT_6]();
|
||||
}
|
||||
|
||||
SIGNAL(INT7_vect) {
|
||||
ISR(INT7_vect) {
|
||||
if(intFunc[EXTERNAL_INT_7])
|
||||
intFunc[EXTERNAL_INT_7]();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
SIGNAL(INT0_vect) {
|
||||
ISR(INT0_vect) {
|
||||
if(intFunc[EXTERNAL_INT_0])
|
||||
intFunc[EXTERNAL_INT_0]();
|
||||
}
|
||||
|
||||
SIGNAL(INT1_vect) {
|
||||
ISR(INT1_vect) {
|
||||
if(intFunc[EXTERNAL_INT_1])
|
||||
intFunc[EXTERNAL_INT_1]();
|
||||
}
|
||||
|
||||
#if defined(EICRA) && defined(ISC20)
|
||||
SIGNAL(INT2_vect) {
|
||||
ISR(INT2_vect) {
|
||||
if(intFunc[EXTERNAL_INT_2])
|
||||
intFunc[EXTERNAL_INT_2]();
|
||||
}
|
||||
@ -314,7 +314,7 @@ SIGNAL(INT2_vect) {
|
||||
#endif
|
||||
|
||||
/*
|
||||
SIGNAL(SIG_2WIRE_SERIAL) {
|
||||
ISR(TWI_vect) {
|
||||
if(twiIntFunc)
|
||||
twiIntFunc();
|
||||
}
|
||||
|
@ -2,9 +2,6 @@
|
||||
Copyright (c) 2010 Gerben van den Broeke
|
||||
All rights reserved.
|
||||
|
||||
malloc, free, realloc from avr-libc 1.7.0
|
||||
with minor modifications, by Paul Stoffregen
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
@ -33,21 +30,15 @@
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
/* $Id: malloc.c 2149 2010-06-09 20:45:37Z joerg_wunsch $ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include "sectionname.h"
|
||||
#include "stdlib_private.h"
|
||||
|
||||
#include <avr/io.h>
|
||||
|
||||
|
||||
#define __MALLOC_MARGIN__ 120
|
||||
|
||||
|
||||
struct __freelist {
|
||||
size_t sz;
|
||||
struct __freelist *nx;
|
||||
};
|
||||
|
||||
/*
|
||||
* Exported interface:
|
||||
*
|
||||
@ -59,13 +50,16 @@ struct __freelist {
|
||||
* with the data segment.
|
||||
*/
|
||||
|
||||
/* May be changed by the user only before the first malloc() call. */
|
||||
|
||||
#define STACK_POINTER() ((char *)AVR_STACK_POINTER_REG)
|
||||
extern char __heap_start;
|
||||
char *__brkval = &__heap_start; // first location not yet allocated
|
||||
struct __freelist *__flp; // freelist pointer (head of freelist)
|
||||
char *__brkval_maximum = 100;
|
||||
size_t __malloc_margin = 128;
|
||||
char *__malloc_heap_start = &__heap_start;
|
||||
char *__malloc_heap_end = &__heap_end;
|
||||
|
||||
char *__brkval;
|
||||
struct __freelist *__flp;
|
||||
|
||||
ATTRIBUTE_CLIB_SECTION
|
||||
void *
|
||||
malloc(size_t len)
|
||||
{
|
||||
@ -160,7 +154,11 @@ malloc(size_t len)
|
||||
* Since we don't have an operating system, just make sure
|
||||
* that we don't collide with the stack.
|
||||
*/
|
||||
cp = STACK_POINTER() - __MALLOC_MARGIN__;
|
||||
if (__brkval == 0)
|
||||
__brkval = __malloc_heap_start;
|
||||
cp = __malloc_heap_end;
|
||||
if (cp == 0)
|
||||
cp = STACK_POINTER() - __malloc_margin;
|
||||
if (cp <= __brkval)
|
||||
/*
|
||||
* Memory exhausted.
|
||||
@ -173,7 +171,6 @@ malloc(size_t len)
|
||||
if (avail >= len && avail >= len + sizeof(size_t)) {
|
||||
fp1 = (struct __freelist *)__brkval;
|
||||
__brkval += len + sizeof(size_t);
|
||||
__brkval_maximum = __brkval;
|
||||
fp1->sz = len;
|
||||
return &(fp1->nx);
|
||||
}
|
||||
@ -184,6 +181,7 @@ malloc(size_t len)
|
||||
}
|
||||
|
||||
|
||||
ATTRIBUTE_CLIB_SECTION
|
||||
void
|
||||
free(void *p)
|
||||
{
|
||||
@ -267,114 +265,3 @@ free(void *p)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void *
|
||||
realloc(void *ptr, size_t len)
|
||||
{
|
||||
struct __freelist *fp1, *fp2, *fp3, *ofp3;
|
||||
char *cp, *cp1;
|
||||
void *memp;
|
||||
size_t s, incr;
|
||||
|
||||
/* Trivial case, required by C standard. */
|
||||
if (ptr == 0)
|
||||
return malloc(len);
|
||||
|
||||
cp1 = (char *)ptr;
|
||||
cp1 -= sizeof(size_t);
|
||||
fp1 = (struct __freelist *)cp1;
|
||||
|
||||
cp = (char *)ptr + len; /* new next pointer */
|
||||
if (cp < cp1)
|
||||
/* Pointer wrapped across top of RAM, fail. */
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* See whether we are growing or shrinking. When shrinking,
|
||||
* we split off a chunk for the released portion, and call
|
||||
* free() on it. Therefore, we can only shrink if the new
|
||||
* size is at least sizeof(struct __freelist) smaller than the
|
||||
* previous size.
|
||||
*/
|
||||
if (len <= fp1->sz) {
|
||||
/* The first test catches a possible unsigned int
|
||||
* rollover condition. */
|
||||
if (fp1->sz <= sizeof(struct __freelist) ||
|
||||
len > fp1->sz - sizeof(struct __freelist))
|
||||
return ptr;
|
||||
fp2 = (struct __freelist *)cp;
|
||||
fp2->sz = fp1->sz - len - sizeof(size_t);
|
||||
fp1->sz = len;
|
||||
free(&(fp2->nx));
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we get here, we are growing. First, see whether there
|
||||
* is space in the free list on top of our current chunk.
|
||||
*/
|
||||
incr = len - fp1->sz;
|
||||
cp = (char *)ptr + fp1->sz;
|
||||
fp2 = (struct __freelist *)cp;
|
||||
for (s = 0, ofp3 = 0, fp3 = __flp;
|
||||
fp3;
|
||||
ofp3 = fp3, fp3 = fp3->nx) {
|
||||
if (fp3 == fp2 && fp3->sz + sizeof(size_t) >= incr) {
|
||||
/* found something that fits */
|
||||
if (fp3->sz + sizeof(size_t) - incr > sizeof(struct __freelist)) {
|
||||
/* split off a new freelist entry */
|
||||
cp = (char *)ptr + len;
|
||||
fp2 = (struct __freelist *)cp;
|
||||
fp2->nx = fp3->nx;
|
||||
fp2->sz = fp3->sz - incr;
|
||||
fp1->sz = len;
|
||||
} else {
|
||||
/* it just fits, so use it entirely */
|
||||
fp1->sz += fp3->sz + sizeof(size_t);
|
||||
fp2 = fp3->nx;
|
||||
}
|
||||
if (ofp3)
|
||||
ofp3->nx = fp2;
|
||||
else
|
||||
__flp = fp2;
|
||||
return ptr;
|
||||
}
|
||||
/*
|
||||
* Find the largest chunk on the freelist while
|
||||
* walking it.
|
||||
*/
|
||||
if (fp3->sz > s)
|
||||
s = fp3->sz;
|
||||
}
|
||||
/*
|
||||
* If we are the topmost chunk in memory, and there was no
|
||||
* large enough chunk on the freelist that could be re-used
|
||||
* (by a call to malloc() below), quickly extend the
|
||||
* allocation area if possible, without need to copy the old
|
||||
* data.
|
||||
*/
|
||||
if (__brkval == (char *)ptr + fp1->sz && len > s) {
|
||||
cp = (char *)ptr + len;
|
||||
cp1 = STACK_POINTER() - __MALLOC_MARGIN__;
|
||||
if (cp < cp1) {
|
||||
__brkval = cp;
|
||||
__brkval_maximum = cp;
|
||||
fp1->sz = len;
|
||||
return ptr;
|
||||
}
|
||||
/* If that failed, we are out of luck. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call malloc() for a new chunk, then copy over the data, and
|
||||
* release the old region.
|
||||
*/
|
||||
if ((memp = malloc(len)) == 0)
|
||||
return 0;
|
||||
memcpy(memp, ptr, fp1->sz);
|
||||
free(ptr);
|
||||
return memp;
|
||||
}
|
||||
|
150
hardware/arduino/avr/cores/arduino/avr-libc/realloc.c
Normal file
150
hardware/arduino/avr/cores/arduino/avr-libc/realloc.c
Normal file
@ -0,0 +1,150 @@
|
||||
/* Copyright (c) 2004, 2010 Joerg Wunsch
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* Neither the name of the copyright holders nor the names of
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/* $Id: realloc.c 2127 2010-06-07 14:49:37Z joerg_wunsch $ */
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "sectionname.h"
|
||||
#include "stdlib_private.h"
|
||||
|
||||
#include <avr/io.h>
|
||||
|
||||
ATTRIBUTE_CLIB_SECTION
|
||||
void *
|
||||
realloc(void *ptr, size_t len)
|
||||
{
|
||||
struct __freelist *fp1, *fp2, *fp3, *ofp3;
|
||||
char *cp, *cp1;
|
||||
void *memp;
|
||||
size_t s, incr;
|
||||
|
||||
/* Trivial case, required by C standard. */
|
||||
if (ptr == 0)
|
||||
return malloc(len);
|
||||
|
||||
cp1 = (char *)ptr;
|
||||
cp1 -= sizeof(size_t);
|
||||
fp1 = (struct __freelist *)cp1;
|
||||
|
||||
cp = (char *)ptr + len; /* new next pointer */
|
||||
if (cp < cp1)
|
||||
/* Pointer wrapped across top of RAM, fail. */
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* See whether we are growing or shrinking. When shrinking,
|
||||
* we split off a chunk for the released portion, and call
|
||||
* free() on it. Therefore, we can only shrink if the new
|
||||
* size is at least sizeof(struct __freelist) smaller than the
|
||||
* previous size.
|
||||
*/
|
||||
if (len <= fp1->sz) {
|
||||
/* The first test catches a possible unsigned int
|
||||
* rollover condition. */
|
||||
if (fp1->sz <= sizeof(struct __freelist) ||
|
||||
len > fp1->sz - sizeof(struct __freelist))
|
||||
return ptr;
|
||||
fp2 = (struct __freelist *)cp;
|
||||
fp2->sz = fp1->sz - len - sizeof(size_t);
|
||||
fp1->sz = len;
|
||||
free(&(fp2->nx));
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/*
|
||||
* If we get here, we are growing. First, see whether there
|
||||
* is space in the free list on top of our current chunk.
|
||||
*/
|
||||
incr = len - fp1->sz;
|
||||
cp = (char *)ptr + fp1->sz;
|
||||
fp2 = (struct __freelist *)cp;
|
||||
for (s = 0, ofp3 = 0, fp3 = __flp;
|
||||
fp3;
|
||||
ofp3 = fp3, fp3 = fp3->nx) {
|
||||
if (fp3 == fp2 && fp3->sz + sizeof(size_t) >= incr) {
|
||||
/* found something that fits */
|
||||
if (fp3->sz + sizeof(size_t) - incr > sizeof(struct __freelist)) {
|
||||
/* split off a new freelist entry */
|
||||
cp = (char *)ptr + len;
|
||||
fp2 = (struct __freelist *)cp;
|
||||
fp2->nx = fp3->nx;
|
||||
fp2->sz = fp3->sz - incr;
|
||||
fp1->sz = len;
|
||||
} else {
|
||||
/* it just fits, so use it entirely */
|
||||
fp1->sz += fp3->sz + sizeof(size_t);
|
||||
fp2 = fp3->nx;
|
||||
}
|
||||
if (ofp3)
|
||||
ofp3->nx = fp2;
|
||||
else
|
||||
__flp = fp2;
|
||||
return ptr;
|
||||
}
|
||||
/*
|
||||
* Find the largest chunk on the freelist while
|
||||
* walking it.
|
||||
*/
|
||||
if (fp3->sz > s)
|
||||
s = fp3->sz;
|
||||
}
|
||||
/*
|
||||
* If we are the topmost chunk in memory, and there was no
|
||||
* large enough chunk on the freelist that could be re-used
|
||||
* (by a call to malloc() below), quickly extend the
|
||||
* allocation area if possible, without need to copy the old
|
||||
* data.
|
||||
*/
|
||||
if (__brkval == (char *)ptr + fp1->sz && len > s) {
|
||||
cp1 = __malloc_heap_end;
|
||||
cp = (char *)ptr + len;
|
||||
if (cp1 == 0)
|
||||
cp1 = STACK_POINTER() - __malloc_margin;
|
||||
if (cp < cp1) {
|
||||
__brkval = cp;
|
||||
fp1->sz = len;
|
||||
return ptr;
|
||||
}
|
||||
/* If that failed, we are out of luck. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call malloc() for a new chunk, then copy over the data, and
|
||||
* release the old region.
|
||||
*/
|
||||
if ((memp = malloc(len)) == 0)
|
||||
return 0;
|
||||
memcpy(memp, ptr, fp1->sz);
|
||||
free(ptr);
|
||||
return memp;
|
||||
}
|
||||
|
49
hardware/arduino/avr/cores/arduino/avr-libc/sectionname.h
Normal file
49
hardware/arduino/avr/cores/arduino/avr-libc/sectionname.h
Normal file
@ -0,0 +1,49 @@
|
||||
/* Copyright (c) 2009 Atmel Corporation
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
|
||||
* Neither the name of the copyright holders nor the names of
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef __SECTIONNAME_H__
|
||||
#define __SECTIONNAME_H__
|
||||
|
||||
/* Put all avr-libc functions in a common, unique sub-section name under .text. */
|
||||
|
||||
#define CLIB_SECTION .text.avr-libc
|
||||
#define MLIB_SECTION .text.avr-libc.fplib
|
||||
|
||||
#define STR(x) _STR(x)
|
||||
#define _STR(x) #x
|
||||
|
||||
#define ATTRIBUTE_CLIB_SECTION __attribute__ ((section (STR(CLIB_SECTION))))
|
||||
#define ATTRIBUTE_MLIB_SECTION __attribute__ ((section (STR(MLIB_SECTION))))
|
||||
|
||||
#define ASSEMBLY_CLIB_SECTION .section CLIB_SECTION, "ax", @progbits
|
||||
#define ASSEMBLY_MLIB_SECTION .section MLIB_SECTION, "ax", @progbits
|
||||
|
||||
#endif
|
58
hardware/arduino/avr/cores/arduino/avr-libc/stdlib_private.h
Normal file
58
hardware/arduino/avr/cores/arduino/avr-libc/stdlib_private.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* Copyright (c) 2004, Joerg Wunsch
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of the copyright holders nor the names of
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* $Id: stdlib_private.h 1657 2008-03-24 17:11:08Z arcanum $ */
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <avr/io.h>
|
||||
|
||||
#if !defined(__DOXYGEN__)
|
||||
|
||||
struct __freelist {
|
||||
size_t sz;
|
||||
struct __freelist *nx;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
extern char *__brkval; /* first location not yet allocated */
|
||||
extern struct __freelist *__flp; /* freelist pointer (head of freelist) */
|
||||
extern size_t __malloc_margin; /* user-changeable before the first malloc() */
|
||||
extern char *__malloc_heap_start;
|
||||
extern char *__malloc_heap_end;
|
||||
|
||||
extern char __heap_start;
|
||||
extern char __heap_end;
|
||||
|
||||
/* Needed for definition of AVR_STACK_POINTER_REG. */
|
||||
#include <avr/io.h>
|
||||
|
||||
#define STACK_POINTER() ((char *)AVR_STACK_POINTER_REG)
|
||||
|
@ -42,9 +42,9 @@ volatile unsigned long timer0_millis = 0;
|
||||
static unsigned char timer0_fract = 0;
|
||||
|
||||
#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
|
||||
SIGNAL(TIM0_OVF_vect)
|
||||
ISR(TIM0_OVF_vect)
|
||||
#else
|
||||
SIGNAL(TIMER0_OVF_vect)
|
||||
ISR(TIMER0_OVF_vect)
|
||||
#endif
|
||||
{
|
||||
// copy these to local variables so they can be stored in registers
|
||||
|
@ -47,6 +47,8 @@ int analogRead(uint8_t pin)
|
||||
if (pin >= 18) pin -= 18; // allow for channel or pin numbers
|
||||
#elif defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__)
|
||||
if (pin >= 24) pin -= 24; // allow for channel or pin numbers
|
||||
#elif defined(analogPinToChannel) && (defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__))
|
||||
pin = analogPinToChannel(pin);
|
||||
#else
|
||||
if (pin >= 14) pin -= 14; // allow for channel or pin numbers
|
||||
#endif
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
44
hardware/arduino/avr/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade.sh
Normal file → Executable file
44
hardware/arduino/avr/firmwares/wifishield/scripts/ArduinoWifiShield_upgrade.sh
Normal file → Executable file
@ -1,8 +1,11 @@
|
||||
#!/bin/sh
|
||||
|
||||
WIFI_FW_PATH="/hardware/arduino/firmwares/wifi-shield"
|
||||
WIFI_FW_PATH="/hardware/arduino/firmwares/wifishield/binary"
|
||||
AVR_TOOLS_PATH="/hardware/tools/avr/bin"
|
||||
|
||||
TARGET_MICRO="at32uc3a1256"
|
||||
|
||||
|
||||
progname=$0
|
||||
|
||||
usage () {
|
||||
@ -20,28 +23,49 @@ EOF
|
||||
upgradeHDmodule () {
|
||||
sleep 1 # Give time to the shield to end the boot
|
||||
echo "****Upgrade HD WiFi module firmware****\n"
|
||||
dfu-programmer at32uc3a1256 erase
|
||||
dfu-programmer at32uc3a1256 flash --suppress-bootloader-mem $WIFI_FW_PATH/wifi_dnld.hex
|
||||
dfu-programmer at32uc3a1256 start
|
||||
echo -n "\nRemove the J3 jumper then press the RESET button on the shield then type [ENTER] to upgrade the firmware of the shield..\n"
|
||||
dfu-programmer $TARGET_MICRO erase
|
||||
dfu-programmer $TARGET_MICRO flash --suppress-bootloader-mem $WIFI_FW_PATH/wifi_dnld.hex
|
||||
dfu-programmer $TARGET_MICRO start
|
||||
|
||||
if [ $? != 0 ] ; then
|
||||
echo "\nError during device initialization, please close the J3 jumper and press the reset button.\nTry -h for help\n"
|
||||
exit 1 # if the device is not recognized exit
|
||||
fi
|
||||
|
||||
echo -n "\nPress the RESET button on the shield then type [ENTER] to upgrade the firmware of the shield..\n"
|
||||
read readEnter
|
||||
}
|
||||
|
||||
upgradeShield () {
|
||||
sleep 1 # Give time to the shield to end the boot
|
||||
echo "****Upgrade WiFi Shield firmware****\n"
|
||||
dfu-programmer at32uc3a1256 erase
|
||||
dfu-programmer at32uc3a1256 flash --suppress-bootloader-mem $WIFI_FW_PATH/wifiHD.hex
|
||||
dfu-programmer at32uc3a1256 start
|
||||
dfu-programmer $TARGET_MICRO erase
|
||||
dfu-programmer $TARGET_MICRO flash --suppress-bootloader-mem $WIFI_FW_PATH/wifiHD.hex
|
||||
dfu-programmer $TARGET_MICRO start
|
||||
|
||||
if [ $? != 0 ] ; then
|
||||
echo "\nError during device initialization, please close the J3 jumper and press the reset button.\nTry -h for help\n"
|
||||
exit 1 # if the device is not recognized exit
|
||||
fi
|
||||
|
||||
echo "\nDone. Remove the J3 jumper and press the RESET button on the shield."
|
||||
echo "Thank you!\n"
|
||||
}
|
||||
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Arduino WiFi Shield upgrade
|
||||
=========================================
|
||||
Disclaimer: to access to the USB devices correctly, the dfu-programmer needs to be used as root. Run this script as root.
|
||||
Instructions:
|
||||
|
||||
To access to the USB devices correctly, the dfu-programmer needs to have the root permissions.
|
||||
|
||||
You can upgrade the firmware of the antenna togheter with the shield firmware or only the shield firmware
|
||||
if there aren't changes on the antenna firmware.
|
||||
|
||||
Use the '-h' parameter for help
|
||||
=========================================
|
||||
|
||||
EOF
|
||||
|
||||
@ -90,7 +114,7 @@ if [ $USER = 'root' ] ; then #check if the current user is root
|
||||
esac
|
||||
done
|
||||
else
|
||||
echo "You are not root!\n"
|
||||
echo "Please retry running the script as root.\n"
|
||||
fi
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
Binary file not shown.
16358
hardware/arduino/avr/firmwares/wifishield/wifiHD/Release/wifiHD.hex
Normal file
16358
hardware/arduino/avr/firmwares/wifishield/wifiHD/Release/wifiHD.hex
Normal file
File diff suppressed because it is too large
Load Diff
@ -93,6 +93,7 @@
|
||||
#define LED1_GPIO AVR32_PIN_PB20
|
||||
#define LED2_GPIO AVR32_PIN_PB21
|
||||
#define DEB_PIN_GPIO AVR32_PIN_PA20
|
||||
#define DEB2_PIN_GPIO AVR32_PIN_PB00
|
||||
//! @}
|
||||
|
||||
/*! \name PWM Channels of LEDs
|
||||
|
@ -1226,7 +1226,7 @@
|
||||
* in seconds. (does not require sockets.c, and will affect tcp.c)
|
||||
*/
|
||||
#ifndef LWIP_TCP_KEEPALIVE
|
||||
#define LWIP_TCP_KEEPALIVE 0
|
||||
#define LWIP_TCP_KEEPALIVE 1
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
@ -46,6 +46,7 @@
|
||||
|
||||
#include "compiler.h"
|
||||
#include "debug.h"
|
||||
#include "util.h"
|
||||
|
||||
|
||||
#if (defined __GNUC__)
|
||||
@ -117,3 +118,16 @@ void uc3_round_trace(U32 val)
|
||||
|
||||
//Enable_global_interrupt();
|
||||
}
|
||||
|
||||
void dump(char* _buf, uint16_t _count) {
|
||||
|
||||
int i;
|
||||
for (i = 0; i < _count; ++i)
|
||||
{
|
||||
printk("0x%x ", _buf[i]);
|
||||
if ((i!=0)&&(i % 10 == 0))
|
||||
printk("\n\t");
|
||||
}
|
||||
printk("\n");
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,9 @@
|
||||
#include "timer.h"
|
||||
#include "lwip/dns.h"
|
||||
#include <board_init.h>
|
||||
#include "util.h"
|
||||
#include "lwip/udp.h"
|
||||
#include "lwip_setup.h"
|
||||
|
||||
extern const char* fwVersion;
|
||||
|
||||
@ -92,7 +95,7 @@ bool end_write = false; //TODO only for debug
|
||||
// Signal indicating a new command is coming from SPI interface
|
||||
static volatile Bool startRecvCmdSignal = FALSE;
|
||||
|
||||
#define MAX_CMD_NUM 30
|
||||
#define MAX_CMD_NUM 36
|
||||
typedef struct sCmd_spi_list{
|
||||
cmd_spi_cb_t cb;
|
||||
char cmd_id;
|
||||
@ -136,6 +139,7 @@ void initStatSpi()
|
||||
|
||||
void printStatSpi()
|
||||
{
|
||||
printk("totSpiCmds\t: 0x%x\n", cmdCorr);
|
||||
printk("lastCmd \t: 0x%x\n", statSpi.lastCmd);
|
||||
printk("lastErr \t: 0x%x\n", statSpi.lastError);
|
||||
printk("spiStatus\t: 0x%X\n", statSpi.status);
|
||||
@ -169,7 +173,28 @@ cmd_resetStatSpi(int argc, char* argv[], void* ctx)
|
||||
|
||||
int result = WL_CONNECT_FAILED; //Store the result of the last operation
|
||||
|
||||
void* mapSockTCP[MAX_SOCK_NUM];
|
||||
void* mapSockTCP[MAX_SOCK_NUM][MAX_MODE_NUM];
|
||||
|
||||
//Udp RemoteIp and remote Port
|
||||
static tRemoteClient remoteClients[MAX_SOCK_NUM] = {{0,0}};
|
||||
|
||||
void setRemoteClient(uint16_t sock, uint32_t _ipaddr, uint16_t _port)
|
||||
{
|
||||
if (sock < MAX_SOCK_NUM)
|
||||
{
|
||||
remoteClients[sock].ipaddr = _ipaddr;
|
||||
remoteClients[sock].port = _port;
|
||||
}
|
||||
}
|
||||
|
||||
tRemoteClient* getRemoteClient(uint16_t sock)
|
||||
{
|
||||
if (sock < MAX_SOCK_NUM)
|
||||
{
|
||||
return &remoteClients[sock];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct netif* ard_netif = NULL;
|
||||
|
||||
@ -180,10 +205,10 @@ struct ip_addr _hostIpAddr;
|
||||
|
||||
static bool hostIpAddrFound = false;
|
||||
|
||||
void* getTTCP(uint8_t sock)
|
||||
void* getTTCP(uint8_t sock, uint8_t mode)
|
||||
{
|
||||
if (sock < MAX_SOCK_NUM)
|
||||
return mapSockTCP[sock];
|
||||
return mapSockTCP[sock][mode];
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -194,26 +219,31 @@ int getSock(void * _ttcp)
|
||||
int i = 0;
|
||||
for (; i<MAX_SOCK_NUM; i++)
|
||||
{
|
||||
if (_ttcp == mapSockTCP[i])
|
||||
if (_ttcp == mapSockTCP[i][GET_TCP_MODE(_ttcp)])
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void setMapSock(uint8_t sock, void* _ttcp)
|
||||
void setMapSockMode(uint8_t sock, void* _ttcp, uint8_t _tcp_mode)
|
||||
{
|
||||
if (sock < MAX_SOCK_NUM)
|
||||
mapSockTCP[sock]=_ttcp;
|
||||
INFO_TCP("Map [%d, %p]\n", sock, _ttcp);
|
||||
if ((IS_VALID_SOCK(sock))&&(_ttcp!=NULL))
|
||||
mapSockTCP[sock][_tcp_mode]=_ttcp;
|
||||
INFO_TCP("Map [%d, %p, %s]\n", sock, _ttcp, Mode2Str(_tcp_mode));
|
||||
}
|
||||
|
||||
void clearMapSockTcp(uint8_t sock)
|
||||
void setMapSock(uint8_t sock, void* _ttcp)
|
||||
{
|
||||
setMapSockMode(sock, _ttcp, GET_TCP_MODE(_ttcp));
|
||||
}
|
||||
|
||||
void clearMapSockTcp(uint8_t sock, uint8_t mode)
|
||||
{
|
||||
if (sock < MAX_SOCK_NUM)
|
||||
{
|
||||
//printk("UnMap [%d, %p]\n", sock, mapSockTCP[sock]);
|
||||
mapSockTCP[sock] = NULL;
|
||||
mapSockTCP[sock][mode] = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
@ -223,6 +253,7 @@ void initMapSockTcp()
|
||||
memset(mapSockTCP, 0, sizeof(mapSockTCP));
|
||||
}
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* Calculate bitrate based on number of bytes transmitted and elapsed time
|
||||
*/
|
||||
@ -235,10 +266,10 @@ static void ard_tcp_print_stats(struct ttcp *ttcp) {
|
||||
printk("\n");
|
||||
|
||||
printk("TTCP [%p]: %d bytes processed, %d.%d KB/s (%s/%s)\n", ttcp, bytes,
|
||||
bytes / ms, bytes % ms, ttcp->udp ? "udp" : "tcp", ttcp->mode
|
||||
== TTCP_MODE_TRANSMIT ? "tx" : "rx");
|
||||
bytes / ms, bytes % ms, ProtMode2Str(ttcp->udp),
|
||||
Mode2Str(ttcp->mode));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void showTTCPstatus()
|
||||
{
|
||||
@ -248,19 +279,45 @@ void showTTCPstatus()
|
||||
int i = 0;
|
||||
for (; i<MAX_SOCK_NUM; i++)
|
||||
{
|
||||
void* p = getTTCP(i);
|
||||
if (p)
|
||||
int ii=0;
|
||||
for (; ii<MAX_MODE_NUM; ii++)
|
||||
{
|
||||
ttcp_t* _ttcp = (ttcp_t* )p;
|
||||
printk("Socket n.:%d addr:0x%x port:%d\n", i, _ttcp->addr, _ttcp->port);
|
||||
if (_ttcp->tpcb){
|
||||
printk("[tpcp-%p]-Status:%d\n", _ttcp->tpcb, _ttcp->tpcb->state);
|
||||
void* p = getTTCP(i, ii);
|
||||
if (p)
|
||||
{
|
||||
ttcp_t* _ttcp = (ttcp_t* )p;
|
||||
printk("Socket n.:%d(%d) [0x%x] %s %s addr:%s port:%d\n", i, ii, _ttcp,
|
||||
ProtMode2Str(_ttcp->udp), Mode2Str(_ttcp->mode), ip2str(_ttcp->addr), _ttcp->port);
|
||||
if (_ttcp->udp == TCP_MODE)
|
||||
{
|
||||
int j = 0;
|
||||
for (; j<MAX_CLIENT_ACCEPTED; ++j)
|
||||
{
|
||||
if (_ttcp->tpcb[j]){
|
||||
printk("[%d tpcp-%p]-Status:%d\n", j, _ttcp->tpcb[j], _ttcp->tpcb[j]->state);
|
||||
}
|
||||
}
|
||||
|
||||
if (_ttcp->lpcb){
|
||||
printk("[tlcp-%p]-Status:%d\n", _ttcp->lpcb, _ttcp->lpcb->state);
|
||||
}
|
||||
}else{
|
||||
if (_ttcp->upcb){
|
||||
struct ip_addr loc = _ttcp->upcb->local_ip;
|
||||
printk("[upcp-%p] flags:0x%x local:%s[0x%x]-%d\n",
|
||||
_ttcp->upcb, _ttcp->upcb->flags,
|
||||
ip2str(loc), loc, _ttcp->upcb->local_port);
|
||||
tRemoteClient remote = {0,0};;
|
||||
getRemoteData(i, ii, &remote);
|
||||
struct ip_addr ipaddr = { remote.ipaddr };
|
||||
printk("remote:%s(0x%x)-%d\n", ip2str(ipaddr), remote.ipaddr, remote.port);
|
||||
}
|
||||
}
|
||||
//ard_tcp_print_stats(_ttcp);
|
||||
printk("Data avail:%s\n", isAvailTcpDataByte(i)?"YES":"NO");
|
||||
printk("------------------------------\n");
|
||||
}
|
||||
if (_ttcp->lpcb){
|
||||
printk("[tlcp-%p]-Status:%d\n", _ttcp->lpcb, _ttcp->lpcb->state);
|
||||
}
|
||||
ard_tcp_print_stats(_ttcp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tcp_debug_print_pcbs();
|
||||
@ -270,12 +327,8 @@ int write_stream(volatile avr32_spi_t *spi, const char *stream, uint16_t len)
|
||||
{
|
||||
uint16_t _len = 0;
|
||||
unsigned short dummy=0;
|
||||
bool streamExit = false;
|
||||
|
||||
do {
|
||||
if (*stream == END_CMD)
|
||||
streamExit = true;
|
||||
|
||||
//SIGN1_DN();
|
||||
if (spi_write(spi, *stream) == SPI_ERROR_TIMEOUT)
|
||||
{
|
||||
@ -294,16 +347,7 @@ int write_stream(volatile avr32_spi_t *spi, const char *stream, uint16_t len)
|
||||
spi_read(spi,&dummy);
|
||||
}
|
||||
//SIGN1_UP();
|
||||
}while ((!streamExit)&&(_len <= len));
|
||||
|
||||
if (!streamExit)
|
||||
{
|
||||
#ifdef _SPI_STATS_
|
||||
statSpi.wrongFrame++;
|
||||
statSpi.lastError = SPI_ERROR_ARGUMENT;
|
||||
#endif
|
||||
return SPI_ERROR_ARGUMENT;
|
||||
}
|
||||
}while (_len < len);
|
||||
return SPI_OK;
|
||||
}
|
||||
|
||||
@ -323,8 +367,7 @@ void sendError()
|
||||
volatile avr32_spi_t *spi = ARD_SPI; \
|
||||
Bool global_interrupt_enabled = Is_global_interrupt_enabled(); \
|
||||
if (global_interrupt_enabled) Disable_global_interrupt(); \
|
||||
spi->IER.rdrf = 1; \
|
||||
spi->IER.rxbuff = 1; spi->IER.endrx = 1; \
|
||||
spi->IER.rdrf = 1; spi->IER.rxbuff = 1; spi->IER.endrx = 1; \
|
||||
if (global_interrupt_enabled) Enable_global_interrupt(); \
|
||||
}while(0);
|
||||
|
||||
@ -340,54 +383,6 @@ void sendError()
|
||||
eic_clear_interrupt_line(&AVR32_EIC, AVR32_SPI0_IRQ); \
|
||||
}while(0);
|
||||
|
||||
void dump(char* _buf, uint16_t _count) {
|
||||
|
||||
int i;
|
||||
for (i = 0; i < _count; ++i)
|
||||
printk("0x%x ", _buf[i]);
|
||||
printk("\n");
|
||||
}
|
||||
#ifdef _APP_DEBUG_
|
||||
#define DUMP dump
|
||||
#endif
|
||||
|
||||
#ifdef _APP_DEBUG_
|
||||
#define DUMP_SPI_DATA(BUF, COUNT) do { \
|
||||
if (verboseDebug & INFO_SPI_FLAG) { \
|
||||
int i = 0; \
|
||||
for (; i < COUNT; ++i) \
|
||||
{ \
|
||||
printk("0x%x ", BUF[i]); \
|
||||
if (i % 20 == 0) \
|
||||
printk("\n"); \
|
||||
} \
|
||||
printk("\n"); \
|
||||
} \
|
||||
}while(0);
|
||||
#else
|
||||
#define DUMP_SPI_DATA(BUF, COUNT) do {}while(0);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef _APP_DEBUG_
|
||||
#define DUMP_SPI_CMD(BUF) do { \
|
||||
if (verboseDebug & INFO_SPI_FLAG) { \
|
||||
int i = 0; \
|
||||
for (; i < CMD_MAX_LEN; ++i) \
|
||||
{ \
|
||||
printk("0x%x ", BUF[i]); \
|
||||
if (BUF[i] == END_CMD) \
|
||||
break; \
|
||||
} \
|
||||
printk("\n"); \
|
||||
} \
|
||||
}while(0);
|
||||
#else
|
||||
#define DUMP_SPI_CMD(BUF) do {}while(0);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int spi_add_cmd(char _cmd_id, cmd_spi_cb_t cb, cmd_spi_rcb_t rcb, void* ctx,
|
||||
char flag) {
|
||||
U32 i;
|
||||
@ -541,6 +536,114 @@ int set_passphrase_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
RETURN_ERR(err)
|
||||
}
|
||||
|
||||
int set_ip_config_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
struct ip_addr lwip_addr;
|
||||
struct ctx_server *hs = ctx;
|
||||
struct net_cfg *ncfg = &(hs->net_cfg);
|
||||
struct netif *nif = ncfg->netif;
|
||||
uint8_t parmsToChange=0;
|
||||
const uint8_t MAX_IP_CONFIG_PARAMS = 3;
|
||||
|
||||
wl_err_t err = WL_SUCCESS;
|
||||
tParam* params = (tParam*) buf;
|
||||
|
||||
if (params->paramLen == 1)
|
||||
{
|
||||
GET_PARAM_NEXT(BYTE, params, _parmsToChange);
|
||||
parmsToChange = _parmsToChange;
|
||||
}
|
||||
else
|
||||
RETURN_ERR(WL_FAILURE)
|
||||
|
||||
INFO_SPI("%p numParam=%d parmsToChange=%d\n", ctx, numParam, parmsToChange);
|
||||
|
||||
if (parmsToChange <= MAX_IP_CONFIG_PARAMS)
|
||||
{
|
||||
int i=0;
|
||||
for (; i<parmsToChange; ++i)
|
||||
{
|
||||
if (params->paramLen == 4)
|
||||
{
|
||||
GET_PARAM_NEXT(LONG, params, _ip_addr);
|
||||
lwip_addr.addr = _ip_addr;
|
||||
INFO_SPI("%d] nif:%p lwip_addr=0x%x\n", i, nif, lwip_addr.addr);
|
||||
switch (i)
|
||||
{
|
||||
case 0: // local_ip
|
||||
{
|
||||
netif_set_ipaddr(nif, &lwip_addr);
|
||||
break;
|
||||
}
|
||||
case 1: // gateway
|
||||
{
|
||||
netif_set_gw(nif, &lwip_addr);
|
||||
break;
|
||||
}
|
||||
case 2: // subnet
|
||||
{
|
||||
netif_set_netmask(nif, &lwip_addr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
RETURN_ERR(WL_FAILURE)
|
||||
}
|
||||
|
||||
}
|
||||
/* Disable DHCP */
|
||||
ncfg->dhcp_enabled = STATIC_IP_CONFIG;
|
||||
}else
|
||||
RETURN_ERR(WL_FAILURE)
|
||||
|
||||
RETURN_ERR(err)
|
||||
}
|
||||
|
||||
int set_dns_config_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
struct ip_addr lwip_addr;
|
||||
struct ctx_server *hs = ctx;
|
||||
struct net_cfg *ncfg = &(hs->net_cfg);
|
||||
struct netif *nif = ncfg->netif;
|
||||
uint8_t parmsToChange=0;
|
||||
const uint8_t MAX_DNS_CONFIG_PARAMS = 2;
|
||||
|
||||
wl_err_t err = WL_SUCCESS;
|
||||
tParam* params = (tParam*) buf;
|
||||
|
||||
if (params->paramLen == 1)
|
||||
{
|
||||
GET_PARAM_NEXT(BYTE, params, _parmsToChange);
|
||||
parmsToChange = _parmsToChange;
|
||||
}
|
||||
else
|
||||
RETURN_ERR(WL_FAILURE)
|
||||
|
||||
INFO_SPI("%p numParam=%d parmsToChange=%d\n", ctx, numParam, parmsToChange);
|
||||
|
||||
if (parmsToChange <= MAX_DNS_CONFIG_PARAMS)
|
||||
{
|
||||
int i=0;
|
||||
for (; i<parmsToChange; ++i)
|
||||
{
|
||||
if (params->paramLen == 4)
|
||||
{
|
||||
GET_PARAM_NEXT(LONG, params, _ip_addr);
|
||||
lwip_addr.addr = _ip_addr;
|
||||
INFO_SPI("%d] nif:%p lwip_addr=0x%x\n", i, nif, lwip_addr.addr);
|
||||
dns_setserver(i, &lwip_addr);
|
||||
}else{
|
||||
RETURN_ERR(WL_FAILURE)
|
||||
}
|
||||
}
|
||||
/* Disable DHCP */
|
||||
ncfg->dhcp_enabled = STATIC_IP_CONFIG;
|
||||
}else
|
||||
RETURN_ERR(WL_FAILURE)
|
||||
|
||||
RETURN_ERR(err)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void set_result(wl_status_t _status)
|
||||
{
|
||||
result = _status;
|
||||
@ -578,7 +681,7 @@ extern int ttcp_start(struct ip_addr addr, uint16_t port, void *opaque,
|
||||
void *done_cb, int mode, uint16_t nbuf, uint16_t buflen, int udp, int verbose);
|
||||
|
||||
|
||||
int start_server_tcp(uint16_t port, uint8_t sock)
|
||||
int start_server_tcp(uint16_t port, uint8_t sock, uint8_t protMode)
|
||||
{
|
||||
struct ip_addr addr = { 0 };
|
||||
uint16_t buflen = 1024;
|
||||
@ -590,7 +693,7 @@ int start_server_tcp(uint16_t port, uint8_t sock)
|
||||
#else
|
||||
int verbose = 0;
|
||||
#endif
|
||||
int udp = 0;
|
||||
int udp = protMode;
|
||||
int mode = 1; //RECEIVE
|
||||
void* _ttcp = NULL;
|
||||
|
||||
@ -605,20 +708,20 @@ int start_server_tcp(uint16_t port, uint8_t sock)
|
||||
|
||||
if (!ifStatus)
|
||||
{
|
||||
WARN("IF down...wait\n");
|
||||
WARN_VER("IF down...wait\n");
|
||||
return WIFI_SPI_ERR;
|
||||
}
|
||||
|
||||
|
||||
if (ard_tcp_start(addr, port, NULL, NULL, mode, nbuf, buflen, udp, verbose, sock, &_ttcp) == 0)
|
||||
{
|
||||
INFO_SPI("Start Server [%d, %d] OK!\n", port, sock);
|
||||
INFO_SPI("Start Server %s [%d, %d] OK!\n", ProtMode2Str(protMode), port, sock);
|
||||
setMapSock(sock, _ttcp);
|
||||
err = WL_SUCCESS;
|
||||
}else{
|
||||
|
||||
WARN("Start Server [%d, %d] FAILED!\n", port, sock);
|
||||
clearMapSockTcp(sock);
|
||||
WARN("Start Server %s [%d, %d] FAILED!\n", ProtMode2Str(protMode), port, sock);
|
||||
clearMapSockTcp(sock, TTCP_MODE_RECEIVE);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
@ -627,59 +730,72 @@ int start_server_tcp(uint16_t port, uint8_t sock)
|
||||
int start_server_tcp_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
wl_err_t err = WL_FAILURE;
|
||||
tParam* params = (tParam*) buf;
|
||||
if (numParam == 2)
|
||||
if (numParam == 3)
|
||||
{
|
||||
GET_PARAM_NEXT(INT, params, port);
|
||||
GET_PARAM_NEXT(BYTE, params, sock);
|
||||
err = start_server_tcp(port, sock);
|
||||
GET_PARAM_NEXT(BYTE, params, protMode);
|
||||
err = start_server_tcp(port, sock, protMode);
|
||||
}
|
||||
return (err==WL_SUCCESS) ? WIFI_SPI_ACK : WIFI_SPI_ERR;
|
||||
}
|
||||
|
||||
int start_client_tcp_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
wl_err_t err = WL_FAILURE;
|
||||
tParam* params = (tParam*) buf;
|
||||
if (numParam == 3)
|
||||
{
|
||||
GET_PARAM_NEXT(LONG, params, _addr);
|
||||
GET_PARAM_NEXT(INT, params, port);
|
||||
GET_PARAM_NEXT(BYTE, params, sock);
|
||||
int start_client_tcp(uint32_t _addr, uint16_t port, uint8_t sock, uint8_t protMode)
|
||||
{
|
||||
uint16_t buflen = 1024;
|
||||
uint16_t nbuf = 1024;
|
||||
wl_err_t err = WL_FAILURE;
|
||||
struct ip_addr addr = { .addr = _addr};
|
||||
|
||||
INFO_SPI("Addr:0x%x, port:%d, sock:%d\n", _addr, port, sock);
|
||||
INFO_SPI("Addr:0x%x, port:%d, sock:%d, prot:%s\n", _addr, port, sock, ProtMode2Str(protMode));
|
||||
|
||||
uint16_t buflen = 1024;
|
||||
uint16_t nbuf = 1024;
|
||||
struct ip_addr addr = { .addr = _addr};
|
||||
#ifdef _APP_DEBUG_
|
||||
int verbose = 1;
|
||||
#else
|
||||
int verbose = 0;
|
||||
#endif
|
||||
int udp = 0;
|
||||
int mode = 0; //TRANSMIT
|
||||
void* _ttcp = NULL;
|
||||
#ifdef _APP_DEBUG_
|
||||
int verbose = 1;
|
||||
#else
|
||||
int verbose = 0;
|
||||
#endif
|
||||
|
||||
int udp = protMode;
|
||||
int mode = 0; //TRANSMIT
|
||||
void* _ttcp = NULL;
|
||||
|
||||
if (sock >= MAX_SOCK_NUM)
|
||||
return WIFI_SPI_ERR;
|
||||
|
||||
// Check previous connection
|
||||
_ttcp = getTTCP(sock);
|
||||
if (_ttcp != NULL)
|
||||
{
|
||||
WARN("Previous client %p not stopped !\n", _ttcp);
|
||||
ard_tcp_stop(_ttcp);
|
||||
clearMapSockTcp(sock);
|
||||
}
|
||||
// Check previous connection
|
||||
_ttcp = getTTCP(sock, TTCP_MODE_TRANSMIT);
|
||||
if (_ttcp != NULL)
|
||||
{
|
||||
WARN("Previous client %p not stopped !\n", _ttcp);
|
||||
ard_tcp_stop(_ttcp);
|
||||
clearMapSockTcp(sock, TTCP_MODE_TRANSMIT);
|
||||
}
|
||||
|
||||
if (ard_tcp_start((struct ip_addr)addr, port, NULL, NULL, mode, nbuf, buflen, udp, verbose, sock, &_ttcp) == 0)
|
||||
{
|
||||
INFO_SPI("Start Client [0x%x, %d, %d] OK!\n", addr, port, sock);
|
||||
setMapSock(sock, _ttcp);
|
||||
err = WL_SUCCESS;
|
||||
}else{
|
||||
INFO_SPI("Start Client [0x%x, %d, %d] FAILED!\n", addr, port, sock);
|
||||
clearMapSockTcp(sock);
|
||||
}
|
||||
if (ard_tcp_start(addr, port, NULL, NULL, mode, nbuf, buflen, udp, verbose, sock, &_ttcp) == 0)
|
||||
{
|
||||
INFO_SPI("Start Client %s %p [0x%x, %d, %d] OK!\n", ProtMode2Str(protMode),
|
||||
_ttcp, addr, port, sock);
|
||||
setMapSock(sock, _ttcp);
|
||||
err = WL_SUCCESS;
|
||||
}else{
|
||||
INFO_SPI("Start Client %s %p [0x%x, %d, %d] FAILED!\n", ProtMode2Str(protMode),
|
||||
_ttcp, addr, port, sock);
|
||||
clearMapSockTcp(sock, TTCP_MODE_TRANSMIT);
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int start_client_tcp_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
wl_err_t err = WL_FAILURE;
|
||||
tParam* params = (tParam*) buf;
|
||||
if (numParam == 4)
|
||||
{
|
||||
GET_PARAM_NEXT(LONG, params, _addr);
|
||||
GET_PARAM_NEXT(INT, params, port);
|
||||
GET_PARAM_NEXT(BYTE, params, sock);
|
||||
GET_PARAM_NEXT(BYTE, params, protMode);
|
||||
err = start_client_tcp(_addr, port, sock, protMode);
|
||||
}
|
||||
return (err==WL_SUCCESS) ? WIFI_SPI_ACK : WIFI_SPI_ERR;
|
||||
}
|
||||
@ -697,7 +813,7 @@ int stop_client_tcp_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
|
||||
if (sock < MAX_SOCK_NUM)
|
||||
{
|
||||
_ttcp = getTTCP(sock);
|
||||
_ttcp = getTTCP(sock, TTCP_MODE_TRANSMIT);
|
||||
ard_tcp_stop(_ttcp);
|
||||
err = WL_SUCCESS;
|
||||
}
|
||||
@ -705,6 +821,37 @@ int stop_client_tcp_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
return (err==WL_SUCCESS) ? WIFI_SPI_ACK : WIFI_SPI_ERR;
|
||||
}
|
||||
|
||||
int insert_data_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
|
||||
tDataParam* msg = (tDataParam*) buf;
|
||||
if ((numParam == 2)&&(msg->dataLen == 1))
|
||||
{
|
||||
GET_DATA_BYTE(sock, buf+2);
|
||||
GET_DATA_INT(len, buf+3);
|
||||
//printk("tcp:%p buf:%p len:%d\n", getTTCP(sock), (uint8_t*)(buf+5), len);
|
||||
insertBuf(sock, (uint8_t*)(buf+5), len);
|
||||
}
|
||||
return WIFI_SPI_ACK;
|
||||
}
|
||||
|
||||
int send_data_udp_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
wl_err_t err = WL_FAILURE;
|
||||
|
||||
tParam* params = (tParam*) buf;
|
||||
if ((numParam == 1)&&(params->paramLen == 1))
|
||||
{
|
||||
GET_PARAM_NEXT(BYTE, params, sock);
|
||||
uint16_t len = 0;
|
||||
uint8_t* p = mergeBuf(sock, NULL, &len);
|
||||
err = sendUdpData(getTTCP(sock, TTCP_MODE_TRANSMIT), p, len);
|
||||
clearBuf(sock);
|
||||
free(p);
|
||||
}
|
||||
|
||||
return (err==WL_SUCCESS) ? WIFI_SPI_ACK : WIFI_SPI_ERR;
|
||||
}
|
||||
|
||||
|
||||
int send_data_tcp_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
wl_err_t err = WL_FAILURE;
|
||||
DATA_LED_ON();
|
||||
@ -714,7 +861,7 @@ int send_data_tcp_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
GET_DATA_BYTE(sock, buf+2);
|
||||
GET_DATA_INT(len, buf+3);
|
||||
//printk("tcp:%p buf:%p len:%d\n", getTTCP(sock), (uint8_t*)(buf+5), len);
|
||||
err = sendTcpData(getTTCP(sock), (uint8_t*)(buf+5), len);
|
||||
err = sendTcpData(getTTCP(sock, TTCP_MODE_TRANSMIT), (uint8_t*)(buf+5), len);
|
||||
}
|
||||
DATA_LED_OFF();
|
||||
return (err==WL_SUCCESS) ? WIFI_SPI_ACK : WIFI_SPI_ERR;
|
||||
@ -726,7 +873,6 @@ int ack_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
|
||||
int get_result_cmd_cb(int numParam, char* buf, void* ctx) {
|
||||
INFO_SPI("ifStatus:%d result:%d\n", ifStatus, result);
|
||||
*buf=(ifStatus)?WL_CONNECTED:result;
|
||||
return WIFI_SPI_ACK;
|
||||
}
|
||||
|
||||
@ -744,7 +890,7 @@ cmd_spi_state_t get_reply_cb(char* recv, char* reply, void* ctx, uint16_t* count
|
||||
if (ctx != NULL) {
|
||||
reply[4] = (*(uint8_t*)ctx); //param
|
||||
} else {
|
||||
reply[4] = result; //param
|
||||
reply[4] = (ifStatus)?WL_CONNECTED:result; //param
|
||||
}
|
||||
|
||||
END_HEADER_REPLY(reply, 5, *count);
|
||||
@ -784,6 +930,51 @@ cmd_spi_state_t get_reply_ipaddr_cb(char* recv, char* reply, void* ctx, uint16_t
|
||||
return SPI_CMD_DONE;
|
||||
}
|
||||
|
||||
void getRemoteData(uint8_t sock, uint8_t mode, tRemoteClient* remoteData)
|
||||
{
|
||||
if ((sock>=0) && (sock<MAX_SOCK_NUM))
|
||||
{
|
||||
void* p = getTTCP(sock, mode);
|
||||
if (p)
|
||||
{
|
||||
ttcp_t* _ttcp = (ttcp_t* )p;
|
||||
if ((_ttcp->udp == UDP_MODE))
|
||||
{
|
||||
if (_ttcp->mode == TTCP_MODE_RECEIVE)
|
||||
{
|
||||
remoteData->ipaddr = getRemoteClient(sock)->ipaddr;
|
||||
remoteData->port = getRemoteClient(sock)->port;
|
||||
}else{
|
||||
remoteData->ipaddr = (_ttcp->upcb) ? _ttcp->upcb->remote_ip.addr : 0;
|
||||
remoteData->port = (_ttcp->upcb) ? _ttcp->upcb->remote_port : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cmd_spi_state_t get_reply_remote_data_cb(char* recv, char* reply, void* ctx, uint16_t* count) {
|
||||
|
||||
CHECK_ARD_NETIF(recv, reply, count);
|
||||
DUMP_SPI_CMD(recv);
|
||||
|
||||
GET_DATA_BYTE(sock, recv+4);
|
||||
|
||||
CREATE_HEADER_REPLY(reply, recv, 2);
|
||||
tRemoteClient remoteData = {0,0};
|
||||
//TODO pass the mode
|
||||
getRemoteData(sock, TTCP_MODE_RECEIVE, &remoteData);
|
||||
|
||||
PUT_LONG_IN_BYTE_NO(remoteData.ipaddr, reply, 3);
|
||||
PUT_DATA_INT(remoteData.port, reply, 8);
|
||||
|
||||
END_HEADER_REPLY(reply, 11, *count);
|
||||
|
||||
return SPI_CMD_DONE;
|
||||
}
|
||||
|
||||
|
||||
void foundHostByName(const char *name, struct ip_addr *ipaddr, void *callback_arg)
|
||||
{
|
||||
_hostIpAddr.addr = (ipaddr)?ipaddr->addr:0xffffffff;
|
||||
@ -1071,11 +1262,11 @@ cmd_spi_state_t get_state_tcp_cmd_cb(char* recv, char* reply, void* ctx, uint16_
|
||||
uint8_t _state = CLOSED;
|
||||
if ((recv[3]==1)&&(recv[4]>=0)&&(recv[4]<MAX_SOCK_NUM))
|
||||
{
|
||||
_state = getStateTcp(getTTCP((uint8_t)recv[4]), 0);
|
||||
_state = getStateTcp(getTTCP((uint8_t)recv[4], TTCP_MODE_RECEIVE), 0);
|
||||
}
|
||||
PUT_DATA_BYTE(_state, reply, 3);
|
||||
END_HEADER_REPLY(reply, 5, *count);
|
||||
INFO_SPI("state:%d\n", _state);
|
||||
INFO_SPI_POLL("state:%d\n", _state);
|
||||
|
||||
return SPI_CMD_DONE;
|
||||
}
|
||||
@ -1087,33 +1278,20 @@ cmd_spi_state_t get_client_state_tcp_cmd_cb(char* recv, char* reply, void* ctx,
|
||||
CREATE_HEADER_REPLY(reply, recv, PARAM_NUMS_1);
|
||||
|
||||
uint8_t _state = CLOSED;
|
||||
if ((recv[3]==1)&&(recv[4]>=0)&&(recv[4]<MAX_SOCK_NUM))
|
||||
uint8_t _sock = recv[4];
|
||||
if ((recv[3]==1)&&(_sock>=0)&&(_sock<MAX_SOCK_NUM))
|
||||
{
|
||||
void * p= getTTCP((uint8_t)recv[4]);
|
||||
void * p= getTTCP(_sock, TTCP_MODE_TRANSMIT);
|
||||
if (p!=NULL)
|
||||
{
|
||||
// get if we are in server or Transmit mode (0)
|
||||
if (getModeTcp(p) == TTCP_MODE_TRANSMIT)
|
||||
{
|
||||
|
||||
_state = getStateTcp(p, 1);
|
||||
INFO_SPI_VER("CLI> p=%p _ttcp=%p state(tpcb):%d state:%d\n",
|
||||
p, ((struct ttcp*) p)->tpcb,
|
||||
((struct ttcp*) p)->tpcb->state,
|
||||
_state);
|
||||
}else {
|
||||
_state = getStateTcp(p, 1);
|
||||
INFO_SPI_VER("SER> p=%p _ttcp=%p state(tpcb):%d state(lpcb):%d state:%d\n",
|
||||
p, ((struct ttcp*) p)->tpcb,
|
||||
((struct ttcp*) p)->tpcb->state,
|
||||
((struct ttcp*) p)->lpcb->state,
|
||||
_state);
|
||||
}
|
||||
_state = getStateTcp(p, 1);
|
||||
}else{
|
||||
WARN_VER("TTCP not found for sock:%d\n", _sock);
|
||||
}
|
||||
}
|
||||
PUT_DATA_BYTE(_state, reply, 3);
|
||||
END_HEADER_REPLY(reply, 5, *count);
|
||||
INFO_SPI("state:%d\n", _state);
|
||||
INFO_SPI_POLL("sock:%d state:%d\n", _sock, _state);
|
||||
|
||||
return SPI_CMD_DONE;
|
||||
}
|
||||
@ -1123,15 +1301,15 @@ cmd_spi_state_t avail_data_tcp_cmd_cb(char* recv, char* reply, void* ctx, uint16
|
||||
CHECK_ARD_NETIF(recv, reply, count);
|
||||
|
||||
CREATE_HEADER_REPLY(reply, recv, PARAM_NUMS_1);
|
||||
uint8_t dataAvail = 0;
|
||||
uint16_t dataAvail = 0;
|
||||
if ((recv[3]==1)&&(recv[4]>=0)&&(recv[4]<MAX_SOCK_NUM))
|
||||
{
|
||||
dataAvail = isAvailTcpDataByte((uint8_t)recv[4]) ? 1 : 0;
|
||||
dataAvail = getAvailTcpDataByte((uint8_t)recv[4]);
|
||||
}
|
||||
PUT_DATA_BYTE(dataAvail, reply, 3);
|
||||
END_HEADER_REPLY(reply, 5, *count);
|
||||
PUT_DATA_INT_NO(dataAvail, reply, 3);
|
||||
END_HEADER_REPLY(reply, 6, *count);
|
||||
|
||||
INFO_SPI("dataAvail:%d\n", dataAvail);
|
||||
INFO_SPI_POLL("dataAvail:%d\n", dataAvail);
|
||||
|
||||
return SPI_CMD_DONE;
|
||||
}
|
||||
@ -1155,7 +1333,7 @@ cmd_spi_state_t data_sent_tcp_cmd_cb(char* recv, char* reply, void* ctx, uint16_
|
||||
uint8_t dataSent = 0;
|
||||
if ((recv[3]==1)&&(recv[4]>=0)&&(recv[4]<MAX_SOCK_NUM))
|
||||
{
|
||||
dataSent = isDataSent(getTTCP((uint8_t)recv[4]));
|
||||
dataSent = isDataSent(getTTCP((uint8_t)recv[4], TTCP_MODE_TRANSMIT));
|
||||
}
|
||||
PUT_DATA_BYTE(dataSent, reply, 3);
|
||||
END_HEADER_REPLY(reply, 5, *count);
|
||||
@ -1199,14 +1377,15 @@ cmd_spi_state_t get_databuf_tcp_cmd_cb(char* recv, char* reply, void* ctx, uint1
|
||||
|
||||
CHECK_ARD_NETIF(recv, reply, count);
|
||||
|
||||
if ((recv[3]==1)&&(recv[4]>=0)&&(recv[4]<MAX_SOCK_NUM))
|
||||
GET_DATA_BYTE(sock, buf+5);
|
||||
if ((sock>=0)&&(sock<MAX_SOCK_NUM))
|
||||
{
|
||||
if (getTcpData((uint8_t)recv[4], (void**)&data, &len))
|
||||
if (getTcpData((uint8_t)sock, (void**)&data, &len))
|
||||
{
|
||||
CREATE_HEADER_REPLY(reply, recv, PARAM_NUMS_1);
|
||||
PUT_BUFDATA_INT(data, len, reply, 3);
|
||||
END_HEADER_REPLY(reply, 3+len+2+1, *count);
|
||||
freeTcpData((uint8_t)recv[4]);
|
||||
END_HEADER_REPLY(reply, 3+len+2, *count);
|
||||
freeTcpData((uint8_t)sock);
|
||||
}else{
|
||||
CREATE_HEADER_REPLY(reply, recv, PARAM_NUMS_0);
|
||||
END_HEADER_REPLY(reply, 3, *count);
|
||||
@ -1264,16 +1443,17 @@ int sendReply(int cmdIdx, char* recv, char* reply, void* resultCmd)
|
||||
AVAIL_FOR_SPI();
|
||||
_result = write_stream(ARD_SPI, &reply[0], _count);
|
||||
#ifdef _SPI_STATS_
|
||||
if ( result != SPI_OK)
|
||||
if ( _result != SPI_OK)
|
||||
{
|
||||
statSpi.lastCmd = cmd_spi_list[cmdIdx].cmd_id;
|
||||
}
|
||||
#endif
|
||||
BUSY_FOR_SPI();
|
||||
|
||||
//unsigned char status = spi_getStatus(ARD_SPI);
|
||||
//INFO_SPI("Status after write: 0x%x\n",status);
|
||||
|
||||
IF_SPI_DUMP(printk("==>"));
|
||||
DUMP_SPI(recv, count);
|
||||
IF_SPI_DUMP(printk("<=="));
|
||||
DUMP_SPI(reply, _count);
|
||||
replyCount = _count;
|
||||
return _result;
|
||||
}
|
||||
@ -1282,21 +1462,22 @@ unsigned char* getStartCmdSeq(unsigned char* _recv, int len, int *offset)
|
||||
{
|
||||
int i = 0;
|
||||
*offset = 0;
|
||||
DEB_PIN_UP();
|
||||
//DEB_PIN_UP();
|
||||
for (; i<len; ++i)
|
||||
{
|
||||
if (_recv[i]==START_CMD)
|
||||
{
|
||||
if (i!=0)
|
||||
{
|
||||
DEB_PIN_DN();
|
||||
DEB_PIN_TRIGGER();
|
||||
IF_WARN_VER(dump((char*)_recv, (uint16_t)len));
|
||||
WARN("%d] Disall. %d/%d cmd:%d\n", cmdCorr, i, len,_recv[i+1]);
|
||||
}
|
||||
*offset = i;
|
||||
return &_recv[i];
|
||||
}
|
||||
}
|
||||
DEB_PIN_DN();
|
||||
//DEB_PIN_DN();
|
||||
WARN("%d] Disall. %d\n", cmdCorr, i);
|
||||
|
||||
return NULL;
|
||||
@ -1330,12 +1511,12 @@ int call_reply_cb(char* recv, char* reply) {
|
||||
{
|
||||
tSpiMsg* spiMsg = (tSpiMsg*) recv;
|
||||
_result = cmd_spi_list[i].cb(spiMsg->nParam,
|
||||
(char*) &(spiMsg->params[0]), NULL);
|
||||
(char*) &(spiMsg->params[0]), cmd_spi_list[i].ctx);
|
||||
}else
|
||||
{
|
||||
tSpiMsgData* spiMsg = (tSpiMsgData*) recv;
|
||||
_result = cmd_spi_list[i].cb(spiMsg->nParam,
|
||||
(char*) &(spiMsg->params[0]), NULL);
|
||||
(char*) &(spiMsg->params[0]), cmd_spi_list[i].ctx);
|
||||
}
|
||||
|
||||
if (_result != WIFI_SPI_ACK)
|
||||
@ -1380,10 +1561,12 @@ int call_reply_cb(char* recv, char* reply) {
|
||||
return REPLY_NO_ERR;
|
||||
}
|
||||
|
||||
void init_spi_cmds() {
|
||||
void init_spi_cmds(void* ctx) {
|
||||
spi_add_cmd(SET_NET_CMD, set_net_cmd_cb, ack_reply_cb, NULL, CMD_SET_FLAG);
|
||||
spi_add_cmd(SET_PASSPHRASE_CMD, set_passphrase_cmd_cb, ack_reply_cb, NULL, CMD_SET_FLAG);
|
||||
spi_add_cmd(SET_KEY_CMD, set_key_cmd_cb, ack_reply_cb, NULL, CMD_SET_FLAG);
|
||||
spi_add_cmd(SET_IP_CONFIG_CMD, set_ip_config_cmd_cb, ack_reply_cb, ctx, CMD_SET_FLAG);
|
||||
spi_add_cmd(SET_DNS_CONFIG_CMD, set_dns_config_cmd_cb, ack_reply_cb, ctx, CMD_SET_FLAG);
|
||||
spi_add_cmd(GET_CONN_STATUS_CMD, get_result_cmd_cb, get_reply_cb, NULL, CMD_GET_FLAG);
|
||||
spi_add_cmd(GET_IPADDR_CMD, ack_cmd_cb, get_reply_ipaddr_cb, NULL, CMD_GET_FLAG);
|
||||
spi_add_cmd(GET_MACADDR_CMD, ack_cmd_cb, get_reply_mac_cb, NULL, CMD_GET_FLAG);
|
||||
@ -1411,6 +1594,9 @@ void init_spi_cmds() {
|
||||
spi_add_cmd(GET_CLIENT_STATE_TCP_CMD, ack_cmd_cb, get_client_state_tcp_cmd_cb, NULL, CMD_GET_FLAG);
|
||||
spi_add_cmd(GET_FW_VERSION_CMD, ack_cmd_cb, get_firmware_version_cmd_cb, NULL, CMD_GET_FLAG);
|
||||
spi_add_cmd(GET_TEST_CMD, ack_cmd_cb, get_test_cmd_cb, NULL, CMD_GET_FLAG);
|
||||
spi_add_cmd(INSERT_DATABUF_CMD, insert_data_cmd_cb, ack_reply_cb, NULL, CMD_IMM_SET_FLAG);
|
||||
spi_add_cmd(SEND_DATA_UDP_CMD, send_data_udp_cmd_cb, ack_reply_cb, NULL, CMD_SET_FLAG);
|
||||
spi_add_cmd(GET_REMOTE_DATA_CMD, ack_cmd_cb, get_reply_remote_data_cb, NULL, CMD_GET_FLAG);
|
||||
}
|
||||
|
||||
|
||||
@ -1452,8 +1638,9 @@ bool checkMsgFormat(uint8_t* _recv, int len, int* offset)
|
||||
unsigned char* recv = getStartCmdSeq(_recv, len, offset);
|
||||
if ((recv == NULL)||(recv!=_recv))
|
||||
{
|
||||
if ((enableDebug & INFO_WARN_FLAG)&&(len < 20)) //TODO stamp only short messages wrong
|
||||
dump((char*)_recv, len);
|
||||
DEB_PIN_TRIGGER();
|
||||
|
||||
IF_WARN_VER(DUMP((char*)_recv, len));
|
||||
|
||||
STATSPI_DISALIGN_ERROR();
|
||||
|
||||
@ -1468,7 +1655,7 @@ bool checkMsgFormat(uint8_t* _recv, int len, int* offset)
|
||||
paramLenTot = checkMsgParam8(recv);
|
||||
else
|
||||
{
|
||||
DUMP_SPI_DATA(_recv, len);
|
||||
DUMP_SPI(_recv, len);
|
||||
paramLenTot = checkMsgParam16(recv);
|
||||
}
|
||||
|
||||
@ -1512,8 +1699,8 @@ void spi_poll(struct netif* netif) {
|
||||
int err = call_reply_cb(buf, &reply[0]);
|
||||
if (err != REPLY_NO_ERR)
|
||||
{
|
||||
DUMP_SPI_DATA(buf, count);
|
||||
DUMP_SPI_DATA(reply, replyCount);
|
||||
DUMP_SPI(buf, count);
|
||||
DUMP_SPI(reply, replyCount);
|
||||
}
|
||||
receivedChars = 0;
|
||||
count = 0;
|
||||
@ -1523,8 +1710,7 @@ void spi_poll(struct netif* netif) {
|
||||
{
|
||||
sendError();
|
||||
WARN("%d] Check format msg failed!\n", cmdCorr);
|
||||
if (enableDebug & INFO_WARN_FLAG)
|
||||
dump((char*)_receiveBuffer, receivedChars);
|
||||
IF_WARN_VER(dump((char*)_receiveBuffer, receivedChars));
|
||||
state = SPI_CMD_IDLE;
|
||||
count=0;
|
||||
//mark as buffer used
|
||||
@ -1552,11 +1738,7 @@ inline int spi_slaveReceiveInt(volatile avr32_spi_t *spi)
|
||||
int index = 0;
|
||||
int err = SPI_OK;
|
||||
state = SPI_CMD_INPUT;
|
||||
|
||||
if (_receiveBuffer[0] != 0)
|
||||
{
|
||||
STATSPI_OVERRIDE_ERROR();
|
||||
}
|
||||
bool endOfFrame = false;
|
||||
|
||||
do {
|
||||
unsigned int timeout = SPI_TIMEOUT;
|
||||
@ -1569,8 +1751,20 @@ inline int spi_slaveReceiveInt(volatile avr32_spi_t *spi)
|
||||
break;
|
||||
}
|
||||
}
|
||||
_receiveBuffer[index] = (spi->rdr >> AVR32_SPI_RDR_RD_OFFSET) & 0x00ff;
|
||||
//DEB_PIN_TG();
|
||||
#if 0
|
||||
#ifdef _SPI_STATS_
|
||||
if (spi->sr & AVR32_SPI_SR_OVRES_MASK)
|
||||
{
|
||||
STATSPI_OVERRIDE_ERROR();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (err == SPI_OK) {
|
||||
_receiveBuffer[index] = (spi->rdr >> AVR32_SPI_RDR_RD_OFFSET) & 0x00ff;
|
||||
DEB_PIN_UP(2);
|
||||
if ((index==0) && (_receiveBuffer[index] != START_CMD))
|
||||
DEB_PIN_TRIGGER();
|
||||
++index;
|
||||
++receivedChars;
|
||||
}else{
|
||||
@ -1585,7 +1779,35 @@ inline int spi_slaveReceiveInt(volatile avr32_spi_t *spi)
|
||||
err = SPI_ERROR_OVERRUN_AND_MODE_FAULT;
|
||||
break;
|
||||
}
|
||||
} while (_receiveBuffer[index - 1] != END_CMD);
|
||||
|
||||
if (_receiveBuffer[index - 1] == END_CMD)
|
||||
{
|
||||
int8_t numParams = 0;
|
||||
int idx = PARAM_LEN_POS+1;
|
||||
bool islen16bit = ((_receiveBuffer[CMD_POS] & DATA_FLAG) == DATA_FLAG);
|
||||
if (index >= idx)
|
||||
{
|
||||
numParams = _receiveBuffer[PARAM_LEN_POS];
|
||||
while (((index-1) > idx)&&(numParams>0))
|
||||
{
|
||||
if (islen16bit)
|
||||
idx += (_receiveBuffer[idx]<<8) + _receiveBuffer[idx+1]+2;
|
||||
else
|
||||
idx += _receiveBuffer[idx]+1;
|
||||
--numParams;
|
||||
}
|
||||
if (((index-1) == idx) && (numParams == 0))
|
||||
endOfFrame = true;
|
||||
}
|
||||
if (!endOfFrame){
|
||||
WARN("Wrong termination index:%d nParam:%d idx:%d 16bit:%d\n", index, numParams, idx, islen16bit);
|
||||
#ifdef _DEBUG_
|
||||
dump((char*)_receiveBuffer, receivedChars);
|
||||
while(0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} while (!endOfFrame);
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -1597,8 +1819,7 @@ __interrupt
|
||||
static void spi_int_handler(void)
|
||||
{
|
||||
volatile avr32_spi_t *spi = ARD_SPI;
|
||||
//DEB_PIN_DN();
|
||||
//AVAIL_FOR_SPI();
|
||||
DEB_PIN_DN(2);
|
||||
DISABLE_SPI_INT();
|
||||
|
||||
if ((spi->sr & AVR32_SPI_SR_RDRF_MASK) != 0)
|
||||
@ -1610,12 +1831,10 @@ static void spi_int_handler(void)
|
||||
startReply=true;
|
||||
++cmdCorr;
|
||||
//maintain disable interrupt to send the reply command
|
||||
//DEB_PIN_UP();
|
||||
return;
|
||||
}
|
||||
}
|
||||
ENABLE_SPI_INT();
|
||||
//DEB_PIN_UP();
|
||||
}
|
||||
|
||||
inline spi_status_t spi_read8(volatile avr32_spi_t *spi, unsigned char *data)
|
||||
@ -1682,7 +1901,7 @@ void initExtInt()
|
||||
Enable_global_interrupt();
|
||||
}
|
||||
|
||||
int initSpi()
|
||||
int initSpi(void* ctx)
|
||||
{
|
||||
volatile avr32_spi_t *spi = &AVR32_SPI0;
|
||||
gpio_map_t spi_piomap = { \
|
||||
@ -1734,7 +1953,7 @@ int initSpi()
|
||||
#ifdef _SPI_STATS_
|
||||
initStatSpi();
|
||||
#endif
|
||||
init_spi_cmds();
|
||||
init_spi_cmds(ctx);
|
||||
|
||||
memset(_receiveBuffer, 0, sizeof(_receiveBuffer));
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
@ -37,19 +37,27 @@ typedef enum {
|
||||
CMD_IMM_SET_FLAG = 0x04,
|
||||
}cmd_flags;
|
||||
|
||||
typedef enum eProtMode {TCP_MODE, UDP_MODE}tProtMode;
|
||||
|
||||
#define TIMEOUT_SPI 200
|
||||
#define SPI_ALIGN_ERROR 0xF0
|
||||
#define SPI_OVERRIDE_ERROR 0xF1
|
||||
#define SPI_TIMEOUT_ERROR 0xF2
|
||||
#define DUMMY_DATA 0xFF
|
||||
|
||||
typedef int (*cmd_spi_cb_t)(int numParam, char* buf, void* ctx);
|
||||
typedef cmd_spi_state_t (*cmd_spi_rcb_t)(char* recv, char* reply, void* ctx, uint16_t* _count);
|
||||
|
||||
typedef struct eRemoteClient{
|
||||
uint32_t ipaddr;
|
||||
uint16_t port;
|
||||
}tRemoteClient;
|
||||
|
||||
void set_result_cmd(int err) ;
|
||||
|
||||
void set_result(wl_status_t _status);
|
||||
|
||||
int initSpi(void);
|
||||
int initSpi(void* ctx);
|
||||
|
||||
void initExtInt();
|
||||
|
||||
@ -61,10 +69,20 @@ void showTTCPstatus();
|
||||
|
||||
int getSock(void * _ttcp);
|
||||
|
||||
void* getTTCP(uint8_t sock);
|
||||
void* getTTCP(uint8_t sock, uint8_t mode);
|
||||
|
||||
void clearMapSockTcp(uint8_t sock);
|
||||
void setMapSockMode(uint8_t sock, void* _ttcp, uint8_t _tcp_mode);
|
||||
|
||||
int start_server_tcp(uint16_t port, uint8_t sock);
|
||||
void clearMapSockTcp(uint8_t sock, uint8_t mode);
|
||||
|
||||
int start_server_tcp(uint16_t port, uint8_t sock, uint8_t protMode);
|
||||
|
||||
int start_client_tcp(uint32_t _addr, uint16_t port, uint8_t sock, uint8_t protMode);
|
||||
|
||||
void setRemoteClient(uint16_t sock, uint32_t _ipaddr, uint16_t _port);
|
||||
|
||||
tRemoteClient* getRemoteClient(uint16_t sock);
|
||||
|
||||
void getRemoteData(uint8_t sock, uint8_t mode, tRemoteClient* remoteData);
|
||||
|
||||
#endif /* ARD_SPI_H_ */
|
||||
|
@ -27,21 +27,20 @@
|
||||
#include "getopt.h"
|
||||
#include "ard_utils.h"
|
||||
#include "debug.h"
|
||||
#include "trace.h"
|
||||
|
||||
unsigned int startTime = 0;
|
||||
extern bool ifStatus;
|
||||
static uint8_t tcp_poll_retries = 0;
|
||||
static int isDataSentCount = 0;
|
||||
|
||||
bool pending_close = false;
|
||||
bool pending_accept = false;
|
||||
|
||||
static err_t tcp_data_sent(void *arg, struct tcp_pcb *pcb, u16_t len);
|
||||
|
||||
static void atcp_init_pend_flags()
|
||||
static void atcp_init_pend_flags(struct ttcp* _ttcp)
|
||||
{
|
||||
pending_close = false;
|
||||
pending_accept = false;
|
||||
int i = 0;
|
||||
for (; i<MAX_CLIENT_ACCEPTED; ++i)
|
||||
{
|
||||
if (_ttcp) _ttcp->pending_close[i] = false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,17 +50,23 @@ static void ard_tcp_destroy(struct ttcp* ttcp) {
|
||||
err_t err = ERR_OK;
|
||||
DUMP_TCP_STATE(ttcp);
|
||||
|
||||
if (getSock(ttcp)==-1)
|
||||
uint8_t sock = getSock(ttcp);
|
||||
if (sock == -1)
|
||||
WARN("ttcp already deallocated!\n");
|
||||
|
||||
if (ttcp->tpcb) {
|
||||
tcp_arg(ttcp->tpcb, NULL);
|
||||
tcp_sent(ttcp->tpcb, NULL);
|
||||
tcp_recv(ttcp->tpcb, NULL);
|
||||
tcp_err(ttcp->tpcb, NULL);
|
||||
//TEMPORAQARY
|
||||
//err = tcp_close(ttcp->tpcb);
|
||||
INFO_TCP("Closing tpcb: state:0x%x err:%d\n", ttcp->tpcb->state, err);
|
||||
freeAllTcpData(sock);
|
||||
int i = 0;
|
||||
for (; i<MAX_CLIENT_ACCEPTED; ++i)
|
||||
{
|
||||
if (ttcp->tpcb[i]) {
|
||||
tcp_arg(ttcp->tpcb[i], NULL);
|
||||
tcp_sent(ttcp->tpcb[i], NULL);
|
||||
tcp_recv(ttcp->tpcb[i], NULL);
|
||||
tcp_err(ttcp->tpcb[i], NULL);
|
||||
//TEMPORAQARY
|
||||
//err = tcp_close(ttcp->tpcb);
|
||||
INFO_TCP("Closing tpcb: state:0x%x err:%d\n", ttcp->tpcb[i]->state, err);
|
||||
}
|
||||
}
|
||||
|
||||
if (ttcp->lpcb) {
|
||||
@ -76,44 +81,10 @@ static void ard_tcp_destroy(struct ttcp* ttcp) {
|
||||
udp_remove(ttcp->upcb);
|
||||
}
|
||||
|
||||
if (ttcp->payload)
|
||||
free(ttcp->payload);
|
||||
|
||||
FREE_PAYLOAD(ttcp);
|
||||
free(ttcp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clean up and free the ttcp structure
|
||||
*/
|
||||
static void ard_tcp_abort(struct ttcp* ttcp) {
|
||||
|
||||
INFO_TCP("Abort ttcb:%p tpcb:%p lpcb:%p\n", ttcp, ttcp->tpcb, ttcp->lpcb);
|
||||
if (ttcp->tpcb) {
|
||||
tcp_arg(ttcp->tpcb, NULL);
|
||||
tcp_sent(ttcp->tpcb, NULL);
|
||||
tcp_recv(ttcp->tpcb, NULL);
|
||||
tcp_err(ttcp->tpcb, NULL);
|
||||
tcp_abort(ttcp->tpcb);
|
||||
}
|
||||
|
||||
if (ttcp->lpcb) {
|
||||
tcp_arg(ttcp->lpcb, NULL);
|
||||
tcp_accept(ttcp->lpcb, NULL);
|
||||
tcp_abort(ttcp->lpcb);
|
||||
}
|
||||
|
||||
if (ttcp->upcb) {
|
||||
udp_disconnect(ttcp->upcb);
|
||||
udp_remove(ttcp->upcb);
|
||||
}
|
||||
|
||||
if (ttcp->payload)
|
||||
free(ttcp->payload);
|
||||
|
||||
free(ttcp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Invoked when transfer is done or aborted (non-zero result).
|
||||
*/
|
||||
@ -125,26 +96,27 @@ static void ard_tcp_done(struct ttcp* ttcp, int result) {
|
||||
ttcp->done_cb(ttcp->opaque, result);
|
||||
|
||||
ard_tcp_destroy(ttcp);
|
||||
clearMapSockTcp(getSock(ttcp));
|
||||
clearMapSockTcp(getSock(ttcp), GET_TCP_MODE(ttcp));
|
||||
}
|
||||
|
||||
static void
|
||||
tcp_timeout_cb(void *ctx);
|
||||
|
||||
/**
|
||||
* Only used in TCP mode.
|
||||
* Will transmit a maximum of pbuf->tot_len bytes.
|
||||
* Called upon connect and when there's space available in the TCP send window
|
||||
*
|
||||
*/
|
||||
static void tcp_send_data(struct ttcp *ttcp) {
|
||||
static err_t tcp_send_data_pcb(struct ttcp *ttcp, struct tcp_pcb *pcb) {
|
||||
err_t err = ERR_OK;
|
||||
uint32_t len, orig_len;
|
||||
uint32_t len;
|
||||
|
||||
len = ttcp->left;
|
||||
ttcp->buff_sent = 0;
|
||||
INFO_TCP_VER("left=%d len:%d tcp_sndbuf:%d\n", ttcp->left, len, tcp_sndbuf(ttcp->tpcb));
|
||||
GET_CLIENT_ID(ttcp, pcb);
|
||||
|
||||
len = ttcp->left[id];
|
||||
ttcp->buff_sent[id] = 0;
|
||||
|
||||
if (len == 0) return ERR_MEM;
|
||||
|
||||
INFO_TCP_VER("left=%d len:%d\n", ttcp->left[id], len);
|
||||
|
||||
/* don't send more than we have in the payload */
|
||||
if (len > ttcp->buflen)
|
||||
@ -152,91 +124,95 @@ static void tcp_send_data(struct ttcp *ttcp) {
|
||||
|
||||
/* We cannot send more data than space available in the send
|
||||
buffer. */
|
||||
if (len > tcp_sndbuf(ttcp->tpcb))
|
||||
len = tcp_sndbuf(ttcp->tpcb);
|
||||
if (len > tcp_sndbuf(pcb))
|
||||
len = tcp_sndbuf(pcb);
|
||||
|
||||
orig_len = len;
|
||||
uint8_t count = 0;
|
||||
do {
|
||||
startTime = timer_get_ms();
|
||||
err = tcp_write(ttcp->tpcb, ttcp->payload, len, TCP_WRITE_FLAG_COPY);
|
||||
INFO_TCP_VER("%d) tcp_write %p state:%d len:%d err:%d\n", count++, ttcp->tpcb, ttcp->tpcb->state, len, err);
|
||||
if (err == ERR_MEM)
|
||||
{
|
||||
len /= 2;
|
||||
ttcp->buff_sent = 0;
|
||||
}else if (err == ERR_OK){
|
||||
ttcp->buff_sent = 1;
|
||||
isDataSentCount = 0;
|
||||
}
|
||||
} while (err == ERR_MEM && len > 1);
|
||||
|
||||
if (err == ERR_OK){
|
||||
//tcp_output(ttcp->tpcb);
|
||||
INFO_TCP_VER("tcp_output: left=%d new left:%d\n",
|
||||
ttcp->left, ttcp->left-len);
|
||||
ttcp->left -= len;
|
||||
IF_TCP(startTime = timer_get_ms());
|
||||
err = tcp_write(pcb, ttcp->payload[id], len, TCP_WRITE_FLAG_COPY);
|
||||
if (err != ERR_OK)
|
||||
{
|
||||
INFO_TCP("tcp_write failed %p state:%d len:%d err:%d\n",
|
||||
pcb, pcb->state, len, err);
|
||||
ttcp->buff_sent[id] = 0;
|
||||
}else{
|
||||
ttcp->buff_sent[id] = 1;
|
||||
ttcp->left[id] -= len;
|
||||
}
|
||||
else
|
||||
WARN("TTCP [%p-%p]: tcp_write failed err:%d origLen:%d len:%d\n",
|
||||
ttcp, ttcp->tpcb, err, orig_len, len);
|
||||
//
|
||||
// ttcp->tid = timer_sched_timeout_cb(0, TIMEOUT_ONESHOT,
|
||||
// tcp_timeout_cb, ttcp);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Only used in TCP mode.
|
||||
*/
|
||||
static err_t tcp_connect_cb(void *arg, struct tcp_pcb *tpcb, err_t err) {
|
||||
struct ttcp* ttcp = arg;
|
||||
struct ttcp* _ttcp = arg;
|
||||
|
||||
INFO_TCP("TTCP [%p-%p]: connect %d %d\n", ttcp, tpcb, err, ttcp->tpcb->state);
|
||||
if (_ttcp == NULL) return ERR_ARG;
|
||||
|
||||
_connected = ( ttcp->tpcb->state == ESTABLISHED) ? 1 : 0;
|
||||
tcp_poll_retries = 0;
|
||||
GET_CLIENT_ID(_ttcp, tpcb);
|
||||
INFO_TCP("TTCP [%p-%p]: connect %d %d\n", _ttcp, tpcb, err, tpcb->state);
|
||||
|
||||
ttcp->start_time = timer_get_ms();
|
||||
_connected = ( tpcb->state == ESTABLISHED) ? 1 : 0;
|
||||
_ttcp->tcp_poll_retries[id] = 0;
|
||||
|
||||
_ttcp->start_time = timer_get_ms();
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
static void cleanSockState_cb(void *ctx) {
|
||||
struct ttcp* ttcp = ctx;
|
||||
struct ttcp* _ttcp = ctx;
|
||||
|
||||
int sock = getSock(ttcp);
|
||||
if (_ttcp == NULL) return;
|
||||
|
||||
int sock = getSock(_ttcp);
|
||||
if (sock != -1)
|
||||
clearMapSockTcp(sock);
|
||||
INFO_TCP("TTCP [%p]: cleanSockState_cb %d\n", ttcp, sock);
|
||||
clearMapSockTcp(sock, GET_TCP_MODE(_ttcp));
|
||||
INFO_TCP("TTCP [%p]: cleanSockState_cb %d\n", _ttcp, sock);
|
||||
_connected = false;
|
||||
}
|
||||
|
||||
static void cleanSockStateDelayed(void * arg)
|
||||
{
|
||||
INFO_TCP("arg %p\n", arg);
|
||||
timer_sched_timeout_cb(1000, TIMEOUT_ONESHOT,
|
||||
cleanSockState_cb, arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used in TCP mode.
|
||||
*/
|
||||
|
||||
static err_t close_conn_pcb(struct tcp_pcb* tpcb) {
|
||||
|
||||
err_t err = tcp_close(tpcb);
|
||||
if (err== ERR_OK)
|
||||
{
|
||||
tcp_arg(tpcb, NULL);
|
||||
tcp_sent(tpcb, NULL);
|
||||
tcp_recv(tpcb, NULL);
|
||||
}
|
||||
|
||||
INFO_TCP("Closing tpcb[%p]: state:0x%x err:%d\n", tpcb, tpcb->state, err);
|
||||
return err;
|
||||
}
|
||||
|
||||
static void atcp_conn_err_cb(void *arg, err_t err) {
|
||||
struct ttcp* _ttcp = arg;
|
||||
|
||||
WARN("TTCP [%p]: connection error: %d arg:%p\n",
|
||||
_ttcp, err, arg);
|
||||
WARN("TTCP [%p]: connection error: %d currId:%d\n",
|
||||
_ttcp, err, getCurrClientConnId());
|
||||
|
||||
if (ifStatus == false)
|
||||
printk("Abort connection\n");
|
||||
cleanSockState_cb(_ttcp);
|
||||
|
||||
atcp_init_pend_flags();
|
||||
if (err == ERR_ABRT)
|
||||
{
|
||||
removeNewClientConn(_ttcp, GET_CURR_PCB(_ttcp));
|
||||
FREE_PAYLOAD_ID(_ttcp, getCurrClientConnId());
|
||||
}
|
||||
}
|
||||
|
||||
static void atcp_conn_cli_err_cb(void *arg, err_t err) {
|
||||
struct ttcp* _ttcp = arg;
|
||||
|
||||
if (_ttcp == NULL) return;
|
||||
|
||||
WARN("TTCP [%p]: connection error: %d arg:%p\n",
|
||||
_ttcp, err, arg);
|
||||
|
||||
@ -246,47 +222,54 @@ static void atcp_conn_cli_err_cb(void *arg, err_t err) {
|
||||
if ((_ttcp)&&(err == ERR_ABRT))
|
||||
{
|
||||
WARN("TTCP [%p]: free memory\n", _ttcp);
|
||||
tcp_poll_retries = 0;
|
||||
cleanSockState_cb(_ttcp);
|
||||
if (_ttcp->payload)
|
||||
free(_ttcp->payload);
|
||||
free(_ttcp);
|
||||
// TODO
|
||||
FREE_PAYLOAD(_ttcp);
|
||||
}
|
||||
|
||||
atcp_init_pend_flags();
|
||||
//atcp_init_pend_flags(_ttcp);
|
||||
}
|
||||
|
||||
static err_t close_conn(struct ttcp *_ttcp, struct tcp_pcb* tpcb) {
|
||||
|
||||
static void close_conn(struct ttcp *_ttcp) {
|
||||
tcp_arg(_ttcp->tpcb, NULL);
|
||||
tcp_sent(_ttcp->tpcb, NULL);
|
||||
tcp_recv(_ttcp->tpcb, NULL);
|
||||
err_t err = tcp_close(_ttcp->tpcb);
|
||||
INFO_TCP("Closing tpcb[%p]: state:0x%x err:%d\n",_ttcp->tpcb, _ttcp->tpcb->state, err);
|
||||
if (_ttcp == NULL) return ERR_MEM;
|
||||
|
||||
GET_CLIENT_ID(_ttcp, tpcb);
|
||||
|
||||
err_t err = close_conn_pcb(_ttcp->tpcb[id]);
|
||||
|
||||
if (err == ERR_MEM)
|
||||
pending_close = true;
|
||||
{
|
||||
WARN("Cannot close id:%d-%p put pending\n", id, _ttcp->tpcb[id]);
|
||||
_ttcp->pending_close[id] = true;
|
||||
}
|
||||
else{
|
||||
atcp_init_pend_flags();
|
||||
WARN("----------------------\n");
|
||||
_ttcp->pending_close[id] = false;
|
||||
removeNewClientConn(_ttcp, _ttcp->tpcb[id]);
|
||||
FREE_PAYLOAD_ID(_ttcp, id);
|
||||
INFO_TCP("----------------------\n");
|
||||
}
|
||||
return err;
|
||||
}
|
||||
|
||||
void closeConnections()
|
||||
{
|
||||
int i = 0;
|
||||
for (; i<MAX_SOCK_NUM; i++)
|
||||
int ii=0;
|
||||
for (; ii<MAX_MODE_NUM; ii++)
|
||||
{
|
||||
void* p = getTTCP(i);
|
||||
if (p)
|
||||
int i = 0;
|
||||
for (; i<MAX_SOCK_NUM; i++)
|
||||
{
|
||||
ttcp_t* _ttcp = (ttcp_t* )p;
|
||||
|
||||
INFO_TCP("Closing connections tpcb[%p] state:0x%x - lpcb[%p] state: 0x%x\n",
|
||||
_ttcp->tpcb, _ttcp->tpcb->state, _ttcp->lpcb, _ttcp->lpcb->state);
|
||||
//tcp_close(_ttcp->tpcb);
|
||||
ard_tcp_destroy(_ttcp);
|
||||
clearMapSockTcp(getSock(_ttcp));
|
||||
void* p = getTTCP(i, ii);
|
||||
if (p)
|
||||
{
|
||||
ttcp_t* _ttcp = (ttcp_t* )p;
|
||||
if (_ttcp->udp == TCP_MODE)
|
||||
{
|
||||
ard_tcp_destroy(_ttcp);
|
||||
clearMapSockTcp(getSock(_ttcp), GET_TCP_MODE(_ttcp));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -299,7 +282,6 @@ static err_t atcp_recv_cb(void *arg, struct tcp_pcb *pcb, struct pbuf *p,
|
||||
struct ttcp* ttcp = arg;
|
||||
|
||||
if (err == ERR_OK && p != NULL) {
|
||||
INFO_TCP("pcb:%p pbuf: %p err:%d len:%d\n", pcb, p, err, p->tot_len);
|
||||
DATA_LED_ON();
|
||||
/* for print_stats() */
|
||||
ttcp->recved += p->tot_len;
|
||||
@ -310,16 +292,17 @@ static err_t atcp_recv_cb(void *arg, struct tcp_pcb *pcb, struct pbuf *p,
|
||||
ttcp->print_cnt++;
|
||||
}
|
||||
|
||||
insert_pBuf(p, ttcp->sock, (void*) pcb);
|
||||
tcp_recved(pcb, p->tot_len);
|
||||
uint8_t* pBufferStore = insert_pBuf(p, ttcp->sock, (void*) pcb);
|
||||
INFO_TCP("sock:%d pcb:%p pbuf:%p err:%d bufStore:%p len:%d\n",
|
||||
ttcp->sock, pcb, p, err, pBufferStore, p->tot_len);
|
||||
pbuf_free(p);
|
||||
DATA_LED_OFF();
|
||||
}
|
||||
|
||||
/* p will be NULL when remote end is done */
|
||||
if (err == ERR_OK && p == NULL) {
|
||||
INFO_TCP("atcp_recv_cb p=NULL\n");
|
||||
close_conn(ttcp);
|
||||
INFO_TCP("atcp_recv_cb p=NULL on sock:%d pcb:%p\n", ttcp->sock, pcb);
|
||||
close_conn(ttcp, pcb);
|
||||
}
|
||||
|
||||
if (err!=ERR_OK)
|
||||
@ -329,107 +312,238 @@ static err_t atcp_recv_cb(void *arg, struct tcp_pcb *pcb, struct pbuf *p,
|
||||
|
||||
void ack_recved(void* pcb, int len) {
|
||||
// Comment the call because it is activated on atcp_recv_cb
|
||||
//tcp_recved(pcb, len);
|
||||
INFO_TCP("Received %p len:%d\n", pcb, len);
|
||||
tcp_recved(pcb, len);
|
||||
}
|
||||
|
||||
static err_t atcp_poll(void *arg, struct tcp_pcb *pcb) {
|
||||
struct ttcp* _ttcp = arg;
|
||||
if ((_ttcp) && (_ttcp->left>0))
|
||||
++tcp_poll_retries;
|
||||
|
||||
if (tcp_poll_retries > 4) {
|
||||
WARN("ARD TCP [%p] arg=%p retries=%d\n",
|
||||
pcb, arg, tcp_poll_retries);
|
||||
tcp_poll_retries = 0;
|
||||
if (_ttcp == NULL) return ERR_ARG;
|
||||
|
||||
GET_CLIENT_ID(_ttcp, pcb);
|
||||
|
||||
if (_ttcp->left[id]>0)
|
||||
++_ttcp->tcp_poll_retries[id];
|
||||
|
||||
if (_ttcp->tcp_poll_retries[id] > 4) {
|
||||
WARN("ARD TCP [%p] arg=%p retries=%d abort\n",
|
||||
pcb, arg, _ttcp->tcp_poll_retries[id]);
|
||||
_ttcp->tcp_poll_retries[id] = 0;
|
||||
tcp_abort(pcb);
|
||||
atcp_init_pend_flags();
|
||||
_ttcp->pending_close[id] = false;
|
||||
return ERR_ABRT;
|
||||
}
|
||||
|
||||
if (pcb)
|
||||
INFO_TCP_POLL("keepAliveCnt:%d keep_idle:%d persist_cnt:%d\n",
|
||||
pcb->keep_cnt_sent, pcb->keep_idle, pcb->persist_cnt);
|
||||
|
||||
if (_ttcp->left[id] > 0)
|
||||
INFO_TCP("ARD TCP [%p-%p] arg=%p retries=%d pend.close:%d len:%d\n",
|
||||
(_ttcp)?GET_FIRST_CLIENT_TCP(_ttcp):0, pcb, arg,
|
||||
_ttcp->tcp_poll_retries[id], _ttcp->pending_close[id], (_ttcp)?_ttcp->left[id]:0);
|
||||
tcp_send_data_pcb(_ttcp, pcb);
|
||||
|
||||
WARN("ARD TCP [%p-%p] arg=%p retries=%d pend.close:%d\n", (_ttcp)?_ttcp->tpcb:0, pcb, arg,
|
||||
tcp_poll_retries, pending_close);
|
||||
if (_ttcp) tcp_send_data(_ttcp);
|
||||
|
||||
if (pending_close)
|
||||
{
|
||||
err_t err = tcp_close(pcb);
|
||||
if (err == ERR_MEM)
|
||||
{
|
||||
pending_close = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
atcp_init_pend_flags();
|
||||
}
|
||||
|
||||
INFO_TCP("ARD TCP [%p-%p] try to close pending:%d\n", pcb, (_ttcp)?_ttcp->tpcb:0, pending_close);
|
||||
if (_ttcp->pending_close[id])
|
||||
{
|
||||
err_t err = ERR_OK;
|
||||
if (id >=0){
|
||||
err = tcp_close(pcb);
|
||||
if (err == ERR_MEM)
|
||||
{
|
||||
_ttcp->pending_close[id] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ttcp->pending_close[id] = false;
|
||||
removeNewClientConn(_ttcp, _ttcp->tpcb[id]);
|
||||
FREE_PAYLOAD_ID(_ttcp, id);
|
||||
INFO_TCP("----------------------\n");
|
||||
}
|
||||
}
|
||||
INFO_TCP("ARD TCP [%p-%p] try to close pending:%d err:%d id:%d\n", pcb,
|
||||
(_ttcp)?GET_FIRST_CLIENT_TCP(_ttcp):0, _ttcp->pending_close[id], err, id);
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
static err_t atcp_poll_conn(void *arg, struct tcp_pcb *pcb) {
|
||||
struct ttcp* _ttcp = arg;
|
||||
++tcp_poll_retries;
|
||||
|
||||
if (tcp_poll_retries > 8) {
|
||||
if (_ttcp == NULL) return ERR_ARG;
|
||||
|
||||
GET_CLIENT_ID(_ttcp, pcb)
|
||||
|
||||
INFO_TCP_POLL("ARD TCP [%p-%p] arg=%p retries=%d pend.close:%d conn:%d\n",
|
||||
(_ttcp)?GET_FIRST_CLIENT_TCP(_ttcp):0, pcb, arg,
|
||||
_ttcp->tcp_poll_retries[id], _ttcp->pending_close[id], _connected);
|
||||
|
||||
if (id != NO_VALID_ID)
|
||||
{
|
||||
if (_ttcp->pending_close[id])
|
||||
++(_ttcp->tcp_poll_retries[id]);
|
||||
}
|
||||
|
||||
if (_ttcp->tcp_poll_retries[id] > 8) {
|
||||
WARN("ARD TCP [%p-%p] arg=%p retries=%d\n",
|
||||
pcb, _ttcp->tpcb, arg, tcp_poll_retries);
|
||||
tcp_poll_retries = 0;
|
||||
pcb, GET_FIRST_CLIENT_TCP(_ttcp), arg, _ttcp->tcp_poll_retries[id]);
|
||||
_ttcp->tcp_poll_retries[id] = 0;
|
||||
tcp_abort(pcb);
|
||||
return ERR_ABRT;
|
||||
}
|
||||
|
||||
WARN("ARD TCP [%p-%p] arg=%p retries=%d pend.close:%d conn:%d\n", (_ttcp)?_ttcp->tpcb:0, pcb, arg,
|
||||
tcp_poll_retries, pending_close, _connected);
|
||||
if ((_ttcp)&&(_connected)) tcp_send_data_pcb(_ttcp, pcb);
|
||||
|
||||
if ((_ttcp)&&(_connected)) tcp_send_data(_ttcp);
|
||||
|
||||
if (pending_close)
|
||||
if ((id != NO_VALID_ID) && (_ttcp->pending_close[id]))
|
||||
{
|
||||
err_t err = tcp_close(pcb);
|
||||
if (err == ERR_MEM)
|
||||
{
|
||||
pending_close = true;
|
||||
_ttcp->pending_close[id] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
cleanSockState_cb(_ttcp);
|
||||
if (_ttcp->payload)
|
||||
free(_ttcp->payload);
|
||||
free(_ttcp);
|
||||
pending_close = false;
|
||||
|
||||
FREE_PAYLOAD_ID(_ttcp, id);
|
||||
_ttcp->pending_close[id] = false;
|
||||
}
|
||||
|
||||
INFO_TCP("ARD TCP [%p-%p] try to close pending:%d\n", pcb, (_ttcp)?_ttcp->tpcb:0, pending_close);
|
||||
INFO_TCP("ARD TCP [%p-%p] try to close pending:%d\n", pcb, (_ttcp)?GET_FIRST_CLIENT_TCP(_ttcp):0, _ttcp->pending_close[id]);
|
||||
}
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int8_t currConnId = 0;
|
||||
|
||||
int8_t getCurrClientConnId() { return currConnId;}
|
||||
|
||||
int8_t getNewClientConnId(struct ttcp* _ttcp, struct tcp_pcb *newpcb)
|
||||
{
|
||||
if (_ttcp != NULL){
|
||||
int i = 0;
|
||||
for (; i<MAX_CLIENT_ACCEPTED; ++i)
|
||||
{
|
||||
int idx = GET_IDX_CONN(i);
|
||||
|
||||
if (_ttcp->tpcb[idx] == newpcb)
|
||||
{
|
||||
INFO_TCP_VER("ttcp:%p id=%d, tpcb=%p\n", _ttcp, idx, newpcb);
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
WARN("No Valid Id for ttcp:%p pcb:%p\n", _ttcp, newpcb);
|
||||
return NO_VALID_ID;
|
||||
}
|
||||
|
||||
struct tcp_pcb * getFirstClient(struct ttcp* _ttcp, bool verbose)
|
||||
{
|
||||
if (_ttcp != NULL){
|
||||
int i = 0;
|
||||
for (; i<MAX_CLIENT_ACCEPTED; ++i)
|
||||
{
|
||||
int idx = GET_IDX_CONN(i);
|
||||
if (_ttcp->tpcb[idx] != NULL)
|
||||
{
|
||||
if (verbose) INFO_TCP("ttcp:%p id=%d, tpcb=%p\n", _ttcp, idx, _ttcp->tpcb[idx]);
|
||||
currConnId = idx;
|
||||
return _ttcp->tpcb[idx];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (verbose) WARN("No Valid client for ttcp:%p\n", _ttcp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int8_t setNewClientConn(struct ttcp* _ttcp, struct tcp_pcb *newpcb, uint8_t id)
|
||||
{
|
||||
if ((_ttcp != NULL)&&(id>=0)&&(id<MAX_CLIENT_ACCEPTED)){
|
||||
INFO_TCP("ttcp:%p id=%d, tpcb=%p\n", _ttcp, id, newpcb);
|
||||
_ttcp->tpcb[id] = newpcb;
|
||||
return id;
|
||||
}
|
||||
return NO_VALID_ID;
|
||||
}
|
||||
|
||||
int8_t insertNewClientConn(struct ttcp* _ttcp, struct tcp_pcb *newpcb)
|
||||
{
|
||||
if (_ttcp != NULL){
|
||||
int i = 0;
|
||||
for (; i<MAX_CLIENT_ACCEPTED; ++i)
|
||||
{
|
||||
int idx = GET_IDX_CONN(i);
|
||||
if ((_ttcp->tpcb[idx] == NULL)||(_ttcp->tpcb[idx] == newpcb))
|
||||
{
|
||||
INFO_TCP("ttcp:%p id=%d, tpcb=%p\n", _ttcp, idx, newpcb);
|
||||
_ttcp->tpcb[idx] = newpcb;
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NO_VALID_ID;
|
||||
}
|
||||
|
||||
int8_t removeNewClientConn(struct ttcp* _ttcp, struct tcp_pcb *newpcb)
|
||||
{
|
||||
if (_ttcp != NULL){
|
||||
int i = 0;
|
||||
for (; i<MAX_CLIENT_ACCEPTED; ++i)
|
||||
{
|
||||
int idx = GET_IDX_CONN(i);
|
||||
if (_ttcp->tpcb[idx] == newpcb)
|
||||
{
|
||||
INFO_TCP("ttcp:%p id=%d, tpcb=%p\n", _ttcp, idx, newpcb);
|
||||
_ttcp->tpcb[idx] = NULL;
|
||||
return idx;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NO_VALID_ID;
|
||||
}
|
||||
|
||||
bool cleanNewClientConn(struct ttcp* _ttcp)
|
||||
{
|
||||
if (_ttcp != NULL){
|
||||
int i = 0;
|
||||
for (; i<MAX_CLIENT_ACCEPTED; ++i)
|
||||
_ttcp->tpcb[i] = NULL;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Only used in TCP mode.
|
||||
*/
|
||||
static err_t atcp_accept_cb(void *arg, struct tcp_pcb *newpcb, err_t err) {
|
||||
struct ttcp* ttcp = arg;
|
||||
struct ttcp* _ttcp = arg;
|
||||
|
||||
INFO_TCP("ARD TCP [%p]: accept new [%p]\n", ttcp, newpcb);
|
||||
if (_ttcp == NULL) return ERR_ARG;
|
||||
|
||||
INFO_TCP("ARD TCP [%p]: accept new [%p]\n", _ttcp, newpcb);
|
||||
INFO_TCP("local:%d remote:%d state:%d\n", newpcb->local_port, newpcb->remote_port, newpcb->state);
|
||||
|
||||
if (pending_accept)
|
||||
{
|
||||
WARN("Accepting another connection: %p-%p\n", ttcp->tpcb, newpcb);
|
||||
return ERR_OK;
|
||||
}
|
||||
pending_accept = true;
|
||||
tcp_setprio(newpcb, TCP_PRIO_MIN);
|
||||
tcp_poll_retries = 0;
|
||||
ttcp->tpcb = newpcb;
|
||||
tcp_recv(ttcp->tpcb, atcp_recv_cb);
|
||||
tcp_err(ttcp->tpcb, atcp_conn_err_cb);
|
||||
tcp_poll(ttcp->tpcb, atcp_poll, 4);
|
||||
int8_t id = insertNewClientConn(_ttcp, newpcb);
|
||||
|
||||
ttcp->start_time = timer_get_ms();
|
||||
ASSERT((_ttcp->payload[id]==NULL), "payload not freed!");
|
||||
_ttcp->payload[id] = malloc(_ttcp->buflen);
|
||||
INFO_TCP("Alloc payload %d-%p\n", id, _ttcp->payload[id]);
|
||||
if (_ttcp->payload[id] == NULL) {
|
||||
WARN("TTCP [%p]: could not allocate payload\n", _ttcp);
|
||||
return -1;
|
||||
}
|
||||
tcp_arg(_ttcp->tpcb[id], _ttcp);
|
||||
tcp_recv(_ttcp->tpcb[id], atcp_recv_cb);
|
||||
tcp_err(_ttcp->tpcb[id], atcp_conn_err_cb);
|
||||
tcp_poll(_ttcp->tpcb[id], atcp_poll, 4);
|
||||
// Copy the pointer to ttcp also to TRANSMIT mode for the clients connected to the server
|
||||
int _sock = getSock(_ttcp);
|
||||
if ((_sock != -1)&&(IS_VALID_SOCK(_sock)))
|
||||
setMapSockMode(_sock, _ttcp, TTCP_MODE_TRANSMIT);
|
||||
_ttcp->start_time = timer_get_ms();
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@ -439,55 +553,54 @@ static err_t atcp_accept_cb(void *arg, struct tcp_pcb *newpcb, err_t err) {
|
||||
static int atcp_start(struct ttcp* ttcp) {
|
||||
err_t err = ERR_OK;
|
||||
|
||||
ttcp->tpcb = tcp_new();
|
||||
if (ttcp->tpcb == NULL) {
|
||||
struct tcp_pcb * p = tcp_new();
|
||||
|
||||
if (p == NULL) {
|
||||
WARN("TTCP [%p]: could not allocate pcb\n", ttcp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ttcp->payload = malloc(ttcp->buflen);
|
||||
if (ttcp->payload == NULL) {
|
||||
WARN("TTCP [%p]: could not allocate payload\n", ttcp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tcp_arg(ttcp->tpcb, ttcp);
|
||||
atcp_init_pend_flags();
|
||||
currConnId = 0;
|
||||
tcp_arg(p, ttcp);
|
||||
atcp_init_pend_flags(ttcp);
|
||||
|
||||
if (ttcp->mode == TTCP_MODE_TRANSMIT) {
|
||||
tcp_err(ttcp->tpcb, atcp_conn_cli_err_cb);
|
||||
tcp_recv(ttcp->tpcb, atcp_recv_cb);
|
||||
tcp_sent(ttcp->tpcb, tcp_data_sent);
|
||||
tcp_poll(ttcp->tpcb, atcp_poll_conn, 4);
|
||||
int8_t id = insertNewClientConn(ttcp, p);
|
||||
ttcp->payload[id] = malloc(ttcp->buflen);
|
||||
INFO_TCP("Alloc payload %d-%p\n", id, ttcp->payload[id]);
|
||||
if (ttcp->payload[id] == NULL) {
|
||||
WARN("TTCP [%p]: could not allocate payload\n", ttcp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct tcp_pcb * pcb = p;
|
||||
tcp_err(pcb, atcp_conn_cli_err_cb);
|
||||
tcp_recv(pcb, atcp_recv_cb);
|
||||
tcp_sent(pcb, tcp_data_sent);
|
||||
tcp_poll(pcb, atcp_poll_conn, 4);
|
||||
_connected = false;
|
||||
INFO_TCP("[tpcb]-%p payload:%p\n", ttcp->tpcb, ttcp->payload);
|
||||
INFO_TCP("[tpcb]-%p payload:%p\n", pcb, ttcp->payload[id]);
|
||||
DUMP_TCP_STATE(ttcp);
|
||||
if (tcp_connect(ttcp->tpcb, &ttcp->addr, ttcp->port, tcp_connect_cb)
|
||||
if (tcp_connect(pcb, &ttcp->addr, ttcp->port, tcp_connect_cb)
|
||||
!= ERR_OK) {
|
||||
WARN("TTCP [%p]: tcp connect failed\n", ttcp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
} else {
|
||||
INFO_TCP("BEFORE BIND ttcp:%p lpcb:%p pcb:%p\n", ttcp, ttcp->lpcb, ttcp->tpcb);
|
||||
INFO_TCP("[tpcb]-local:%d remote:%d state:%d\n", ttcp->tpcb->local_port,
|
||||
ttcp->tpcb->remote_port, ttcp->tpcb->state);
|
||||
INFO_TCP("BEFORE BIND ttcp:%p lpcb:%p pcb:%p\n", ttcp, ttcp->lpcb, GET_FIRST_CLIENT_TCP(ttcp));
|
||||
|
||||
err = tcp_bind(ttcp->tpcb, IP_ADDR_ANY, ttcp->port);
|
||||
err = tcp_bind(p, IP_ADDR_ANY, ttcp->port);
|
||||
if (err != ERR_OK){
|
||||
WARN("TTCP [%p]: bind failed err=%d Port already used\n", ttcp, err);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ttcp->lpcb = tcp_listen(ttcp->tpcb);
|
||||
ttcp->lpcb = tcp_listen(p);
|
||||
if (ttcp->lpcb == NULL) {
|
||||
WARN("TTCP [%p]: listen failed\n", ttcp);
|
||||
return -1;
|
||||
}
|
||||
if (ttcp->lpcb == ttcp->tpcb ) {
|
||||
WARN("TTCP [%p]: listen failed tpcb [%p] in listen mode\n", ttcp, ttcp->tpcb);
|
||||
return -1;
|
||||
}
|
||||
|
||||
DUMP_TCP_STATE(ttcp);
|
||||
tcp_accept(ttcp->lpcb, atcp_accept_cb);
|
||||
@ -496,130 +609,64 @@ static int atcp_start(struct ttcp* ttcp) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
udp_send_data(struct ttcp* ttcp);
|
||||
|
||||
/**
|
||||
* Only used in UDP mode. Scheduled after data has been sent in udp_send_data()
|
||||
* if we have more data to send.
|
||||
*/
|
||||
static void udp_timeout_cb(void *ctx) {
|
||||
struct ttcp* ttcp = ctx;
|
||||
udp_send_data(ttcp);
|
||||
}
|
||||
|
||||
static int udp_send_bytes(struct ttcp* ttcp, uint32_t len) {
|
||||
struct pbuf* p = pbuf_alloc(PBUF_TRANSPORT, len, PBUF_RAM);
|
||||
if (p == NULL) {
|
||||
WARN("TTCP [%p]: could not allocate pbuf\n", ttcp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (udp_send(ttcp->upcb, p) != ERR_OK) {
|
||||
WARN("TTCP [%p]: udp_send() failed\n", ttcp);
|
||||
pbuf_free(p);
|
||||
return -1;
|
||||
}
|
||||
|
||||
pbuf_free(p);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used in UDP mode. First call will send the start marker. When all
|
||||
* ttcp data has been sent, a number of end markers will be sent. After
|
||||
* end marker transmission, this function will complete the ttcp process.
|
||||
*/
|
||||
static void udp_send_data(struct ttcp* ttcp) {
|
||||
/* send start marker first time */
|
||||
if (!ttcp->udp_started) {
|
||||
if (udp_send_bytes(ttcp, 4) == 0) {
|
||||
ttcp->udp_started = 1;
|
||||
ttcp->start_time = timer_get_ms();
|
||||
}
|
||||
}
|
||||
|
||||
/* normal case */
|
||||
else if (ttcp->left) {
|
||||
/* send data */
|
||||
if (udp_send_bytes(ttcp, ttcp->buflen) == 0)
|
||||
ttcp->left -= ttcp->buflen;
|
||||
}
|
||||
|
||||
/* end marker? */
|
||||
else if (ttcp->left == 0 && ttcp->udp_end_marker_left) {
|
||||
if (udp_send_bytes(ttcp, 4) == 0)
|
||||
ttcp->udp_end_marker_left--;
|
||||
}
|
||||
|
||||
/* all end markers sent */
|
||||
else if (ttcp->left == 0) {
|
||||
ard_tcp_done(ttcp, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
ttcp->tid
|
||||
= timer_sched_timeout_cb(0, TIMEOUT_ONESHOT, udp_timeout_cb, ttcp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Only used in UDP mode. Will finalize the ttcp process when an end marker
|
||||
* is seen.
|
||||
*/
|
||||
static void udp_recv_cb(void *arg, struct udp_pcb *upcb, struct pbuf *p,
|
||||
static void audp_recv_cb(void *arg, struct udp_pcb *upcb, struct pbuf *p,
|
||||
struct ip_addr *addr, u16_t port) {
|
||||
struct ttcp* ttcp = arg;
|
||||
|
||||
/* got start marker? we might lose this so if we get it just reset
|
||||
* the timer
|
||||
*/
|
||||
if (!ttcp->udp_started && p->tot_len <= 4) {
|
||||
ttcp->start_time = timer_get_ms();
|
||||
ttcp->udp_started = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* after receiving at least 1 byte, check end marker
|
||||
* don't check udp_started since we might have lost the start marker
|
||||
*/
|
||||
if (ttcp->recved && p->tot_len <= 4) {
|
||||
ard_tcp_done(ttcp, 0);
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* for print_stats() */
|
||||
ttcp->recved += p->tot_len;
|
||||
DUMP(p->payload,p->tot_len);
|
||||
if (ttcp->verbose) {
|
||||
printk(".");
|
||||
if (ttcp->print_cnt % 80 == 0)
|
||||
printk("\n");
|
||||
ttcp->print_cnt++;
|
||||
}
|
||||
INFO_TCP("UDP Insert %p sock:%d addr:%s port:%d\n", p, ttcp->sock,
|
||||
ip2str(*addr), port);
|
||||
insert_pBuf(p, ttcp->sock, (void*) upcb);
|
||||
setRemoteClient(ttcp->sock, addr->addr, port);
|
||||
|
||||
out: pbuf_free(p);
|
||||
pbuf_free(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start UDP transfer.
|
||||
*/
|
||||
static int udp_start(struct ttcp* ttcp) {
|
||||
err_t err = ERR_OK;
|
||||
ttcp->udp_end_marker_left = 5;
|
||||
ttcp->upcb = udp_new();
|
||||
if (ttcp->upcb == NULL) {
|
||||
printk("TTCP [%p]: could not allocate pcb\n", ttcp);
|
||||
WARN("TTCP [%p]: could not allocate pcb\n", ttcp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
INFO_TCP("%s, upcb:%p %s:%d\n", __FUNCTION__, ttcp->upcb, ip2str(ttcp->addr), ttcp->port);
|
||||
if (ttcp->mode == TTCP_MODE_TRANSMIT) {
|
||||
if (udp_connect(ttcp->upcb, &ttcp->addr, ttcp->port) != ERR_OK) {
|
||||
printk("TTCP [%p]: udp connect failed\n", ttcp);
|
||||
if (udp_connect(ttcp->upcb, &(ttcp->addr), ttcp->port) != ERR_OK) {
|
||||
WARN("TTCP [%p]: udp connect failed\n", ttcp);
|
||||
return -1;
|
||||
}
|
||||
udp_send_data(ttcp);
|
||||
udp_recv(ttcp->upcb, audp_recv_cb, ttcp);
|
||||
} else {
|
||||
udp_recv(ttcp->upcb, udp_recv_cb, ttcp);
|
||||
/* bind to any IP address on port specified */
|
||||
err = udp_bind(ttcp->upcb, IP_ADDR_ANY, ttcp->port);
|
||||
if (err!= ERR_OK) {
|
||||
WARN("TTCP [%p]: bind failed err=%d Port already used\n", ttcp, err);
|
||||
return -1;
|
||||
}
|
||||
// clear remote client data
|
||||
setRemoteClient(ttcp->sock, 0, 0);
|
||||
udp_recv(ttcp->upcb, audp_recv_cb, ttcp);
|
||||
}
|
||||
|
||||
INFO_TCP("%s, loc:0x%x-%d rem:0x%x-%d\n", __FUNCTION__,
|
||||
ttcp->upcb->local_ip.addr, ttcp->upcb->local_port,
|
||||
ttcp->upcb->remote_ip.addr, ttcp->upcb->remote_port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -660,12 +707,12 @@ int ard_tcp_start(struct ip_addr addr, uint16_t port, void *opaque,
|
||||
ttcp->port = port;
|
||||
ttcp->nbuf = nbuf;
|
||||
ttcp->mode = mode;
|
||||
ttcp->left = nbuf * buflen;
|
||||
ttcp->done_cb = done_cb;
|
||||
ttcp->opaque = opaque;
|
||||
ttcp->udp = udp;
|
||||
ttcp->verbose = verbose;
|
||||
ttcp->buflen = buflen;
|
||||
cleanNewClientConn(ttcp);
|
||||
|
||||
if (ttcp->udp)
|
||||
status = udp_start(ttcp);
|
||||
@ -677,16 +724,14 @@ int ard_tcp_start(struct ip_addr addr, uint16_t port, void *opaque,
|
||||
goto fail;
|
||||
}
|
||||
INFO_TCP("TTCP [%p-%p]: nbuf=%d, buflen=%d, port=%d (%s/%s)\n", ttcp,
|
||||
ttcp->tpcb, ttcp->nbuf, ttcp->buflen, ttcp->port, ttcp->udp ? "udp"
|
||||
: "tcp", ttcp->mode == TTCP_MODE_TRANSMIT ? "tx" : "rx");
|
||||
((ttcp->udp==1)?(void*)ttcp->upcb:GET_FIRST_CLIENT_TCP(ttcp)), ttcp->nbuf, ttcp->buflen,
|
||||
ttcp->port, ProtMode2Str(ttcp->udp), Mode2Str(ttcp->mode));
|
||||
|
||||
*_ttcp = (void*) ttcp;
|
||||
ttcp->sock = sock;
|
||||
ttcp->buff_sent = 1;
|
||||
|
||||
return 0;
|
||||
|
||||
//fail: ard_tcp_abort(ttcp);
|
||||
fail: ard_tcp_destroy(ttcp);
|
||||
return -1;
|
||||
}
|
||||
@ -699,18 +744,22 @@ void ard_tcp_stop(void* ttcp) {
|
||||
return;
|
||||
}
|
||||
if (_ttcp->mode == TTCP_MODE_TRANSMIT) {
|
||||
INFO_TCP("Destroy TCP connection...state:%d\n", _ttcp->tpcb->state);
|
||||
int i = getCurrClientConnId();
|
||||
ard_tcp_destroy(_ttcp);
|
||||
clearMapSockTcp(getSock(_ttcp));
|
||||
tcp_poll_retries = 0;
|
||||
clearMapSockTcp(getSock(_ttcp), GET_TCP_MODE(_ttcp));
|
||||
_ttcp->tcp_poll_retries[i] = 0;
|
||||
}else{
|
||||
INFO_TCP("Closing connection...state:%d\n", _ttcp->tpcb->state);
|
||||
DUMP_TCP_STATE(_ttcp);
|
||||
if ((_ttcp)&&(_ttcp->tpcb)&&(_ttcp->tpcb->state!=LAST_ACK)&&(_ttcp->tpcb->state!=CLOSED))
|
||||
|
||||
int i = getCurrClientConnId();
|
||||
if ((_ttcp)&&(_ttcp->tpcb[i])&&(_ttcp->tpcb[i]->state!=LAST_ACK)&&(_ttcp->tpcb[i]->state!=CLOSED))
|
||||
{
|
||||
close_conn(_ttcp);
|
||||
// Flush all the data
|
||||
err_t err=tcp_output(_ttcp->tpcb[i]);
|
||||
INFO_TCP("flush data: tpcb:%p err:%d\n", _ttcp->tpcb[i], err);
|
||||
// if any socket cannot be close stop the close connection
|
||||
close_conn(_ttcp, _ttcp->tpcb[i]);
|
||||
}
|
||||
pending_accept = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -719,15 +768,22 @@ uint8_t getStateTcp(void* p, bool client) {
|
||||
|
||||
if (ifStatus == false)
|
||||
return CLOSED;
|
||||
if ((_ttcp != NULL) && (_ttcp->tpcb != NULL)) {
|
||||
//DUMP_TCP_STATE(_ttcp);
|
||||
struct tcp_pcb * pcb = GET_FIRST_CLIENT_TCP_NV(_ttcp);
|
||||
if ((_ttcp != NULL) && ((pcb != NULL) || (client==0))) {
|
||||
IF_SPI_POLL(DUMP_TCP_STATE(_ttcp));
|
||||
if (client)
|
||||
return _ttcp->tpcb->state;
|
||||
{
|
||||
if ((pcb->state != ESTABLISHED)&&(pcb->state != CLOSED))
|
||||
DUMP_TCP_STATE(_ttcp);
|
||||
return pcb->state;
|
||||
}
|
||||
else
|
||||
{
|
||||
return _ttcp->lpcb->state;
|
||||
}
|
||||
} else {
|
||||
INFO_TCP_VER("TCP not initialized ttcp:%p tpcb:%p lpcb:%p\n",
|
||||
_ttcp, ((_ttcp)?_ttcp->tpcb:0), ((_ttcp)?_ttcp->lpcb:0));
|
||||
WARN_POLL("TCP not initialized ttcp:%p tpcb:%p lpcb:%p\n",
|
||||
_ttcp, ((_ttcp)?pcb:0), ((_ttcp)?_ttcp->lpcb:0));
|
||||
}
|
||||
return CLOSED;
|
||||
}
|
||||
@ -743,9 +799,9 @@ uint8_t getModeTcp(void* p) {
|
||||
uint8_t isDataSent(void* p) {
|
||||
struct ttcp *_ttcp = (struct ttcp *)p;
|
||||
|
||||
if ((_ttcp)&&(!_ttcp->buff_sent))
|
||||
int8_t id = getCurrClientConnId();
|
||||
if ((_ttcp)&&(!_ttcp->buff_sent[id]))
|
||||
{
|
||||
INFO_TCP_VER("%d) Wait to send data\n", ++isDataSentCount);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -759,26 +815,24 @@ static err_t tcp_data_sent(void *arg, struct tcp_pcb *pcb, u16_t len) {
|
||||
|
||||
_ttcp = arg;
|
||||
|
||||
tcp_poll_retries = 0;
|
||||
if (_ttcp) _ttcp->buff_sent = 1;
|
||||
if (_ttcp == NULL) return ERR_ARG;
|
||||
|
||||
GET_CLIENT_ID(_ttcp, pcb);
|
||||
_ttcp->tcp_poll_retries[id] = 0;
|
||||
_ttcp->buff_sent[id] = 1;
|
||||
|
||||
INFO_TCP("Packet sent pcb:%p len:%d dur:%d left:%d count:%d\n", pcb, len, timer_get_ms() - startTime,
|
||||
(_ttcp)?(_ttcp->left):0, isDataSentCount);
|
||||
INFO_TCP("Packet sent pcb:%p len:%d dur:%d left:%d\n", pcb, len, timer_get_ms() - startTime,
|
||||
(_ttcp)?(_ttcp->left[id]):0);
|
||||
|
||||
isDataSentCount = 0;
|
||||
|
||||
if ((_ttcp)&&(_ttcp->left > 0)) {
|
||||
tcp_send_data(_ttcp);
|
||||
if ((_ttcp)&&(_ttcp->left[id] > 0)) {
|
||||
tcp_send_data_pcb(_ttcp, pcb);
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int sendTcpData(void* p, uint8_t* buf, uint16_t len) {
|
||||
INFO_TCP("buf:%p len:%d\n", buf, len);
|
||||
DUMP_TCP(buf,len);
|
||||
|
||||
int sendTcpData(void* p, uint8_t* buf, uint16_t len)
|
||||
{
|
||||
struct ttcp* _ttcp = (struct ttcp*) p;
|
||||
|
||||
if (_ttcp==NULL)
|
||||
@ -786,25 +840,25 @@ int sendTcpData(void* p, uint8_t* buf, uint16_t len) {
|
||||
WARN("ttcp == NULL!\n");
|
||||
return WL_FAILURE;
|
||||
}
|
||||
|
||||
struct tcp_pcb * pcb = GET_FIRST_CLIENT_TCP_NV(_ttcp);
|
||||
GET_CLIENT_ID(_ttcp, pcb);
|
||||
|
||||
INFO_TCP_VER("ttcp:%p pcb:%p buf:%p len:%d\n", _ttcp, pcb, buf, len);
|
||||
DUMP_TCP(buf,len);
|
||||
IF_TCP_VER(DUMP_TCP_STATE(_ttcp));
|
||||
|
||||
INFO_TCP_VER("CLI> p=%p _ttcp=%p state(tpcb):%d state(lpcb):%d\n",
|
||||
p, ((struct ttcp*) p)->tpcb,
|
||||
((struct ttcp*) p)->tpcb->state,
|
||||
((struct ttcp*) p)->lpcb->state);
|
||||
if ((_ttcp != NULL) && (pcb != NULL) &&
|
||||
(buf != NULL) && (len != 0) && (_ttcp->payload[id] != NULL)) {
|
||||
if (pcb->state == ESTABLISHED || pcb->state == CLOSE_WAIT ||
|
||||
pcb->state == SYN_SENT || pcb->state == SYN_RCVD) {
|
||||
|
||||
if ((_ttcp != NULL) && (_ttcp->tpcb != NULL) &&
|
||||
(buf != NULL) && (len != 0) && (_ttcp->payload != NULL)) {
|
||||
if (_ttcp->tpcb->state == ESTABLISHED ||
|
||||
_ttcp->tpcb->state == CLOSE_WAIT ||
|
||||
_ttcp->tpcb->state == SYN_SENT ||
|
||||
_ttcp->tpcb->state == SYN_RCVD) {
|
||||
|
||||
memcpy(_ttcp->payload, buf, len);
|
||||
_ttcp->payload[len]='\0';
|
||||
INFO_TCP_VER("%s\n", _ttcp->payload);
|
||||
_ttcp->left = len;
|
||||
tcp_sent(_ttcp->tpcb, tcp_data_sent);
|
||||
tcp_send_data(_ttcp);
|
||||
memcpy(_ttcp->payload[id], buf, len);
|
||||
_ttcp->payload[id][len]='\0';
|
||||
INFO_TCP_VER("'%s'\n", _ttcp->payload[id]);
|
||||
_ttcp->left[id] = len;
|
||||
tcp_sent(pcb, tcp_data_sent);
|
||||
tcp_send_data_pcb(_ttcp, pcb);
|
||||
|
||||
return WL_SUCCESS;
|
||||
}
|
||||
@ -813,6 +867,34 @@ int sendTcpData(void* p, uint8_t* buf, uint16_t len) {
|
||||
return WL_FAILURE;
|
||||
}
|
||||
|
||||
int sendUdpData(void* ttcp, uint8_t* buf, uint16_t len) {
|
||||
struct ttcp* _ttcp = (struct ttcp*) ttcp;
|
||||
if ((_ttcp != NULL) && (buf != NULL) && (len != 0))
|
||||
{
|
||||
INFO_TCP("buf:%p len:%d\n", buf, len);
|
||||
DUMP_TCP(buf,len);
|
||||
}else{
|
||||
return WL_FAILURE;
|
||||
}
|
||||
|
||||
struct pbuf* p = pbuf_alloc(PBUF_TRANSPORT, len, PBUF_RAM);
|
||||
if (p == NULL) {
|
||||
WARN("TTCP [%p]: could not allocate pbuf\n", ttcp);
|
||||
return WL_FAILURE;
|
||||
}
|
||||
memcpy(p->payload, buf, len);
|
||||
if (udp_send(_ttcp->upcb, p) != ERR_OK) {
|
||||
WARN("TTCP [%p]: udp_send() failed\n", _ttcp);
|
||||
pbuf_free(p);
|
||||
return WL_FAILURE;
|
||||
}
|
||||
|
||||
pbuf_free(p);
|
||||
return WL_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
char
|
||||
usage[] =
|
||||
"Usage: ttcp -t/-r [-options] host\n\
|
||||
|
@ -15,6 +15,41 @@ typedef void (ard_tcp_done_cb_t)(void *opaque, int result);
|
||||
|
||||
#define TTCP_MODE_TRANSMIT 0
|
||||
#define TTCP_MODE_RECEIVE 1
|
||||
#define MAX_MODE_NUM 2
|
||||
|
||||
#define GET_TCP_MODE(X) ((X!=NULL)?((struct ttcp*)(X))->mode:0)
|
||||
#define IS_VALID_SOCK(SOCK) ((SOCK>=0)&&(SOCK<MAX_SOCK_NUM))
|
||||
#define IS_UDP_SOCK(SOCK) ((getTTCP(SOCK, TTCP_MODE_RECEIVE)!=NULL)?((struct ttcp*)(getTTCP(SOCK, TTCP_MODE_RECEIVE)))->udp:0)
|
||||
|
||||
// Maximum number of client connection accepted by server
|
||||
#define MAX_CLIENT_ACCEPTED 4
|
||||
#define NO_VALID_ID 0xff
|
||||
|
||||
#define GET_FIRST_CLIENT_TCP(TTCP) getFirstClient(TTCP, 1)
|
||||
#define GET_FIRST_CLIENT_TCP_NV(TTCP) getFirstClient(TTCP, 0)
|
||||
#define GET_CLIENT_TCP(TTCP,ID) (((TTCP!=NULL)&&(ID>=0)&&(ID<MAX_CLIENT_ACCEPTED))?TTCP->tpcb[ID] : NULL)
|
||||
#define GET_CLIENT_ID(TTCP, PCB) uint8_t id = NO_VALID_ID; do { \
|
||||
id = getNewClientConnId(TTCP, PCB); \
|
||||
if (id == NO_VALID_ID) return ERR_MEM; \
|
||||
}while(0);
|
||||
#define GET_IDX_CONN(I) ((I+currConnId)<MAX_CLIENT_ACCEPTED ? (I+currConnId) : (I+currConnId-MAX_CLIENT_ACCEPTED))
|
||||
#define GET_CURR_PCB(TTCP) GET_CLIENT_TCP(TTCP,getCurrClientConnId())
|
||||
|
||||
#define FREE_PAYLOAD(TTCP) do { \
|
||||
int id = getCurrClientConnId(); \
|
||||
INFO_TCP("Freeing payload %d-%p\n", id, TTCP->payload[id]); \
|
||||
if (TTCP->payload[id]) { \
|
||||
free(TTCP->payload[id]); \
|
||||
TTCP->payload[id] = NULL; } \
|
||||
}while(0);
|
||||
|
||||
#define FREE_PAYLOAD_ID(TTCP,ID) do { \
|
||||
INFO_TCP("Freeing payload %d-%p\n", ID, TTCP->payload[ID]); \
|
||||
if (TTCP->payload[ID]) { \
|
||||
free(TTCP->payload[ID]); \
|
||||
TTCP->payload[ID] = NULL; } \
|
||||
}while(0);
|
||||
|
||||
|
||||
typedef struct ttcp {
|
||||
|
||||
@ -26,12 +61,12 @@ typedef struct ttcp {
|
||||
int verbose; /* -v */
|
||||
int udp; /* -u */
|
||||
uint8_t sock;
|
||||
uint8_t buff_sent;
|
||||
uint8_t buff_sent[MAX_CLIENT_ACCEPTED];
|
||||
|
||||
/* common */
|
||||
uint16_t print_cnt;
|
||||
uint32_t start_time;
|
||||
uint32_t left;
|
||||
uint32_t left[MAX_CLIENT_ACCEPTED];
|
||||
uint32_t recved;
|
||||
ard_tcp_done_cb_t* done_cb;
|
||||
void* opaque;
|
||||
@ -39,9 +74,11 @@ typedef struct ttcp {
|
||||
uint32_t tid;
|
||||
|
||||
/* TCP specific */
|
||||
struct tcp_pcb* tpcb;
|
||||
struct tcp_pcb* tpcb[MAX_CLIENT_ACCEPTED];
|
||||
struct tcp_pcb* lpcb;
|
||||
char* payload;
|
||||
char* payload[MAX_CLIENT_ACCEPTED];
|
||||
uint8_t tcp_poll_retries[MAX_CLIENT_ACCEPTED];
|
||||
bool pending_close[MAX_CLIENT_ACCEPTED];
|
||||
|
||||
/* UDP specific */
|
||||
int udp_started;
|
||||
@ -62,10 +99,26 @@ uint8_t getModeTcp(void* p);
|
||||
|
||||
int sendTcpData(void* p, uint8_t* buf, uint16_t len);
|
||||
|
||||
int sendUdpData(void* p, uint8_t* buf, uint16_t len);
|
||||
|
||||
uint8_t isDataSent(void* p );
|
||||
|
||||
cmd_state_t cmd_ttcp(int argc, char* argv[], void* ctx);
|
||||
|
||||
int8_t setNewClientConn(struct ttcp* _ttcp, struct tcp_pcb *newpcb, uint8_t id);
|
||||
|
||||
int8_t insertNewClientConn(struct ttcp* _ttcp, struct tcp_pcb *newpcb);
|
||||
|
||||
int8_t removeNewClientConn(struct ttcp* _ttcp, struct tcp_pcb *newpcb);
|
||||
|
||||
bool cleanNewClientConn(struct ttcp* _ttcp);
|
||||
|
||||
int8_t getNewClientConnId(struct ttcp* _ttcp, struct tcp_pcb *newpcb);
|
||||
|
||||
int8_t getCurrClientConnId();
|
||||
|
||||
struct tcp_pcb * getFirstClient(struct ttcp* _ttcp, bool verbose);
|
||||
|
||||
void closeConnections();
|
||||
|
||||
#endif
|
||||
|
@ -4,38 +4,144 @@
|
||||
* Created on: Jul 4, 2010
|
||||
* Author: mlf by Metodo2 srl
|
||||
*/
|
||||
#undef _APP_DEBUG_
|
||||
//#define _APP_DEBUG_
|
||||
|
||||
#include "lwip/pbuf.h"
|
||||
#include "wifi_spi.h"
|
||||
#include "ard_utils.h"
|
||||
#include "debug.h"
|
||||
#include "ard_spi.h"
|
||||
#include "ard_tcp.h"
|
||||
|
||||
#define MAX_PBUF_STORED 30
|
||||
|
||||
tData pBufStore[MAX_PBUF_STORED][MAX_SOCK_NUM];
|
||||
|
||||
unsigned char headBuf = 0;
|
||||
unsigned char tailBuf = 0;
|
||||
unsigned char headBuf[MAX_SOCK_NUM] = {0};
|
||||
unsigned char tailBuf[MAX_SOCK_NUM] = {0};
|
||||
|
||||
#define IS_BUF_AVAIL() (tailBuf!=headBuf)
|
||||
#define IS_BUF_EMPTY() ((tailBuf == 0) && (headBuf == 0))
|
||||
#define IS_BUF_AVAIL(x) (tailBuf[x] != headBuf[x])
|
||||
#define IS_BUF_EMPTY(x) ((tailBuf[x] == 0) && (headBuf[x] == 0))
|
||||
|
||||
void init_pBuf()
|
||||
{
|
||||
memset(pBufStore, 0, sizeof(pBufStore));
|
||||
}
|
||||
|
||||
void insert_pBuf(struct pbuf* q, uint8_t sock, void* _pcb)
|
||||
uint8_t* insertBuf(uint8_t sock, uint8_t* buf, uint16_t len)
|
||||
{
|
||||
DUMP(buf,len);
|
||||
if (sock>= MAX_SOCK_NUM)
|
||||
{
|
||||
WARN("Sock out of range: sock=%d", sock);
|
||||
return NULL;
|
||||
}
|
||||
if (pBufStore[headBuf[sock]][sock].data != NULL)
|
||||
{
|
||||
WARN("Overwriting buffer %p idx:%d!\n", pBufStore[headBuf[sock]][sock].data, headBuf[sock]);
|
||||
// to avoid memory leak free the oldest buffer
|
||||
freetDataIdx(headBuf[sock], sock);
|
||||
}
|
||||
|
||||
u8_t* p = (u8_t*)calloc(len,sizeof(u8_t));
|
||||
if(p != NULL) {
|
||||
memcpy(p, buf, len);
|
||||
|
||||
pBufStore[headBuf[sock]][sock].data = p;
|
||||
pBufStore[headBuf[sock]][sock].len = len;
|
||||
pBufStore[headBuf[sock]][sock].idx = 0;
|
||||
pBufStore[headBuf[sock]][sock].pcb = getTTCP(sock, TTCP_MODE_TRANSMIT);
|
||||
headBuf[sock]++;
|
||||
|
||||
if (headBuf[sock] == MAX_PBUF_STORED)
|
||||
headBuf[sock] = 0;
|
||||
if (headBuf[sock] == tailBuf[sock])
|
||||
{
|
||||
WARN("Avoid to Overwrite data [%d-%d]!\n", headBuf[sock], tailBuf[sock]);
|
||||
if (headBuf[sock] != 0)
|
||||
--headBuf[sock];
|
||||
else
|
||||
headBuf[sock] = MAX_PBUF_STORED-1;
|
||||
}
|
||||
INFO_UTIL("Insert[%d]: %p:%d-%d [%d,%d]\n", sock, p, len, p[0], headBuf[sock], tailBuf[sock]);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
uint16_t calcMergeLen(uint8_t sock)
|
||||
{
|
||||
uint16_t len = 0;
|
||||
|
||||
unsigned char index = tailBuf[sock];
|
||||
do {
|
||||
if (pBufStore[index][sock].data != NULL)
|
||||
{
|
||||
len += pBufStore[index][sock].len;
|
||||
len -= pBufStore[index][sock].idx;
|
||||
INFO_UTIL_VER(" [%d]: len:%d idx:%d tot:%d\n", sock, pBufStore[index][sock].len, pBufStore[index][sock].idx, len);
|
||||
}
|
||||
++index;
|
||||
if (index == MAX_PBUF_STORED)
|
||||
index = 0;
|
||||
}while (index!=headBuf[sock]);
|
||||
return len;
|
||||
}
|
||||
|
||||
uint16_t clearBuf(uint8_t sock)
|
||||
{
|
||||
uint16_t len = 0;
|
||||
|
||||
unsigned char index = tailBuf[sock];
|
||||
do {
|
||||
if (pBufStore[index][sock].data != NULL)
|
||||
{
|
||||
freetDataIdx(index,sock);
|
||||
}
|
||||
++index;
|
||||
if (index == MAX_PBUF_STORED)
|
||||
index = 0;
|
||||
}while (index!=headBuf[sock]);
|
||||
tailBuf[sock]=index;
|
||||
return len;
|
||||
}
|
||||
|
||||
uint8_t* mergeBuf(uint8_t sock, uint8_t** buf, uint16_t* _len)
|
||||
{
|
||||
uint16_t len = calcMergeLen(sock);
|
||||
uint8_t* p = (u8_t*)calloc(len,sizeof(u8_t));
|
||||
uint8_t* _p = p;
|
||||
if(p != NULL) {
|
||||
unsigned char index = tailBuf[sock];
|
||||
do {
|
||||
if (pBufStore[index][sock].data != NULL)
|
||||
{
|
||||
memcpy(p, pBufStore[index][sock].data, pBufStore[index][sock].len);
|
||||
p += pBufStore[index][sock].len;
|
||||
}
|
||||
++index;
|
||||
if (index == MAX_PBUF_STORED)
|
||||
index = 0;
|
||||
}while (index!=headBuf[sock]);
|
||||
}
|
||||
DUMP(_p,len);
|
||||
if (buf != NULL)
|
||||
*buf = _p;
|
||||
if (_len != NULL)
|
||||
*_len = len;
|
||||
return _p;
|
||||
}
|
||||
|
||||
uint8_t* insert_pBuf(struct pbuf* q, uint8_t sock, void* _pcb)
|
||||
{
|
||||
if (q == NULL)
|
||||
return;
|
||||
return NULL;
|
||||
|
||||
if (pBufStore[headBuf][sock].data != NULL)
|
||||
if (pBufStore[headBuf[sock]][sock].data != NULL)
|
||||
{
|
||||
WARN("Overwriting buffer %p idx:%d!\n", pBufStore[headBuf][sock].data, headBuf);
|
||||
WARN("Overwriting buffer %p idx:%d!\n", pBufStore[headBuf[sock]][sock].data, headBuf[sock]);
|
||||
// to avoid memory leak free the oldest buffer
|
||||
freetDataIdx(headBuf, sock);
|
||||
freetDataIdx(headBuf[sock], sock);
|
||||
}
|
||||
|
||||
u8_t* p = (u8_t*)calloc(q->tot_len,sizeof(u8_t));
|
||||
@ -44,32 +150,55 @@ void insert_pBuf(struct pbuf* q, uint8_t sock, void* _pcb)
|
||||
WARN("pbuf_copy_partial failed: src:%p, dst:%p, len:%d\n", q, p, q->tot_len);
|
||||
free(p);
|
||||
p = NULL;
|
||||
return;
|
||||
return p;
|
||||
}
|
||||
|
||||
pBufStore[headBuf][sock].data = p;
|
||||
pBufStore[headBuf][sock].len = q->tot_len;
|
||||
pBufStore[headBuf][sock].idx = 0;
|
||||
pBufStore[headBuf][sock].pcb = _pcb;
|
||||
headBuf++;
|
||||
pBufStore[headBuf[sock]][sock].data = p;
|
||||
pBufStore[headBuf[sock]][sock].len = q->tot_len;
|
||||
pBufStore[headBuf[sock]][sock].idx = 0;
|
||||
pBufStore[headBuf[sock]][sock].pcb = _pcb;
|
||||
headBuf[sock]++;
|
||||
|
||||
if (headBuf == MAX_PBUF_STORED)
|
||||
headBuf = 0;
|
||||
if (headBuf == tailBuf)
|
||||
WARN("Overwriting data [%d-%d]!\n", headBuf, tailBuf);
|
||||
INFO_UTIL("Insert: %p:%d-%d [%d,%d]\n", p, q->tot_len, p[0], headBuf, tailBuf);
|
||||
if (headBuf[sock] == MAX_PBUF_STORED)
|
||||
headBuf[sock] = 0;
|
||||
if (headBuf[sock] == tailBuf[sock])
|
||||
{
|
||||
WARN("Avoid to Overwrite data [%d-%d]!\n", headBuf[sock], tailBuf[sock]);
|
||||
if (headBuf[sock] != 0)
|
||||
--headBuf[sock];
|
||||
else
|
||||
headBuf[sock] = MAX_PBUF_STORED-1;
|
||||
}
|
||||
INFO_UTIL("Insert[%d]: %p:%d-%d [%d,%d]\n", sock, p, q->tot_len, p[0], headBuf[sock], tailBuf[sock]);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
void dumpPbuf(uint8_t sock)
|
||||
{
|
||||
unsigned char index = tailBuf[sock];
|
||||
printk("headBuf=%d tailBuf=%d\n", headBuf[sock], tailBuf[sock]);
|
||||
do {
|
||||
if (pBufStore[index][sock].data != NULL)
|
||||
{
|
||||
printk("%d] pcb:%p Buf: %p Len:%d\n", pBufStore[index][sock].idx, pBufStore[index][sock].pcb,
|
||||
pBufStore[index][sock].data, pBufStore[index][sock].len);
|
||||
}
|
||||
++index;
|
||||
if (index == MAX_PBUF_STORED)
|
||||
index = 0;
|
||||
}while (index!=headBuf[sock]);
|
||||
}
|
||||
|
||||
tData* get_pBuf(uint8_t sock)
|
||||
{
|
||||
if (IS_BUF_EMPTY())
|
||||
if (IS_BUF_EMPTY(sock))
|
||||
return NULL;
|
||||
|
||||
if (IS_BUF_AVAIL())
|
||||
if (IS_BUF_AVAIL(sock))
|
||||
{
|
||||
tData* p = &(pBufStore[tailBuf][sock]);
|
||||
INFO_UTIL_VER("%p [%d,%d]\n", p, headBuf, tailBuf);
|
||||
tData* p = &(pBufStore[tailBuf[sock]][sock]);
|
||||
INFO_UTIL_VER("%p [%d,%d]\n", p, headBuf[sock], tailBuf[sock]);
|
||||
return p;
|
||||
}
|
||||
return NULL;
|
||||
@ -83,14 +212,14 @@ void freetData(void * buf, uint8_t sock)
|
||||
return;
|
||||
}
|
||||
|
||||
pBufStore[tailBuf][sock].data = NULL;
|
||||
pBufStore[tailBuf][sock].len = 0;
|
||||
pBufStore[tailBuf][sock].idx = 0;
|
||||
pBufStore[tailBuf][sock].pcb = 0;
|
||||
pBufStore[tailBuf[sock]][sock].data = NULL;
|
||||
pBufStore[tailBuf[sock]][sock].len = 0;
|
||||
pBufStore[tailBuf[sock]][sock].idx = 0;
|
||||
pBufStore[tailBuf[sock]][sock].pcb = 0;
|
||||
|
||||
if (++tailBuf == MAX_PBUF_STORED)
|
||||
tailBuf = 0;
|
||||
INFO_UTIL("%p [%d,%d]\n", buf, headBuf, tailBuf);
|
||||
if (++tailBuf[sock] == MAX_PBUF_STORED)
|
||||
tailBuf[sock] = 0;
|
||||
INFO_UTIL("%p [%d,%d]\n", buf, headBuf[sock], tailBuf[sock]);
|
||||
free(buf);
|
||||
}
|
||||
|
||||
@ -117,6 +246,16 @@ void freetDataIdx(uint8_t idxBuf, uint8_t sock)
|
||||
|
||||
void ack_recved(void* pcb, int len);
|
||||
|
||||
void ackAndFreeData(void* pcb, int len, uint8_t sock, uint8_t* data)
|
||||
{
|
||||
INFO_TCP("Ack pcb:%p len:%d sock:%d data:%p\n", pcb, len, sock, data);
|
||||
if (!IS_UDP_SOCK(sock))
|
||||
ack_recved(pcb, len);
|
||||
if (data != NULL)
|
||||
freetData(data, sock);
|
||||
}
|
||||
|
||||
|
||||
bool isAvailTcpDataByte(uint8_t sock)
|
||||
{
|
||||
tData* p = get_pBuf(sock);
|
||||
@ -126,11 +265,10 @@ bool isAvailTcpDataByte(uint8_t sock)
|
||||
INFO_UTIL_VER("check:%d %d %p\n",p->idx, p->len, p->data);
|
||||
if (p->idx == p->len)
|
||||
{
|
||||
freetData(p->data, sock);
|
||||
ack_recved(p->pcb, p->len);
|
||||
INFO_UTIL("Free %p other buf %d tail:%d head:%d\n",
|
||||
p->data, IS_BUF_AVAIL(), tailBuf, headBuf);
|
||||
return (IS_BUF_AVAIL());
|
||||
p->data, IS_BUF_AVAIL(sock), tailBuf[sock], headBuf[sock]);
|
||||
ackAndFreeData(p->pcb, p->len, sock, p->data);
|
||||
return (IS_BUF_AVAIL(sock));
|
||||
}else{
|
||||
return true;
|
||||
}
|
||||
@ -138,6 +276,12 @@ bool isAvailTcpDataByte(uint8_t sock)
|
||||
return false;
|
||||
}
|
||||
|
||||
uint16_t getAvailTcpDataByte(uint8_t sock)
|
||||
{
|
||||
uint16_t len = calcMergeLen(sock);
|
||||
INFO_UTIL_VER("Availabled data: %d\n", len);
|
||||
return len;
|
||||
}
|
||||
|
||||
|
||||
bool getTcpDataByte(uint8_t sock, uint8_t* payload, uint8_t peek)
|
||||
@ -155,12 +299,11 @@ bool getTcpDataByte(uint8_t sock, uint8_t* payload, uint8_t peek)
|
||||
else
|
||||
*payload = buf[p->idx++];
|
||||
INFO_UTIL_VER("get:%d %p %d\n",p->idx, p->data, *payload);
|
||||
if (p->idx == p->len)
|
||||
ackAndFreeData(p->pcb, p->len, sock, p->data);
|
||||
return true;
|
||||
}else{
|
||||
//dealloc current buffer
|
||||
INFO_UTIL("Free %p\n", p->data);
|
||||
freetData(p->data, sock);
|
||||
ack_recved(p->pcb, p->len);
|
||||
ackAndFreeData(p->pcb, p->len, sock, p->data);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -185,12 +328,20 @@ bool freeTcpData(uint8_t sock)
|
||||
p = get_pBuf(sock);
|
||||
if (p != NULL)
|
||||
{
|
||||
freetData(p->data, sock);
|
||||
ack_recved(p->pcb, p->len);
|
||||
ackAndFreeData(p->pcb, p->len, sock, p->data);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void freeAllTcpData(uint8_t sock)
|
||||
{
|
||||
tData* p = NULL;
|
||||
do{
|
||||
p = get_pBuf(sock);
|
||||
if (p != NULL)
|
||||
freetData(p->data, sock);
|
||||
}while(p!=NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,9 +36,12 @@
|
||||
#define SIGN2_DN LED2_DN
|
||||
#define SIGN2_TL LED2_TL
|
||||
|
||||
#define DEB_PIN_UP() gpio_set_gpio_pin(DEB_PIN_GPIO)
|
||||
#define DEB_PIN_DN() gpio_clr_gpio_pin(DEB_PIN_GPIO)
|
||||
#define DEB_PIN_ENA() gpio_enable_gpio_pin(DEB_PIN_GPIO);
|
||||
#define DEB_PIN_UP(X) gpio_set_gpio_pin(DEB##X##_PIN_GPIO)
|
||||
#define DEB_PIN_DN(X) gpio_clr_gpio_pin(DEB##X##_PIN_GPIO)
|
||||
#define DEB_PIN_ENA(X) gpio_enable_gpio_pin(DEB##X##_PIN_GPIO)
|
||||
#define DEB_PIN_TOGGLE(X) gpio_tgl_gpio_pin(DEB##X##_PIN_GPIO)
|
||||
#define DEB_PIN_TRIGGER(X) DEB_PIN_DN(X); DEB_PIN_UP(X);
|
||||
|
||||
|
||||
#else
|
||||
#define SIGN0_UP()
|
||||
@ -51,9 +54,11 @@
|
||||
#define SIGN2_DN()
|
||||
#define SIGN2_TL()
|
||||
|
||||
#define DEB_PIN_UP()
|
||||
#define DEB_PIN_DN()
|
||||
#define DEB_PIN_ENA()
|
||||
#define DEB_PIN_UP(X)
|
||||
#define DEB_PIN_DN(X)
|
||||
#define DEB_PIN_ENA(X)
|
||||
#define DEB_PIN_TOGGLE(X)
|
||||
#define DEB_PIN_TRIGGER(X)
|
||||
|
||||
//#define TOGGLE_SIG0
|
||||
#endif
|
||||
@ -119,8 +124,16 @@
|
||||
|
||||
|
||||
#define PUT_DATA_INT(INT, BYTE, IDX) { \
|
||||
uint16_t _int = INT; \
|
||||
BYTE[IDX] = (uint8_t)((_int & 0xff00)>>8); \
|
||||
uint16_t _int = INT; \
|
||||
BYTE[IDX] = 2; \
|
||||
BYTE[IDX+1] = (uint8_t)((_int & 0xff00)>>8); \
|
||||
BYTE[IDX+2] = (uint8_t)(_int & 0xff); \
|
||||
}
|
||||
|
||||
#define PUT_DATA_INT_NO(INT, BYTE, IDX) { \
|
||||
uint16_t _int = INT; \
|
||||
BYTE[IDX] = 2; \
|
||||
BYTE[IDX+2] = (uint8_t)((_int & 0xff00)>>8); \
|
||||
BYTE[IDX+1] = (uint8_t)(_int & 0xff); \
|
||||
}
|
||||
|
||||
@ -201,7 +214,7 @@
|
||||
#define STATSPI_TIMEOUT_ERROR() \
|
||||
statSpi.timeoutIntErr++; \
|
||||
statSpi.rxErr++; \
|
||||
statSpi.lastError = err; \
|
||||
statSpi.lastError = SPI_TIMEOUT_ERROR; \
|
||||
statSpi.status = spi_getStatus(ARD_SPI);
|
||||
|
||||
#define STATSPI_DISALIGN_ERROR() \
|
||||
@ -228,11 +241,16 @@
|
||||
#define STATSPI_OVERRIDE_ERROR()
|
||||
#endif
|
||||
|
||||
#define DUMP_TCP_STATE(TTCP) \
|
||||
INFO_TCP("ttcp:%p tpcb:%p state:%d lpcb:%p state:%d\n", \
|
||||
TTCP, TTCP->tpcb, (TTCP->tpcb)?TTCP->tpcb->state:0, \
|
||||
TTCP->lpcb, (TTCP->lpcb)?TTCP->lpcb->state:0);
|
||||
|
||||
#define DUMP_TCP_STATE(TTCP) do {\
|
||||
int i = getCurrClientConnId(); \
|
||||
INFO_TCP("%d] ttcp:%p tpcb:%p state:%d lpcb:%p state:%d left:%d sent:%d\n", \
|
||||
i, TTCP, TTCP->tpcb[i], (TTCP->tpcb[i])?TTCP->tpcb[i]->state:0, \
|
||||
TTCP->lpcb, (TTCP->lpcb)?TTCP->lpcb->state:0, \
|
||||
(TTCP->tpcb[i])?TTCP->left[i]:0, (TTCP->tpcb[i])?TTCP->buff_sent[i]:0); \
|
||||
} while(0);
|
||||
|
||||
#define Mode2Str(_Mode) ((_Mode==0)?"TRANSMIT":"RECEIVE")
|
||||
#define ProtMode2Str(_protMode) ((_protMode==0)?"TCP":"UDP")
|
||||
|
||||
typedef struct sData
|
||||
{
|
||||
@ -246,7 +264,13 @@ struct pbuf;
|
||||
|
||||
void init_pBuf();
|
||||
|
||||
void insert_pBuf(struct pbuf* q, uint8_t sock, void* _pcb);
|
||||
uint8_t* insert_pBuf(struct pbuf* q, uint8_t sock, void* _pcb);
|
||||
|
||||
uint8_t* insertBuf(uint8_t sock, uint8_t* buf, uint16_t len);
|
||||
|
||||
uint8_t* mergeBuf(uint8_t sock, uint8_t** buf, uint16_t* _len);
|
||||
|
||||
uint16_t clearBuf(uint8_t sock);
|
||||
|
||||
tData* get_pBuf(uint8_t sock);
|
||||
|
||||
@ -260,8 +284,12 @@ bool getTcpData(uint8_t sock, void** payload, uint16_t* len);
|
||||
|
||||
bool getTcpDataByte(uint8_t sock, uint8_t* payload, uint8_t peek);
|
||||
|
||||
uint16_t getAvailTcpDataByte(uint8_t sock);
|
||||
|
||||
bool isAvailTcpDataByte(uint8_t sock);
|
||||
|
||||
uint8_t freeTcpData(uint8_t sock);
|
||||
|
||||
void freeAllTcpData(uint8_t sock);
|
||||
|
||||
#endif /* ARD_UTILS_H_ */
|
||||
|
@ -43,24 +43,11 @@
|
||||
#include "lwip/dns.h"
|
||||
#include "debug.h"
|
||||
#include "ard_spi.h"
|
||||
#include "ard_tcp.h"
|
||||
#include "ard_utils.h"
|
||||
|
||||
extern void showTTCPstatus();
|
||||
|
||||
#define ENABLE_DEBUG_LEVEL 1
|
||||
#define VERBOSE_DEBUG_LEVEL 2
|
||||
|
||||
#define CHECK_ENA_DEBUG(LEVEL, FLAG) \
|
||||
do{ \
|
||||
if (LEVEL >= ENABLE_DEBUG_LEVEL) enableDebug |= FLAG; \
|
||||
else enableDebug &= ~FLAG; \
|
||||
}while(0);
|
||||
|
||||
#define CHECK_VERB_DEBUG(LEVEL, FLAG) \
|
||||
do{ \
|
||||
if (LEVEL >= VERBOSE_DEBUG_LEVEL) verboseDebug |= FLAG; \
|
||||
else verboseDebug &= ~FLAG; \
|
||||
}while(0);
|
||||
|
||||
#define _DNS_CMD_
|
||||
|
||||
/**
|
||||
@ -195,23 +182,26 @@ cmd_ibss(int argc, char* argv[], void* ctx)
|
||||
cmd_state_t
|
||||
cmd_set_ip(int argc, char* argv[], void* ctx)
|
||||
{
|
||||
struct net_cfg *ncfg = ctx;
|
||||
struct ctx_server *hs = ctx;
|
||||
struct net_cfg *ncfg = &(hs->net_cfg);
|
||||
struct ip_addr lwip_addr;
|
||||
struct netif *nif = ncfg->netif;
|
||||
|
||||
if (argc == 2 &&
|
||||
(strncmp(argv[1], "none", 4) == 0)) {
|
||||
ncfg->dhcp_enabled = 1;
|
||||
ncfg->dhcp_enabled = DYNAMIC_IP_CONFIG;
|
||||
|
||||
return CMD_DONE;
|
||||
}
|
||||
else if (argc != 4 ) {
|
||||
printk("usage: ip <ip> <netmask> <gateway-ip>\n");
|
||||
printk(" or : ip none (to enable DHCP)\n");
|
||||
printk("usage: ipconfig <ip> <netmask> <gateway-ip>\n");
|
||||
printk(" or : ipconfig none (to enable DHCP)\n");
|
||||
return CMD_DONE;
|
||||
}
|
||||
|
||||
/* IP address */
|
||||
lwip_addr = str2ip(argv[1]);
|
||||
INFO_SPI("nif:%p lwip_addr=0x%x\n", nif, lwip_addr.addr);
|
||||
netif_set_ipaddr(nif, &lwip_addr);
|
||||
/* Netmask */
|
||||
lwip_addr = str2ip(argv[2]);
|
||||
@ -220,7 +210,7 @@ cmd_set_ip(int argc, char* argv[], void* ctx)
|
||||
lwip_addr = str2ip(argv[3]);
|
||||
netif_set_gw(nif, &lwip_addr);
|
||||
/* Disable DHCP */
|
||||
ncfg->dhcp_enabled = 0;
|
||||
ncfg->dhcp_enabled = STATIC_IP_CONFIG;
|
||||
|
||||
return CMD_DONE;
|
||||
}
|
||||
@ -373,14 +363,15 @@ cmd_setDnsServer(int argc, char* argv[], void* ctx)
|
||||
*
|
||||
*/
|
||||
cmd_state_t
|
||||
cmd_startTcpSrv(int argc, char* argv[], void* ctx)
|
||||
cmd_startSrv(int argc, char* argv[], void* ctx)
|
||||
{
|
||||
const char *usage = "usage: startTcpSrv <port> <sock>\n";
|
||||
const char *usage = "usage: startSrv <port> <sock> <tcp(0)/udp(1)>\n";
|
||||
|
||||
int port = 0;
|
||||
int sock = 0;
|
||||
int protMode = 0;
|
||||
|
||||
if (argc < 3) {
|
||||
if (argc < 4) {
|
||||
printk(usage);
|
||||
return CMD_DONE;
|
||||
}
|
||||
@ -389,15 +380,50 @@ cmd_startTcpSrv(int argc, char* argv[], void* ctx)
|
||||
port = atoi(argv[1]);
|
||||
/* socket index */
|
||||
sock = atoi(argv[2]);
|
||||
/* Protocol Mode */
|
||||
protMode = atoi(argv[3]);
|
||||
|
||||
printk("Start TCP server on port %d sock %d\n", port, sock);
|
||||
if (start_server_tcp(port, sock) != -1)
|
||||
printk("Start %s server on port %d sock %d\n", ProtMode2Str(protMode), port, sock);
|
||||
if (start_server_tcp(port, sock, protMode) == -1)
|
||||
{
|
||||
printk("Start TCP server on port %d sock %d FAILED\n", port, sock);
|
||||
WARN("Start %s server on port %d sock %d FAILED\n", ProtMode2Str(protMode), port, sock);
|
||||
}
|
||||
return CMD_DONE;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
cmd_state_t
|
||||
cmd_startCli(int argc, char* argv[], void* ctx)
|
||||
{
|
||||
const char *usage = "usage: startCli <ipaddr> <port> <sock> <tcp(0)/udp(1)>\n";
|
||||
struct ip_addr addr = {0};
|
||||
int port = 0;
|
||||
int sock = 0;
|
||||
int protMode = 0;
|
||||
|
||||
if (argc < 5) {
|
||||
printk(usage);
|
||||
return CMD_DONE;
|
||||
}
|
||||
|
||||
/* IP address */
|
||||
addr = str2ip(argv[1]);
|
||||
/* TCP port */
|
||||
port = atoi(argv[2]);
|
||||
/* socket index */
|
||||
sock = atoi(argv[3]);
|
||||
/* Protocol Mode */
|
||||
protMode = atoi(argv[4]);
|
||||
|
||||
printk("Start client on addr 0x%x, port %d sock %d mode %d\n", addr, port, sock, protMode);
|
||||
if (start_client_tcp(addr.addr, port, sock, protMode) == -1)
|
||||
{
|
||||
WARN("Start client on port %d sock %d prot %d mode %d FAILED\n", port, sock, protMode);
|
||||
}
|
||||
return CMD_DONE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -432,11 +458,15 @@ cmd_status(int argc, char* argv[], void* ctx)
|
||||
|
||||
/* print ip address */
|
||||
if (netif_is_up(netif_default))
|
||||
printk("ip addr: %s\n", ip2str(netif_default->ip_addr));
|
||||
{
|
||||
printk("ip addr: %s - ", ip2str(netif_default->ip_addr));
|
||||
printk("netmask: %s - ", ip2str(netif_default->netmask));
|
||||
printk("gateway: %s\n", ip2str(netif_default->gw));
|
||||
}
|
||||
else
|
||||
printk("ip interface is down\n");
|
||||
printk("dhcp : ");
|
||||
if (ncfg->dhcp_enabled) {
|
||||
if (ncfg->dhcp_enabled == DYNAMIC_IP_CONFIG) {
|
||||
printk("enabled\n");
|
||||
}
|
||||
else {
|
||||
@ -445,8 +475,8 @@ cmd_status(int argc, char* argv[], void* ctx)
|
||||
struct ip_addr addr1 = dns_getserver(0);
|
||||
struct ip_addr addr2 = dns_getserver(1);
|
||||
|
||||
printk("==> DNS1: %s\n", ip2str(addr1), addr1);
|
||||
printk("==> DNS2: %s\n", ip2str(addr2), addr2);
|
||||
printk("DNS: %s - ", ip2str(addr1));
|
||||
printk("%s\n", ip2str(addr2));
|
||||
|
||||
showTTCPstatus();
|
||||
return CMD_DONE;
|
||||
@ -595,16 +625,14 @@ cmd_debug(int argc, char* argv[], void* ctx)
|
||||
|
||||
if (argc == 2 && strcmp(argv[1], "off") == 0) {
|
||||
printk("Debug OFF\n");
|
||||
enableDebug = DEFAULT_INFO_FLAG;
|
||||
verboseDebug = 0;
|
||||
INIT_DEBUG_VARIABLES()
|
||||
return CMD_DONE;
|
||||
}else if (argc == 2 && strcmp(argv[1], "print") == 0) {
|
||||
printk("Debug enabled: 0x%x\n", enableDebug);
|
||||
printk("Verbose enabled: 0x%x\n", verboseDebug);
|
||||
PRINT_DEBUG_VARIABLES()
|
||||
return CMD_DONE;
|
||||
}else if (argc == 2 && strcmp(argv[1], "on") == 0) {
|
||||
printk("Debug ON\n");
|
||||
enableDebug = 0xff;
|
||||
TURNON_DEBUG_VARIABLES();
|
||||
return CMD_DONE;
|
||||
}
|
||||
if (argc < 3) {
|
||||
@ -613,23 +641,91 @@ cmd_debug(int argc, char* argv[], void* ctx)
|
||||
}
|
||||
level = atoi(argv[2]);
|
||||
if (argc == 3 && strcmp(argv[1], "init") == 0) {
|
||||
CHECK_ENA_DEBUG(level, INFO_INIT_FLAG);
|
||||
CHECK_VERB_DEBUG(level, INFO_INIT_FLAG);
|
||||
CHECK_DEBUG_LEVEL(level, INFO_INIT_FLAG);
|
||||
}else if (argc == 3 && strcmp(argv[1], "spi") == 0) {
|
||||
CHECK_ENA_DEBUG(level, INFO_SPI_FLAG);
|
||||
CHECK_VERB_DEBUG(level, INFO_SPI_FLAG);
|
||||
CHECK_DEBUG_LEVEL(level, INFO_SPI_FLAG);
|
||||
}else if (argc == 3 && strcmp(argv[1], "tcp") == 0) {
|
||||
CHECK_ENA_DEBUG(level, INFO_TCP_FLAG);
|
||||
CHECK_VERB_DEBUG(level, INFO_TCP_FLAG);
|
||||
CHECK_DEBUG_LEVEL(level, INFO_TCP_FLAG);
|
||||
}else if (argc == 3 && strcmp(argv[1], "cm") == 0) {
|
||||
CHECK_ENA_DEBUG(level, INFO_CM_FLAG);
|
||||
CHECK_VERB_DEBUG(level, INFO_CM_FLAG);
|
||||
CHECK_DEBUG_LEVEL(level, INFO_CM_FLAG);
|
||||
}else if (argc == 3 && strcmp(argv[1], "util") == 0) {
|
||||
CHECK_ENA_DEBUG(level, INFO_UTIL_FLAG);
|
||||
CHECK_VERB_DEBUG(level, INFO_UTIL_FLAG);
|
||||
CHECK_DEBUG_LEVEL(level, INFO_UTIL_FLAG);
|
||||
}else if (argc == 3 && strcmp(argv[1], "warn") == 0) {
|
||||
CHECK_ENA_DEBUG(level, INFO_WARN_FLAG);
|
||||
CHECK_VERB_DEBUG(level, INFO_WARN_FLAG);
|
||||
CHECK_DEBUG_LEVEL(level, INFO_WARN_FLAG);
|
||||
}
|
||||
return CMD_DONE;
|
||||
}
|
||||
|
||||
extern void dumpPbuf(uint8_t sock);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
cmd_state_t
|
||||
cmd_dumpBuf(int argc, char* argv[], void* ctx)
|
||||
{
|
||||
const char *usage = "usage: dumpPbuf [sock]\n\t"\
|
||||
"sock: socket Number\n";
|
||||
|
||||
if (argc == 2 && strcmp(argv[1], "all") == 0) {
|
||||
printk("Dump All Buffers\n");
|
||||
int i = 0;
|
||||
for (; i<MAX_SOCK_NUM; ++i)
|
||||
{
|
||||
printk("Socket: %d\n", i);
|
||||
dumpPbuf(i);
|
||||
}
|
||||
}else if (argc == 2) {
|
||||
uint8_t sock = atoi(argv[1]);
|
||||
printk("Socket: %d\n", sock);
|
||||
dumpPbuf(sock);
|
||||
}else {
|
||||
printk(usage);
|
||||
}
|
||||
return CMD_DONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
cmd_state_t
|
||||
cmd_sendUdpData(int argc, char* argv[], void* ctx)
|
||||
{
|
||||
const char pattern[]={'M', 'I', 'M', 'L', 'F', 'D'};
|
||||
const char* pattern2[]={"Prova", "1234567890","FineTest"};
|
||||
const char *usage = "usage: sendUdp [sock]\n\t"\
|
||||
"sock: socket Number\n";
|
||||
|
||||
if (argc < 2)
|
||||
printk(usage);
|
||||
|
||||
if (argc >= 2) {
|
||||
|
||||
uint8_t sock = atoi(argv[1]);
|
||||
printk("Socket: %d\n", sock);
|
||||
|
||||
if (argc >= 3) {
|
||||
uint8_t patternType = atoi(argv[2]);
|
||||
printk("PatternType: %d\n", patternType);
|
||||
if (patternType == 1)
|
||||
{
|
||||
insertBuf(sock, (uint8_t*)pattern2[0], strlen(pattern2[0]));
|
||||
insertBuf(sock, (uint8_t*)pattern2[1], strlen(pattern2[1]));
|
||||
insertBuf(sock, (uint8_t*)pattern2[2], strlen(pattern2[2]));
|
||||
}
|
||||
if (patternType == 2)
|
||||
{
|
||||
mergeBuf(sock, NULL, NULL);
|
||||
}
|
||||
}else{
|
||||
if (sock < MAX_SOCK_NUM)
|
||||
{
|
||||
sendUdpData(getTTCP(sock, TTCP_MODE_TRANSMIT), (uint8_t*)pattern, sizeof(pattern)/sizeof(char));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return CMD_DONE;
|
||||
}
|
||||
|
@ -54,7 +54,10 @@ cmd_state_t cmd_statSpi(int argc, char* argv[], void* ctx);
|
||||
cmd_state_t cmd_resetStatSpi(int argc, char* argv[], void* ctx);
|
||||
cmd_state_t cmd_gethostbyname(int argc, char* argv[], void* ctx);
|
||||
cmd_state_t cmd_setDnsServer(int argc, char* argv[], void* ctx);
|
||||
cmd_state_t cmd_startTcpSrv(int argc, char* argv[], void* ctx);
|
||||
cmd_state_t cmd_startSrv(int argc, char* argv[], void* ctx);
|
||||
cmd_state_t cmd_startCli(int argc, char* argv[], void* ctx);
|
||||
cmd_state_t cmd_dumpBuf(int argc, char* argv[], void* ctx);
|
||||
cmd_state_t cmd_sendUdpData(int argc, char* argv[], void* ctx);
|
||||
#ifdef WFE_6_12
|
||||
cmd_state_t cmd_ibss(int argc, char* argv[], void* ctx);
|
||||
#endif
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include <board_init.h>
|
||||
#include <usart.h>
|
||||
|
||||
#define MAX_CMD_CONSOLE_NUM 12
|
||||
#define MAX_CMD_CONSOLE_NUM 15
|
||||
struct {
|
||||
cmd_cb_t cb;
|
||||
const char* str;
|
||||
|
@ -18,92 +18,174 @@
|
||||
#define INFO_SPI_FLAG 4
|
||||
#define INFO_CM_FLAG 8
|
||||
#define INFO_UTIL_FLAG 16
|
||||
#define INFO_5 32
|
||||
|
||||
#define INFO_D (1<<0xD) // Debug
|
||||
#define INFO_E (1<<0xE) // Error
|
||||
#define INFO_WARN_FLAG (1<<0xF) // Warning
|
||||
#define DEFAULT_INFO_FLAG 0 //INFO_WARN_FLAG
|
||||
|
||||
#ifdef _DEBUG_
|
||||
#define DEFINE_DEBUG_VARIABLES() \
|
||||
uint16_t enableDebug = DEFAULT_INFO_FLAG | INFO_WARN_FLAG; \
|
||||
uint16_t verboseDebug = 0; \
|
||||
uint16_t dumpDebug = 0; \
|
||||
uint16_t pollDebug = 0;
|
||||
#else
|
||||
#define DEFINE_DEBUG_VARIABLES() \
|
||||
uint16_t enableDebug = DEFAULT_INFO_FLAG; \
|
||||
uint16_t verboseDebug = 0; \
|
||||
uint16_t dumpDebug = 0; \
|
||||
uint16_t pollDebug = 0;
|
||||
#endif
|
||||
|
||||
#define INIT_DEBUG_VARIABLES() \
|
||||
enableDebug = DEFAULT_INFO_FLAG | INFO_WARN_FLAG; \
|
||||
verboseDebug = 0; \
|
||||
dumpDebug = 0; pollDebug = 0;
|
||||
|
||||
|
||||
#define PRINT_DEBUG_VARIABLES() \
|
||||
printk("Debug enabled: 0x%x\n", enableDebug); \
|
||||
printk("Verbose enabled: 0x%x\n", verboseDebug); \
|
||||
printk("Dump enabled: 0x%x\n", dumpDebug); \
|
||||
printk("POoll enabled: 0x%x\n", pollDebug);
|
||||
|
||||
#define TURNON_DEBUG_VARIABLES() \
|
||||
enableDebug = 0xff;
|
||||
|
||||
extern uint16_t enableDebug;
|
||||
extern uint16_t verboseDebug;
|
||||
extern uint16_t dumpDebug;
|
||||
extern uint16_t pollDebug;
|
||||
|
||||
#define ENABLE_DEBUG_LEVEL 1
|
||||
#define VERBOSE_DEBUG_LEVEL 2
|
||||
#define DUMP_DEBUG_LEVEL 3
|
||||
#define POLL_DEBUG_LEVEL 4
|
||||
|
||||
#define CHECK_DEBUG(VAR, LEVEL, LEVEL_LIMIT, FLAG) \
|
||||
do{ \
|
||||
if (LEVEL >= LEVEL_LIMIT) VAR |= FLAG; \
|
||||
else VAR &= ~FLAG; \
|
||||
}while(0);
|
||||
|
||||
#define CHECK_ENA_DEBUG(LEVEL, FLAG) \
|
||||
CHECK_DEBUG(enableDebug, LEVEL, ENABLE_DEBUG_LEVEL, FLAG)
|
||||
#define CHECK_VERB_DEBUG(LEVEL, FLAG) \
|
||||
CHECK_DEBUG(verboseDebug, LEVEL, VERBOSE_DEBUG_LEVEL, FLAG)
|
||||
#define CHECK_DUMP_DEBUG(LEVEL, FLAG) \
|
||||
CHECK_DEBUG(dumpDebug, LEVEL, DUMP_DEBUG_LEVEL, FLAG)
|
||||
#define CHECK_POLL_DEBUG(LEVEL, FLAG) \
|
||||
CHECK_DEBUG(pollDebug, LEVEL, POLL_DEBUG_LEVEL, FLAG)
|
||||
|
||||
|
||||
#define CHECK_DEBUG_LEVEL(LEVEL, INFO_FLAG) \
|
||||
CHECK_ENA_DEBUG(LEVEL, INFO_FLAG) \
|
||||
CHECK_VERB_DEBUG(LEVEL, INFO_FLAG) \
|
||||
CHECK_DUMP_DEBUG(LEVEL, INFO_FLAG) \
|
||||
CHECK_POLL_DEBUG(LEVEL, INFO_FLAG)
|
||||
|
||||
#ifdef _INFO_DEBUG_
|
||||
#define INFO_INIT(msg, args...) do { \
|
||||
if (enableDebug & INFO_INIT_FLAG) printk("I-[%s] " msg , __func__ , ##args ); \
|
||||
#define PRINT_DEBUG(msg, args...) do { \
|
||||
printk("[%s] " msg , __func__ , ##args ); \
|
||||
} while (0)
|
||||
|
||||
#define INFO_TCP(msg, args...) do { \
|
||||
if (enableDebug & INFO_TCP_FLAG) printk("I-[%s] " msg , __func__ , ##args ); \
|
||||
} while (0)
|
||||
|
||||
#define INFO_TCP_VER(msg, args...) do { \
|
||||
if ((enableDebug & INFO_TCP_FLAG)&&(verboseDebug & INFO_TCP_FLAG)) \
|
||||
#define INFO_DEBUG(msg, args...) do { \
|
||||
printk("I-[%s] " msg , __func__ , ##args ); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define INFO_SPI(msg, args...) do { \
|
||||
if (enableDebug & INFO_SPI_FLAG) printk("I-[%s] " msg , __func__ , ##args ); \
|
||||
#define WARN_DEBUG(msg, args...) do { \
|
||||
printk("W-[%s] " msg , __func__ , ##args ); \
|
||||
} while (0)
|
||||
|
||||
#define INFO_SPI_VER(msg, args...) do { \
|
||||
if ((enableDebug & INFO_SPI_FLAG)&&(verboseDebug & INFO_SPI_FLAG)) \
|
||||
printk("I-[%s] " msg , __func__ , ##args ); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#define INFO_UTIL(msg, args...) do { \
|
||||
if (enableDebug & INFO_UTIL_FLAG) printk("I-[%s] " msg , __func__ , ##args ); \
|
||||
} while (0)
|
||||
|
||||
#define INFO_UTIL_VER(msg, args...) do { \
|
||||
if ((enableDebug & INFO_UTIL_FLAG)&&(verboseDebug & INFO_UTIL_FLAG)) \
|
||||
printk("I-[%s] " msg , __func__ , ##args ); \
|
||||
} while (0)
|
||||
|
||||
|
||||
#else
|
||||
#define INFO_INIT(msg, args...) do {}while(0);
|
||||
#define INFO_TCP(msg, args...) do {}while(0);
|
||||
#define INFO_TCP_VER(msg, args...) do { }while(0);
|
||||
#define INFO_SPI(msg, args...) do {}while(0);
|
||||
#define INFO_SPI_VER(msg, args...) do { }while(0);
|
||||
#define INFO_UTIL(msg, args...) do {}while(0);
|
||||
#define INFO_UTIL_VER(msg, args...) do { }while(0);
|
||||
do { }while(0);
|
||||
#endif
|
||||
|
||||
#ifdef _APP_DEBUG_
|
||||
#define INFO(msg, args...) do { \
|
||||
printk("I-[%s] " msg , __func__ , ##args ); \
|
||||
#define IF_DEBUG(X,Y) do { \
|
||||
if (enableDebug & INFO_##X##_FLAG) \
|
||||
Y; \
|
||||
} while (0)
|
||||
|
||||
#else /* !defined(_DEBUG_) */
|
||||
//#define INFO(msg, args...) do {} while (0)
|
||||
#endif /* !defined(_DEBUG_) */
|
||||
#define IF_DEBUG_VER(X,Y) do { \
|
||||
if (verboseDebug & INFO_##X##_FLAG) \
|
||||
Y; \
|
||||
} while (0)
|
||||
|
||||
#if 1
|
||||
#define WARN(msg, args...) do { \
|
||||
if (enableDebug & INFO_WARN_FLAG) printk("W-[%s] " msg , __func__ , ##args ); \
|
||||
} while (0)
|
||||
#define IF_DEBUG_DUMP(X,Y) do { \
|
||||
if (dumpDebug & INFO_##X##_FLAG) \
|
||||
Y; \
|
||||
} while (0)
|
||||
|
||||
#define IF_DEBUG_POLL(X,Y) do { \
|
||||
if (pollDebug & INFO_##X##_FLAG) {\
|
||||
Y; \
|
||||
}} while (0)
|
||||
|
||||
|
||||
|
||||
#define IF_WARN(Y) IF_DEBUG(WARN,Y)
|
||||
#define IF_WARN_VER(Y) IF_DEBUG_VER(WARN,Y)
|
||||
#define IF_TCP(Y) IF_DEBUG(TCP,Y)
|
||||
#define IF_TCP_VER(Y) IF_DEBUG_VER(TCP,Y)
|
||||
#define IF_TCP_POLL(Y) IF_DEBUG_POLL(TCP,Y)
|
||||
#define IF_TCP_DUMP(Y) IF_DEBUG_DUMP(TCP,Y)
|
||||
#define IF_SPI(Y) IF_DEBUG(SPI,Y)
|
||||
#define IF_SPI_VER(Y) IF_DEBUG_VER(SPI,Y)
|
||||
#define IF_SPI_DUMP(Y) IF_DEBUG_DUMP(SPI,Y)
|
||||
#define IF_SPI_POLL(Y) IF_DEBUG_POLL(SPI,Y)
|
||||
#define IF_UTIL(Y) IF_DEBUG(UTIL,Y)
|
||||
#define IF_UTIL_VER(Y) IF_DEBUG_VER(UTIL,Y)
|
||||
|
||||
#define WARN(msg, args...) IF_DEBUG(WARN,WARN_DEBUG(msg, ##args))
|
||||
#define WARN_VER(msg, args...) IF_DEBUG_VER(WARN,WARN_DEBUG(msg, ##args))
|
||||
#define WARN_POLL(msg, args...) IF_DEBUG_POLL(WARN,WARN_DEBUG(msg, ##args))
|
||||
#if 0 // disable to reduce the size of binary
|
||||
#define INFO_INIT(msg, args...) IF_DEBUG(INIT,PRINT_DEBUG(msg, ##args))
|
||||
#define INFO_INIT_VER(msg, args...) IF_DEBUG_VER(INIT,PRINT_DEBUG(msg, ##args))
|
||||
#else
|
||||
#define WARN(msg, args...) do { } while (0)
|
||||
#define INFO_INIT(msg, args...)
|
||||
#define INFO_INIT_VER(msg, args...)
|
||||
#endif
|
||||
#define INFO_TCP(msg, args...) IF_DEBUG(TCP,PRINT_DEBUG(msg, ##args))
|
||||
#define INFO_TCP_VER(msg, args...) IF_DEBUG_VER(TCP,PRINT_DEBUG(msg, ##args))
|
||||
#define INFO_TCP_DUMP(msg, args...) IF_DEBUG_DUMP(TCP,PRINT_DEBUG(msg, ##args))
|
||||
#define INFO_TCP_POLL(msg, args...) IF_DEBUG_POLL(TCP,PRINT_DEBUG(msg, ##args))
|
||||
#define INFO_SPI(msg, args...) IF_DEBUG(SPI,PRINT_DEBUG(msg, ##args))
|
||||
#define INFO_SPI_VER(msg, args...) IF_DEBUG_VER(SPI,PRINT_DEBUG(msg, ##args))
|
||||
#define INFO_SPI_DUMP(msg, args...) IF_DEBUG_DUMP(SPI,PRINT_DEBUG(msg, ##args))
|
||||
#define INFO_SPI_POLL(msg, args...) IF_DEBUG_POLL(SPI,PRINT_DEBUG(msg, ##args))
|
||||
#define INFO_UTIL(msg, args...) IF_DEBUG(UTIL,PRINT_DEBUG(msg, ##args))
|
||||
#define INFO_UTIL_VER(msg, args...) IF_DEBUG_VER(UTIL,PRINT_DEBUG(msg, ##args))
|
||||
#define CM_DPRINTF(msg, args...) IF_DEBUG(CM,PRINT_DEBUG(msg, ##args))
|
||||
|
||||
extern void dump(char* _buf, uint16_t _count);
|
||||
|
||||
#ifdef _APP_DEBUG_
|
||||
#define DUMP(BUF, COUNT) do { \
|
||||
printk("[%s]\n", __func__); \
|
||||
#define _DUMP(BUF, COUNT) do { \
|
||||
printk("[%s]: ", __func__); \
|
||||
dump((char*)BUF, COUNT); \
|
||||
} while (0)
|
||||
|
||||
#ifdef _APP_DEBUG_
|
||||
#define DUMP(BUF, COUNT) _DUMP(BUF, COUNT)
|
||||
#else
|
||||
#define DUMP(BUF, COUNT) do {} while (0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DUMP_TCP(BUF, COUNT) do { \
|
||||
if (verboseDebug & INFO_TCP_FLAG) { \
|
||||
printk("[%s]\n", __func__); \
|
||||
dump((char*)BUF, COUNT); \
|
||||
}} while (0)
|
||||
#define DUMP_TCP(BUF, COUNT) IF_TCP_DUMP(_DUMP(BUF, COUNT))
|
||||
#define DUMP_SPI(BUF, COUNT) IF_SPI_DUMP(_DUMP(BUF, COUNT))
|
||||
|
||||
#define DUMP_SPI_CMD(BUF) do { \
|
||||
if (dumpDebug & INFO_SPI_FLAG) { \
|
||||
int i = 0; \
|
||||
for (; i < CMD_MAX_LEN; ++i) \
|
||||
{ \
|
||||
printk("0x%x ", BUF[i]); \
|
||||
if (BUF[i] == END_CMD) \
|
||||
break; \
|
||||
} \
|
||||
printk("\n"); \
|
||||
} \
|
||||
}while(0);
|
||||
|
||||
|
@ -1,12 +1,21 @@
|
||||
#ifndef _LWIP_SETUP_H
|
||||
#define _LWIP_SETUP_H
|
||||
|
||||
#define INIT_IP_CONFIG 0xff
|
||||
#define STATIC_IP_CONFIG 0
|
||||
#define DYNAMIC_IP_CONFIG 1
|
||||
|
||||
struct net_cfg {
|
||||
struct netif *netif; /* lwip network interface */
|
||||
uint8_t dhcp_enabled;
|
||||
uint8_t dhcp_running;
|
||||
};
|
||||
|
||||
struct ctx_server {
|
||||
struct net_cfg net_cfg;
|
||||
uint8_t wl_init_complete;
|
||||
};
|
||||
|
||||
/*! Start the IP stack.
|
||||
* If cfg->netif must have been allocated and lwip_init()
|
||||
* must have been called before this function is called
|
||||
|
@ -111,7 +111,7 @@
|
||||
* MEMP_NUM_TCP_PCB: the number of simulatenously active TCP connections.
|
||||
* (requires the LWIP_TCP option)
|
||||
*/
|
||||
#define MEMP_NUM_TCP_PCB 2
|
||||
#define MEMP_NUM_TCP_PCB 4
|
||||
|
||||
/**
|
||||
* MEMP_NUM_TCP_PCB_LISTEN: the number of listening TCP connections.
|
||||
|
@ -39,7 +39,7 @@
|
||||
#include <lwip_setup.h>
|
||||
|
||||
/* FIRMWARE version */
|
||||
const char* fwVersion = "1.0.0";
|
||||
const char* fwVersion = "1.1.0";
|
||||
|
||||
#if BOARD == ARDUINO
|
||||
#if !defined(DATAFLASH)
|
||||
@ -78,25 +78,13 @@ void fw_download_cb(void* ctx, uint8_t** buf, uint32_t* len)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct ctx_server {
|
||||
struct net_cfg net_cfg;
|
||||
uint8_t wl_init_complete;
|
||||
};
|
||||
|
||||
bool ifStatus = false;
|
||||
bool scanNetCompleted = false;
|
||||
|
||||
static bool initSpiComplete = false;
|
||||
|
||||
// variable used as enable flag for debug prints
|
||||
#ifdef _DEBUG_
|
||||
uint16_t enableDebug = DEFAULT_INFO_FLAG | INFO_WARN_FLAG;// | INFO_SPI_FLAG;
|
||||
uint16_t verboseDebug = 0;
|
||||
#else
|
||||
uint16_t enableDebug = DEFAULT_INFO_FLAG;
|
||||
uint16_t verboseDebug = 0;
|
||||
#endif
|
||||
|
||||
DEFINE_DEBUG_VARIABLES();
|
||||
|
||||
/**
|
||||
*
|
||||
@ -121,7 +109,7 @@ wl_cm_conn_cb(struct wl_network_t* net, void* ctx)
|
||||
INFO_INIT("Connection cb...\n");
|
||||
|
||||
printk("link up, connected to \"%s\"\n", ssid2str(&net->ssid));
|
||||
if ( hs->net_cfg.dhcp_enabled ) {
|
||||
if ( hs->net_cfg.dhcp_enabled == DYNAMIC_IP_CONFIG ) {
|
||||
INFO_INIT("Start DHCP...\n");
|
||||
printk("requesting dhcp ... ");
|
||||
int8_t result = dhcp_start(hs->net_cfg.netif);
|
||||
@ -129,7 +117,7 @@ wl_cm_conn_cb(struct wl_network_t* net, void* ctx)
|
||||
hs->net_cfg.dhcp_running = 1;
|
||||
}
|
||||
else {
|
||||
netif_set_up(hs->net_cfg.netif);
|
||||
netif_set_up(hs->net_cfg.netif);
|
||||
}
|
||||
|
||||
INFO_INIT("Start DNS...\n");
|
||||
@ -277,7 +265,7 @@ poll(struct ctx_server* hs)
|
||||
#endif
|
||||
}
|
||||
|
||||
void initShell()
|
||||
void initShell(void* ctx)
|
||||
{
|
||||
/* initialize shell */
|
||||
INFO_INIT("Shell init...\n");
|
||||
@ -285,9 +273,10 @@ void initShell()
|
||||
console_add_cmd("scan", cmd_scan, NULL);
|
||||
console_add_cmd("connect", cmd_connect, NULL);
|
||||
console_add_cmd("setkey", cmd_setkey, NULL);
|
||||
console_add_cmd("status", cmd_status, NULL);
|
||||
console_add_cmd("status", cmd_status, ctx);
|
||||
console_add_cmd("debug", cmd_debug, NULL);
|
||||
|
||||
console_add_cmd("dumpBuf", cmd_dumpBuf, NULL);
|
||||
console_add_cmd("ipconfig", cmd_set_ip, ctx);
|
||||
#ifdef ADD_CMDS
|
||||
console_add_cmd("powersave", cmd_power, NULL);
|
||||
console_add_cmd("psconf", cmd_psconf, NULL);
|
||||
@ -307,8 +296,11 @@ void initShell()
|
||||
#ifdef _DNS_CMD_
|
||||
console_add_cmd("getHost", cmd_gethostbyname, NULL);
|
||||
console_add_cmd("setDNS", cmd_setDnsServer, NULL);
|
||||
console_add_cmd("startTcpSrv", cmd_startTcpSrv, NULL);
|
||||
#endif
|
||||
console_add_cmd("startSrv", cmd_startSrv, NULL);
|
||||
console_add_cmd("startCli", cmd_startCli, NULL);
|
||||
console_add_cmd("sendUdp", cmd_sendUdpData, NULL);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -321,12 +313,16 @@ wl_init_complete_cb(void* ctx)
|
||||
struct ip_addr ipaddr, netmask, gw;
|
||||
wl_err_t wl_status;
|
||||
|
||||
IP4_ADDR(&gw, 0,0,0,0);
|
||||
IP4_ADDR(&ipaddr, 0,0,0,0);
|
||||
IP4_ADDR(&netmask, 0,0,0,0);
|
||||
|
||||
/* default is dhcp enabled */
|
||||
hs->net_cfg.dhcp_enabled = 1;
|
||||
if (hs->net_cfg.dhcp_enabled == INIT_IP_CONFIG)
|
||||
{
|
||||
IP4_ADDR(&gw, 0,0,0,0);
|
||||
IP4_ADDR(&ipaddr, 0,0,0,0);
|
||||
IP4_ADDR(&netmask, 0,0,0,0);
|
||||
|
||||
/* default is dhcp enabled */
|
||||
hs->net_cfg.dhcp_enabled = DYNAMIC_IP_CONFIG;
|
||||
}
|
||||
|
||||
start_ip_stack(&hs->net_cfg,
|
||||
ipaddr,
|
||||
netmask,
|
||||
@ -341,7 +337,7 @@ wl_init_complete_cb(void* ctx)
|
||||
|
||||
wl_scan();
|
||||
|
||||
if (initSpi()){
|
||||
if (initSpi(hs)){
|
||||
WARN("Spi not initialized\n");
|
||||
}else
|
||||
{
|
||||
@ -359,9 +355,13 @@ void startup_init(void)
|
||||
|
||||
// if DEBUG enabled use DEB_PIN_GPIO for debug purposes
|
||||
DEB_PIN_ENA();
|
||||
DEB_PIN_ENA(2);
|
||||
DEB_PIN_UP();
|
||||
DEB_PIN_UP(2);
|
||||
}
|
||||
|
||||
const char timestamp[] = __TIMESTAMP__;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -381,8 +381,6 @@ main(void)
|
||||
|
||||
tc_init();
|
||||
|
||||
initShell();
|
||||
|
||||
delay_init(FOSC0);
|
||||
|
||||
#ifdef _TEST_SPI_
|
||||
@ -396,7 +394,7 @@ main(void)
|
||||
|
||||
}
|
||||
#else
|
||||
printk("Arduino Wifi Startup... [%s]\n", __TIMESTAMP__);
|
||||
printk("Arduino Wifi Startup... [%s]\n", timestamp);
|
||||
|
||||
size_t size_ctx_server = sizeof(struct ctx_server);
|
||||
hs = calloc(1, size_ctx_server);
|
||||
@ -405,10 +403,11 @@ main(void)
|
||||
size_t size_netif = sizeof(struct netif);
|
||||
hs->net_cfg.netif = calloc(1, size_netif);
|
||||
ASSERT(hs->net_cfg.netif, "out of memory");
|
||||
hs->net_cfg.dhcp_enabled = INIT_IP_CONFIG;
|
||||
|
||||
INFO_INIT("hs:%p size:0x%x netif:%p size:0x%x\n", hs, size_ctx_server,
|
||||
hs->net_cfg.netif, size_netif);
|
||||
|
||||
initShell(hs);
|
||||
timer_init(NULL, NULL);
|
||||
lwip_init();
|
||||
|
||||
|
@ -24,12 +24,16 @@
|
||||
#define START_CMD 0xE0
|
||||
#define END_CMD 0xEE
|
||||
#define ERR_CMD 0xEF
|
||||
#define CMD_POS 1 // Position of Command OpCode on SPI stream
|
||||
#define PARAM_LEN_POS 2 // Position of Param len on SPI stream
|
||||
|
||||
enum {
|
||||
SET_NET_CMD = 0x10,
|
||||
SET_PASSPHRASE_CMD = 0x11,
|
||||
SET_KEY_CMD = 0x12,
|
||||
TEST_CMD = 0x13,
|
||||
SET_IP_CONFIG_CMD = 0x14,
|
||||
SET_DNS_CONFIG_CMD = 0x15,
|
||||
|
||||
GET_CONN_STATUS_CMD = 0x20,
|
||||
GET_IPADDR_CMD = 0x21,
|
||||
@ -56,11 +60,14 @@ enum {
|
||||
START_SCAN_NETWORKS = 0x36,
|
||||
GET_FW_VERSION_CMD = 0x37,
|
||||
GET_TEST_CMD = 0x38,
|
||||
SEND_DATA_UDP_CMD = 0x39,
|
||||
GET_REMOTE_DATA_CMD = 0x3A,
|
||||
|
||||
// All command with DATA_FLAG 0x40 send a 16bit Len
|
||||
|
||||
SEND_DATA_TCP_CMD = 0x44,
|
||||
GET_DATABUF_TCP_CMD = 0x45,
|
||||
INSERT_DATABUF_CMD = 0x46,
|
||||
|
||||
};
|
||||
|
||||
@ -150,3 +157,4 @@ typedef struct __attribute__((__packed__))
|
||||
}tByteParam;
|
||||
|
||||
#endif
|
||||
uint8_t param;
|
@ -59,15 +59,9 @@
|
||||
*/
|
||||
#define ROAMING_RSSI_DIFF 10
|
||||
|
||||
|
||||
#if 1
|
||||
# include "printf-stdarg.h"
|
||||
#include "ard_utils.h"
|
||||
# define CM_DPRINTF(fmt...) if (enableDebug & INFO_CM_FLAG) printk(fmt)
|
||||
#else
|
||||
# define CM_DPRINTF(fmt...)
|
||||
#endif
|
||||
|
||||
#include "debug.h"
|
||||
|
||||
/** \defgroup wl_cm Connection Manager
|
||||
*
|
||||
|
1291
hardware/arduino/avr/firmwares/wifishield/wifiHD/wifiHD.cproj
Normal file
1291
hardware/arduino/avr/firmwares/wifishield/wifiHD/wifiHD.cproj
Normal file
@ -0,0 +1,1291 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>6.0</ProjectVersion>
|
||||
<ToolchainName>com.Atmel.AVRGCC32</ToolchainName>
|
||||
<ProjectGuid>417e15db-488a-4b56-8d4e-fbe832b2b649</ProjectGuid>
|
||||
<Name>wifiHD</Name>
|
||||
<avrdevice>AT32uc3a1256</avrdevice>
|
||||
<avrdeviceseries>none</avrdeviceseries>
|
||||
<AvrProjectType>Importer</AvrProjectType>
|
||||
<OutputType>Executable</OutputType>
|
||||
<Language>C</Language>
|
||||
<OutputFileName>wifiHD</OutputFileName>
|
||||
<OutputFileExtension>.elf</OutputFileExtension>
|
||||
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||
<ToolchainFlavour>Native</ToolchainFlavour>
|
||||
<avrtool>com.atmel.avrdbg.tool.jtagicemk3</avrtool>
|
||||
<KeepTimersRunning>true</KeepTimersRunning>
|
||||
<AsfFrameworkConfig>
|
||||
<framework-data>
|
||||
<options />
|
||||
<configurations>
|
||||
<configuration key="config.avr32.utils.trampoline" value="yes" default="yes" content-id="Atmel.ASF" />
|
||||
<configuration key="config.avr32.utils.gccstartup" value="yes" default="yes" content-id="Atmel.ASF" />
|
||||
<configuration key="config.utils.interrupt.intc" value="yes" default="yes" content-id="Atmel.ASF" />
|
||||
<configuration key="config.avr32.drivers.intc.exception" value="yes" default="yes" content-id="Atmel.ASF" />
|
||||
</configurations>
|
||||
<files />
|
||||
<documentation help="" />
|
||||
</framework-data>
|
||||
</AsfFrameworkConfig>
|
||||
<avrtoolinterface>JTAG</avrtoolinterface>
|
||||
<com_atmel_avrdbg_tool_jtagicemk3>
|
||||
<ToolType>com.atmel.avrdbg.tool.jtagicemk3</ToolType>
|
||||
<ToolName>JTAGICE3</ToolName>
|
||||
<ToolNumber>J30200003078</ToolNumber>
|
||||
<KeepTimersRunning>true</KeepTimersRunning>
|
||||
<OverrideVtor>false</OverrideVtor>
|
||||
<OverrideVtorValue>
|
||||
</OverrideVtorValue>
|
||||
<Channel>
|
||||
<host>127.0.0.1</host>
|
||||
<port>51999</port>
|
||||
<ssl>False</ssl>
|
||||
</Channel>
|
||||
<ToolOptions>
|
||||
<InterfaceName>JTAG</InterfaceName>
|
||||
<InterfaceProperties>
|
||||
<JtagDbgClock>250000</JtagDbgClock>
|
||||
<JtagProgClock>1000000</JtagProgClock>
|
||||
<IspClock>150000</IspClock>
|
||||
<JtagInChain>false</JtagInChain>
|
||||
<JtagEnableExtResetOnStartSession>false</JtagEnableExtResetOnStartSession>
|
||||
<JtagDevicesBefore>0</JtagDevicesBefore>
|
||||
<JtagDevicesAfter>0</JtagDevicesAfter>
|
||||
<JtagInstrBitsBefore>0</JtagInstrBitsBefore>
|
||||
<JtagInstrBitsAfter>0</JtagInstrBitsAfter>
|
||||
</InterfaceProperties>
|
||||
</ToolOptions>
|
||||
</com_atmel_avrdbg_tool_jtagicemk3>
|
||||
<AsfVersion>3.5.0</AsfVersion>
|
||||
<OverrideVtor>false</OverrideVtor>
|
||||
<OverrideVtorValue />
|
||||
<eraseonlaunchrule>0</eraseonlaunchrule>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<ToolchainSettings>
|
||||
<Avr32Gcc>
|
||||
<avr32gcc.common.outputfiles.hex>True</avr32gcc.common.outputfiles.hex>
|
||||
<avr32gcc.common.outputfiles.lss>True</avr32gcc.common.outputfiles.lss>
|
||||
<avr32gcc.common.outputfiles.eep>True</avr32gcc.common.outputfiles.eep>
|
||||
<avr32gcc.common.outputfiles.srec>True</avr32gcc.common.outputfiles.srec>
|
||||
<avr32gcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>BOARD=ARDUINO</Value>
|
||||
<Value>WITH_KEY</Value>
|
||||
<Value>WITH_WPA</Value>
|
||||
<Value>WITH_NO_DMA</Value>
|
||||
<Value>DATAFLASH=1</Value>
|
||||
<Value>_INFO_DEBUG_=1</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.compiler.symbols.DefSymbols>
|
||||
<avr32gcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PDCA</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/TC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EBI/SMC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/DELAY</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/RTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EIC</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/CPU/CYCLE_COUNTER</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
<Value>../src</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include/ipv4</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-port-1.3.2/HD/if/include</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/WIFI/HD</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.compiler.directories.IncludePaths>
|
||||
<avr32gcc.compiler.optimization.level>Optimize for size (-Os)</avr32gcc.compiler.optimization.level>
|
||||
<avr32gcc.compiler.optimization.OtherFlags>-fdata-sections -ffunction-sections</avr32gcc.compiler.optimization.OtherFlags>
|
||||
<avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>True</avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>
|
||||
<avr32gcc.compiler.optimization.UseAssemblerForPseudoInstructions>True</avr32gcc.compiler.optimization.UseAssemblerForPseudoInstructions>
|
||||
<avr32gcc.compiler.optimization.ForceDoubleWordAlignment>True</avr32gcc.compiler.optimization.ForceDoubleWordAlignment>
|
||||
<avr32gcc.compiler.warnings.AllWarnings>True</avr32gcc.compiler.warnings.AllWarnings>
|
||||
<avr32gcc.compiler.miscellaneous.OtherFlags>-c -fmessage-length=0</avr32gcc.compiler.miscellaneous.OtherFlags>
|
||||
<avr32gcc.linker.general.DoNotUseStandardStartFiles>True</avr32gcc.linker.general.DoNotUseStandardStartFiles>
|
||||
<avr32gcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>newlib_addons-at32ucr2-speed_opt</Value>
|
||||
<Value>_ucr2_hd_spi_v2.7.0</Value>
|
||||
<Value>_ucr2_hd_wl_sta_intwpa_v2.7.0</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.linker.libraries.Libraries>
|
||||
<avr32gcc.linker.libraries.LibrarySearchPaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/WIFI/HD/v2.7.0/UCR2/GCC</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.linker.libraries.LibrarySearchPaths>
|
||||
<avr32gcc.linker.optimization.GarbageCollectUnusedSections>True</avr32gcc.linker.optimization.GarbageCollectUnusedSections>
|
||||
<avr32gcc.linker.optimization.PutReadOnlyDataInWritableDataSection>True</avr32gcc.linker.optimization.PutReadOnlyDataInWritableDataSection>
|
||||
<avr32gcc.linker.optimization.AllowDirectReferencesToDataSection>True</avr32gcc.linker.optimization.AllowDirectReferencesToDataSection>
|
||||
<avr32gcc.linker.miscellaneous.LinkerFlags>-Wl,--gc-sections -Wl,-e,_trampoline -T../src/SOFTWARE_FRAMEWORK/UTILS/LINKER_SCRIPTS/AT32UC3A/1256/GCC/link_uc3a1256.lds</avr32gcc.linker.miscellaneous.LinkerFlags>
|
||||
<avr32gcc.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PDCA</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/TC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EBI/SMC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/DELAY</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/RTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EIC</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/CPU/CYCLE_COUNTER</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.assembler.general.IncludePaths>
|
||||
<avr32gcc.preprocessingassembler.general.AssemblerFlags>-Wa,-g</avr32gcc.preprocessingassembler.general.AssemblerFlags>
|
||||
<avr32gcc.preprocessingassembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PDCA</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/TC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EBI/SMC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/DELAY</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/RTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EIC</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/CPU/CYCLE_COUNTER</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.preprocessingassembler.general.IncludePaths>
|
||||
</Avr32Gcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<ToolchainSettings>
|
||||
<Avr32Gcc>
|
||||
<avr32gcc.common.outputfiles.hex>True</avr32gcc.common.outputfiles.hex>
|
||||
<avr32gcc.common.outputfiles.lss>True</avr32gcc.common.outputfiles.lss>
|
||||
<avr32gcc.common.outputfiles.eep>True</avr32gcc.common.outputfiles.eep>
|
||||
<avr32gcc.common.outputfiles.srec>True</avr32gcc.common.outputfiles.srec>
|
||||
<avr32gcc.compiler.preprocessor.DoNotSearchSystemDirectories>false</avr32gcc.compiler.preprocessor.DoNotSearchSystemDirectories>
|
||||
<avr32gcc.compiler.preprocessor.PreprocessOnly>false</avr32gcc.compiler.preprocessor.PreprocessOnly>
|
||||
<avr32gcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>BOARD=ARDUINO</Value>
|
||||
<Value>NO_SYS</Value>
|
||||
<Value>_DEBUG_</Value>
|
||||
<Value>_ASSERT_ENABLE_</Value>
|
||||
<Value>WITH_KEY</Value>
|
||||
<Value>WITH_WPA</Value>
|
||||
<Value>WITH_NO_DMA</Value>
|
||||
<Value>DATAFLASH=1</Value>
|
||||
<Value>_INFO_DEBUG_=1</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.compiler.symbols.DefSymbols>
|
||||
<avr32gcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PDCA</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/TC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EBI/SMC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/DELAY</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/RTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EIC</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/CPU/CYCLE_COUNTER</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
<Value>../src</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include/ipv4</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-port-1.3.2/HD/if/include</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/WIFI/HD</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.compiler.directories.IncludePaths>
|
||||
<avr32gcc.compiler.optimization.level>Optimize (-O1)</avr32gcc.compiler.optimization.level>
|
||||
<avr32gcc.compiler.optimization.OtherFlags>-fdata-sections -ffunction-sections</avr32gcc.compiler.optimization.OtherFlags>
|
||||
<avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>true</avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>
|
||||
<avr32gcc.compiler.optimization.EnableFastFloatingPointLibrary>false</avr32gcc.compiler.optimization.EnableFastFloatingPointLibrary>
|
||||
<avr32gcc.compiler.optimization.EnableUnsafeMatchOptimizations>false</avr32gcc.compiler.optimization.EnableUnsafeMatchOptimizations>
|
||||
<avr32gcc.compiler.optimization.EnableFastMath>false</avr32gcc.compiler.optimization.EnableFastMath>
|
||||
<avr32gcc.compiler.optimization.GeneratePositionIndependentCode>false</avr32gcc.compiler.optimization.GeneratePositionIndependentCode>
|
||||
<avr32gcc.compiler.optimization.UseAssemblerForPseudoInstructions>true</avr32gcc.compiler.optimization.UseAssemblerForPseudoInstructions>
|
||||
<avr32gcc.compiler.optimization.ForceDoubleWordAlignment>true</avr32gcc.compiler.optimization.ForceDoubleWordAlignment>
|
||||
<avr32gcc.compiler.optimization.PutLargeImmediatesInConstPool>false</avr32gcc.compiler.optimization.PutLargeImmediatesInConstPool>
|
||||
<avr32gcc.compiler.optimization.DoNotInitializeGotRegisterBeforeUsing>false</avr32gcc.compiler.optimization.DoNotInitializeGotRegisterBeforeUsing>
|
||||
<avr32gcc.compiler.optimization.UseSectionRoDataForReadOnlyData>false</avr32gcc.compiler.optimization.UseSectionRoDataForReadOnlyData>
|
||||
<avr32gcc.compiler.optimization.DebugLevel>Maximum (-g3)</avr32gcc.compiler.optimization.DebugLevel>
|
||||
<avr32gcc.compiler.optimization.GenerateGprofInformation>false</avr32gcc.compiler.optimization.GenerateGprofInformation>
|
||||
<avr32gcc.compiler.optimization.GenerateProfInformation>false</avr32gcc.compiler.optimization.GenerateProfInformation>
|
||||
<avr32gcc.compiler.warnings.AllWarnings>true</avr32gcc.compiler.warnings.AllWarnings>
|
||||
<avr32gcc.compiler.warnings.CheckSyntaxOnly>false</avr32gcc.compiler.warnings.CheckSyntaxOnly>
|
||||
<avr32gcc.compiler.warnings.Pedantic>false</avr32gcc.compiler.warnings.Pedantic>
|
||||
<avr32gcc.compiler.warnings.PedanticWarningsAsErrors>false</avr32gcc.compiler.warnings.PedanticWarningsAsErrors>
|
||||
<avr32gcc.compiler.warnings.InhibitAllWarnings>false</avr32gcc.compiler.warnings.InhibitAllWarnings>
|
||||
<avr32gcc.compiler.miscellaneous.OtherFlags>-c -fmessage-length=0</avr32gcc.compiler.miscellaneous.OtherFlags>
|
||||
<avr32gcc.compiler.miscellaneous.SupportAnsiPrograms>false</avr32gcc.compiler.miscellaneous.SupportAnsiPrograms>
|
||||
<avr32gcc.linker.general.DoNotUseStandardStartFiles>true</avr32gcc.linker.general.DoNotUseStandardStartFiles>
|
||||
<avr32gcc.linker.general.DoNotUseDefaultLibraries>false</avr32gcc.linker.general.DoNotUseDefaultLibraries>
|
||||
<avr32gcc.linker.general.NoStartupOrDefaultLibs>false</avr32gcc.linker.general.NoStartupOrDefaultLibs>
|
||||
<avr32gcc.linker.general.OmitAllSymbolInformation>false</avr32gcc.linker.general.OmitAllSymbolInformation>
|
||||
<avr32gcc.linker.general.NoSharedLibraries>false</avr32gcc.linker.general.NoSharedLibraries>
|
||||
<avr32gcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>newlib_addons-at32ucr2-speed_opt</Value>
|
||||
<Value>_ucr2_hd_spi_v2.7.0</Value>
|
||||
<Value>_ucr2_hd_wl_sta_intwpa_v2.7.0</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.linker.libraries.Libraries>
|
||||
<avr32gcc.linker.libraries.LibrarySearchPaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/WIFI/HD/v2.7.0/UCR2/GCC</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.linker.libraries.LibrarySearchPaths>
|
||||
<avr32gcc.linker.optimization.GarbageCollectUnusedSections>true</avr32gcc.linker.optimization.GarbageCollectUnusedSections>
|
||||
<avr32gcc.linker.optimization.EnableFastFloatingPointLibrary>false</avr32gcc.linker.optimization.EnableFastFloatingPointLibrary>
|
||||
<avr32gcc.linker.optimization.EnableUnsafeMatchOptimizations>false</avr32gcc.linker.optimization.EnableUnsafeMatchOptimizations>
|
||||
<avr32gcc.linker.optimization.EnableFastMath>false</avr32gcc.linker.optimization.EnableFastMath>
|
||||
<avr32gcc.linker.optimization.GeneratePositionIndependentCode>false</avr32gcc.linker.optimization.GeneratePositionIndependentCode>
|
||||
<avr32gcc.linker.optimization.PutReadOnlyDataInWritableDataSection>true</avr32gcc.linker.optimization.PutReadOnlyDataInWritableDataSection>
|
||||
<avr32gcc.linker.optimization.AllowDirectReferencesToDataSection>true</avr32gcc.linker.optimization.AllowDirectReferencesToDataSection>
|
||||
<avr32gcc.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PDCA</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/TC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EBI/SMC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/DELAY</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/RTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EIC</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/CPU/CYCLE_COUNTER</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.assembler.general.IncludePaths>
|
||||
<avr32gcc.assembler.general.AnounceVersion>false</avr32gcc.assembler.general.AnounceVersion>
|
||||
<avr32gcc.assembler.debugging.DebugLevel>Default (-g)</avr32gcc.assembler.debugging.DebugLevel>
|
||||
<avr32gcc.preprocessingassembler.general.AssemblerFlags>-Wa,-g</avr32gcc.preprocessingassembler.general.AssemblerFlags>
|
||||
<avr32gcc.preprocessingassembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PDCA</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/TC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EBI/SMC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/DELAY</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/RTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EIC</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/CPU/CYCLE_COUNTER</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.preprocessingassembler.general.IncludePaths>
|
||||
<avr32gcc.preprocessingassembler.general.SuppressWarnings>false</avr32gcc.preprocessingassembler.general.SuppressWarnings>
|
||||
<avr32gcc.preprocessingassembler.general.AnounceVersion>false</avr32gcc.preprocessingassembler.general.AnounceVersion>
|
||||
<avr32gcc.preprocessingassembler.debugging.DebugLevel>Default (-Wa,-g)</avr32gcc.preprocessingassembler.debugging.DebugLevel>
|
||||
</Avr32Gcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug_512' ">
|
||||
<OutputPath>bin\Debug_512\</OutputPath>
|
||||
<ToolchainSettings>
|
||||
<Avr32Gcc>
|
||||
<avr32gcc.common.outputfiles.hex>True</avr32gcc.common.outputfiles.hex>
|
||||
<avr32gcc.common.outputfiles.lss>True</avr32gcc.common.outputfiles.lss>
|
||||
<avr32gcc.common.outputfiles.eep>True</avr32gcc.common.outputfiles.eep>
|
||||
<avr32gcc.common.outputfiles.srec>True</avr32gcc.common.outputfiles.srec>
|
||||
<avr32gcc.compiler.preprocessor.DoNotSearchSystemDirectories>false</avr32gcc.compiler.preprocessor.DoNotSearchSystemDirectories>
|
||||
<avr32gcc.compiler.preprocessor.PreprocessOnly>false</avr32gcc.compiler.preprocessor.PreprocessOnly>
|
||||
<avr32gcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>BOARD=ARDUINO</Value>
|
||||
<Value>_APP_DEBUG_</Value>
|
||||
<Value>_DEBUG_</Value>
|
||||
<Value>_ASSERT_ENABLE_</Value>
|
||||
<Value>EXT_BOARD=SPB104</Value>
|
||||
<Value>WITH_KEY</Value>
|
||||
<Value>WITH_WPA</Value>
|
||||
<Value>WITH_NO_DMA</Value>
|
||||
<Value>LWIP_DEBUG</Value>
|
||||
<Value>_INFO_DEBUG_=1</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.compiler.symbols.DefSymbols>
|
||||
<avr32gcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PDCA</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/TC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EBI/SMC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/DELAY</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/RTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EIC</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/CPU/CYCLE_COUNTER</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
<Value>../src</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include/ipv4</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-port-1.3.2/HD/if/include</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/WIFI/HD</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.compiler.directories.IncludePaths>
|
||||
<avr32gcc.compiler.optimization.level>Optimize (-O1)</avr32gcc.compiler.optimization.level>
|
||||
<avr32gcc.compiler.optimization.OtherFlags>-fdata-sections</avr32gcc.compiler.optimization.OtherFlags>
|
||||
<avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>true</avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>
|
||||
<avr32gcc.compiler.optimization.EnableFastFloatingPointLibrary>false</avr32gcc.compiler.optimization.EnableFastFloatingPointLibrary>
|
||||
<avr32gcc.compiler.optimization.EnableUnsafeMatchOptimizations>false</avr32gcc.compiler.optimization.EnableUnsafeMatchOptimizations>
|
||||
<avr32gcc.compiler.optimization.EnableFastMath>false</avr32gcc.compiler.optimization.EnableFastMath>
|
||||
<avr32gcc.compiler.optimization.GeneratePositionIndependentCode>false</avr32gcc.compiler.optimization.GeneratePositionIndependentCode>
|
||||
<avr32gcc.compiler.optimization.UseAssemblerForPseudoInstructions>true</avr32gcc.compiler.optimization.UseAssemblerForPseudoInstructions>
|
||||
<avr32gcc.compiler.optimization.ForceDoubleWordAlignment>false</avr32gcc.compiler.optimization.ForceDoubleWordAlignment>
|
||||
<avr32gcc.compiler.optimization.PutLargeImmediatesInConstPool>false</avr32gcc.compiler.optimization.PutLargeImmediatesInConstPool>
|
||||
<avr32gcc.compiler.optimization.DoNotInitializeGotRegisterBeforeUsing>false</avr32gcc.compiler.optimization.DoNotInitializeGotRegisterBeforeUsing>
|
||||
<avr32gcc.compiler.optimization.UseSectionRoDataForReadOnlyData>false</avr32gcc.compiler.optimization.UseSectionRoDataForReadOnlyData>
|
||||
<avr32gcc.compiler.optimization.DebugLevel>Maximum (-g3)</avr32gcc.compiler.optimization.DebugLevel>
|
||||
<avr32gcc.compiler.optimization.GenerateGprofInformation>false</avr32gcc.compiler.optimization.GenerateGprofInformation>
|
||||
<avr32gcc.compiler.optimization.GenerateProfInformation>false</avr32gcc.compiler.optimization.GenerateProfInformation>
|
||||
<avr32gcc.compiler.warnings.AllWarnings>true</avr32gcc.compiler.warnings.AllWarnings>
|
||||
<avr32gcc.compiler.warnings.CheckSyntaxOnly>false</avr32gcc.compiler.warnings.CheckSyntaxOnly>
|
||||
<avr32gcc.compiler.warnings.Pedantic>false</avr32gcc.compiler.warnings.Pedantic>
|
||||
<avr32gcc.compiler.warnings.PedanticWarningsAsErrors>false</avr32gcc.compiler.warnings.PedanticWarningsAsErrors>
|
||||
<avr32gcc.compiler.warnings.InhibitAllWarnings>false</avr32gcc.compiler.warnings.InhibitAllWarnings>
|
||||
<avr32gcc.compiler.miscellaneous.OtherFlags>-c -fmessage-length=0</avr32gcc.compiler.miscellaneous.OtherFlags>
|
||||
<avr32gcc.compiler.miscellaneous.SupportAnsiPrograms>false</avr32gcc.compiler.miscellaneous.SupportAnsiPrograms>
|
||||
<avr32gcc.linker.general.DoNotUseStandardStartFiles>true</avr32gcc.linker.general.DoNotUseStandardStartFiles>
|
||||
<avr32gcc.linker.general.DoNotUseDefaultLibraries>false</avr32gcc.linker.general.DoNotUseDefaultLibraries>
|
||||
<avr32gcc.linker.general.NoStartupOrDefaultLibs>false</avr32gcc.linker.general.NoStartupOrDefaultLibs>
|
||||
<avr32gcc.linker.general.OmitAllSymbolInformation>false</avr32gcc.linker.general.OmitAllSymbolInformation>
|
||||
<avr32gcc.linker.general.NoSharedLibraries>false</avr32gcc.linker.general.NoSharedLibraries>
|
||||
<avr32gcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>newlib_addons-at32ucr2-speed_opt</Value>
|
||||
<Value>_ucr2_hd_spi_standalone_v2.1.1</Value>
|
||||
<Value>_ucr2_hd_wl_standalone_v2.1.1</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.linker.libraries.Libraries>
|
||||
<avr32gcc.linker.libraries.LibrarySearchPaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/WIFI/HD/v2.1.1/UCR2/GCC</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.linker.libraries.LibrarySearchPaths>
|
||||
<avr32gcc.linker.optimization.GarbageCollectUnusedSections>true</avr32gcc.linker.optimization.GarbageCollectUnusedSections>
|
||||
<avr32gcc.linker.optimization.EnableFastFloatingPointLibrary>false</avr32gcc.linker.optimization.EnableFastFloatingPointLibrary>
|
||||
<avr32gcc.linker.optimization.EnableUnsafeMatchOptimizations>false</avr32gcc.linker.optimization.EnableUnsafeMatchOptimizations>
|
||||
<avr32gcc.linker.optimization.EnableFastMath>false</avr32gcc.linker.optimization.EnableFastMath>
|
||||
<avr32gcc.linker.optimization.GeneratePositionIndependentCode>false</avr32gcc.linker.optimization.GeneratePositionIndependentCode>
|
||||
<avr32gcc.linker.optimization.PutReadOnlyDataInWritableDataSection>true</avr32gcc.linker.optimization.PutReadOnlyDataInWritableDataSection>
|
||||
<avr32gcc.linker.optimization.AllowDirectReferencesToDataSection>true</avr32gcc.linker.optimization.AllowDirectReferencesToDataSection>
|
||||
<avr32gcc.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PDCA</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/TC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EBI/SMC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/DELAY</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/RTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EIC</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/CPU/CYCLE_COUNTER</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.assembler.general.IncludePaths>
|
||||
<avr32gcc.assembler.general.AnounceVersion>false</avr32gcc.assembler.general.AnounceVersion>
|
||||
<avr32gcc.assembler.debugging.DebugLevel>Default (-g)</avr32gcc.assembler.debugging.DebugLevel>
|
||||
<avr32gcc.preprocessingassembler.general.AssemblerFlags>-Wa,-g</avr32gcc.preprocessingassembler.general.AssemblerFlags>
|
||||
<avr32gcc.preprocessingassembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PDCA</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/TC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EBI/SMC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/DELAY</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/RTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EIC</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/CPU/CYCLE_COUNTER</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.preprocessingassembler.general.IncludePaths>
|
||||
<avr32gcc.preprocessingassembler.general.SuppressWarnings>false</avr32gcc.preprocessingassembler.general.SuppressWarnings>
|
||||
<avr32gcc.preprocessingassembler.general.AnounceVersion>false</avr32gcc.preprocessingassembler.general.AnounceVersion>
|
||||
<avr32gcc.preprocessingassembler.debugging.DebugLevel>Default (-Wa,-g)</avr32gcc.preprocessingassembler.debugging.DebugLevel>
|
||||
</Avr32Gcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release_512' ">
|
||||
<OutputPath>bin\Release_512\</OutputPath>
|
||||
<ToolchainSettings>
|
||||
<Avr32Gcc>
|
||||
<avr32gcc.common.outputfiles.hex>True</avr32gcc.common.outputfiles.hex>
|
||||
<avr32gcc.common.outputfiles.lss>True</avr32gcc.common.outputfiles.lss>
|
||||
<avr32gcc.common.outputfiles.eep>True</avr32gcc.common.outputfiles.eep>
|
||||
<avr32gcc.common.outputfiles.srec>True</avr32gcc.common.outputfiles.srec>
|
||||
<avr32gcc.compiler.preprocessor.DoNotSearchSystemDirectories>false</avr32gcc.compiler.preprocessor.DoNotSearchSystemDirectories>
|
||||
<avr32gcc.compiler.preprocessor.PreprocessOnly>false</avr32gcc.compiler.preprocessor.PreprocessOnly>
|
||||
<avr32gcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>BOARD=ARDUINO</Value>
|
||||
<Value>_ASSERT_ENABLE_</Value>
|
||||
<Value>EXT_BOARD=SPB104</Value>
|
||||
<Value>WITH_KEY</Value>
|
||||
<Value>WITH_WPA</Value>
|
||||
<Value>WITH_NO_DMA</Value>
|
||||
<Value>LWIP_DEBUG</Value>
|
||||
<Value>_INFO_DEBUG_=1</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.compiler.symbols.DefSymbols>
|
||||
<avr32gcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PDCA</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/TC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EBI/SMC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/DELAY</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/RTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EIC</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/CPU/CYCLE_COUNTER</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
<Value>../src</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include/ipv4</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-port-1.3.2/HD/if/include</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/WIFI/HD</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.compiler.directories.IncludePaths>
|
||||
<avr32gcc.compiler.optimization.OtherFlags>-fdata-sections</avr32gcc.compiler.optimization.OtherFlags>
|
||||
<avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>true</avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>
|
||||
<avr32gcc.compiler.optimization.EnableFastFloatingPointLibrary>false</avr32gcc.compiler.optimization.EnableFastFloatingPointLibrary>
|
||||
<avr32gcc.compiler.optimization.EnableUnsafeMatchOptimizations>false</avr32gcc.compiler.optimization.EnableUnsafeMatchOptimizations>
|
||||
<avr32gcc.compiler.optimization.EnableFastMath>false</avr32gcc.compiler.optimization.EnableFastMath>
|
||||
<avr32gcc.compiler.optimization.GeneratePositionIndependentCode>false</avr32gcc.compiler.optimization.GeneratePositionIndependentCode>
|
||||
<avr32gcc.compiler.optimization.UseAssemblerForPseudoInstructions>true</avr32gcc.compiler.optimization.UseAssemblerForPseudoInstructions>
|
||||
<avr32gcc.compiler.optimization.ForceDoubleWordAlignment>false</avr32gcc.compiler.optimization.ForceDoubleWordAlignment>
|
||||
<avr32gcc.compiler.optimization.PutLargeImmediatesInConstPool>false</avr32gcc.compiler.optimization.PutLargeImmediatesInConstPool>
|
||||
<avr32gcc.compiler.optimization.DoNotInitializeGotRegisterBeforeUsing>false</avr32gcc.compiler.optimization.DoNotInitializeGotRegisterBeforeUsing>
|
||||
<avr32gcc.compiler.optimization.UseSectionRoDataForReadOnlyData>false</avr32gcc.compiler.optimization.UseSectionRoDataForReadOnlyData>
|
||||
<avr32gcc.compiler.optimization.GenerateGprofInformation>false</avr32gcc.compiler.optimization.GenerateGprofInformation>
|
||||
<avr32gcc.compiler.optimization.GenerateProfInformation>false</avr32gcc.compiler.optimization.GenerateProfInformation>
|
||||
<avr32gcc.compiler.warnings.AllWarnings>true</avr32gcc.compiler.warnings.AllWarnings>
|
||||
<avr32gcc.compiler.warnings.CheckSyntaxOnly>false</avr32gcc.compiler.warnings.CheckSyntaxOnly>
|
||||
<avr32gcc.compiler.warnings.Pedantic>false</avr32gcc.compiler.warnings.Pedantic>
|
||||
<avr32gcc.compiler.warnings.PedanticWarningsAsErrors>false</avr32gcc.compiler.warnings.PedanticWarningsAsErrors>
|
||||
<avr32gcc.compiler.warnings.InhibitAllWarnings>false</avr32gcc.compiler.warnings.InhibitAllWarnings>
|
||||
<avr32gcc.compiler.miscellaneous.OtherFlags>-c -fmessage-length=0</avr32gcc.compiler.miscellaneous.OtherFlags>
|
||||
<avr32gcc.compiler.miscellaneous.SupportAnsiPrograms>false</avr32gcc.compiler.miscellaneous.SupportAnsiPrograms>
|
||||
<avr32gcc.linker.general.DoNotUseStandardStartFiles>true</avr32gcc.linker.general.DoNotUseStandardStartFiles>
|
||||
<avr32gcc.linker.general.DoNotUseDefaultLibraries>false</avr32gcc.linker.general.DoNotUseDefaultLibraries>
|
||||
<avr32gcc.linker.general.NoStartupOrDefaultLibs>false</avr32gcc.linker.general.NoStartupOrDefaultLibs>
|
||||
<avr32gcc.linker.general.OmitAllSymbolInformation>false</avr32gcc.linker.general.OmitAllSymbolInformation>
|
||||
<avr32gcc.linker.general.NoSharedLibraries>false</avr32gcc.linker.general.NoSharedLibraries>
|
||||
<avr32gcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>newlib_addons-at32ucr2-speed_opt</Value>
|
||||
<Value>_ucr2_hd_spi_standalone_v2.1.1</Value>
|
||||
<Value>_ucr2_hd_wl_standalone_v2.1.1</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.linker.libraries.Libraries>
|
||||
<avr32gcc.linker.libraries.LibrarySearchPaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/WIFI/HD/v2.1.1/UCR2/GCC</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.linker.libraries.LibrarySearchPaths>
|
||||
<avr32gcc.linker.optimization.GarbageCollectUnusedSections>true</avr32gcc.linker.optimization.GarbageCollectUnusedSections>
|
||||
<avr32gcc.linker.optimization.EnableFastFloatingPointLibrary>false</avr32gcc.linker.optimization.EnableFastFloatingPointLibrary>
|
||||
<avr32gcc.linker.optimization.EnableUnsafeMatchOptimizations>false</avr32gcc.linker.optimization.EnableUnsafeMatchOptimizations>
|
||||
<avr32gcc.linker.optimization.EnableFastMath>false</avr32gcc.linker.optimization.EnableFastMath>
|
||||
<avr32gcc.linker.optimization.GeneratePositionIndependentCode>false</avr32gcc.linker.optimization.GeneratePositionIndependentCode>
|
||||
<avr32gcc.linker.optimization.PutReadOnlyDataInWritableDataSection>true</avr32gcc.linker.optimization.PutReadOnlyDataInWritableDataSection>
|
||||
<avr32gcc.linker.optimization.AllowDirectReferencesToDataSection>true</avr32gcc.linker.optimization.AllowDirectReferencesToDataSection>
|
||||
<avr32gcc.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PDCA</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/TC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EBI/SMC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/DELAY</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/RTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EIC</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/CPU/CYCLE_COUNTER</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.assembler.general.IncludePaths>
|
||||
<avr32gcc.assembler.general.AnounceVersion>false</avr32gcc.assembler.general.AnounceVersion>
|
||||
<avr32gcc.preprocessingassembler.general.AssemblerFlags>-Wa,-g</avr32gcc.preprocessingassembler.general.AssemblerFlags>
|
||||
<avr32gcc.preprocessingassembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PDCA</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/TC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EBI/SMC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/DELAY</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/RTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/EIC</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/CPU/CYCLE_COUNTER</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.preprocessingassembler.general.IncludePaths>
|
||||
<avr32gcc.preprocessingassembler.general.SuppressWarnings>false</avr32gcc.preprocessingassembler.general.SuppressWarnings>
|
||||
<avr32gcc.preprocessingassembler.general.AnounceVersion>false</avr32gcc.preprocessingassembler.general.AnounceVersion>
|
||||
</Avr32Gcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="src" />
|
||||
<Compile Include="src\ard_spi.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\ard_spi.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\ard_tcp.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\ard_tcp.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\ard_utils.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\ard_utils.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\avr32_spi.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\board_init.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\board_init.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\cmd_wl.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\cmd_wl.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\CONFIG\conf_access.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\CONFIG\conf_at45dbx.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\console.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\console.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\debug.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\fw_download.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\fw_download_extflash.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<None Include="src\license.txt">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Compile Include="src\lwipopts.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\lwip_setup.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\lwip_setup.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\main.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\nvram.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\nvram.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\owl_os.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\ping.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\ping.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\printf-stdarg.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\printf-stdarg.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY\DATA_FLASH\AT45DBX\at45dbx.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY\DATA_FLASH\AT45DBX\at45dbx_mem.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\timer.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\timer.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\top_defs.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\trace.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\util.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\util.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\wifi_spi.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\wl_cm.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\wl_cm.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\wl_definitions.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\CONFIG" />
|
||||
<Compile Include="src\CONFIG\conf_ebi.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\CONFIG\conf_sd_mmc_spi.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\ASM" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\ASM\trampoline.x">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\BOARDS" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\BOARDS\board.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\BOARDS\board.h.my">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\BOARDS\ARDUINO" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\BOARDS\ARDUINO\arduino.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\BOARDS\ARDUINO\led.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\BOARDS\ARDUINO\led.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY\DATA_FLASH" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY\DATA_FLASH\AT45DBX" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\wlap_api.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\wl_api.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\wl_os.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\wl_sdio.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\wl_spi.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\v2.7.0" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY\DATA_FLASH\AT45DBX\at45dbx.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY\DATA_FLASH\AT45DBX\at45dbx_mem.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\v2.7.0\revision.txt">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\v2.7.0\UCR1" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\v2.7.0\UCR1\GCC" />
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\v2.7.0\UCR1\GCC\lib_ucr1_hd_sdio_v2.7.0.a">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\v2.7.0\UCR1\GCC\lib_ucr1_hd_spi_v2.7.0.a">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\v2.7.0\UCR1\GCC\lib_ucr1_hd_wl_sta_intwpa_v2.7.0.a">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\v2.7.0\UCR2" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\v2.7.0\UCR2\GCC" />
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\v2.7.0\UCR2\GCC\lib_ucr2_hd_sdio_v2.7.0.a">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\v2.7.0\UCR2\GCC\lib_ucr2_hd_spi_v2.7.0.a">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\WIFI\HD\v2.7.0\UCR2\GCC\lib_ucr2_hd_wl_sta_intwpa_v2.7.0.a">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\CPU" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\CPU\CYCLE_COUNTER" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\CPU\CYCLE_COUNTER\cycle_counter.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\EBI" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\EIC" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\EIC\eic.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\EIC\eic.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\FLASHC" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\FLASHC\flashc.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\FLASHC\flashc.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\GPIO" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\GPIO\gpio.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\GPIO\gpio.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\INTC" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\INTC\exception.x">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\INTC\intc.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\INTC\intc.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PDCA" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PDCA\pdca.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PDCA\pdca.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PM" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PM\pm.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PM\pm.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PM\pm_conf_clocks.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PM\power_clocks_lib.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PM\power_clocks_lib.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\RTC" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\RTC\rtc.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\RTC\rtc.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\SPI" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\SPI\spi.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\SPI\spi.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\TC" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\TC\tc.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\TC\tc.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\USART" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\USART\usart.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\USART\usart.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\DELAY" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\DELAY\delay.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\DELAY\delay.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\dhcp.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\dns.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\init.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\mem.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\memp.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\netif.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\pbuf.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\raw.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\stats.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\tcp.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\tcp_in.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\tcp_out.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\udp.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\ipv4" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\ipv4\autoip.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\ipv4\icmp.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\ipv4\igmp.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\ipv4\inet.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\ipv4\inet_chksum.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\ipv4\ip.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\ipv4\ip_addr.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\core\ipv4\ip_frag.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\ipv4" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\ipv4\lwip" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\ipv4\lwip\autoip.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\ipv4\lwip\icmp.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\ipv4\lwip\igmp.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\ipv4\lwip\inet.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\ipv4\lwip\inet_chksum.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\ipv4\lwip\ip.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\ipv4\lwip\ip_addr.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\ipv4\lwip\ip_frag.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\api.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\api_msg.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\arch.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\debug.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\def.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\dhcp.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\dns.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\err.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\init.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\mem.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\memp.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\memp_std.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\netbuf.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\netdb.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\netif.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\netifapi.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\opt.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\pbuf.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\raw.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\sio.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\snmp.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\snmp_asn1.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\snmp_msg.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\snmp_structs.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\sockets.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\stats.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\sys.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\tcp.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\tcpip.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\lwip\udp.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\netif" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\netif\etharp.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\netif\loopif.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\netif\ppp_oe.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\include\netif\slipif.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\netif" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\netif\etharp.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-1.3.2\src\netif\loopif.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2\HD" />
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2\HD\readme.txt">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2\HD\if" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2\HD\if\include" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2\HD\if\include\lwipopts.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2\HD\if\include\arch" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2\HD\if\include\arch\cc.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2\HD\if\include\arch\perf.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2\HD\if\include\netif" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2\HD\if\include\netif\wlif.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2\HD\if\netif" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\LWIP\lwip-port-1.3.2\HD\if\netif\wlif.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\MEMORY" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\MEMORY\CTRL_ACCESS" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\MEMORY\CTRL_ACCESS\ctrl_access.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\MEMORY\CTRL_ACCESS\ctrl_access.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\compiler.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\conf_isp.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\parts.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\DEBUG" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\DEBUG\debug.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\DEBUG\debug.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\DEBUG\print_funcs.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\DEBUG\print_funcs.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS" />
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\libnewlib_addons-at32ucr2-speed_opt.a">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\INCLUDE" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\INCLUDE\nlao_cpu.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\INCLUDE\nlao_exceptions.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\INCLUDE\nlao_interrupts.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\INCLUDE\nlao_io.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\INCLUDE\nlao_usart.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A\0512" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A\0512\GCC" />
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A\0512\GCC\link_uc3a0512.lds">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A\1256" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A\1256\GCC" />
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A\1256\GCC\link_uc3a1256.lds">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\PREPROCESSOR" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\PREPROCESSOR\mrepeat.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\PREPROCESSOR\preprocessor.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\PREPROCESSOR\stringz.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\PREPROCESSOR\tpaste.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\STARTUP_FILES" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\STARTUP_FILES\GCC" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\STARTUP_FILES\GCC\crt0.x">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -0,0 +1,495 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectVersion>6.0</ProjectVersion>
|
||||
<ToolchainName>com.Atmel.AVRGCC32</ToolchainName>
|
||||
<ProjectGuid>eb9606bc-de32-4edd-9cda-ae3bf36977a2</ProjectGuid>
|
||||
<Name>wifi_dnld</Name>
|
||||
<avrdevice>AT32uc3a1256</avrdevice>
|
||||
<avrdeviceseries>none</avrdeviceseries>
|
||||
<AvrProjectType>Importer</AvrProjectType>
|
||||
<OutputType>Executable</OutputType>
|
||||
<Language>C</Language>
|
||||
<OutputFileName>wifi_dnld</OutputFileName>
|
||||
<OutputFileExtension>.elf</OutputFileExtension>
|
||||
<OutputDirectory>$(MSBuildProjectDirectory)\$(Configuration)</OutputDirectory>
|
||||
<ToolchainFlavour>Native</ToolchainFlavour>
|
||||
<avrtool />
|
||||
<KeepTimersRunning>true</KeepTimersRunning>
|
||||
<OverrideVtor>false</OverrideVtor>
|
||||
<OverrideVtorValue />
|
||||
<eraseonlaunchrule>0</eraseonlaunchrule>
|
||||
<AsfVersion>3.5.0</AsfVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<ToolchainSettings>
|
||||
<Avr32Gcc>
|
||||
<avr32gcc.common.outputfiles.hex>True</avr32gcc.common.outputfiles.hex>
|
||||
<avr32gcc.common.outputfiles.lss>True</avr32gcc.common.outputfiles.lss>
|
||||
<avr32gcc.common.outputfiles.eep>True</avr32gcc.common.outputfiles.eep>
|
||||
<avr32gcc.common.outputfiles.srec>True</avr32gcc.common.outputfiles.srec>
|
||||
<avr32gcc.compiler.preprocessor.DoNotSearchSystemDirectories>false</avr32gcc.compiler.preprocessor.DoNotSearchSystemDirectories>
|
||||
<avr32gcc.compiler.preprocessor.PreprocessOnly>false</avr32gcc.compiler.preprocessor.PreprocessOnly>
|
||||
<avr32gcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>BOARD=ARDUINO</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.compiler.symbols.DefSymbols>
|
||||
<avr32gcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
<Value>../src</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.compiler.directories.IncludePaths>
|
||||
<avr32gcc.compiler.optimization.OtherFlags>-fdata-sections</avr32gcc.compiler.optimization.OtherFlags>
|
||||
<avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>true</avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>
|
||||
<avr32gcc.compiler.optimization.EnableFastFloatingPointLibrary>false</avr32gcc.compiler.optimization.EnableFastFloatingPointLibrary>
|
||||
<avr32gcc.compiler.optimization.EnableUnsafeMatchOptimizations>false</avr32gcc.compiler.optimization.EnableUnsafeMatchOptimizations>
|
||||
<avr32gcc.compiler.optimization.EnableFastMath>false</avr32gcc.compiler.optimization.EnableFastMath>
|
||||
<avr32gcc.compiler.optimization.GeneratePositionIndependentCode>false</avr32gcc.compiler.optimization.GeneratePositionIndependentCode>
|
||||
<avr32gcc.compiler.optimization.UseAssemblerForPseudoInstructions>true</avr32gcc.compiler.optimization.UseAssemblerForPseudoInstructions>
|
||||
<avr32gcc.compiler.optimization.ForceDoubleWordAlignment>false</avr32gcc.compiler.optimization.ForceDoubleWordAlignment>
|
||||
<avr32gcc.compiler.optimization.PutLargeImmediatesInConstPool>false</avr32gcc.compiler.optimization.PutLargeImmediatesInConstPool>
|
||||
<avr32gcc.compiler.optimization.DoNotInitializeGotRegisterBeforeUsing>false</avr32gcc.compiler.optimization.DoNotInitializeGotRegisterBeforeUsing>
|
||||
<avr32gcc.compiler.optimization.UseSectionRoDataForReadOnlyData>false</avr32gcc.compiler.optimization.UseSectionRoDataForReadOnlyData>
|
||||
<avr32gcc.compiler.optimization.OtherDebuggingFlags />
|
||||
<avr32gcc.compiler.optimization.GenerateGprofInformation>false</avr32gcc.compiler.optimization.GenerateGprofInformation>
|
||||
<avr32gcc.compiler.optimization.GenerateProfInformation>false</avr32gcc.compiler.optimization.GenerateProfInformation>
|
||||
<avr32gcc.compiler.warnings.AllWarnings>true</avr32gcc.compiler.warnings.AllWarnings>
|
||||
<avr32gcc.compiler.warnings.CheckSyntaxOnly>false</avr32gcc.compiler.warnings.CheckSyntaxOnly>
|
||||
<avr32gcc.compiler.warnings.Pedantic>false</avr32gcc.compiler.warnings.Pedantic>
|
||||
<avr32gcc.compiler.warnings.PedanticWarningsAsErrors>false</avr32gcc.compiler.warnings.PedanticWarningsAsErrors>
|
||||
<avr32gcc.compiler.warnings.InhibitAllWarnings>false</avr32gcc.compiler.warnings.InhibitAllWarnings>
|
||||
<avr32gcc.compiler.miscellaneous.OtherFlags>-c -fmessage-length=0</avr32gcc.compiler.miscellaneous.OtherFlags>
|
||||
<avr32gcc.compiler.miscellaneous.SupportAnsiPrograms>false</avr32gcc.compiler.miscellaneous.SupportAnsiPrograms>
|
||||
<avr32gcc.linker.general.DoNotUseStandardStartFiles>true</avr32gcc.linker.general.DoNotUseStandardStartFiles>
|
||||
<avr32gcc.linker.general.DoNotUseDefaultLibraries>false</avr32gcc.linker.general.DoNotUseDefaultLibraries>
|
||||
<avr32gcc.linker.general.NoStartupOrDefaultLibs>false</avr32gcc.linker.general.NoStartupOrDefaultLibs>
|
||||
<avr32gcc.linker.general.OmitAllSymbolInformation>false</avr32gcc.linker.general.OmitAllSymbolInformation>
|
||||
<avr32gcc.linker.general.NoSharedLibraries>false</avr32gcc.linker.general.NoSharedLibraries>
|
||||
<avr32gcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>newlib_addons-at32ucr2-speed_opt</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.linker.libraries.Libraries>
|
||||
<avr32gcc.linker.libraries.LibrarySearchPaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.linker.libraries.LibrarySearchPaths>
|
||||
<avr32gcc.linker.optimization.GarbageCollectUnusedSections>true</avr32gcc.linker.optimization.GarbageCollectUnusedSections>
|
||||
<avr32gcc.linker.optimization.EnableFastFloatingPointLibrary>false</avr32gcc.linker.optimization.EnableFastFloatingPointLibrary>
|
||||
<avr32gcc.linker.optimization.EnableUnsafeMatchOptimizations>false</avr32gcc.linker.optimization.EnableUnsafeMatchOptimizations>
|
||||
<avr32gcc.linker.optimization.EnableFastMath>false</avr32gcc.linker.optimization.EnableFastMath>
|
||||
<avr32gcc.linker.optimization.GeneratePositionIndependentCode>false</avr32gcc.linker.optimization.GeneratePositionIndependentCode>
|
||||
<avr32gcc.linker.optimization.PutReadOnlyDataInWritableDataSection>true</avr32gcc.linker.optimization.PutReadOnlyDataInWritableDataSection>
|
||||
<avr32gcc.linker.optimization.AllowDirectReferencesToDataSection>true</avr32gcc.linker.optimization.AllowDirectReferencesToDataSection>
|
||||
<avr32gcc.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.assembler.general.IncludePaths>
|
||||
<avr32gcc.assembler.general.AnounceVersion>false</avr32gcc.assembler.general.AnounceVersion>
|
||||
<avr32gcc.preprocessingassembler.general.AssemblerFlags>-Wa,-g</avr32gcc.preprocessingassembler.general.AssemblerFlags>
|
||||
<avr32gcc.preprocessingassembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.preprocessingassembler.general.IncludePaths>
|
||||
<avr32gcc.preprocessingassembler.general.SuppressWarnings>false</avr32gcc.preprocessingassembler.general.SuppressWarnings>
|
||||
<avr32gcc.preprocessingassembler.general.AnounceVersion>false</avr32gcc.preprocessingassembler.general.AnounceVersion>
|
||||
</Avr32Gcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<ToolchainSettings>
|
||||
<Avr32Gcc>
|
||||
<avr32gcc.common.outputfiles.hex>True</avr32gcc.common.outputfiles.hex>
|
||||
<avr32gcc.common.outputfiles.lss>True</avr32gcc.common.outputfiles.lss>
|
||||
<avr32gcc.common.outputfiles.eep>True</avr32gcc.common.outputfiles.eep>
|
||||
<avr32gcc.common.outputfiles.srec>True</avr32gcc.common.outputfiles.srec>
|
||||
<avr32gcc.compiler.preprocessor.DoNotSearchSystemDirectories>false</avr32gcc.compiler.preprocessor.DoNotSearchSystemDirectories>
|
||||
<avr32gcc.compiler.preprocessor.PreprocessOnly>false</avr32gcc.compiler.preprocessor.PreprocessOnly>
|
||||
<avr32gcc.compiler.symbols.DefSymbols>
|
||||
<ListValues>
|
||||
<Value>BOARD=ARDUINO</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.compiler.symbols.DefSymbols>
|
||||
<avr32gcc.compiler.directories.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
<Value>../src</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.compiler.directories.IncludePaths>
|
||||
<avr32gcc.compiler.optimization.OtherFlags>-fdata-sections</avr32gcc.compiler.optimization.OtherFlags>
|
||||
<avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>true</avr32gcc.compiler.optimization.PrepareFunctionsForGarbageCollection>
|
||||
<avr32gcc.compiler.optimization.EnableFastFloatingPointLibrary>false</avr32gcc.compiler.optimization.EnableFastFloatingPointLibrary>
|
||||
<avr32gcc.compiler.optimization.EnableUnsafeMatchOptimizations>false</avr32gcc.compiler.optimization.EnableUnsafeMatchOptimizations>
|
||||
<avr32gcc.compiler.optimization.EnableFastMath>false</avr32gcc.compiler.optimization.EnableFastMath>
|
||||
<avr32gcc.compiler.optimization.GeneratePositionIndependentCode>false</avr32gcc.compiler.optimization.GeneratePositionIndependentCode>
|
||||
<avr32gcc.compiler.optimization.UseAssemblerForPseudoInstructions>true</avr32gcc.compiler.optimization.UseAssemblerForPseudoInstructions>
|
||||
<avr32gcc.compiler.optimization.ForceDoubleWordAlignment>false</avr32gcc.compiler.optimization.ForceDoubleWordAlignment>
|
||||
<avr32gcc.compiler.optimization.PutLargeImmediatesInConstPool>false</avr32gcc.compiler.optimization.PutLargeImmediatesInConstPool>
|
||||
<avr32gcc.compiler.optimization.DoNotInitializeGotRegisterBeforeUsing>false</avr32gcc.compiler.optimization.DoNotInitializeGotRegisterBeforeUsing>
|
||||
<avr32gcc.compiler.optimization.UseSectionRoDataForReadOnlyData>false</avr32gcc.compiler.optimization.UseSectionRoDataForReadOnlyData>
|
||||
<avr32gcc.compiler.optimization.DebugLevel>Maximum (-g3)</avr32gcc.compiler.optimization.DebugLevel>
|
||||
<avr32gcc.compiler.optimization.OtherDebuggingFlags />
|
||||
<avr32gcc.compiler.optimization.GenerateGprofInformation>false</avr32gcc.compiler.optimization.GenerateGprofInformation>
|
||||
<avr32gcc.compiler.optimization.GenerateProfInformation>false</avr32gcc.compiler.optimization.GenerateProfInformation>
|
||||
<avr32gcc.compiler.warnings.AllWarnings>true</avr32gcc.compiler.warnings.AllWarnings>
|
||||
<avr32gcc.compiler.warnings.CheckSyntaxOnly>false</avr32gcc.compiler.warnings.CheckSyntaxOnly>
|
||||
<avr32gcc.compiler.warnings.Pedantic>false</avr32gcc.compiler.warnings.Pedantic>
|
||||
<avr32gcc.compiler.warnings.PedanticWarningsAsErrors>false</avr32gcc.compiler.warnings.PedanticWarningsAsErrors>
|
||||
<avr32gcc.compiler.warnings.InhibitAllWarnings>false</avr32gcc.compiler.warnings.InhibitAllWarnings>
|
||||
<avr32gcc.compiler.miscellaneous.OtherFlags>-c -fmessage-length=0</avr32gcc.compiler.miscellaneous.OtherFlags>
|
||||
<avr32gcc.compiler.miscellaneous.SupportAnsiPrograms>false</avr32gcc.compiler.miscellaneous.SupportAnsiPrograms>
|
||||
<avr32gcc.linker.general.DoNotUseStandardStartFiles>true</avr32gcc.linker.general.DoNotUseStandardStartFiles>
|
||||
<avr32gcc.linker.general.DoNotUseDefaultLibraries>false</avr32gcc.linker.general.DoNotUseDefaultLibraries>
|
||||
<avr32gcc.linker.general.NoStartupOrDefaultLibs>false</avr32gcc.linker.general.NoStartupOrDefaultLibs>
|
||||
<avr32gcc.linker.general.OmitAllSymbolInformation>false</avr32gcc.linker.general.OmitAllSymbolInformation>
|
||||
<avr32gcc.linker.general.NoSharedLibraries>false</avr32gcc.linker.general.NoSharedLibraries>
|
||||
<avr32gcc.linker.libraries.Libraries>
|
||||
<ListValues>
|
||||
<Value>newlib_addons-at32ucr2-speed_opt</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.linker.libraries.Libraries>
|
||||
<avr32gcc.linker.libraries.LibrarySearchPaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.linker.libraries.LibrarySearchPaths>
|
||||
<avr32gcc.linker.optimization.GarbageCollectUnusedSections>true</avr32gcc.linker.optimization.GarbageCollectUnusedSections>
|
||||
<avr32gcc.linker.optimization.EnableFastFloatingPointLibrary>false</avr32gcc.linker.optimization.EnableFastFloatingPointLibrary>
|
||||
<avr32gcc.linker.optimization.EnableUnsafeMatchOptimizations>false</avr32gcc.linker.optimization.EnableUnsafeMatchOptimizations>
|
||||
<avr32gcc.linker.optimization.EnableFastMath>false</avr32gcc.linker.optimization.EnableFastMath>
|
||||
<avr32gcc.linker.optimization.GeneratePositionIndependentCode>false</avr32gcc.linker.optimization.GeneratePositionIndependentCode>
|
||||
<avr32gcc.linker.optimization.PutReadOnlyDataInWritableDataSection>true</avr32gcc.linker.optimization.PutReadOnlyDataInWritableDataSection>
|
||||
<avr32gcc.linker.optimization.AllowDirectReferencesToDataSection>true</avr32gcc.linker.optimization.AllowDirectReferencesToDataSection>
|
||||
<avr32gcc.assembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.assembler.general.IncludePaths>
|
||||
<avr32gcc.assembler.general.AnounceVersion>false</avr32gcc.assembler.general.AnounceVersion>
|
||||
<avr32gcc.assembler.debugging.DebugLevel>Default (-g)</avr32gcc.assembler.debugging.DebugLevel>
|
||||
<avr32gcc.preprocessingassembler.general.AssemblerFlags>-Wa,-g</avr32gcc.preprocessingassembler.general.AssemblerFlags>
|
||||
<avr32gcc.preprocessingassembler.general.IncludePaths>
|
||||
<ListValues>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/DEBUG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/SERVICES/MEMORY/CTRL_ACCESS</Value>
|
||||
<Value>../src/CONFIG</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/COMPONENTS/MEMORY/DATA_FLASH/AT45DBX</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/USART</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/SPI</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/PM</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/GPIO</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/FLASHC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/LIBS/NEWLIB_ADDONS/INCLUDE</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS/PREPROCESSOR</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/UTILS</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/DRIVERS/INTC</Value>
|
||||
<Value>../src/SOFTWARE_FRAMEWORK/BOARDS</Value>
|
||||
</ListValues>
|
||||
</avr32gcc.preprocessingassembler.general.IncludePaths>
|
||||
<avr32gcc.preprocessingassembler.general.SuppressWarnings>false</avr32gcc.preprocessingassembler.general.SuppressWarnings>
|
||||
<avr32gcc.preprocessingassembler.general.AnounceVersion>false</avr32gcc.preprocessingassembler.general.AnounceVersion>
|
||||
<avr32gcc.preprocessingassembler.debugging.DebugLevel>Default (-Wa,-g)</avr32gcc.preprocessingassembler.debugging.DebugLevel>
|
||||
</Avr32Gcc>
|
||||
</ToolchainSettings>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(AVRSTUDIO_EXE_PATH)\\Vs\\Compiler.targets" />
|
||||
<ItemGroup>
|
||||
<Folder Include="src" />
|
||||
<Compile Include="src\clocks.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\clocks.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\flash_fw.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<None Include="src\license.txt">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Compile Include="src\nor_flash.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\nor_flash.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\printf-stdarg.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\printf-stdarg.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\startup.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\startup.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\wl_fw.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\CONFIG" />
|
||||
<Compile Include="src\CONFIG\conf_access.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\CONFIG\conf_at45dbx.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\Doc" />
|
||||
<None Include="src\Doc\gettingstarted.pdf">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<None Include="src\Doc\SPB104 product brief.pdf">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\ASM" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\ASM\trampoline.x">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\BOARDS" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\BOARDS\board.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\BOARDS\board.h.ori">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\BOARDS\ARDUINO" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\BOARDS\ARDUINO\arduino.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\BOARDS\ARDUINO\led.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\BOARDS\ARDUINO\led.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY\DATA_FLASH" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY\DATA_FLASH\AT45DBX" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY\DATA_FLASH\AT45DBX\at45dbx.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY\DATA_FLASH\AT45DBX\at45dbx.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY\DATA_FLASH\AT45DBX\at45dbx_mem.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\COMPONENTS\MEMORY\DATA_FLASH\AT45DBX\at45dbx_mem.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\FLASHC" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\FLASHC\flashc.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\FLASHC\flashc.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\GPIO" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\GPIO\gpio.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\GPIO\gpio.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\INTC" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\INTC\exception.x">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\INTC\intc.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\INTC\intc.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PM" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PM\pm.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PM\pm.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PM\pm_conf_clocks.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PM\power_clocks_lib.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\PM\power_clocks_lib.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\SPI" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\SPI\spi.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\SPI\spi.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\DRIVERS\USART" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\USART\usart.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\DRIVERS\USART\usart.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\MEMORY" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\SERVICES\MEMORY\CTRL_ACCESS" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\MEMORY\CTRL_ACCESS\ctrl_access.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\SERVICES\MEMORY\CTRL_ACCESS\ctrl_access.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\compiler.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\conf_isp.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\parts.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\DEBUG" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\DEBUG\debug.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\DEBUG\debug.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\DEBUG\print_funcs.c">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\DEBUG\print_funcs.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS" />
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\libnewlib_addons-at32ucr2-speed_opt.a">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\INCLUDE" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\INCLUDE\nlao_cpu.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\INCLUDE\nlao_exceptions.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\INCLUDE\nlao_interrupts.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\INCLUDE\nlao_io.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\LIBS\NEWLIB_ADDONS\INCLUDE\nlao_usart.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A\0512" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A\0512\GCC" />
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A\0512\GCC\link_uc3a0512.lds">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A\1256" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A\1256\GCC" />
|
||||
<None Include="src\SOFTWARE_FRAMEWORK\UTILS\LINKER_SCRIPTS\AT32UC3A\1256\GCC\link_uc3a1256.lds">
|
||||
<SubType>compile</SubType>
|
||||
</None>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\PREPROCESSOR" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\PREPROCESSOR\mrepeat.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\PREPROCESSOR\preprocessor.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\PREPROCESSOR\stringz.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\PREPROCESSOR\tpaste.h">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\STARTUP_FILES" />
|
||||
<Folder Include="src\SOFTWARE_FRAMEWORK\UTILS\STARTUP_FILES\GCC" />
|
||||
<Compile Include="src\SOFTWARE_FRAMEWORK\UTILS\STARTUP_FILES\GCC\crt0.x">
|
||||
<SubType>compile</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
36
hardware/arduino/avr/firmwares/wifishield/wifishield.atsln
Normal file
36
hardware/arduino/avr/firmwares/wifishield/wifishield.atsln
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Atmel Studio Solution File, Format Version 11.00
|
||||
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "wifi_dnld", "wifi_dnld\wifi_dnld.cproj", "{EB9606BC-DE32-4EDD-9CDA-AE3BF36977A2}"
|
||||
EndProject
|
||||
Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "wifiHD", "wifiHD\wifiHD.cproj", "{417E15DB-488A-4B56-8D4E-FBE832B2B649}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug_512|AVR = Debug_512|AVR
|
||||
Debug|AVR = Debug|AVR
|
||||
Release_512|AVR = Release_512|AVR
|
||||
Release|AVR = Release|AVR
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EB9606BC-DE32-4EDD-9CDA-AE3BF36977A2}.Debug_512|AVR.ActiveCfg = Debug|AVR
|
||||
{EB9606BC-DE32-4EDD-9CDA-AE3BF36977A2}.Debug_512|AVR.Build.0 = Debug|AVR
|
||||
{EB9606BC-DE32-4EDD-9CDA-AE3BF36977A2}.Debug|AVR.ActiveCfg = Debug|AVR
|
||||
{EB9606BC-DE32-4EDD-9CDA-AE3BF36977A2}.Debug|AVR.Build.0 = Debug|AVR
|
||||
{EB9606BC-DE32-4EDD-9CDA-AE3BF36977A2}.Release_512|AVR.ActiveCfg = Release|AVR
|
||||
{EB9606BC-DE32-4EDD-9CDA-AE3BF36977A2}.Release_512|AVR.Build.0 = Release|AVR
|
||||
{EB9606BC-DE32-4EDD-9CDA-AE3BF36977A2}.Release|AVR.ActiveCfg = Release|AVR
|
||||
{EB9606BC-DE32-4EDD-9CDA-AE3BF36977A2}.Release|AVR.Build.0 = Release|AVR
|
||||
{417E15DB-488A-4B56-8D4E-FBE832B2B649}.Debug_512|AVR.ActiveCfg = Debug_512|AVR
|
||||
{417E15DB-488A-4B56-8D4E-FBE832B2B649}.Debug_512|AVR.Build.0 = Debug_512|AVR
|
||||
{417E15DB-488A-4B56-8D4E-FBE832B2B649}.Debug|AVR.ActiveCfg = Debug|AVR
|
||||
{417E15DB-488A-4B56-8D4E-FBE832B2B649}.Debug|AVR.Build.0 = Debug|AVR
|
||||
{417E15DB-488A-4B56-8D4E-FBE832B2B649}.Release_512|AVR.ActiveCfg = Release_512|AVR
|
||||
{417E15DB-488A-4B56-8D4E-FBE832B2B649}.Release_512|AVR.Build.0 = Release_512|AVR
|
||||
{417E15DB-488A-4B56-8D4E-FBE832B2B649}.Release|AVR.ActiveCfg = Release|AVR
|
||||
{417E15DB-488A-4B56-8D4E-FBE832B2B649}.Release|AVR.Build.0 = Release|AVR
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
68
hardware/arduino/avr/libraries/GSM/GSM.h
Normal file
68
hardware/arduino/avr/libraries/GSM/GSM.h
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3SIMPLIFIERFILE_
|
||||
#define _GSM3SIMPLIFIERFILE_
|
||||
|
||||
// This file simplifies the use of the GSM3 library
|
||||
// First we include everything.
|
||||
|
||||
#include <GSM3CircularBuffer.h>
|
||||
#include <GSM3MobileCellManagement.h>
|
||||
#include <GSM3MobileClientService.h>
|
||||
#include <GSM3MobileNetworkRegistry.h>
|
||||
#include <GSM3MobileServerService.h>
|
||||
#include <GSM3ShieldV1AccessProvider.h>
|
||||
#include <GSM3ShieldV1BandManagement.h>
|
||||
#include <GSM3ShieldV1ClientProvider.h>
|
||||
#include <GSM3ShieldV1DataNetworkProvider.h>
|
||||
#include <GSM3ShieldV1ModemVerification.h>
|
||||
#include <GSM3ShieldV1PinManagement.h>
|
||||
#include <GSM3ShieldV1ScanNetworks.h>
|
||||
#include <GSM3SMSService.h>
|
||||
#include <GSM3VoiceCallService.h>
|
||||
|
||||
#define GSM GSM3ShieldV1AccessProvider
|
||||
#define GPRS GSM3ShieldV1DataNetworkProvider
|
||||
#define GSMClient GSM3MobileClientService
|
||||
#define GSMServer GSM3MobileServerService
|
||||
#define GSMVoiceCall GSM3VoiceCallService
|
||||
#define GSM_SMS GSM3SMSService
|
||||
|
||||
#define GSMPIN GSM3ShieldV1PinManagement
|
||||
#define GSMModem GSM3ShieldV1ModemVerification
|
||||
#define GSMCell GSM3CellManagement
|
||||
#define GSMBand GSM3ShieldV1BandManagement
|
||||
#define GSMScanner GSM3ShieldV1ScanNetworks
|
||||
|
||||
#endif
|
319
hardware/arduino/avr/libraries/GSM/GSM3CircularBuffer.cpp
Normal file
319
hardware/arduino/avr/libraries/GSM/GSM3CircularBuffer.cpp
Normal file
@ -0,0 +1,319 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#include "GSM3CircularBuffer.h"
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
GSM3CircularBuffer::GSM3CircularBuffer(GSM3CircularBufferManager* mgr)
|
||||
{
|
||||
head=0;
|
||||
tail=0;
|
||||
cbm=mgr;
|
||||
}
|
||||
|
||||
int GSM3CircularBuffer::write(char c)
|
||||
{
|
||||
byte aux=(tail+1)& __BUFFERMASK__;
|
||||
if(aux!=head)
|
||||
{
|
||||
theBuffer[tail]=c;
|
||||
// Lets put an extra zero at the end, so we can
|
||||
// read chains as we like.
|
||||
// This is not exactly perfect, we are always 1+ behind the head
|
||||
theBuffer[aux]=0;
|
||||
tail=aux;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char GSM3CircularBuffer::read()
|
||||
{
|
||||
char res;
|
||||
if(head!=tail)
|
||||
{
|
||||
res=theBuffer[head];
|
||||
head=(head+1)& __BUFFERMASK__;
|
||||
//if(cbm)
|
||||
// cbm->spaceAvailable();
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
char GSM3CircularBuffer::peek(int increment)
|
||||
{
|
||||
char res;
|
||||
byte num_aux;
|
||||
|
||||
if (tail>head) num_aux = tail-head;
|
||||
else num_aux = 128 - head + tail;
|
||||
|
||||
if(increment < num_aux)
|
||||
{
|
||||
res=theBuffer[head];
|
||||
return res;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void GSM3CircularBufferManager::spaceAvailable(){return;};
|
||||
|
||||
void GSM3CircularBuffer::flush()
|
||||
{
|
||||
head=tail;
|
||||
}
|
||||
|
||||
char* GSM3CircularBuffer::nextString()
|
||||
{
|
||||
while(head!=tail)
|
||||
{
|
||||
head=(head+1) & __BUFFERMASK__;
|
||||
if(theBuffer[head]==0)
|
||||
{
|
||||
head=(head+1) & __BUFFERMASK__;
|
||||
return (char*)theBuffer+head;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool GSM3CircularBuffer::locate(const char* reference)
|
||||
{
|
||||
|
||||
return locate(reference, head, tail, 0, 0);
|
||||
}
|
||||
|
||||
bool GSM3CircularBuffer::chopUntil(const char* reference, bool movetotheend, bool usehead)
|
||||
{
|
||||
byte from, to;
|
||||
|
||||
if(locate(reference, head, tail, &from, &to))
|
||||
{
|
||||
if(usehead)
|
||||
{
|
||||
if(movetotheend)
|
||||
head=(to+1) & __BUFFERMASK__;
|
||||
else
|
||||
head=from;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(movetotheend)
|
||||
tail=(to+1) & __BUFFERMASK__;
|
||||
else
|
||||
tail=from;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool GSM3CircularBuffer::locate(const char* reference, byte thishead, byte thistail, byte* from, byte* to)
|
||||
{
|
||||
int refcursor=0;
|
||||
bool into=false;
|
||||
byte b2, binit;
|
||||
bool possible=1;
|
||||
|
||||
if(reference[0]==0)
|
||||
return true;
|
||||
|
||||
for(byte b1=thishead; b1!=thistail;b1=(b1+1)& __BUFFERMASK__)
|
||||
{
|
||||
possible = 1;
|
||||
b2 = b1;
|
||||
while (possible&&(b2!=thistail))
|
||||
{
|
||||
if(theBuffer[b2]==reference[refcursor])
|
||||
{
|
||||
if(!into)
|
||||
binit=b2;
|
||||
into=true;
|
||||
refcursor++;
|
||||
if(reference[refcursor]==0)
|
||||
{
|
||||
if(from)
|
||||
*from=binit;
|
||||
if(to)
|
||||
*to=b2;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (into==true)
|
||||
{
|
||||
possible = 0;
|
||||
into=false;
|
||||
refcursor=0;
|
||||
}
|
||||
b2=(b2+1)& __BUFFERMASK__;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GSM3CircularBuffer::extractSubstring(const char* from, const char* to, char* buffer, int bufsize)
|
||||
{
|
||||
byte t1;
|
||||
byte h2;
|
||||
byte b;
|
||||
int i;
|
||||
|
||||
//DEBUG
|
||||
//Serial.println("Beginning extractSubstring");
|
||||
//Serial.print("head,tail=");Serial.print(int(head));Serial.print(",");Serial.println(int(tail));
|
||||
|
||||
if(!locate(from, head, tail, 0, &t1))
|
||||
return false;
|
||||
|
||||
//DEBUG
|
||||
//Serial.println("Located chain from.");
|
||||
|
||||
t1++; //To point the next.
|
||||
if(!locate(to, t1, tail, &h2, 0))
|
||||
return false;
|
||||
|
||||
//DEBUG
|
||||
//Serial.println("Located chain to.");
|
||||
/*Serial.print("t1=");Serial.println(int(t1));
|
||||
Serial.print("h2=");Serial.println(int(h2));*/
|
||||
|
||||
|
||||
for(i=0,b=t1;i<bufsize, b!=((h2) & __BUFFERMASK__); i++, b=(b+1)& __BUFFERMASK__)
|
||||
buffer[i]=theBuffer[b];
|
||||
buffer[i]=0;
|
||||
|
||||
//DEBUG
|
||||
//Serial.println("");
|
||||
//Serial.println("Finishing extractSubstring");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int GSM3CircularBuffer::readInt()
|
||||
{
|
||||
int res=0;
|
||||
byte c;
|
||||
bool anyfound=false;
|
||||
bool negative=false;
|
||||
for(byte b=head + 1; b!=tail; b=(b+1)& __BUFFERMASK__)
|
||||
{
|
||||
c=theBuffer[b];
|
||||
if((c==' ' )&&(!anyfound))
|
||||
{
|
||||
} else if((c=='-' )&&(!anyfound))
|
||||
{
|
||||
negative=true;
|
||||
anyfound=true; // Don't admit blanks after -
|
||||
} else if((c>='0')&&(c<='9'))
|
||||
{
|
||||
anyfound=true;
|
||||
res=(res*10)+(int)c-48;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(negative)
|
||||
res=(-1)*res;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
if(negative)
|
||||
res=(-1)*res;
|
||||
return res;
|
||||
}
|
||||
|
||||
void GSM3CircularBuffer::debugBuffer()
|
||||
{
|
||||
byte h1=head;
|
||||
byte t1=tail;
|
||||
Serial.println();
|
||||
Serial.print(h1);
|
||||
Serial.print(" ");
|
||||
Serial.print(t1);
|
||||
Serial.print('>');
|
||||
for(byte b=h1; b!=t1; b=(b+1)& __BUFFERMASK__)
|
||||
printCharDebug(theBuffer[b]);
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
void GSM3CircularBuffer::printCharDebug(uint8_t c)
|
||||
{
|
||||
if((c>31)&&(c<127))
|
||||
Serial.print((char)c);
|
||||
else
|
||||
{
|
||||
Serial.print('%');
|
||||
Serial.print(c);
|
||||
Serial.print('%');
|
||||
}
|
||||
}
|
||||
|
||||
bool GSM3CircularBuffer::retrieveBuffer(char* buffer, int bufsize, int& SizeWritten)
|
||||
{
|
||||
byte b;
|
||||
int i;
|
||||
|
||||
/*for(i=0,b=head;i<bufsize, b!=tail; i++, b=(b+1)& __BUFFERMASK__)
|
||||
{
|
||||
buffer[i]=theBuffer[b];
|
||||
}
|
||||
buffer[i]=0;
|
||||
SizeWritten = i;*/
|
||||
b=head;
|
||||
for(i=0;i<bufsize; i++)
|
||||
{
|
||||
if (b!=tail)
|
||||
{
|
||||
buffer[i]=theBuffer[b];
|
||||
buffer[i+1]=0;
|
||||
b=(b+1)& __BUFFERMASK__;
|
||||
SizeWritten = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
205
hardware/arduino/avr/libraries/GSM/GSM3CircularBuffer.h
Normal file
205
hardware/arduino/avr/libraries/GSM/GSM3CircularBuffer.h
Normal file
@ -0,0 +1,205 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef __GSM3_CIRCULARBUFFER__
|
||||
#define __GSM3_CIRCULARBUFFER__
|
||||
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifndef byte
|
||||
#define byte uint8_t
|
||||
#endif
|
||||
|
||||
// These values have to be interrelated
|
||||
// To-Do: may we have just one? (BUFFERMASK)
|
||||
#define __BUFFERSIZE__ 128
|
||||
#define __BUFFERMASK__ 0x7F
|
||||
|
||||
class GSM3CircularBufferManager
|
||||
{
|
||||
public:
|
||||
|
||||
/** If there is spaceAvailable in the buffer, lets send a XON
|
||||
*/
|
||||
virtual void spaceAvailable();
|
||||
};
|
||||
|
||||
class GSM3CircularBuffer
|
||||
{
|
||||
private:
|
||||
// Buffer pointers.
|
||||
// head=tail means buffer empty
|
||||
// tail=head-1 means buffer full
|
||||
// tail=head+1 means just one char (pointed by head)
|
||||
// REMEMBER. head can be moved only by the main program
|
||||
// REMEMBER. tail can be moved only by the other thread (interrupts)
|
||||
// REMEMBER. head and tail can move only FORWARD
|
||||
volatile byte head; // First written one
|
||||
volatile byte tail; // Last written one.
|
||||
|
||||
GSM3CircularBufferManager* cbm; // Circular buffer manager
|
||||
|
||||
// The buffer
|
||||
volatile byte theBuffer[__BUFFERSIZE__];
|
||||
|
||||
/** Checks if a substring exists in the buffer
|
||||
@param reference Substring
|
||||
@param thishead Head
|
||||
@param thistail Tail
|
||||
@param from Initial byte position
|
||||
@param to Final byte position
|
||||
@return true if exists, in otherwise return false
|
||||
*/
|
||||
bool locate(const char* reference, byte thishead, byte thistail, byte* from=0, byte* to=0);
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor
|
||||
@param mgr Circular buffer manager
|
||||
*/
|
||||
GSM3CircularBuffer(GSM3CircularBufferManager* mgr=0);
|
||||
|
||||
// TO-DO.Check if this formule runs too at the buffer limit
|
||||
|
||||
/** Get available bytes in circular buffer
|
||||
@return available bytes
|
||||
*/
|
||||
inline byte availableBytes(){ return ((head-(tail+1))&__BUFFERMASK__);};
|
||||
|
||||
/** Stored bytes in circular buffer
|
||||
@return stored bytes
|
||||
*/
|
||||
inline byte storedBytes(){ return ((tail-head)&__BUFFERMASK__);};
|
||||
|
||||
/** Write a character in circular buffer
|
||||
@param c Character
|
||||
@return 1 if successful
|
||||
*/
|
||||
int write(char c);
|
||||
|
||||
/** Returns a character and moves the pointer
|
||||
@return character
|
||||
*/
|
||||
char read();
|
||||
|
||||
/** Returns a character but does not move the pointer.
|
||||
@param increment Increment
|
||||
@return character
|
||||
*/
|
||||
char peek(int increment);
|
||||
|
||||
/** Returns a pointer to the head of the buffer
|
||||
@return buffer with pointer in head
|
||||
*/
|
||||
inline char* firstString(){return (char*)theBuffer+head;};
|
||||
|
||||
/** Go forward one string
|
||||
@return buffer with one string advance
|
||||
*/
|
||||
char* nextString();
|
||||
|
||||
/** Flush circular buffer
|
||||
*/
|
||||
void flush();
|
||||
|
||||
/** Get tail
|
||||
@return tail
|
||||
*/
|
||||
inline byte getTail(){return tail;};
|
||||
|
||||
/** Get head
|
||||
@return head
|
||||
*/
|
||||
inline byte getHead(){return head;};
|
||||
|
||||
// Only can be executed from the interrupt!
|
||||
/** Delete circular buffer to the end
|
||||
@param from Initial byte position
|
||||
*/
|
||||
inline void deleteToTheEnd(byte from){tail=from;};
|
||||
|
||||
/** Checks if a substring exists in the buffer
|
||||
move=0, dont move, =1,put head at the beginning of the string, =2, put head at the end
|
||||
@param reference
|
||||
@return true if exists, in otherwise return false
|
||||
*/
|
||||
bool locate(const char* reference);
|
||||
|
||||
/** Locates reference. If found, moves head (or tail) to the beginning (or end)
|
||||
@param reference
|
||||
@param movetotheend
|
||||
@param head
|
||||
@return true if successful
|
||||
*/
|
||||
bool chopUntil(const char* reference, bool movetotheend, bool head=true);
|
||||
|
||||
/** Reads an integer from the head. Stops with first non blank, non number character
|
||||
@return integer from the head
|
||||
*/
|
||||
int readInt();
|
||||
|
||||
// Caveat: copies the first bytes until buffer is full
|
||||
|
||||
/** Extract a substring from circular buffer
|
||||
@param from Initial byte position
|
||||
@param to Final byte position
|
||||
@param buffer Buffer for copy substring
|
||||
@param bufsize Buffer size
|
||||
@return true if successful, false if substring does not exists
|
||||
*/
|
||||
bool extractSubstring(const char* from, const char* to, char* buffer, int bufsize);
|
||||
|
||||
/** Retrieve all the contents of buffer from head to tail
|
||||
@param buffer
|
||||
@param bufsize
|
||||
@param SizeWritten
|
||||
@return true if successful
|
||||
*/
|
||||
bool retrieveBuffer(char* buffer, int bufsize, int& SizeWritten);
|
||||
|
||||
/** Debug function to print the buffer after receiving data from the modem.
|
||||
*/
|
||||
void debugBuffer();
|
||||
|
||||
/** Utility: dump character if printable, else, put in %x%
|
||||
@param c Character
|
||||
*/
|
||||
static void printCharDebug(uint8_t c);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,3 @@
|
||||
#include <GSM3MobileAccessProvider.h>
|
||||
|
||||
GSM3MobileAccessProvider* theGSM3MobileAccessProvider;
|
@ -0,0 +1,68 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3MOBILEACCESSPROVIDER_
|
||||
#define _GSM3MOBILEACCESSPROVIDER_
|
||||
|
||||
enum GSM3_NetworkStatus_t { ERROR, IDLE, CONNECTING, GSM_READY, GPRS_READY, TRANSPARENT_CONNECTED};
|
||||
|
||||
class GSM3MobileAccessProvider
|
||||
{
|
||||
public:
|
||||
// Access functions
|
||||
//Configuration functions.
|
||||
/** Establish GSM connection
|
||||
@param pin PIN code
|
||||
@param restart Determines if hardware restart
|
||||
@param synchronous Determines sync mode
|
||||
@return If synchronous, GSM3_NetworkStatus_t. If asynchronous, returns 0.
|
||||
*/
|
||||
virtual inline GSM3_NetworkStatus_t begin(char* pin=0,bool restart=true, bool synchronous=true)=0;
|
||||
|
||||
/** Check network access status
|
||||
@return 1 if Alive, 0 if down
|
||||
*/
|
||||
virtual inline int isAccessAlive()=0;
|
||||
|
||||
/** Shutdown the modem (power off really)
|
||||
@return true if successful
|
||||
*/
|
||||
virtual inline bool shutdown()=0;
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
virtual int ready()=0;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1 @@
|
||||
#include <GSM3MobileCellManagement.h>
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3MOBILECELLMANAGEMENT_
|
||||
#define _GSM3MOBILECELLMANAGEMENT_
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
class GSM3MobileCellManagement
|
||||
{
|
||||
public:
|
||||
|
||||
virtual inline int getLocation() {return 0;};
|
||||
|
||||
virtual inline int getICCID() {return 0;};
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
virtual int ready()=0;
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,3 @@
|
||||
#include <GSM3MobileClientProvider.h>
|
||||
|
||||
GSM3MobileClientProvider* theGSM3MobileClientProvider;
|
156
hardware/arduino/avr/libraries/GSM/GSM3MobileClientProvider.h
Normal file
156
hardware/arduino/avr/libraries/GSM/GSM3MobileClientProvider.h
Normal file
@ -0,0 +1,156 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef __GSM3_MOBILECLIENTPROVIDER__
|
||||
#define __GSM3_MOBILECLIENTPROVIDER__
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <IPAddress.h>
|
||||
|
||||
class GSM3MobileClientProvider
|
||||
{
|
||||
protected:
|
||||
|
||||
uint8_t sockets;
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
GSM3MobileClientProvider(){};
|
||||
|
||||
/** Minimum socket
|
||||
@return socket
|
||||
*/
|
||||
virtual inline int minSocket()=0;
|
||||
|
||||
/** Maximum socket
|
||||
@return socket
|
||||
*/
|
||||
virtual inline int maxSocket()=0;
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
virtual int ready()=0;
|
||||
|
||||
/** Get status socket client
|
||||
@param socket Socket
|
||||
@return 1 if connected
|
||||
*/
|
||||
virtual bool getStatusSocketClient(uint8_t socket)=0;
|
||||
|
||||
// Socket management
|
||||
|
||||
/** Get socket
|
||||
@param socket Socket
|
||||
@return socket
|
||||
*/
|
||||
virtual int getSocket(int socket=-1)=0;
|
||||
|
||||
/** Release socket
|
||||
@param socket Socket
|
||||
*/
|
||||
virtual void releaseSocket(int socket)=0;
|
||||
|
||||
// Client socket functions
|
||||
|
||||
/** Connect to a server via TCP connection
|
||||
@param server Server name or IP address in a String
|
||||
@param port Port
|
||||
@param id_socket Socket
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
virtual int connectTCPClient(const char* server, int port, int id_socket)=0;
|
||||
|
||||
/** Connect to a server (by IP address) via TCP connection
|
||||
@param add IP address in IPAddress format
|
||||
@param port Port
|
||||
@param id_socket Socket
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
virtual int connectTCPClient(IPAddress add, int port, int id_socket)=0;
|
||||
|
||||
/** Begin writing through a socket
|
||||
@param client1Server0 1 if modem acts as client, 0 if acts as server
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
virtual void beginWriteSocket(bool client1Server0, int id_socket)=0;
|
||||
|
||||
/** Write through a socket. MUST go after beginWriteSocket()
|
||||
@param c character to be written
|
||||
*/
|
||||
virtual void writeSocket(uint8_t c)=0;
|
||||
|
||||
/** Write through a socket. MUST go after beginWriteSocket()
|
||||
@param buf characters to be written (final 0 will not be written)
|
||||
*/
|
||||
virtual void writeSocket(const char* buf)=0;
|
||||
|
||||
/** Finish current writing
|
||||
*/
|
||||
virtual void endWriteSocket()=0;
|
||||
|
||||
/** Check if there are data to be read in socket.
|
||||
@param client1Server0 1 if modem acts as client, 0 if acts as server
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if there are data available, 4 if no data, otherwise error
|
||||
*/
|
||||
virtual int availableSocket(bool client, int id_socket)=0;
|
||||
|
||||
/** Read data (get a character) available in socket
|
||||
@return character
|
||||
*/
|
||||
virtual int readSocket()=0;
|
||||
|
||||
/** Flush socket
|
||||
*/
|
||||
virtual void flushSocket()=0;
|
||||
|
||||
/** Get a character but will not advance the buffer head
|
||||
@return character
|
||||
*/
|
||||
virtual int peekSocket()=0;
|
||||
|
||||
/** Close a socket
|
||||
@param client1Server0 1 if modem acts as client, 0 if acts as server
|
||||
@param id_socket Socket
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
virtual int disconnectTCP(bool client1Server0, int idsocket)=0;
|
||||
|
||||
};
|
||||
|
||||
extern GSM3MobileClientProvider* theGSM3MobileClientProvider;
|
||||
|
||||
#endif
|
260
hardware/arduino/avr/libraries/GSM/GSM3MobileClientService.cpp
Normal file
260
hardware/arduino/avr/libraries/GSM/GSM3MobileClientService.cpp
Normal file
@ -0,0 +1,260 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#include <GSM3MobileClientService.h>
|
||||
#include <GSM3MobileClientProvider.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
// While there is only a shield (ShieldV1) we will include it by default
|
||||
#include <GSM3ShieldV1ClientProvider.h>
|
||||
GSM3ShieldV1ClientProvider theShieldV1ClientProvider;
|
||||
|
||||
|
||||
#define GSM3MOBILECLIENTSERVICE_CLIENT 0x01 // 1: This side is Client. 0: This side is Server
|
||||
#define GSM3MOBILECLIENTSERVICE_WRITING 0x02 // 1: TRUE 0: FALSE
|
||||
#define GSM3MOBILECLIENTSERVICE_SYNCH 0x04 // 1: TRUE, compatible with other clients 0: FALSE
|
||||
|
||||
#define __TOUTBEGINWRITE__ 10000
|
||||
|
||||
|
||||
GSM3MobileClientService::GSM3MobileClientService(bool synch)
|
||||
{
|
||||
flags = GSM3MOBILECLIENTSERVICE_CLIENT;
|
||||
if(synch)
|
||||
flags |= GSM3MOBILECLIENTSERVICE_SYNCH;
|
||||
mySocket=255;
|
||||
}
|
||||
|
||||
GSM3MobileClientService::GSM3MobileClientService(int socket, bool synch)
|
||||
{
|
||||
// We are creating a socket on an existing, occupied one.
|
||||
flags=0;
|
||||
if(synch)
|
||||
flags |= GSM3MOBILECLIENTSERVICE_SYNCH;
|
||||
mySocket=socket;
|
||||
theGSM3MobileClientProvider->getSocket(socket);
|
||||
|
||||
}
|
||||
|
||||
// Returns 0 if last command is still executing
|
||||
// 1 if success
|
||||
// >1 if error
|
||||
int GSM3MobileClientService::ready()
|
||||
{
|
||||
return theGSM3MobileClientProvider->ready();
|
||||
}
|
||||
|
||||
int GSM3MobileClientService::connect(IPAddress add, uint16_t port)
|
||||
{
|
||||
if(theGSM3MobileClientProvider==0)
|
||||
return 2;
|
||||
|
||||
// TODO: ask for the socket id
|
||||
mySocket=theGSM3MobileClientProvider->getSocket();
|
||||
|
||||
if(mySocket<0)
|
||||
return 2;
|
||||
|
||||
int res=theGSM3MobileClientProvider->connectTCPClient(add, port, mySocket);
|
||||
if(flags & GSM3MOBILECLIENTSERVICE_SYNCH)
|
||||
res=waitForAnswer();
|
||||
|
||||
return res;
|
||||
};
|
||||
|
||||
int GSM3MobileClientService::connect(const char *host, uint16_t port)
|
||||
{
|
||||
|
||||
if(theGSM3MobileClientProvider==0)
|
||||
return 2;
|
||||
// TODO: ask for the socket id
|
||||
mySocket=theGSM3MobileClientProvider->getSocket();
|
||||
|
||||
if(mySocket<0)
|
||||
return 2;
|
||||
|
||||
int res=theGSM3MobileClientProvider->connectTCPClient(host, port, mySocket);
|
||||
if(flags & GSM3MOBILECLIENTSERVICE_SYNCH)
|
||||
res=waitForAnswer();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSM3MobileClientService::waitForAnswer()
|
||||
{
|
||||
unsigned long m;
|
||||
m=millis();
|
||||
int res;
|
||||
|
||||
while(((millis()-m)< __TOUTBEGINWRITE__ )&&(ready()==0))
|
||||
delay(100);
|
||||
|
||||
res=ready();
|
||||
|
||||
// If we get something different from a 1, we are having a problem
|
||||
if(res!=1)
|
||||
res=0;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void GSM3MobileClientService::beginWrite(bool sync)
|
||||
{
|
||||
flags |= GSM3MOBILECLIENTSERVICE_WRITING;
|
||||
theGSM3MobileClientProvider->beginWriteSocket(flags & GSM3MOBILECLIENTSERVICE_CLIENT, mySocket);
|
||||
if(sync)
|
||||
waitForAnswer();
|
||||
}
|
||||
|
||||
size_t GSM3MobileClientService::write(uint8_t c)
|
||||
{
|
||||
if(!(flags & GSM3MOBILECLIENTSERVICE_WRITING))
|
||||
beginWrite(true);
|
||||
theGSM3MobileClientProvider->writeSocket(c);
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t GSM3MobileClientService::write(const uint8_t* buf)
|
||||
{
|
||||
if(!(flags & GSM3MOBILECLIENTSERVICE_WRITING))
|
||||
beginWrite(true);
|
||||
theGSM3MobileClientProvider->writeSocket((const char*)(buf));
|
||||
return strlen((const char*)buf);
|
||||
}
|
||||
|
||||
size_t GSM3MobileClientService::write(const uint8_t* buf, size_t sz)
|
||||
{
|
||||
if(!(flags & GSM3MOBILECLIENTSERVICE_WRITING))
|
||||
beginWrite(true);
|
||||
for(int i=0;i<sz;i++)
|
||||
theGSM3MobileClientProvider->writeSocket(buf[i]);
|
||||
return sz;
|
||||
}
|
||||
|
||||
void GSM3MobileClientService::endWrite(bool sync)
|
||||
{
|
||||
flags ^= GSM3MOBILECLIENTSERVICE_WRITING;
|
||||
theGSM3MobileClientProvider->endWriteSocket();
|
||||
if(sync)
|
||||
waitForAnswer();
|
||||
}
|
||||
|
||||
uint8_t GSM3MobileClientService::connected()
|
||||
{
|
||||
if(mySocket==255)
|
||||
return 0;
|
||||
return theGSM3MobileClientProvider->getStatusSocketClient(mySocket);
|
||||
}
|
||||
|
||||
GSM3MobileClientService::operator bool()
|
||||
{
|
||||
return connected()==1;
|
||||
};
|
||||
|
||||
int GSM3MobileClientService::available()
|
||||
{
|
||||
int res;
|
||||
|
||||
// Even if not connected, we are looking for available data
|
||||
|
||||
if(flags & GSM3MOBILECLIENTSERVICE_WRITING)
|
||||
endWrite(true);
|
||||
|
||||
res=theGSM3MobileClientProvider->availableSocket(flags & GSM3MOBILECLIENTSERVICE_CLIENT,mySocket);
|
||||
if(flags & GSM3MOBILECLIENTSERVICE_SYNCH)
|
||||
res=waitForAnswer();
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
int GSM3MobileClientService::read(uint8_t *buf, size_t size)
|
||||
{
|
||||
int i;
|
||||
uint8_t c;
|
||||
|
||||
for(i=0;i<size;i++)
|
||||
{
|
||||
c=read();
|
||||
if(c==0)
|
||||
break;
|
||||
buf[i]=c;
|
||||
}
|
||||
|
||||
return i;
|
||||
/* This is the old implementation, testing a simpler one
|
||||
int res;
|
||||
// If we were writing, just stop doing it.
|
||||
if(flags & GSM3MOBILECLIENTSERVICE_WRITING)
|
||||
endWrite(true);
|
||||
res=theGSM3MobileClientProvider->readSocket(flags & GSM3MOBILECLIENTSERVICE_CLIENT, (char *)(buf), size, mySocket);
|
||||
|
||||
return res;
|
||||
*/
|
||||
}
|
||||
|
||||
int GSM3MobileClientService::read()
|
||||
{
|
||||
if(flags & GSM3MOBILECLIENTSERVICE_WRITING)
|
||||
endWrite(true);
|
||||
int c=theGSM3MobileClientProvider->readSocket();
|
||||
return c;
|
||||
}
|
||||
|
||||
int GSM3MobileClientService::peek()
|
||||
{
|
||||
if(flags & GSM3MOBILECLIENTSERVICE_WRITING)
|
||||
endWrite(true);
|
||||
return theGSM3MobileClientProvider->peekSocket(/*mySocket, false*/);
|
||||
}
|
||||
|
||||
void GSM3MobileClientService::flush()
|
||||
{
|
||||
if(flags & GSM3MOBILECLIENTSERVICE_WRITING)
|
||||
endWrite(true);
|
||||
theGSM3MobileClientProvider->flushSocket(/*mySocket*/);
|
||||
if(flags & GSM3MOBILECLIENTSERVICE_SYNCH)
|
||||
waitForAnswer();
|
||||
|
||||
}
|
||||
|
||||
void GSM3MobileClientService::stop()
|
||||
{
|
||||
if(flags & GSM3MOBILECLIENTSERVICE_WRITING)
|
||||
endWrite(true);
|
||||
theGSM3MobileClientProvider->disconnectTCP(flags & GSM3MOBILECLIENTSERVICE_CLIENT, mySocket);
|
||||
theGSM3MobileClientProvider->releaseSocket(mySocket);
|
||||
mySocket = 0;
|
||||
if(flags & GSM3MOBILECLIENTSERVICE_SYNCH)
|
||||
waitForAnswer();
|
||||
}
|
||||
|
162
hardware/arduino/avr/libraries/GSM/GSM3MobileClientService.h
Normal file
162
hardware/arduino/avr/libraries/GSM/GSM3MobileClientService.h
Normal file
@ -0,0 +1,162 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3MOBILECLIENTSERVICE_
|
||||
#define _GSM3MOBILECLIENTSERVICE_
|
||||
|
||||
#include <GSM3MobileNetworkProvider.h>
|
||||
#include <Client.h>
|
||||
|
||||
|
||||
class GSM3MobileClientService : public Client
|
||||
{
|
||||
private:
|
||||
|
||||
uint8_t mySocket;
|
||||
uint8_t flags;
|
||||
|
||||
/** Blocks waiting for an answer
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
int waitForAnswer();
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor
|
||||
@param synch Sync mode
|
||||
*/
|
||||
GSM3MobileClientService(bool synch=true);
|
||||
|
||||
/** Constructor
|
||||
@param socket Socket
|
||||
@param synch Sync mode
|
||||
*/
|
||||
GSM3MobileClientService(int socket, bool synch);
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
int ready();
|
||||
|
||||
// we take this function out as IPAddress is complex to bring to
|
||||
// version 1.
|
||||
/** Connect to server by IP address
|
||||
@param (IPAddress)
|
||||
@param (uint16_t)
|
||||
@return returns 0 if last command is still executing, 1 success, 2 if there are no resources
|
||||
*/
|
||||
inline int connect(IPAddress, uint16_t);
|
||||
|
||||
/** Connect to server by hostname
|
||||
@param host Hostname
|
||||
@param port Port
|
||||
@return returns 0 if last command is still executing, 1 success, 2 if there are no resources
|
||||
*/
|
||||
int connect(const char *host, uint16_t port);
|
||||
|
||||
/** Initialize write in request
|
||||
@param sync Sync mode
|
||||
*/
|
||||
void beginWrite(bool sync=false);
|
||||
|
||||
/** Write a character in request
|
||||
@param c Character
|
||||
@return size
|
||||
*/
|
||||
size_t write(uint8_t c);
|
||||
|
||||
/** Write a characters buffer in request
|
||||
@param buf Buffer
|
||||
@return buffer size
|
||||
*/
|
||||
size_t write(const uint8_t *buf);
|
||||
|
||||
/** Write a characters buffer with size in request
|
||||
@param (uint8_t*) Buffer
|
||||
@param (size_t) Buffer size
|
||||
@return buffer size
|
||||
*/
|
||||
size_t write(const uint8_t*, size_t);
|
||||
|
||||
/** Finish write request
|
||||
@param sync Sync mode
|
||||
*/
|
||||
void endWrite(bool sync=false);
|
||||
|
||||
/** Check if connected to server
|
||||
@return 1 if connected
|
||||
*/
|
||||
uint8_t connected();
|
||||
|
||||
operator bool();
|
||||
|
||||
/** Read from response buffer and copy size specified to buffer
|
||||
@param buf Buffer
|
||||
@param size Buffer size
|
||||
@return bytes read
|
||||
*/
|
||||
int read(uint8_t *buf, size_t size);
|
||||
|
||||
/** Read a character from response buffer
|
||||
@return character
|
||||
*/
|
||||
int read();
|
||||
|
||||
/** Check if exists a response available
|
||||
@return 1 if exists, 0 if not exists
|
||||
*/
|
||||
int available();
|
||||
|
||||
/** Read a character from response buffer but does not move the pointer.
|
||||
@return character
|
||||
*/
|
||||
int peek();
|
||||
|
||||
/** Flush response buffer
|
||||
*/
|
||||
void flush();
|
||||
|
||||
/** Stop client
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/** Get socket
|
||||
@return socket
|
||||
*/
|
||||
inline int getSocket(){return (int)mySocket;};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,3 @@
|
||||
#include <GSM3MobileDataNetworkProvider.h>
|
||||
|
||||
// GSM3MobileDataNetworkProvider* theGSM3MobileDataNetworkProvider;
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3MOBILEDATANETWORKPROVIDER_
|
||||
#define _GSM3MOBILEDATANETWORKPROVIDER_
|
||||
|
||||
#include <GSM3MobileAccessProvider.h>
|
||||
|
||||
// This class is not really useful, but serves as a guideline for programmers
|
||||
// We keep it but it should never be linked
|
||||
class GSM3MobileDataNetworkProvider
|
||||
{
|
||||
public:
|
||||
|
||||
/** Attach to GPRS/GSM network
|
||||
@param networkId APN GPRS
|
||||
@param user Username
|
||||
@param pass Password
|
||||
@return connection status
|
||||
*/
|
||||
virtual GSM3_NetworkStatus_t networkAttach(char* networId, char* user, char* pass)=0;
|
||||
|
||||
/** Detach GPRS/GSM network
|
||||
@return connection status
|
||||
*/
|
||||
virtual GSM3_NetworkStatus_t networkDetach()=0;
|
||||
|
||||
};
|
||||
|
||||
extern GSM3MobileDataNetworkProvider* theGSM3MobileDataNetworkProvider;
|
||||
|
||||
#endif
|
191
hardware/arduino/avr/libraries/GSM/GSM3MobileMockupProvider.cpp
Normal file
191
hardware/arduino/avr/libraries/GSM/GSM3MobileMockupProvider.cpp
Normal file
@ -0,0 +1,191 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#include <GSM3MobileNetworkProvider.h>
|
||||
#include <GSM3MobileMockupProvider.h>
|
||||
#include <inttypes.h>
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
|
||||
GSM3MobileMockupProvider::GSM3MobileMockupProvider()
|
||||
{
|
||||
lineStatus=IDLE;
|
||||
msgExample="Hello#World";
|
||||
msgIndex=0;
|
||||
};
|
||||
|
||||
int GSM3MobileMockupProvider::begin(char* pin)
|
||||
{
|
||||
Serial.println("GSM3MobileMockupProvider::begin()");
|
||||
return 0;
|
||||
};
|
||||
|
||||
int GSM3MobileMockupProvider::ready()
|
||||
{
|
||||
Serial.println("GSM3MobileMockupProvider::ready()");
|
||||
return 1;
|
||||
};
|
||||
|
||||
int GSM3MobileMockupProvider::beginSMS(const char* number)
|
||||
{
|
||||
Serial.println("SM3MobileMockupProvider::beginSMS()");
|
||||
return 0;
|
||||
};
|
||||
|
||||
void GSM3MobileMockupProvider::writeSMS(char c)
|
||||
{
|
||||
Serial.print(c);
|
||||
};
|
||||
|
||||
int GSM3MobileMockupProvider::endSMS()
|
||||
{
|
||||
Serial.println("GSM3MobileMockupProvider::endSMS()");
|
||||
};
|
||||
|
||||
int GSM3MobileMockupProvider::availableSMS()
|
||||
{
|
||||
Serial.println("GSM3MobileMockupProvider::availableSMS()");
|
||||
return 120;
|
||||
};
|
||||
|
||||
int GSM3MobileMockupProvider::peek()
|
||||
{
|
||||
return (int)'H';
|
||||
};
|
||||
|
||||
int GSM3MobileMockupProvider::remoteSMSNumber(char* number, int nlength)
|
||||
{
|
||||
if(nlength>=13)
|
||||
strcpy(number, "+34630538546");
|
||||
return 12;
|
||||
};
|
||||
|
||||
|
||||
void GSM3MobileMockupProvider::flushSMS()
|
||||
{
|
||||
Serial.println("GSM3MobileMockupProvider::flushSMS()");
|
||||
};
|
||||
|
||||
int GSM3MobileMockupProvider::readSMS()
|
||||
{
|
||||
if(msgExample[msgIndex]==0)
|
||||
{
|
||||
msgIndex=0;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
msgIndex++;
|
||||
return msgExample[msgIndex-1];
|
||||
};
|
||||
};
|
||||
|
||||
int GSM3MobileMockupProvider::connectTCPClient(const char* server, int port, int id_socket)
|
||||
{
|
||||
Serial.println("GSM3MobileMockupProvider::connectTCPClient()");
|
||||
Serial.print(server);Serial.print(":");Serial.print(port);Serial.print("-");Serial.println(id_socket);
|
||||
}
|
||||
|
||||
void GSM3MobileMockupProvider::writeSocket(const uint8_t *buf, size_t size, int id_socket)
|
||||
{
|
||||
int i;
|
||||
for(i=0;i<size;i++)
|
||||
Serial.print(buf[i]);
|
||||
}
|
||||
/* I'm taking this off. We'll reply from the NetworkProvider
|
||||
uint8_t GSM3MobileMockupProvider::getStatus(uint8_t socket)
|
||||
{
|
||||
if((socket>=minSocket())&&(socket<=maxSocket()))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
*/
|
||||
|
||||
int GSM3MobileMockupProvider::readSocket(uint8_t *buf, size_t size, int idsocket)
|
||||
{
|
||||
int i;
|
||||
int l=strlen(msgExample);
|
||||
for(i=0;(i<size)&&(i<l);i++)
|
||||
buf[i]=msgExample[i];
|
||||
buf[i]=0;
|
||||
return i;
|
||||
}
|
||||
|
||||
int GSM3MobileMockupProvider::availableSocket(int idsocket)
|
||||
{
|
||||
return 1;
|
||||
};
|
||||
|
||||
int GSM3MobileMockupProvider::readSocket(int idsocket, bool advance)
|
||||
{
|
||||
char c;
|
||||
if(msgExample[msgIndex]==0)
|
||||
{
|
||||
msgIndex=0;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
c=msgExample[msgIndex];
|
||||
if(advance)
|
||||
msgIndex++;
|
||||
};
|
||||
return c;
|
||||
};
|
||||
|
||||
void GSM3MobileMockupProvider::flushSocket(int idsocket)
|
||||
{
|
||||
while(readSocket(idsocket));
|
||||
};
|
||||
|
||||
int GSM3MobileMockupProvider::disconnectTCP(int idsocket)
|
||||
{
|
||||
Serial.println("GSM3MobileMockupProvider::disconnectTCP()");
|
||||
return 1;
|
||||
};
|
||||
|
||||
int GSM3MobileMockupProvider::connectTCPServer(int port, char* localIP, int* localIPlength)
|
||||
{
|
||||
Serial.println("GSM3MobileMockupProvider::connectTCPServer()");
|
||||
if((localIP!=0)&&(*localIPlength>12))
|
||||
strcpy("192.168.1.1", localIP);
|
||||
return 1;
|
||||
};
|
||||
|
||||
bool GSM3MobileMockupProvider::getSocketModemStatus(uint8_t s)
|
||||
{
|
||||
// Feeling lazy
|
||||
return true;
|
||||
}
|
||||
|
255
hardware/arduino/avr/libraries/GSM/GSM3MobileMockupProvider.h
Normal file
255
hardware/arduino/avr/libraries/GSM/GSM3MobileMockupProvider.h
Normal file
@ -0,0 +1,255 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3MOBILEMOCKUPPROVIDER_
|
||||
#define _GSM3MOBILEMOCKUPPROVIDER_
|
||||
|
||||
#include <GSM3MobileNetworkProvider.h>
|
||||
#include <GSM3MobileVoiceProvider.h>
|
||||
|
||||
class GSM3MobileMockupProvider: public GSM3MobileNetworkProvider
|
||||
{
|
||||
private:
|
||||
// Introducing this status is quite "heavy". But something like this should
|
||||
// be added to ShieldV1. Or not.
|
||||
// Note, in ShieldV1 there is no "RECEIVINGSMS" status.
|
||||
enum GSM3_modemlinest_e { IDLE, WAITINGANSWER, SENDINGSMS};
|
||||
GSM3_modemlinest_e lineStatus;
|
||||
char* msgExample;
|
||||
int msgIndex;
|
||||
|
||||
public:
|
||||
|
||||
/** Minimum socket
|
||||
@return 1
|
||||
*/
|
||||
inline int minSocket(){return 1;};
|
||||
|
||||
/** Maximum socket
|
||||
@return 8
|
||||
*/
|
||||
inline int maxSocket(){return 8;};
|
||||
|
||||
/** Constructor */
|
||||
GSM3MobileMockupProvider();
|
||||
|
||||
/** Get network status
|
||||
@return network status
|
||||
*/
|
||||
inline GSM3_NetworkStatus_t getStatus(){return ERROR;};
|
||||
|
||||
/** Get voice call status
|
||||
@return call status
|
||||
*/
|
||||
inline GSM3_voiceCall_st getvoiceCallStatus(){return IDLE_CALL;};
|
||||
|
||||
/** Get last command status
|
||||
@return Returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
int ready();
|
||||
inline void closeCommand(int code){};
|
||||
|
||||
//Configuration functions.
|
||||
|
||||
/** Begin connection
|
||||
@param pin PIN code
|
||||
@return
|
||||
*/
|
||||
int begin(char* pin=0);
|
||||
|
||||
/** Check if is modem alive
|
||||
@return 0
|
||||
*/
|
||||
inline int isModemAlive(){return 0;};
|
||||
|
||||
/** Shutdown the modem (power off really)
|
||||
@return true if successful
|
||||
*/
|
||||
inline bool shutdown(){return false;};
|
||||
|
||||
//Call functions
|
||||
|
||||
/** Launch a voice call
|
||||
@param number Phone number to be called
|
||||
@return If asynchronous, returns 0. If synchronous, 1 if success, other if error
|
||||
*/
|
||||
inline int voiceCall(const char* number){return 0;};
|
||||
|
||||
/** Answer a voice call
|
||||
@return If asynchronous, returns 0. If synchronous, 1 if success, other if error
|
||||
*/
|
||||
inline int answerCall(){return 0;};
|
||||
|
||||
/** Hang a voice call
|
||||
@return If asynchronous, returns 0. If synchronous, 1 if success, other if error
|
||||
*/
|
||||
inline int hangCall(){return 0;};
|
||||
|
||||
/** Retrieve phone number of caller
|
||||
@param buffer Buffer for copy phone number
|
||||
@param bufsize Buffer size
|
||||
@return If asynchronous, returns 0. If synchronous, 1 if success, other if error
|
||||
*/
|
||||
inline int retrieveCallingNumber(char* buffer, int*& bufsize){return 0;};
|
||||
|
||||
// SMS functions
|
||||
|
||||
/** Begin a SMS to send it
|
||||
@param number Destination
|
||||
@return error command if it exists
|
||||
*/
|
||||
int beginSMS(const char* number);
|
||||
|
||||
/** End SMS
|
||||
@return error command if it exists
|
||||
*/
|
||||
int endSMS();
|
||||
|
||||
/** Check if SMS available and prepare it to be read
|
||||
@return error command if it exists
|
||||
*/
|
||||
int availableSMS();
|
||||
|
||||
/** Read a byte but do not advance the buffer header (circular buffer)
|
||||
@return character
|
||||
*/
|
||||
int peek();
|
||||
|
||||
/** Delete the SMS from Modem memory and proccess answer
|
||||
*/
|
||||
void flushSMS();
|
||||
|
||||
/** Read sender number phone
|
||||
@param number Buffer for save number phone
|
||||
@param nlength Buffer length
|
||||
@return 1 success, >1 error
|
||||
*/
|
||||
int remoteSMSNumber(char* number, int nlength);
|
||||
|
||||
/** Read one char for SMS buffer (advance circular buffer)
|
||||
@return character
|
||||
*/
|
||||
int readSMS();
|
||||
|
||||
/** Write a SMS character by character
|
||||
@param c Character
|
||||
*/
|
||||
void writeSMS(char c);
|
||||
|
||||
// Socket functions
|
||||
|
||||
/** Connect to a remote TCP server
|
||||
@param server String with IP or server name
|
||||
@param port Remote port number
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
int connectTCPClient(const char* server, int port, int id_socket);
|
||||
|
||||
// Attention to parameter rewriting in ShieldV1
|
||||
/** Write buffer information into a socket
|
||||
@param buf Buffer
|
||||
@param size Buffer size
|
||||
@param idsocket Socket
|
||||
*/
|
||||
void writeSocket(const uint8_t *buf, size_t size, int idsocket);
|
||||
|
||||
// ShieldV1 will have two reading mechanisms:
|
||||
// Mechanism 1: Call AT+QIRD for size bytes. Put them in the circular buffer,
|
||||
// fill buf. Take care to xon/xoff effect, as we may copy just a part of the
|
||||
// incoming bytes.
|
||||
/** Read socket and put information in a buffer
|
||||
@param buf Buffer
|
||||
@param size Buffer size
|
||||
@param idsocket Socket
|
||||
@return
|
||||
*/
|
||||
int readSocket(uint8_t *buf, size_t size, int idsocket);
|
||||
|
||||
// Mechanism 2 in ShieldV1:
|
||||
// When called "available()" or "read()" reuse readSocket code to execute
|
||||
// QIRD SYNCHRONOUSLY. Ask the modem for 1500 bytes but do not copy them anywhere,
|
||||
// leave data in the circular buffer. Put buffer head at the start of received data.
|
||||
// Peek() will get a character but will not advance the buffer head.
|
||||
// Read() will get one character. XON/XOFF will take care of buffer filling
|
||||
// If Read() gets to the end of the QIRD response, execute again QIRD SYNCHRONOUSLY
|
||||
// If the user executes flush(), execute read() until there is nothing more to read()
|
||||
// (the modem gives no way to empty the socket of incoming data)
|
||||
|
||||
/** Check if there are data to be read in socket.
|
||||
@param idsocket Local socket number
|
||||
@return 0 if command running, 1 if there are data available, 4 if no data, otherwise error
|
||||
*/
|
||||
int availableSocket(int idsocket);
|
||||
|
||||
/** Read data (get a character) available in socket
|
||||
@param idsocket Socket
|
||||
@param advance Determines if advance the buffer head
|
||||
@return character
|
||||
*/
|
||||
int readSocket(int idsocket, bool advance=true);
|
||||
|
||||
/** Flush socket
|
||||
@param idsocket Socket
|
||||
*/
|
||||
void flushSocket(int idsocket);
|
||||
|
||||
// This is the same in ShieldV1
|
||||
/** Close a socket
|
||||
@param idsocket Socket
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
int disconnectTCP(int idsocket);
|
||||
|
||||
// TCP Server. Attention. Changing the int*&. We'll receive a buffer for the IP
|
||||
// If the pointer ins NULL just forget it
|
||||
// I think that opening a server does not occupy a socket. Is that true?
|
||||
/** Establish a TCP connection
|
||||
@param port Port
|
||||
@param localIP IP address
|
||||
@param localIPlength IP address size in characters
|
||||
@return command error if exists
|
||||
*/
|
||||
int connectTCPServer(int port, char* localIP, int* localIPlength);
|
||||
|
||||
// Modem sockets status. Return TRUE if the modem thinks the socket is occupied.
|
||||
// This should be detected through an unrequisited response
|
||||
/** Get modem status
|
||||
@param s Socket
|
||||
@return modem status (true if connected)
|
||||
*/
|
||||
bool getSocketModemStatus(uint8_t s);
|
||||
|
||||
|
||||
};
|
||||
#endif
|
@ -0,0 +1,72 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#include <GSM3MobileNetworkProvider.h>
|
||||
#include <HardwareSerial.h>
|
||||
|
||||
GSM3MobileNetworkProvider* theProvider;
|
||||
|
||||
GSM3MobileNetworkProvider::GSM3MobileNetworkProvider()
|
||||
{
|
||||
socketsAsServer=0x0000;
|
||||
};
|
||||
|
||||
|
||||
int GSM3MobileNetworkProvider::getNewOccupiedSocketAsServer()
|
||||
{
|
||||
int i;
|
||||
for(i=minSocketAsServer(); i<=maxSocketAsServer(); i++)
|
||||
{
|
||||
if ((!(socketsAsServer&(0x0001<<i))) && getSocketAsServerModemStatus(i))
|
||||
{
|
||||
socketsAsServer|=((0x0001)<<i);
|
||||
//Serial.print("New occupied=");Serial.println(i);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
//Serial.println("No new occupied");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
bool GSM3MobileNetworkProvider::getStatusSocketAsServer(uint8_t socket)
|
||||
{
|
||||
if(socketsAsServer&(0x0001<<socket))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
136
hardware/arduino/avr/libraries/GSM/GSM3MobileNetworkProvider.h
Normal file
136
hardware/arduino/avr/libraries/GSM/GSM3MobileNetworkProvider.h
Normal file
@ -0,0 +1,136 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3MOBILENETWORKPROVIDER_
|
||||
#define _GSM3MOBILENETWORKPROVIDER_
|
||||
|
||||
#include <GSM3MobileAccessProvider.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
#include <IPAddress.h>
|
||||
|
||||
class GSM3MobileNetworkProvider
|
||||
{
|
||||
private:
|
||||
|
||||
/** Restart hardware
|
||||
@return 1 if successful
|
||||
*/
|
||||
int HWrestart();
|
||||
|
||||
uint16_t socketsAsServer; // Server socket
|
||||
|
||||
/** Get modem status
|
||||
@param s Socket
|
||||
@return modem status (true if connected)
|
||||
*/
|
||||
virtual inline bool getSocketAsServerModemStatus(int s){return false;};
|
||||
|
||||
public:
|
||||
|
||||
/** minSocketAsServer
|
||||
@return 0
|
||||
*/
|
||||
virtual inline int minSocketAsServer(){return 0;};
|
||||
|
||||
/** maxSocketAsServer
|
||||
@return 0
|
||||
*/
|
||||
virtual inline int maxSocketAsServer(){return 0;};
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
virtual int ready()=0;
|
||||
|
||||
/** Constructor */
|
||||
GSM3MobileNetworkProvider();
|
||||
|
||||
/** Get network status
|
||||
@return network status
|
||||
*/
|
||||
virtual inline GSM3_NetworkStatus_t getStatus(){return ERROR;};
|
||||
|
||||
/** Get socket client status
|
||||
@param socket Socket
|
||||
@return 1 if connected, 0 otherwise
|
||||
*/
|
||||
bool getStatusSocketClient(uint8_t socket);
|
||||
|
||||
/** Close a AT command
|
||||
@param code Close code
|
||||
*/
|
||||
virtual inline void closeCommand(int code){};
|
||||
|
||||
/** Establish a TCP connection
|
||||
@param port Port
|
||||
@param localIP IP address
|
||||
@param localIPlength IP address size in characters
|
||||
@return command error if exists
|
||||
*/
|
||||
virtual inline int connectTCPServer(int port, char* localIP, int localIPlength){return 0;};
|
||||
|
||||
/** Get local IP address
|
||||
@param LocalIP Buffer for save IP address
|
||||
@param LocalIPlength Buffer size
|
||||
*/
|
||||
virtual inline int getIP(char* LocalIP, int LocalIPlength){return 0;};
|
||||
|
||||
/** Get new occupied socket
|
||||
@return -1 if no new socket has been occupied
|
||||
*/
|
||||
int getNewOccupiedSocketAsServer();
|
||||
|
||||
/** Get socket status as server
|
||||
@param socket Socket to get status
|
||||
@return socket status
|
||||
*/
|
||||
bool getStatusSocketAsServer(uint8_t socket);
|
||||
|
||||
/** Close a socket
|
||||
@param client1Server0 1 if modem acts as client, 0 if acts as server
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
int disconnectTCP(bool client1Server0, int idsocket){return 1;};
|
||||
|
||||
/** Release socket
|
||||
@param socket Socket
|
||||
*/
|
||||
void releaseSocket(int socket){};
|
||||
|
||||
};
|
||||
|
||||
extern GSM3MobileNetworkProvider* theProvider;
|
||||
|
||||
#endif
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#include <GSM3MobileNetworkRegistry.h>
|
||||
|
||||
GSM3MobileNetworkRegistry::GSM3MobileNetworkRegistry()
|
||||
{
|
||||
theProvider=0;
|
||||
};
|
||||
|
||||
void GSM3MobileNetworkRegistry::registerMobileNetworkProvider(GSM3MobileNetworkProvider* provider)
|
||||
{
|
||||
theProvider=provider;
|
||||
}
|
||||
|
||||
GSM3MobileNetworkProvider* GSM3MobileNetworkRegistry::getMobileNetworkProvider()
|
||||
{
|
||||
return theProvider;
|
||||
}
|
||||
|
||||
GSM3MobileNetworkRegistry theMobileNetworkRegistry;
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3MOBILENETWORKREGISTRY_
|
||||
#define _GSM3MOBILENETWORKREGISTRY_
|
||||
#include <GSM3MobileNetworkProvider.h>
|
||||
|
||||
class GSM3MobileNetworkRegistry
|
||||
{
|
||||
private:
|
||||
|
||||
GSM3MobileNetworkProvider* theProvider; // Network provider
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
GSM3MobileNetworkRegistry();
|
||||
|
||||
/** Register in mobile network provider
|
||||
@param provider Provider
|
||||
*/
|
||||
void registerMobileNetworkProvider(GSM3MobileNetworkProvider* provider);
|
||||
|
||||
/** Returns network provider object pointer
|
||||
@return mobile network provider
|
||||
*/
|
||||
GSM3MobileNetworkProvider* getMobileNetworkProvider();
|
||||
|
||||
};
|
||||
|
||||
extern GSM3MobileNetworkRegistry theMobileNetworkRegistry;
|
||||
|
||||
#endif
|
@ -0,0 +1,3 @@
|
||||
#include <GSM3MobileSMSProvider.h>
|
||||
|
||||
GSM3MobileSMSProvider* theGSM3SMSProvider;
|
91
hardware/arduino/avr/libraries/GSM/GSM3MobileSMSProvider.h
Normal file
91
hardware/arduino/avr/libraries/GSM/GSM3MobileSMSProvider.h
Normal file
@ -0,0 +1,91 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3MOBILESMSPROVIDER_
|
||||
#define _GSM3MOBILESMSPROVIDER_
|
||||
|
||||
class GSM3MobileSMSProvider
|
||||
{
|
||||
public:
|
||||
|
||||
/** Begin a SMS to send it
|
||||
@param to Destination
|
||||
@return error command if it exists
|
||||
*/
|
||||
virtual inline int beginSMS(const char* to){return 0;};
|
||||
|
||||
/** Write a SMS character by character
|
||||
@param c Character
|
||||
*/
|
||||
virtual inline void writeSMS(const char c){};
|
||||
|
||||
/** End SMS
|
||||
@return error command if it exists
|
||||
*/
|
||||
virtual inline int endSMS(){return 0;};
|
||||
|
||||
/** Check if SMS available and prepare it to be read
|
||||
@return number of bytes in a received SMS
|
||||
*/
|
||||
virtual inline int availableSMS(){return 0;};
|
||||
|
||||
/** Read a byte but do not advance the buffer header (circular buffer)
|
||||
@return character
|
||||
*/
|
||||
virtual inline int peekSMS(){return 0;};
|
||||
|
||||
/** Delete the SMS from Modem memory and proccess answer
|
||||
*/
|
||||
virtual inline void flushSMS(){return;};
|
||||
|
||||
/** Read sender number phone
|
||||
@param number Buffer for save number phone
|
||||
@param nlength Buffer length
|
||||
@return 1 success, >1 error
|
||||
*/
|
||||
virtual inline int remoteSMSNumber(char* number, int nlength){return 0;};
|
||||
|
||||
/** Read one char for SMS buffer (advance circular buffer)
|
||||
@return character
|
||||
*/
|
||||
virtual inline int readSMS(){return 0;};
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
virtual int ready()=0;
|
||||
};
|
||||
|
||||
extern GSM3MobileSMSProvider* theGSM3SMSProvider;
|
||||
|
||||
#endif
|
@ -0,0 +1,5 @@
|
||||
#include <GSM3MobileServerProvider.h>
|
||||
|
||||
GSM3MobileServerProvider* theGSM3MobileServerProvider;
|
||||
|
||||
|
@ -0,0 +1,95 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef __GSM3_MOBILESERVERPROVIDER__
|
||||
#define __GSM3_MOBILESERVERPROVIDER__
|
||||
|
||||
|
||||
#include <GSM3MobileAccessProvider.h>
|
||||
#include <inttypes.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
class GSM3MobileServerProvider
|
||||
{
|
||||
/** Get socket status
|
||||
@param s Socket
|
||||
@return modem status (true if connected)
|
||||
*/
|
||||
virtual bool getSocketAsServerModemStatus(int s)=0;
|
||||
|
||||
public:
|
||||
|
||||
/** minSocketAsServer
|
||||
@return socket
|
||||
*/
|
||||
virtual int minSocketAsServer()=0;
|
||||
|
||||
/** maxSocketAsServer
|
||||
@return socket
|
||||
*/
|
||||
virtual int maxSocketAsServer()=0;
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
virtual int ready()=0;
|
||||
|
||||
/** Constructor */
|
||||
GSM3MobileServerProvider(){};
|
||||
|
||||
/** Connect server to TCP port
|
||||
@param port TCP port
|
||||
@return command error if exists
|
||||
*/
|
||||
virtual int connectTCPServer(int port)=0;
|
||||
//virtual int getIP(char* LocalIP, int LocalIPlength)=0;
|
||||
|
||||
/** Get new occupied socket as server
|
||||
@return return -1 if no new socket has been occupied
|
||||
*/
|
||||
virtual int getNewOccupiedSocketAsServer()=0;
|
||||
|
||||
/** Get socket status
|
||||
@param socket Socket
|
||||
@return socket status (true if connected)
|
||||
*/
|
||||
virtual bool getStatusSocketAsServer(uint8_t socket)=0;
|
||||
|
||||
// virtual int disconnectTCP(bool client1Server0, int idsocket)=0;
|
||||
|
||||
};
|
||||
|
||||
extern GSM3MobileServerProvider* theGSM3MobileServerProvider;
|
||||
|
||||
#endif
|
159
hardware/arduino/avr/libraries/GSM/GSM3MobileServerService.cpp
Normal file
159
hardware/arduino/avr/libraries/GSM/GSM3MobileServerService.cpp
Normal file
@ -0,0 +1,159 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#include <GSM3MobileServerService.h>
|
||||
#include <GSM3MobileServerProvider.h>
|
||||
#include <GSM3MobileClientProvider.h>
|
||||
|
||||
|
||||
#define __TOUTSERVER__ 10000
|
||||
#define BUFFERSIZETWEET 100
|
||||
|
||||
#define GSM3MOBILESERVERSERVICE_SYNCH 0x01 // 1: TRUE, compatible with other clients 0: FALSE
|
||||
|
||||
// While there is only a shield (ShieldV1) we will include it by default
|
||||
#include <GSM3ShieldV1ServerProvider.h>
|
||||
GSM3ShieldV1ServerProvider theShieldV1ServerProvider;
|
||||
|
||||
|
||||
GSM3MobileServerService::GSM3MobileServerService(uint8_t port, bool synch)
|
||||
{
|
||||
mySocket=0;
|
||||
_port=port;
|
||||
flags = 0;
|
||||
|
||||
// If synchronous
|
||||
if(synch)
|
||||
flags |= GSM3MOBILESERVERSERVICE_SYNCH;
|
||||
}
|
||||
|
||||
// Returns 0 if last command is still executing
|
||||
// 1 if success
|
||||
// >1 if error
|
||||
int GSM3MobileServerService::ready()
|
||||
{
|
||||
return theGSM3MobileServerProvider->ready();
|
||||
}
|
||||
|
||||
void GSM3MobileServerService::begin()
|
||||
{
|
||||
if(theGSM3MobileServerProvider==0)
|
||||
return;
|
||||
theGSM3MobileServerProvider->connectTCPServer(_port);
|
||||
|
||||
if(flags & GSM3MOBILESERVERSERVICE_SYNCH)
|
||||
waitForAnswer();
|
||||
}
|
||||
|
||||
GSM3MobileClientService GSM3MobileServerService::available(bool synch)
|
||||
{
|
||||
int newSocket;
|
||||
// In case we are debugging, we'll need to force a look at the buffer
|
||||
ready();
|
||||
|
||||
newSocket=theGSM3MobileServerProvider->getNewOccupiedSocketAsServer();
|
||||
|
||||
// Instatiate new client. If we are synch, the client is synchronous/blocking
|
||||
GSM3MobileClientService client((uint8_t)(newSocket), (flags & GSM3MOBILESERVERSERVICE_SYNCH));
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
size_t GSM3MobileServerService::write(uint8_t c)
|
||||
{
|
||||
// Adapt to the new, lean implementation
|
||||
// theGSM3MobileServerProvider->writeSocket(c);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void GSM3MobileServerService::beginWrite()
|
||||
{
|
||||
// Adapt to the new, lean implementation
|
||||
// theGSM3MobileServerProvider->beginWriteSocket(local1Remote0, mySocket);
|
||||
}
|
||||
|
||||
size_t GSM3MobileServerService::write(const uint8_t* buf)
|
||||
{
|
||||
// Adapt to the new, lean implementation
|
||||
// theGSM3MobileServerProvider->writeSocket((const char*)(buf));
|
||||
return strlen((const char*)buf);
|
||||
}
|
||||
|
||||
size_t GSM3MobileServerService::write(const uint8_t* buf, size_t sz)
|
||||
{
|
||||
// Adapt to the new, lean implementation
|
||||
// theGSM3MobileServerProvider->writeSocket((const char*)(buf));
|
||||
}
|
||||
|
||||
void GSM3MobileServerService::endWrite()
|
||||
{
|
||||
// Adapt to the new, lean implementation
|
||||
// theGSM3MobileServerProvider->endWriteSocket();
|
||||
}
|
||||
|
||||
void GSM3MobileServerService::stop()
|
||||
{
|
||||
|
||||
// Review, should be the server?
|
||||
theGSM3MobileClientProvider->disconnectTCP(local1Remote0, mySocket);
|
||||
if(flags & GSM3MOBILESERVERSERVICE_SYNCH)
|
||||
waitForAnswer();
|
||||
theGSM3MobileClientProvider->releaseSocket(mySocket);
|
||||
mySocket = -1;
|
||||
}
|
||||
|
||||
|
||||
/*int GSM3MobileServerService::getIP(char* LocalIP, int LocalIPlength)
|
||||
{
|
||||
return theGSM3MobileServerProvider->getIP(LocalIP, LocalIPlength);
|
||||
}*/
|
||||
|
||||
int GSM3MobileServerService::waitForAnswer()
|
||||
{
|
||||
unsigned long m;
|
||||
m=millis();
|
||||
int res;
|
||||
|
||||
while(((millis()-m)< __TOUTSERVER__ )&&(ready()==0))
|
||||
delay(10);
|
||||
|
||||
res=ready();
|
||||
|
||||
// If we get something different from a 1, we are having a problem
|
||||
if(res!=1)
|
||||
res=0;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
124
hardware/arduino/avr/libraries/GSM/GSM3MobileServerService.h
Normal file
124
hardware/arduino/avr/libraries/GSM/GSM3MobileServerService.h
Normal file
@ -0,0 +1,124 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3MOBILESERVERSERVICE_
|
||||
#define _GSM3MOBILESERVERSERVICE_
|
||||
|
||||
#include <GSM3MobileNetworkProvider.h>
|
||||
#include <GSM3MobileClientService.h>
|
||||
#include <Server.h>
|
||||
|
||||
class GSM3MobileServerService : public Server
|
||||
{
|
||||
private:
|
||||
|
||||
uint8_t _port; // Port
|
||||
uint8_t mySocket; // Actual socket
|
||||
uint8_t flags;
|
||||
bool local1Remote0;
|
||||
|
||||
/** Internal utility, used in synchronous calls
|
||||
@return operation result, 1 if success, 0 otherwise
|
||||
*/
|
||||
int waitForAnswer();
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor
|
||||
@param port Port
|
||||
@param synch True if the server acts synchronously
|
||||
*/
|
||||
GSM3MobileServerService(uint8_t port, bool synch=true);
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
int ready();
|
||||
|
||||
/** Initialize server
|
||||
*/
|
||||
void begin();
|
||||
|
||||
/** Check if there is an incoming client request
|
||||
@param synch If true, the returned client is synchronous or
|
||||
blocking.
|
||||
@return Client if successful, else error
|
||||
*/
|
||||
GSM3MobileClientService available(bool synch=true);
|
||||
|
||||
// Just to keep in line with Ethernet.
|
||||
// Write to every open socket...
|
||||
//void write(uint8_t);
|
||||
//void write(const uint8_t *buf, size_t size);
|
||||
|
||||
/** Begin write in socket
|
||||
*/
|
||||
void beginWrite();
|
||||
|
||||
/** Write character in socket
|
||||
@param c Character
|
||||
@return size
|
||||
*/
|
||||
size_t write(uint8_t c);
|
||||
|
||||
/** Write buffer in socket
|
||||
@param buf Buffer
|
||||
@return size
|
||||
*/
|
||||
size_t write(const uint8_t *buf);
|
||||
|
||||
/** Write buffer in socket with size
|
||||
@param buf Buffer
|
||||
@param sz Buffer size
|
||||
@return size
|
||||
*/
|
||||
size_t write(const uint8_t *buf, size_t sz);
|
||||
|
||||
/** End write in socket
|
||||
*/
|
||||
void endWrite();
|
||||
|
||||
/** Stop server
|
||||
*/
|
||||
void stop();
|
||||
|
||||
// we take this function out as IPAddress is complex to bring to
|
||||
// version 1.
|
||||
// inline int connect(IPAddress ip, uint16_t port){return 0;};
|
||||
// Returns 2 if there are no resources
|
||||
//int getIP(char* LocalIP, int LocalIPlength);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,4 @@
|
||||
#include <GSM3MobileVoiceProvider.h>
|
||||
|
||||
|
||||
GSM3MobileVoiceProvider* theGSM3MobileVoiceProvider;
|
90
hardware/arduino/avr/libraries/GSM/GSM3MobileVoiceProvider.h
Normal file
90
hardware/arduino/avr/libraries/GSM/GSM3MobileVoiceProvider.h
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3MOBILEVOICEPROVIDER_
|
||||
#define _GSM3MOBILEVOICEPROVIDER_
|
||||
|
||||
enum GSM3_voiceCall_st { IDLE_CALL, CALLING, RECEIVINGCALL, TALKING};
|
||||
|
||||
class GSM3MobileVoiceProvider
|
||||
{
|
||||
public:
|
||||
|
||||
/** Initialize the object relating it to the general infrastructure
|
||||
@param
|
||||
@return void
|
||||
*/
|
||||
virtual void initialize(){};
|
||||
|
||||
/** Launch a voice call
|
||||
@param number Phone number to be called
|
||||
@return If asynchronous, returns 0. If synchronous, 1 if success, other if error
|
||||
*/
|
||||
virtual int voiceCall(const char* number)=0;
|
||||
|
||||
/** Answer a voice call
|
||||
@return If asynchronous, returns 0. If synchronous, 1 if success, other if error
|
||||
*/
|
||||
virtual int answerCall()=0;
|
||||
|
||||
/** Hang a voice call
|
||||
@return If asynchronous, returns 0. If synchronous, 1 if success, other if error
|
||||
*/
|
||||
virtual int hangCall()=0;
|
||||
|
||||
/** Retrieve phone number of caller
|
||||
@param buffer Buffer for copy phone number
|
||||
@param bufsize Buffer size
|
||||
@return If asynchronous, returns 0. If synchronous, 1 if success, other if error
|
||||
*/
|
||||
virtual int retrieveCallingNumber(char* buffer, int bufsize)=0;
|
||||
|
||||
/** Returns voice call status
|
||||
@return voice call status
|
||||
*/
|
||||
virtual GSM3_voiceCall_st getvoiceCallStatus()=0;
|
||||
|
||||
/** Set voice call status
|
||||
@param status New status for voice call
|
||||
*/
|
||||
virtual void setvoiceCallStatus(GSM3_voiceCall_st status)=0;
|
||||
|
||||
/** Get last command status
|
||||
@return Returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
virtual int ready()=0;
|
||||
};
|
||||
|
||||
extern GSM3MobileVoiceProvider* theGSM3MobileVoiceProvider;
|
||||
|
||||
#endif
|
126
hardware/arduino/avr/libraries/GSM/GSM3SMSService.cpp
Normal file
126
hardware/arduino/avr/libraries/GSM/GSM3SMSService.cpp
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#include <GSM3SMSService.h>
|
||||
#include <GSM3MobileNetworkProvider.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
// While there is only a shield (ShieldV1) we will include it by default
|
||||
#include <GSM3ShieldV1SMSProvider.h>
|
||||
GSM3ShieldV1SMSProvider theShieldV1SMSProvider;
|
||||
|
||||
#define GSM3SMSSERVICE_SYNCH 0x01 // 1: synchronous 0: asynchronous
|
||||
#define __TOUT__ 10000
|
||||
|
||||
|
||||
GSM3SMSService::GSM3SMSService(bool synch)
|
||||
{
|
||||
if(synch)
|
||||
flags |= GSM3SMSSERVICE_SYNCH;
|
||||
}
|
||||
|
||||
// Returns 0 if last command is still executing
|
||||
// 1 if success
|
||||
// >1 if error
|
||||
int GSM3SMSService::ready()
|
||||
{
|
||||
return theGSM3SMSProvider->ready();
|
||||
}
|
||||
|
||||
int GSM3SMSService::beginSMS(const char *number)
|
||||
{
|
||||
return waitForAnswerIfNeeded(theGSM3SMSProvider->beginSMS(number));
|
||||
};
|
||||
|
||||
int GSM3SMSService::endSMS()
|
||||
{
|
||||
return waitForAnswerIfNeeded(theGSM3SMSProvider->endSMS());
|
||||
};
|
||||
|
||||
size_t GSM3SMSService::write(uint8_t c)
|
||||
{
|
||||
theGSM3SMSProvider->writeSMS(c);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void GSM3SMSService::flush()
|
||||
{
|
||||
theGSM3SMSProvider->flushSMS();
|
||||
waitForAnswerIfNeeded(1);
|
||||
};
|
||||
|
||||
int GSM3SMSService::available()
|
||||
{
|
||||
return waitForAnswerIfNeeded(theGSM3SMSProvider->availableSMS());
|
||||
};
|
||||
|
||||
int GSM3SMSService::remoteNumber(char* number, int nlength)
|
||||
{
|
||||
return theGSM3SMSProvider->remoteSMSNumber(number, nlength);
|
||||
|
||||
}
|
||||
|
||||
int GSM3SMSService::read()
|
||||
{
|
||||
return theGSM3SMSProvider->readSMS();
|
||||
};
|
||||
int GSM3SMSService::peek()
|
||||
{
|
||||
return theGSM3SMSProvider->peekSMS();
|
||||
};
|
||||
|
||||
int GSM3SMSService::waitForAnswerIfNeeded(int returnvalue)
|
||||
{
|
||||
// If synchronous
|
||||
if(flags & GSM3SMSSERVICE_SYNCH )
|
||||
{
|
||||
unsigned long m;
|
||||
m=millis();
|
||||
// Wait for __TOUT__
|
||||
while(((millis()-m)< __TOUT__ )&&(ready()==0))
|
||||
delay(100);
|
||||
// If everything was OK, return 1
|
||||
// else (timeout or error codes) return 0;
|
||||
if(ready()==1)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
// If not synchronous just kick ahead the coming result
|
||||
return ready();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
110
hardware/arduino/avr/libraries/GSM/GSM3SMSService.h
Normal file
110
hardware/arduino/avr/libraries/GSM/GSM3SMSService.h
Normal file
@ -0,0 +1,110 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3SMSSERVICE_
|
||||
#define _GSM3SMSSERVICE_
|
||||
|
||||
#include <GSM3MobileSMSProvider.h>
|
||||
#include <Stream.h>
|
||||
|
||||
class GSM3SMSService : public Stream
|
||||
{
|
||||
private:
|
||||
|
||||
uint8_t flags;
|
||||
|
||||
/** Makes synchronous the functions, if needed
|
||||
@param returnvalue Return value
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
int waitForAnswerIfNeeded(int returnvalue);
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor
|
||||
@param synch Determines sync mode
|
||||
*/
|
||||
GSM3SMSService(bool synch=true);
|
||||
|
||||
/** Write a character in SMS message
|
||||
@param c Character
|
||||
@return size
|
||||
*/
|
||||
size_t write(uint8_t c);
|
||||
|
||||
/** Begin a SMS to send it
|
||||
@param to Destination
|
||||
@return error command if it exists
|
||||
*/
|
||||
int beginSMS(const char* to);
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
int ready();
|
||||
|
||||
/** End SMS
|
||||
@return error command if it exists
|
||||
*/
|
||||
int endSMS();
|
||||
|
||||
/** Check if SMS available and prepare it to be read
|
||||
@return number of bytes in a received SMS
|
||||
*/
|
||||
int available();
|
||||
|
||||
/** Read sender number phone
|
||||
@param number Buffer for save number phone
|
||||
@param nlength Buffer length
|
||||
@return 1 success, >1 error
|
||||
*/
|
||||
int remoteNumber(char* number, int nlength);
|
||||
|
||||
/** Read one char for SMS buffer (advance circular buffer)
|
||||
@return byte
|
||||
*/
|
||||
int read();
|
||||
|
||||
/** Read a byte but do not advance the buffer header (circular buffer)
|
||||
@return byte
|
||||
*/
|
||||
int peek();
|
||||
|
||||
/** Delete the SMS from Modem memory and proccess answer
|
||||
*/
|
||||
void flush();
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
96
hardware/arduino/avr/libraries/GSM/GSM3ShieldV1.cpp
Normal file
96
hardware/arduino/avr/libraries/GSM/GSM3ShieldV1.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#include <GSM3ShieldV1.h>
|
||||
#include <HardwareSerial.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
#define __RESETPIN__ 7
|
||||
#define __TOUTLOCALCOMS__ 500
|
||||
#define __TOUTSHUTDOWN__ 5000
|
||||
#define __TOUTMODEMCONFIGURATION__ 5000//equivalent to 30000 because of time in interrupt routine.
|
||||
#define __TOUTAT__ 1000
|
||||
#define __TOUTSMS__ 7000
|
||||
#define __TOUTCALL__ 15000
|
||||
#define __TOUTGPRS__ 10000
|
||||
#define __NCLIENTS_MAX__ 3
|
||||
|
||||
//Constructor.
|
||||
GSM3ShieldV1::GSM3ShieldV1(bool db)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(1);
|
||||
socketsAccepted=0;
|
||||
theGSM3ShieldV1ModemCore.registerUMProvider(this);
|
||||
theProvider=this;
|
||||
}
|
||||
|
||||
//Response management.
|
||||
void GSM3ShieldV1::manageResponse(byte from, byte to)
|
||||
{
|
||||
switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
|
||||
{
|
||||
case NONE:
|
||||
theGSM3ShieldV1ModemCore.gss.cb.deleteToTheEnd(from);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Function for 2 sec delay inside an interruption.
|
||||
void GSM3ShieldV1::delayInsideInterrupt2seg()
|
||||
{
|
||||
for (int k=0;k<40;k++) theGSM3ShieldV1ModemCore.gss.tunedDelay(50000);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////UNSOLICITED RESULT CODE (URC) FUNCTIONS///////////////////////////////////////////////////////////////////
|
||||
|
||||
//URC recognize.
|
||||
bool GSM3ShieldV1::recognizeUnsolicitedEvent(byte oldTail)
|
||||
{
|
||||
|
||||
int nlength;
|
||||
char auxLocate [15];
|
||||
//POWER DOWN.
|
||||
prepareAuxLocate(PSTR("POWER DOWN"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.gss.cb.flush();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
137
hardware/arduino/avr/libraries/GSM/GSM3ShieldV1.h
Normal file
137
hardware/arduino/avr/libraries/GSM/GSM3ShieldV1.h
Normal file
@ -0,0 +1,137 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef __GSM3_SHIELDV1__
|
||||
#define __GSM3_SHIELDV1__
|
||||
|
||||
#include <GSM3MobileNetworkProvider.h>
|
||||
#include <GSM3ShieldV1ModemCore.h>
|
||||
#include <GSM3ShieldV1BaseProvider.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
|
||||
class GSM3ShieldV1 : public GSM3MobileNetworkProvider, public GSM3ShieldV1BaseProvider
|
||||
{
|
||||
// General code, for modem management
|
||||
private:
|
||||
|
||||
/** Delay inside an interrupt (2 seconds)
|
||||
*/
|
||||
void delayInsideInterrupt2seg();
|
||||
|
||||
// Code for SMS Service
|
||||
private:
|
||||
|
||||
|
||||
long commandMillis;
|
||||
bool commandSent;
|
||||
|
||||
const char* pinConfig; //PIN.
|
||||
char* accessPoint; //APN.
|
||||
char* userName; //User.
|
||||
char* passw; //Password.
|
||||
const char* remoteID; //Server.
|
||||
|
||||
char* dataSocket; //Data socket.
|
||||
int local_Port; //Local Port.
|
||||
char* local_IP; //Local IP.
|
||||
int local_IP_Length; //Local IP length.
|
||||
|
||||
|
||||
int socketDataSize; //Size of socket data to be read.
|
||||
int socketDataSizeWritten; //Number of socket data written in buffer not to overflow the buffer
|
||||
|
||||
int socketsAccepted; //Status for remote clients accepted of closed.
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor **/
|
||||
GSM3ShieldV1(bool debug=false);
|
||||
|
||||
/** Manages modem response
|
||||
@param from Initial byte of buffer
|
||||
@param to Final byte of buffer
|
||||
*/
|
||||
void manageResponse(byte from, byte to);
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
int ready(){return GSM3ShieldV1BaseProvider::ready();};
|
||||
|
||||
/** Parse modem response
|
||||
@param rsp Returns true if expected response exists
|
||||
@param string1 Substring expected in response
|
||||
@param string2 Second substring expected in response
|
||||
@return true if parsed successful
|
||||
*/
|
||||
bool genericParse_rsp2(bool& rsp, char* string1, char* string2);
|
||||
|
||||
/** Recognize URC
|
||||
@param oldTail
|
||||
@return true if successful
|
||||
*/
|
||||
bool recognizeUnsolicitedEvent(byte oldTail);
|
||||
|
||||
/** Receive answer
|
||||
@return true if successful
|
||||
*/
|
||||
bool answerReceived();
|
||||
|
||||
/** Receive socket
|
||||
@param id_socket Socket ID
|
||||
@return true if successful
|
||||
*/
|
||||
bool socketReceived(int id_socket);
|
||||
|
||||
/** Update active ID sockets
|
||||
@param active Active sockets
|
||||
@param ID Id for update
|
||||
*/
|
||||
void update_activeIDsockets (bool active, int ID);
|
||||
|
||||
/** Assign ID to socket
|
||||
@param ID Id to assign to socket
|
||||
@return true if successful
|
||||
*/
|
||||
bool assignIDsocket (int& ID);
|
||||
|
||||
/** Close data socket
|
||||
@return true if successful
|
||||
*/
|
||||
bool closedDataSocket(); //Flag closed current data socket.
|
||||
|
||||
//bool writeIncomingCalls(char* bufferForCallerId) If isn't zero, doesn't wait calls
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,296 @@
|
||||
#include <GSM3ShieldV1AccessProvider.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
#define __RESETPIN__ 7
|
||||
#define __TOUTSHUTDOWN__ 5000
|
||||
#define __TOUTMODEMCONFIGURATION__ 5000//equivalent to 30000 because of time in interrupt routine.
|
||||
#define __TOUTAT__ 1000
|
||||
|
||||
char _command_AT[] PROGMEM = "AT";
|
||||
char _command_CGREG[] PROGMEM = "AT+CGREG?";
|
||||
|
||||
|
||||
GSM3ShieldV1AccessProvider::GSM3ShieldV1AccessProvider(bool debug)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setDebug(debug);
|
||||
|
||||
}
|
||||
|
||||
void GSM3ShieldV1AccessProvider::manageResponse(byte from, byte to)
|
||||
{
|
||||
switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
|
||||
{
|
||||
case MODEMCONFIG:
|
||||
ModemConfigurationContinue();
|
||||
break;
|
||||
case ALIVETEST:
|
||||
isModemAliveContinue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////CONFIGURATION FUNCTIONS///////////////////////////////////////////////////////////////////
|
||||
|
||||
// Begin
|
||||
// Restart or start the modem
|
||||
// May be synchronous
|
||||
GSM3_NetworkStatus_t GSM3ShieldV1AccessProvider::begin(char* pin, bool restart, bool synchronous)
|
||||
{
|
||||
pinMode(__RESETPIN__, OUTPUT);
|
||||
|
||||
// If asked for modem restart, restart
|
||||
if (restart)
|
||||
HWrestart();
|
||||
else
|
||||
HWstart();
|
||||
|
||||
theGSM3ShieldV1ModemCore.gss.begin(9600);
|
||||
// Launch modem configuration commands
|
||||
ModemConfiguration(pin);
|
||||
// If synchronous, wait till ModemConfiguration is over
|
||||
if(synchronous)
|
||||
{
|
||||
// if we shorten this delay, the command fails
|
||||
while(ready()==0)
|
||||
delay(1000);
|
||||
}
|
||||
return getStatus();
|
||||
}
|
||||
|
||||
//HWrestart.
|
||||
int GSM3ShieldV1AccessProvider::HWrestart()
|
||||
{
|
||||
|
||||
theGSM3ShieldV1ModemCore.setStatus(IDLE);
|
||||
digitalWrite(__RESETPIN__, HIGH);
|
||||
delay(12000);
|
||||
digitalWrite(__RESETPIN__, LOW);
|
||||
delay(1000);
|
||||
return 1; //configandwait(pin);
|
||||
}
|
||||
|
||||
//HWrestart.
|
||||
int GSM3ShieldV1AccessProvider::HWstart()
|
||||
{
|
||||
|
||||
theGSM3ShieldV1ModemCore.setStatus(IDLE);
|
||||
digitalWrite(__RESETPIN__, HIGH);
|
||||
delay(2000);
|
||||
digitalWrite(__RESETPIN__, LOW);
|
||||
//delay(1000);
|
||||
|
||||
return 1; //configandwait(pin);
|
||||
}
|
||||
|
||||
//Initial configuration main function.
|
||||
int GSM3ShieldV1AccessProvider::ModemConfiguration(char* pin)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setPhoneNumber(pin);
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,MODEMCONFIG);
|
||||
theGSM3ShieldV1ModemCore.setStatus(CONNECTING);
|
||||
ModemConfigurationContinue();
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
//Initial configuration continue function.
|
||||
void GSM3ShieldV1AccessProvider::ModemConfigurationContinue()
|
||||
{
|
||||
bool resp;
|
||||
|
||||
// 1: Send AT
|
||||
// 2: Wait AT OK and SetPin or CGREG
|
||||
// 3: Wait Pin OK and CGREG
|
||||
// 4: Wait CGREG and Flow SW control or CGREG
|
||||
// 5: Wait IFC OK and SMS Text Mode
|
||||
// 6: Wait SMS text Mode OK and Calling line identification
|
||||
// 7: Wait Calling Line Id OK and Echo off
|
||||
// 8: Wait for OK and COLP command for connecting line identification.
|
||||
// 9: Wait for OK.
|
||||
int ct=theGSM3ShieldV1ModemCore.getCommandCounter();
|
||||
if(ct==1)
|
||||
{
|
||||
// Launch AT
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_AT);
|
||||
}
|
||||
else if(ct==2)
|
||||
{
|
||||
// Wait for AT - OK.
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
if(resp)
|
||||
{
|
||||
// OK received
|
||||
if(theGSM3ShieldV1ModemCore.getPhoneNumber() && (theGSM3ShieldV1ModemCore.getPhoneNumber()[0]!=0))
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+CPIN="), false);
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(3);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rqc(theGSM3ShieldV1ModemCore.getPhoneNumber());
|
||||
}
|
||||
else
|
||||
{
|
||||
//DEBUG
|
||||
//Serial.println("AT+CGREG?");
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(4);
|
||||
theGSM3ShieldV1ModemCore.takeMilliseconds();
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_CGREG);
|
||||
}
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
else if(ct==3)
|
||||
{
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
if(resp)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(4);
|
||||
theGSM3ShieldV1ModemCore.takeMilliseconds();
|
||||
theGSM3ShieldV1ModemCore.delayInsideInterrupt(2000);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_CGREG);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
else if(ct==4)
|
||||
{
|
||||
char auxLocate1 [12];
|
||||
char auxLocate2 [12];
|
||||
prepareAuxLocate(PSTR("+CGREG: 0,1"), auxLocate1);
|
||||
prepareAuxLocate(PSTR("+CGREG: 0,5"), auxLocate2);
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, auxLocate1, auxLocate2))
|
||||
{
|
||||
if(resp)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(5);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+IFC=1,1"));
|
||||
}
|
||||
else
|
||||
{
|
||||
// If not, launch command again
|
||||
if(theGSM3ShieldV1ModemCore.takeMilliseconds() > __TOUTMODEMCONFIGURATION__)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.delayInsideInterrupt(2000);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_CGREG);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(ct==5)
|
||||
{
|
||||
// 5: Wait IFC OK
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
//Delay for SW flow control being active.
|
||||
theGSM3ShieldV1ModemCore.delayInsideInterrupt(2000);
|
||||
// 9: SMS Text Mode
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(6);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+CMGF=1"));
|
||||
}
|
||||
}
|
||||
else if(ct==6)
|
||||
{
|
||||
// 6: Wait SMS text Mode OK
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
//Calling line identification
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(7);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+CLIP=1"));
|
||||
}
|
||||
}
|
||||
else if(ct==7)
|
||||
{
|
||||
// 7: Wait Calling Line Id OK
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
// Echo off
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(8);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("ATE0"));
|
||||
}
|
||||
}
|
||||
else if(ct==8)
|
||||
{
|
||||
// 8: Wait ATEO OK, send COLP
|
||||
// In Arduino Mega, attention, take away the COLP step
|
||||
// It looks as we can only have 8 steps
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(9);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+COLP=1"));
|
||||
}
|
||||
}
|
||||
else if(ct==9)
|
||||
{
|
||||
// 9: Wait ATCOLP OK
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
if (resp)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setStatus(GSM_READY);
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Alive Test main function.
|
||||
int GSM3ShieldV1AccessProvider::isAccessAlive()
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setCommandError(0);
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(1);
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,ALIVETEST);
|
||||
isModemAliveContinue();
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
//Alive Test continue function.
|
||||
void GSM3ShieldV1AccessProvider::isModemAliveContinue()
|
||||
{
|
||||
bool rsp;
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_AT);
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
break;
|
||||
case 2:
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(rsp))
|
||||
{
|
||||
if (rsp) theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Shutdown.
|
||||
bool GSM3ShieldV1AccessProvider::shutdown()
|
||||
{
|
||||
unsigned long m;
|
||||
bool resp;
|
||||
char auxLocate [18];
|
||||
|
||||
// It makes no sense to have an asynchronous shutdown
|
||||
pinMode(__RESETPIN__, OUTPUT);
|
||||
digitalWrite(__RESETPIN__, HIGH);
|
||||
delay(1500);
|
||||
digitalWrite(__RESETPIN__, LOW);
|
||||
theGSM3ShieldV1ModemCore.setStatus(IDLE);
|
||||
theGSM3ShieldV1ModemCore.gss.close();
|
||||
|
||||
m=millis();
|
||||
prepareAuxLocate(PSTR("POWER DOWN"), auxLocate);
|
||||
while((millis()-m) < __TOUTSHUTDOWN__)
|
||||
{
|
||||
delay(1);
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, auxLocate))
|
||||
return resp;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
116
hardware/arduino/avr/libraries/GSM/GSM3ShieldV1AccessProvider.h
Normal file
116
hardware/arduino/avr/libraries/GSM/GSM3ShieldV1AccessProvider.h
Normal file
@ -0,0 +1,116 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3SHIELDV1ACCESSPROVIDER_
|
||||
#define _GSM3SHIELDV1ACCESSPROVIDER_
|
||||
|
||||
#include <GSM3MobileAccessProvider.h>
|
||||
#include <GSM3ShieldV1ModemCore.h>
|
||||
#include <GSM3ShieldV1BaseProvider.h>
|
||||
|
||||
class GSM3ShieldV1AccessProvider : public GSM3MobileAccessProvider, public GSM3ShieldV1BaseProvider
|
||||
{
|
||||
private:
|
||||
|
||||
/** Initialize main modem configuration
|
||||
@param pin PIN code
|
||||
@return command error if exists
|
||||
*/
|
||||
int ModemConfiguration(char* pin);
|
||||
|
||||
/** Continue to modem configuration function
|
||||
*/
|
||||
void ModemConfigurationContinue();
|
||||
|
||||
/** Continue to check if modem alive function
|
||||
*/
|
||||
void isModemAliveContinue();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor
|
||||
@param debug Determines debug mode
|
||||
*/
|
||||
|
||||
GSM3ShieldV1AccessProvider(bool debug=false);
|
||||
|
||||
/** Start the GSM/GPRS modem, attaching to the GSM network
|
||||
@param pin SIM PIN number (4 digits in a string, example: "1234"). If
|
||||
NULL the SIM has no configured PIN.
|
||||
@param restart Restart the modem. Default is TRUE. The modem receives
|
||||
a signal through the Ctrl/D7 pin. If it is shut down, it will
|
||||
start-up. If it is running, it will restart. Takes up to 10
|
||||
seconds
|
||||
@param synchronous If TRUE the call only returns after the Start is complete
|
||||
or fails. If FALSE the call will return inmediately. You have
|
||||
to call repeatedly ready() until you get a result. Default is TRUE.
|
||||
@return If synchronous, GSM3_NetworkStatus_t. If asynchronous, returns 0.
|
||||
*/
|
||||
GSM3_NetworkStatus_t begin(char* pin=0,bool restart=true, bool synchronous=true);
|
||||
|
||||
/** Check network access status
|
||||
@return 1 if Alive, 0 if down
|
||||
*/
|
||||
int isAccessAlive();
|
||||
|
||||
/** Shutdown the modem (power off really)
|
||||
@return true if successful
|
||||
*/
|
||||
bool shutdown();
|
||||
|
||||
/** Returns 0 if last command is still executing
|
||||
@return 1 if success, >1 if error
|
||||
*/
|
||||
int ready(){return GSM3ShieldV1BaseProvider::ready();};
|
||||
|
||||
/** Returns modem status
|
||||
@return modem network status
|
||||
*/
|
||||
inline GSM3_NetworkStatus_t getStatus(){return theGSM3ShieldV1ModemCore.getStatus();};
|
||||
|
||||
void manageResponse(byte from, byte to);
|
||||
|
||||
/** Restart the modem (will shut down if running)
|
||||
@return 1 if success, >1 if error
|
||||
*/
|
||||
int HWrestart();
|
||||
|
||||
/** Start the modem (will not shut down if running)
|
||||
@return 1 if success, >1 if error
|
||||
*/
|
||||
int HWstart();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,67 @@
|
||||
#include <GSM3ShieldV1BandManagement.h>
|
||||
|
||||
GSM3ShieldV1BandManagement::GSM3ShieldV1BandManagement(bool trace): modem(trace)
|
||||
{
|
||||
quectelStrings[UNDEFINED]="";
|
||||
quectelStrings[EGSM_MODE]="\"EGSM_MODE\"";
|
||||
quectelStrings[DCS_MODE]="\"DCS_MODE\"";
|
||||
quectelStrings[PCS_MODE]="\"PCS_MODE\"";
|
||||
quectelStrings[EGSM_DCS_MODE]="\"EGSM_DCS_MODE\"";
|
||||
quectelStrings[GSM850_PCS_MODE]="\"GSM850_PCS_MODE\"";
|
||||
quectelStrings[GSM850_EGSM_DCS_PCS_MODE]="\"GSM850_EGSM_DCS_PCS_MODE\"";
|
||||
}
|
||||
|
||||
GSM3_NetworkStatus_t GSM3ShieldV1BandManagement::begin()
|
||||
{
|
||||
// check modem response
|
||||
modem.begin();
|
||||
|
||||
// reset hardware
|
||||
modem.restartModem();
|
||||
|
||||
return IDLE;
|
||||
}
|
||||
|
||||
String GSM3ShieldV1BandManagement::getBand()
|
||||
{
|
||||
String modemResponse=modem.writeModemCommand("AT+QBAND?", 2000);
|
||||
|
||||
for(GSM3GSMBand i=GSM850_EGSM_DCS_PCS_MODE;i>UNDEFINED;i=(GSM3GSMBand)((int)i-1))
|
||||
{
|
||||
if(modemResponse.indexOf(quectelStrings[i])>=0)
|
||||
return quectelStrings[i];
|
||||
}
|
||||
|
||||
Serial.print("Unrecognized modem answer:");
|
||||
Serial.println(modemResponse);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
bool GSM3ShieldV1BandManagement::setBand(String band)
|
||||
{
|
||||
String command;
|
||||
String modemResponse;
|
||||
bool found=false;
|
||||
|
||||
command="AT+QBAND=";
|
||||
for(GSM3GSMBand i=EGSM_MODE;((i<=GSM850_EGSM_DCS_PCS_MODE)&&(!found));i=(GSM3GSMBand)((int)i+1))
|
||||
{
|
||||
String aux=quectelStrings[i];
|
||||
if(aux.indexOf(band)>=0)
|
||||
{
|
||||
command+=aux;
|
||||
found=true;
|
||||
}
|
||||
}
|
||||
|
||||
if(!found)
|
||||
return false;
|
||||
// Quad-band takes an awful lot of time
|
||||
modemResponse=modem.writeModemCommand(command, 15000);
|
||||
|
||||
if(modemResponse.indexOf("QBAND")>=0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef __GSM3SHIELDV1BANDMANAGEMENT__
|
||||
#define __GSM3SHIELDV1BANDMANAGEMENT__
|
||||
|
||||
// This class executes band management functions for the ShieldV1
|
||||
#include <GSM3ShieldV1DirectModemProvider.h>
|
||||
|
||||
#define NUMBEROFBANDS 7
|
||||
#define GSM_MODE_UNDEFINED "UNDEFINED"
|
||||
#define GSM_MODE_EGSM "EGSM_MODE"
|
||||
#define GSM_MODE_DCS "DCS_MODE"
|
||||
#define GSM_MODE_PCS "PCS_MODE"
|
||||
#define GSM_MODE_EGSM_DCS "EGSM_DCS_MODE"
|
||||
#define GSM_MODE_GSM850_PCS "GSM850_PCS_MODE"
|
||||
#define GSM_MODE_GSM850_EGSM_DCS_PCS "GSM850_EGSM_DCS_PCS_MODE"
|
||||
|
||||
typedef enum GSM3GSMBand {UNDEFINED, EGSM_MODE, DCS_MODE, PCS_MODE, EGSM_DCS_MODE, GSM850_PCS_MODE, GSM850_EGSM_DCS_PCS_MODE};
|
||||
|
||||
//
|
||||
// These are the bands and scopes:
|
||||
//
|
||||
// E-GSM(900)
|
||||
// DCS(1800)
|
||||
// PCS(1900)
|
||||
// E-GSM(900)+DCS(1800) ex: Europe
|
||||
// GSM(850)+PCS(1900) Ex: USA, South Am.
|
||||
// GSM(850)+E-GSM(900)+DCS(1800)+PCS(1900)
|
||||
|
||||
class GSM3ShieldV1BandManagement
|
||||
{
|
||||
private:
|
||||
|
||||
GSM3ShieldV1DirectModemProvider modem; // Direct access to modem
|
||||
|
||||
char* quectelStrings[NUMBEROFBANDS];// = {"\"EGSM_MODE\"", "\"DCS_MODE\"", "\"PCS_MODE\"",
|
||||
//"\"EGSM_DCS_MODE\"", "\"GSM850_PCS_MODE\"",
|
||||
//"\"GSM850_EGSM_DCS_PCS_MODE\""};
|
||||
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor
|
||||
@param trace If true, dumps all AT dialogue to Serial
|
||||
*/
|
||||
GSM3ShieldV1BandManagement(bool trace=false);
|
||||
|
||||
/** Forces modem hardware restart, so we begin from scratch
|
||||
@return always returns IDLE status
|
||||
*/
|
||||
GSM3_NetworkStatus_t begin();
|
||||
|
||||
/** Get current modem work band
|
||||
@return current modem work band
|
||||
*/
|
||||
String getBand();
|
||||
|
||||
/** Changes the modem operating band
|
||||
@param band Desired new band
|
||||
@return true if success, false otherwise
|
||||
*/
|
||||
bool setBand(String band);
|
||||
|
||||
};
|
||||
#endif
|
@ -0,0 +1,27 @@
|
||||
#include <GSM3ShieldV1BaseProvider.h>
|
||||
#include <GSM3ShieldV1ModemCore.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
// Returns 0 if last command is still executing
|
||||
// 1 if success
|
||||
// >1 if error
|
||||
int GSM3ShieldV1BaseProvider::ready()
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.manageReceivedData();
|
||||
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
};
|
||||
|
||||
void GSM3ShieldV1BaseProvider::prepareAuxLocate(PROGMEM prog_char str[], char auxLocate[])
|
||||
{
|
||||
int i=0;
|
||||
char c;
|
||||
|
||||
do
|
||||
{
|
||||
c=pgm_read_byte_near(str + i);
|
||||
auxLocate[i]=c;
|
||||
i++;
|
||||
} while (c!=0);
|
||||
}
|
||||
|
@ -0,0 +1,73 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3SHIELDV1BASEPROVIDER_
|
||||
#define _GSM3SHIELDV1BASEPROVIDER_
|
||||
|
||||
#include <GSM3SoftSerial.h>
|
||||
|
||||
enum GSM3_commandType_e { XON, NONE, MODEMCONFIG, ALIVETEST, BEGINSMS, ENDSMS, AVAILABLESMS, FLUSHSMS,
|
||||
VOICECALL, ANSWERCALL, HANGCALL, RETRIEVECALLINGNUMBER,
|
||||
ATTACHGPRS, DETACHGPRS, CONNECTTCPCLIENT, DISCONNECTTCP, BEGINWRITESOCKET, ENDWRITESOCKET,
|
||||
AVAILABLESOCKET, FLUSHSOCKET, CONNECTSERVER, GETIP, GETCONNECTSTATUS, GETLOCATION, GETICCID};
|
||||
|
||||
class GSM3ShieldV1BaseProvider
|
||||
{
|
||||
public:
|
||||
|
||||
/** Get last command status
|
||||
@return Returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
int ready();
|
||||
|
||||
/** This function locates strings from PROGMEM in the buffer
|
||||
@param str PROGMEN
|
||||
@param auxLocate Buffer where to locate strings
|
||||
*/
|
||||
void prepareAuxLocate(PROGMEM prog_char str[], char auxLocate[]);
|
||||
|
||||
/** Manages modem response
|
||||
@param from Initial byte of buffer
|
||||
@param to Final byte of buffer
|
||||
*/
|
||||
virtual void manageResponse(byte from, byte to);
|
||||
|
||||
/** Recognize URC
|
||||
@param from
|
||||
@return true if successful (default: false)
|
||||
*/
|
||||
virtual bool recognizeUnsolicitedEvent(byte from){return false;};
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,168 @@
|
||||
#include <GSM3ShieldV1CellManagement.h>
|
||||
|
||||
GSM3ShieldV1CellManagement::GSM3ShieldV1CellManagement()
|
||||
{
|
||||
}
|
||||
|
||||
bool GSM3ShieldV1CellManagement::parseQCCID_available(bool& rsp)
|
||||
{
|
||||
char c;
|
||||
bool iccidFound = false;
|
||||
int i = 0;
|
||||
|
||||
while(((c = theGSM3ShieldV1ModemCore.theBuffer().read()) != 0) & (i < 19))
|
||||
{
|
||||
if((c < 58) & (c > 47))
|
||||
iccidFound = true;
|
||||
|
||||
if(iccidFound)
|
||||
{
|
||||
bufferICCID[i] = c;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
bufferICCID[i]=0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GSM3ShieldV1CellManagement::parseQENG_available(bool& rsp)
|
||||
{
|
||||
char c;
|
||||
char location[50] = "";
|
||||
int i = 0;
|
||||
|
||||
if (!(theGSM3ShieldV1ModemCore.theBuffer().chopUntil("+QENG: ", true)))
|
||||
rsp = false;
|
||||
else
|
||||
rsp = true;
|
||||
|
||||
if (!(theGSM3ShieldV1ModemCore.theBuffer().chopUntil("+QENG:", true)))
|
||||
rsp = false;
|
||||
else
|
||||
rsp = true;
|
||||
|
||||
while(((c = theGSM3ShieldV1ModemCore.theBuffer().read()) != 0) & (i < 50))
|
||||
{
|
||||
location[i] = c;
|
||||
i++;
|
||||
}
|
||||
location[i]=0;
|
||||
|
||||
char* res_tok = strtok(location, ",");
|
||||
res_tok=strtok(NULL, ",");
|
||||
strcpy(countryCode, res_tok);
|
||||
res_tok=strtok(NULL, ",");
|
||||
strcpy(networkCode, res_tok);
|
||||
res_tok=strtok(NULL, ",");
|
||||
strcpy(locationArea, res_tok);
|
||||
res_tok=strtok(NULL, ",");
|
||||
strcpy(cellId, res_tok);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int GSM3ShieldV1CellManagement::getLocation(char *country, char *network, char *area, char *cell)
|
||||
{
|
||||
if((theGSM3ShieldV1ModemCore.getStatus() != GSM_READY) && (theGSM3ShieldV1ModemCore.getStatus() != GPRS_READY))
|
||||
return 2;
|
||||
|
||||
countryCode=country;
|
||||
networkCode=network;
|
||||
locationArea=area;
|
||||
cellId=cell;
|
||||
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,GETLOCATION);
|
||||
getLocationContinue();
|
||||
|
||||
unsigned long timeOut = millis();
|
||||
while(((millis() - timeOut) < 5000) & (ready() == 0));
|
||||
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
void GSM3ShieldV1CellManagement::getLocationContinue()
|
||||
{
|
||||
bool resp;
|
||||
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
theGSM3ShieldV1ModemCore.gss.tunedDelay(3000);
|
||||
delay(3000);
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QENG=1"), false);
|
||||
theGSM3ShieldV1ModemCore.print("\r");
|
||||
break;
|
||||
case 2:
|
||||
if (theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.gss.tunedDelay(3000);
|
||||
delay(3000);
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(3);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QENG?"), false);
|
||||
theGSM3ShieldV1ModemCore.print("\r");
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
break;
|
||||
case 3:
|
||||
if (resp)
|
||||
{
|
||||
parseQENG_available(resp);
|
||||
theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int GSM3ShieldV1CellManagement::getICCID(char *iccid)
|
||||
{
|
||||
if((theGSM3ShieldV1ModemCore.getStatus() != GSM_READY) && (theGSM3ShieldV1ModemCore.getStatus() != GPRS_READY))
|
||||
return 2;
|
||||
|
||||
bufferICCID=iccid;
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,GETICCID);
|
||||
getICCIDContinue();
|
||||
|
||||
unsigned long timeOut = millis();
|
||||
while(((millis() - timeOut) < 5000) & (ready() == 0));
|
||||
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
void GSM3ShieldV1CellManagement::getICCIDContinue()
|
||||
{
|
||||
bool resp;
|
||||
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QCCID"), false);
|
||||
theGSM3ShieldV1ModemCore.print("\r");
|
||||
break;
|
||||
case 2:
|
||||
if (theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
parseQCCID_available(resp);
|
||||
theGSM3ShieldV1ModemCore.closeCommand(2);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GSM3ShieldV1CellManagement::manageResponse(byte from, byte to)
|
||||
{
|
||||
switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
|
||||
{
|
||||
case NONE:
|
||||
theGSM3ShieldV1ModemCore.gss.cb.deleteToTheEnd(from);
|
||||
break;
|
||||
case GETLOCATION:
|
||||
getLocationContinue();
|
||||
break;
|
||||
case GETICCID:
|
||||
getICCIDContinue();
|
||||
break;
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef __GSM3_SHIELDV1CELLMANAGEMENT__
|
||||
#define __GSM3_SHIELDV1CELLMANAGEMENT__
|
||||
|
||||
#include <GSM3ShieldV1ModemCore.h>
|
||||
#include <GSM3MobileCellManagement.h>
|
||||
#include <GSM3ShieldV1CellManagement.h>
|
||||
|
||||
class GSM3ShieldV1CellManagement : public GSM3MobileCellManagement, public GSM3ShieldV1BaseProvider
|
||||
{
|
||||
public:
|
||||
|
||||
/** Constructor
|
||||
*/
|
||||
GSM3ShieldV1CellManagement();
|
||||
|
||||
/** Manages modem response
|
||||
@param from Initial byte of buffer
|
||||
@param to Final byte of buffer
|
||||
*/
|
||||
void manageResponse(byte from, byte to);
|
||||
|
||||
/** getLocation
|
||||
@return current cell location
|
||||
*/
|
||||
int getLocation(char *country, char *network, char *area, char *cell);
|
||||
|
||||
/** getICCID
|
||||
*/
|
||||
int getICCID(char *iccid);
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
int ready(){return GSM3ShieldV1BaseProvider::ready();};
|
||||
|
||||
private:
|
||||
|
||||
char *countryCode;
|
||||
char *networkCode;
|
||||
char *locationArea;
|
||||
char *cellId;
|
||||
|
||||
char *bufferICCID;
|
||||
|
||||
/** Continue to getLocation function
|
||||
*/
|
||||
void getLocationContinue();
|
||||
|
||||
/** Continue to getICCID function
|
||||
*/
|
||||
void getICCIDContinue();
|
||||
|
||||
bool parseQENG_available(bool& rsp);
|
||||
|
||||
bool parseQCCID_available(bool& rsp);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,294 @@
|
||||
#include <GSM3ShieldV1ClientProvider.h>
|
||||
#include <GSM3ShieldV1ModemCore.h>
|
||||
|
||||
GSM3ShieldV1ClientProvider::GSM3ShieldV1ClientProvider()
|
||||
{
|
||||
theGSM3MobileClientProvider=this;
|
||||
};
|
||||
|
||||
//Response management.
|
||||
void GSM3ShieldV1ClientProvider::manageResponse(byte from, byte to)
|
||||
{
|
||||
switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
|
||||
{
|
||||
case NONE:
|
||||
theGSM3ShieldV1ModemCore.gss.cb.deleteToTheEnd(from);
|
||||
break;
|
||||
case CONNECTTCPCLIENT:
|
||||
connectTCPClientContinue();
|
||||
break;
|
||||
case FLUSHSOCKET:
|
||||
flushSocketContinue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Connect TCP main function.
|
||||
int GSM3ShieldV1ClientProvider::connectTCPClient(const char* server, int port, int id_socket)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setPort(port);
|
||||
idSocket = id_socket;
|
||||
|
||||
theGSM3ShieldV1ModemCore.setPhoneNumber((char*)server);
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,CONNECTTCPCLIENT);
|
||||
theGSM3ShieldV1ModemCore.registerUMProvider(this);
|
||||
connectTCPClientContinue();
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
int GSM3ShieldV1ClientProvider::connectTCPClient(IPAddress add, int port, int id_socket)
|
||||
{
|
||||
remoteIP=add;
|
||||
theGSM3ShieldV1ModemCore.setPhoneNumber(0);
|
||||
return connectTCPClient(0, port, id_socket);
|
||||
}
|
||||
|
||||
//Connect TCP continue function.
|
||||
void GSM3ShieldV1ClientProvider::connectTCPClientContinue()
|
||||
{
|
||||
bool resp;
|
||||
// 0: Dot or DNS notation activation
|
||||
// 1: Disable SW flow control
|
||||
// 2: Waiting for IFC OK
|
||||
// 3: Start-up TCP connection "AT+QIOPEN"
|
||||
// 4: Wait for connection OK
|
||||
// 5: Wait for CONNECT
|
||||
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIDNSIP="), false);
|
||||
if ((theGSM3ShieldV1ModemCore.getPhoneNumber()!=0)&&
|
||||
((*(theGSM3ShieldV1ModemCore.getPhoneNumber())<'0')||((*(theGSM3ShieldV1ModemCore.getPhoneNumber())>'9'))))
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.print('1');
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
}
|
||||
else
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.print('0');
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
}
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
break;
|
||||
case 2:
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
//Response received
|
||||
if(resp)
|
||||
{
|
||||
// AT+QIOPEN
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIOPEN="),false);
|
||||
theGSM3ShieldV1ModemCore.print("\"TCP\",\"");
|
||||
if(theGSM3ShieldV1ModemCore.getPhoneNumber()!=0)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.print(theGSM3ShieldV1ModemCore.getPhoneNumber());
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteIP.printTo(theGSM3ShieldV1ModemCore);
|
||||
}
|
||||
theGSM3ShieldV1ModemCore.print('"');
|
||||
theGSM3ShieldV1ModemCore.print(',');
|
||||
theGSM3ShieldV1ModemCore.print(theGSM3ShieldV1ModemCore.getPort());
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(3);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
// Response received
|
||||
if(resp)
|
||||
{
|
||||
// OK Received
|
||||
// Great. Go for the next step
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(4);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
char auxLocate [12];
|
||||
prepareAuxLocate(PSTR("CONNECT\r\n"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp,auxLocate))
|
||||
{
|
||||
// Response received
|
||||
if(resp)
|
||||
{
|
||||
// Received CONNECT OK
|
||||
// Great. We're done
|
||||
theGSM3ShieldV1ModemCore.setStatus(TRANSPARENT_CONNECTED);
|
||||
theGSM3ShieldV1ModemCore.theBuffer().chopUntil(auxLocate, true);
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
}
|
||||
else
|
||||
theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Disconnect TCP main function.
|
||||
int GSM3ShieldV1ClientProvider::disconnectTCP(bool client1Server0, int id_socket)
|
||||
{
|
||||
// id Socket does not really mean anything, in this case we have
|
||||
// only one socket running
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,DISCONNECTTCP);
|
||||
|
||||
// If we are not closed, launch the command
|
||||
//[ZZ] if(theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED)
|
||||
// {
|
||||
delay(1000);
|
||||
theGSM3ShieldV1ModemCore.print("+++");
|
||||
delay(1000);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QICLOSE"));
|
||||
theGSM3ShieldV1ModemCore.setStatus(GPRS_READY);
|
||||
// }
|
||||
// Looks like it runs everytime, so we simply flush to death and go on
|
||||
do
|
||||
{
|
||||
// Empty the local buffer, and tell the modem to XON
|
||||
// If meanwhile we receive a DISCONNECT we should detect it as URC.
|
||||
theGSM3ShieldV1ModemCore.theBuffer().flush();
|
||||
theGSM3ShieldV1ModemCore.gss.spaceAvailable();
|
||||
// Give some time for the buffer to refill
|
||||
delay(100);
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
}while(theGSM3ShieldV1ModemCore.theBuffer().storedBytes()>0);
|
||||
|
||||
theGSM3ShieldV1ModemCore.unRegisterUMProvider(this);
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
|
||||
//Write socket first chain main function.
|
||||
void GSM3ShieldV1ClientProvider::beginWriteSocket(bool client1Server0, int id_socket)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//Write socket next chain function.
|
||||
void GSM3ShieldV1ClientProvider::writeSocket(const char* buf)
|
||||
{
|
||||
if(theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED)
|
||||
theGSM3ShieldV1ModemCore.print(buf);
|
||||
}
|
||||
|
||||
//Write socket character function.
|
||||
void GSM3ShieldV1ClientProvider::writeSocket(uint8_t c)
|
||||
{
|
||||
if(theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED)
|
||||
theGSM3ShieldV1ModemCore.print((char)c);
|
||||
}
|
||||
|
||||
//Write socket last chain main function.
|
||||
void GSM3ShieldV1ClientProvider::endWriteSocket()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//Available socket main function.
|
||||
int GSM3ShieldV1ClientProvider::availableSocket(bool client1Server0, int id_socket)
|
||||
{
|
||||
|
||||
if(!(theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED))
|
||||
theGSM3ShieldV1ModemCore.closeCommand(4);
|
||||
|
||||
if(theGSM3ShieldV1ModemCore.theBuffer().storedBytes())
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
else
|
||||
theGSM3ShieldV1ModemCore.closeCommand(4);
|
||||
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
int GSM3ShieldV1ClientProvider::readSocket()
|
||||
{
|
||||
char charSocket;
|
||||
|
||||
if(theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
charSocket = theGSM3ShieldV1ModemCore.theBuffer().read();
|
||||
|
||||
if(theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==100)
|
||||
theGSM3ShieldV1ModemCore.gss.spaceAvailable();
|
||||
|
||||
return charSocket;
|
||||
|
||||
}
|
||||
|
||||
//Read socket main function.
|
||||
int GSM3ShieldV1ClientProvider::peekSocket()
|
||||
{
|
||||
return theGSM3ShieldV1ModemCore.theBuffer().peek(0);
|
||||
}
|
||||
|
||||
|
||||
//Flush SMS main function.
|
||||
void GSM3ShieldV1ClientProvider::flushSocket()
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,FLUSHSOCKET);
|
||||
|
||||
flushSocketContinue();
|
||||
}
|
||||
|
||||
//Send SMS continue function.
|
||||
void GSM3ShieldV1ClientProvider::flushSocketContinue()
|
||||
{
|
||||
// If we have incomed data
|
||||
if(theGSM3ShieldV1ModemCore.theBuffer().storedBytes()>0)
|
||||
{
|
||||
// Empty the local buffer, and tell the modem to XON
|
||||
// If meanwhile we receive a DISCONNECT we should detect it as URC.
|
||||
theGSM3ShieldV1ModemCore.theBuffer().flush();
|
||||
theGSM3ShieldV1ModemCore.gss.spaceAvailable();
|
||||
}
|
||||
else
|
||||
{
|
||||
//We're done
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
}
|
||||
}
|
||||
|
||||
// URC recognize.
|
||||
// Yes, we recognize "closes" in client mode
|
||||
bool GSM3ShieldV1ClientProvider::recognizeUnsolicitedEvent(byte oldTail)
|
||||
{
|
||||
char auxLocate [12];
|
||||
prepareAuxLocate(PSTR("CLOSED"), auxLocate);
|
||||
|
||||
if((theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED) & theGSM3ShieldV1ModemCore.theBuffer().chopUntil(auxLocate, false, false))
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setStatus(GPRS_READY);
|
||||
theGSM3ShieldV1ModemCore.unRegisterUMProvider(this);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int GSM3ShieldV1ClientProvider::getSocket(int socket)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void GSM3ShieldV1ClientProvider::releaseSocket(int socket)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool GSM3ShieldV1ClientProvider::getStatusSocketClient(uint8_t socket)
|
||||
{
|
||||
return (theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
181
hardware/arduino/avr/libraries/GSM/GSM3ShieldV1ClientProvider.h
Normal file
181
hardware/arduino/avr/libraries/GSM/GSM3ShieldV1ClientProvider.h
Normal file
@ -0,0 +1,181 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef __GSM3_SHIELDV1CLIENTPROVIDER__
|
||||
#define __GSM3_SHIELDV1CLIENTPROVIDER__
|
||||
|
||||
#include <GSM3MobileClientProvider.h>
|
||||
#include <GSM3ShieldV1BaseProvider.h>
|
||||
|
||||
class GSM3ShieldV1ClientProvider : public GSM3MobileClientProvider, public GSM3ShieldV1BaseProvider
|
||||
{
|
||||
private:
|
||||
|
||||
int remotePort; //Current operation remote port.
|
||||
IPAddress remoteIP; // Remote IP address
|
||||
int idSocket; // Remote ID socket.
|
||||
|
||||
|
||||
/** Continue to connect TCP client function
|
||||
*/
|
||||
void connectTCPClientContinue();
|
||||
|
||||
/** Continue to available socket function
|
||||
*/
|
||||
void availableSocketContinue();
|
||||
|
||||
/** Continue to flush socket function
|
||||
*/
|
||||
void flushSocketContinue();
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
GSM3ShieldV1ClientProvider();
|
||||
|
||||
/** minSocket
|
||||
@return 0
|
||||
*/
|
||||
int minSocket(){return 0;};
|
||||
|
||||
/** maxSocket
|
||||
@return 0
|
||||
*/
|
||||
int maxSocket(){return 0;};
|
||||
|
||||
/** Connect to a remote TCP server
|
||||
@param server String with IP or server name
|
||||
@param port Remote port number
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
int connectTCPClient(const char* server, int port, int id_socket);
|
||||
|
||||
/** Connect to a remote TCP server
|
||||
@param add Remote IP address
|
||||
@param port Remote port number
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
int connectTCPClient(IPAddress add, int port, int id_socket);
|
||||
|
||||
/** Begin writing through a socket
|
||||
@param client1Server0 1 if modem acts as client, 0 if acts as server
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
void beginWriteSocket(bool client1Server0, int id_socket);
|
||||
|
||||
/** Write through a socket. MUST go after beginWriteSocket()
|
||||
@param buf characters to be written (final 0 will not be written)
|
||||
*/
|
||||
void writeSocket(const char* buf);
|
||||
|
||||
/** Write through a socket. MUST go after beginWriteSocket()
|
||||
@param c character to be written
|
||||
*/
|
||||
void writeSocket(uint8_t c);
|
||||
|
||||
/** Finish current writing
|
||||
*/
|
||||
void endWriteSocket();
|
||||
|
||||
/** Check if there are data to be read in socket.
|
||||
@param client1Server0 1 if modem acts as client, 0 if acts as server
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if there are data available, 4 if no data, otherwise error
|
||||
*/
|
||||
int availableSocket(bool client, int id_socket); // With "available" and "readSocket" ask the modem for 1500 bytes.
|
||||
|
||||
/** Read data (get a character) available in socket
|
||||
@return character
|
||||
*/
|
||||
int readSocket(); //If Read() gets to the end of the QIRD response, execute again QIRD SYNCHRONOUSLY
|
||||
|
||||
/** Flush socket
|
||||
*/
|
||||
void flushSocket();
|
||||
|
||||
/** Get a character but will not advance the buffer head
|
||||
@return character
|
||||
*/
|
||||
int peekSocket();
|
||||
|
||||
/** Close a socket
|
||||
@param client1Server0 1 if modem acts as client, 0 if acts as server
|
||||
@param id_socket Socket
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
int disconnectTCP(bool client1Server0, int id_socket);
|
||||
|
||||
/** Recognize unsolicited event
|
||||
@param oldTail
|
||||
@return true if successful
|
||||
*/
|
||||
bool recognizeUnsolicitedEvent(byte from);
|
||||
|
||||
/** Manages modem response
|
||||
@param from Initial byte position
|
||||
@param to Final byte position
|
||||
*/
|
||||
void manageResponse(byte from, byte to);
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
int ready(){return GSM3ShieldV1BaseProvider::ready();};
|
||||
|
||||
// Client socket management, just to be compatible
|
||||
// with the Multi option
|
||||
|
||||
/** Get socket
|
||||
@param socket Socket
|
||||
@return socket
|
||||
*/
|
||||
int getSocket(int socket=-1);
|
||||
|
||||
/** Release socket
|
||||
@param socket Socket
|
||||
*/
|
||||
void releaseSocket(int socket);
|
||||
|
||||
/** Get socket client status
|
||||
@param socket Socket
|
||||
@return 1 if connected, 0 otherwise
|
||||
*/
|
||||
bool getStatusSocketClient(uint8_t socket);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,363 @@
|
||||
#include <GSM3ShieldV1DataNetworkProvider.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
char _command_CGATT[] PROGMEM = "AT+CGATT=";
|
||||
char _command_SEPARATOR[] PROGMEM = "\",\"";
|
||||
|
||||
//Attach GPRS main function.
|
||||
GSM3_NetworkStatus_t GSM3ShieldV1DataNetworkProvider::attachGPRS(char* apn, char* user_name, char* password, bool synchronous)
|
||||
{
|
||||
user = user_name;
|
||||
passwd = password;
|
||||
// A sad use of byte reuse
|
||||
theGSM3ShieldV1ModemCore.setPhoneNumber(apn);
|
||||
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,ATTACHGPRS);
|
||||
theGSM3ShieldV1ModemCore.setStatus(CONNECTING);
|
||||
|
||||
attachGPRSContinue();
|
||||
|
||||
// If synchronous, wait till attach is over, or not.
|
||||
if(synchronous)
|
||||
{
|
||||
// if we shorten this delay, the command fails
|
||||
while(ready()==0)
|
||||
delay(100);
|
||||
}
|
||||
|
||||
return theGSM3ShieldV1ModemCore.getStatus();
|
||||
}
|
||||
|
||||
//Atthach GPRS continue function.
|
||||
void GSM3ShieldV1DataNetworkProvider::attachGPRSContinue()
|
||||
{
|
||||
bool resp;
|
||||
// 1: Attach to GPRS service "AT+CGATT=1"
|
||||
// 2: Wait attach OK and Set the context 0 as FGCNT "AT+QIFGCNT=0"
|
||||
// 3: Wait context OK and Set bearer type as GPRS, APN, user name and pasword "AT+QICSGP=1..."
|
||||
// 4: Wait bearer OK and Enable the function of MUXIP "AT+QIMUX=1"
|
||||
// 5: Wait for disable MUXIP OK and Set the session mode as non transparent "AT+QIMODE=0"
|
||||
// 6: Wait for session mode OK and Enable notification when data received "AT+QINDI=1"
|
||||
// 8: Wait domain name OK and Register the TCP/IP stack "AT+QIREGAPP"
|
||||
// 9: Wait for Register OK and Activate FGCNT "AT+QIACT"
|
||||
// 10: Wait for activate OK
|
||||
|
||||
int ct=theGSM3ShieldV1ModemCore.getCommandCounter();
|
||||
if(ct==1)
|
||||
{
|
||||
//AT+CGATT
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_CGATT,false);
|
||||
theGSM3ShieldV1ModemCore.print(1);
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
}
|
||||
else if(ct==2)
|
||||
{
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
if(resp)
|
||||
{
|
||||
//AT+QIFGCNT
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIFGCNT=0"));
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(3);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
else if(ct==3)
|
||||
{
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
if(resp)
|
||||
{
|
||||
// Great. Go for the next step
|
||||
//DEBUG
|
||||
//Serial.println("AT+QICSGP.");
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QICSGP=1,\""),false);
|
||||
theGSM3ShieldV1ModemCore.print(theGSM3ShieldV1ModemCore.getPhoneNumber());
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_SEPARATOR,false);
|
||||
theGSM3ShieldV1ModemCore.print(user);
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_SEPARATOR,false);
|
||||
theGSM3ShieldV1ModemCore.print(passwd);
|
||||
theGSM3ShieldV1ModemCore.print("\"\r");
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(4);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
else if(ct==4)
|
||||
{
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
if(resp)
|
||||
{
|
||||
// AT+QIMUX=1 for multisocket
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIMUX=0"));
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(5);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
else if(ct==5)
|
||||
{
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
if(resp)
|
||||
{
|
||||
//AT+QIMODE=0 for multisocket
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIMODE=1"));
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(6);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
else if(ct==6)
|
||||
{
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
if(resp)
|
||||
{
|
||||
// AT+QINDI=1
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QINDI=1"));
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(8);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
else if(ct==8)
|
||||
{
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
if(resp)
|
||||
{
|
||||
// AT+QIREGAPP
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIREGAPP"));
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(9);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
else if(ct==9)
|
||||
{
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
if(resp)
|
||||
{
|
||||
// AT+QIACT
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIACT"));
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(10);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
else if(ct==10)
|
||||
{
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
if (resp)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setStatus(GPRS_READY);
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Detach GPRS main function.
|
||||
GSM3_NetworkStatus_t GSM3ShieldV1DataNetworkProvider::detachGPRS(bool synchronous)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,DETACHGPRS);
|
||||
theGSM3ShieldV1ModemCore.setStatus(CONNECTING);
|
||||
detachGPRSContinue();
|
||||
|
||||
if(synchronous)
|
||||
{
|
||||
while(ready()==0)
|
||||
delay(1);
|
||||
}
|
||||
|
||||
return theGSM3ShieldV1ModemCore.getStatus();
|
||||
}
|
||||
|
||||
void GSM3ShieldV1DataNetworkProvider::detachGPRSContinue()
|
||||
{
|
||||
bool resp;
|
||||
// 1: Detach to GPRS service "AT+CGATT=0"
|
||||
// 2: Wait dettach +PDP DEACT
|
||||
// 3: Wait for OK
|
||||
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
//AT+CGATT=0
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_CGATT,false);
|
||||
theGSM3ShieldV1ModemCore.print(0);
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
break;
|
||||
case 2:
|
||||
char auxLocate[12];
|
||||
prepareAuxLocate(PSTR("+PDP DEACT"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.theBuffer().locate(auxLocate))
|
||||
{
|
||||
if(resp)
|
||||
{
|
||||
// Received +PDP DEACT;
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(3);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
// OK received
|
||||
if (resp)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setStatus(GSM_READY);
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//QILOCIP parse.
|
||||
bool GSM3ShieldV1DataNetworkProvider::parseQILOCIP_rsp(char* LocalIP, int LocalIPlength, bool& rsp)
|
||||
{
|
||||
if (!(theGSM3ShieldV1ModemCore.theBuffer().extractSubstring("\r\n","\r\n", LocalIP, LocalIPlength)))
|
||||
rsp = false;
|
||||
else
|
||||
rsp = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//Get IP main function.
|
||||
int GSM3ShieldV1DataNetworkProvider::getIP(char* LocalIP, int LocalIPlength)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setPhoneNumber(LocalIP);
|
||||
theGSM3ShieldV1ModemCore.setPort(LocalIPlength);
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,GETIP);
|
||||
getIPContinue();
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
void GSM3ShieldV1DataNetworkProvider::getIPContinue()
|
||||
{
|
||||
|
||||
bool resp;
|
||||
// 1: Read Local IP "AT+QILOCIP"
|
||||
// 2: Waiting for IP.
|
||||
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
//AT+QILOCIP
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QILOCIP"));
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
break;
|
||||
case 2:
|
||||
if(parseQILOCIP_rsp(theGSM3ShieldV1ModemCore.getPhoneNumber(), theGSM3ShieldV1ModemCore.getPort(), resp))
|
||||
{
|
||||
if (resp)
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
else
|
||||
theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
theGSM3ShieldV1ModemCore.theBuffer().flush();
|
||||
theGSM3ShieldV1ModemCore.gss.spaceAvailable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Get IP with IPAddress object
|
||||
IPAddress GSM3ShieldV1DataNetworkProvider::getIPAddress() {
|
||||
char ip_temp[15]="";
|
||||
getIP(ip_temp, 15);
|
||||
unsigned long m=millis();
|
||||
|
||||
while((millis()-m)<10*1000 && (!ready())){
|
||||
// wait for a response from the modem:
|
||||
delay(100);
|
||||
}
|
||||
IPAddress ip;
|
||||
inet_aton(ip_temp, ip);
|
||||
return ip;
|
||||
}
|
||||
|
||||
int GSM3ShieldV1DataNetworkProvider::inet_aton(const char* aIPAddrString, IPAddress& aResult)
|
||||
{
|
||||
// See if we've been given a valid IP address
|
||||
const char* p =aIPAddrString;
|
||||
while (*p &&
|
||||
( (*p == '.') || (*p >= '0') || (*p <= '9') ))
|
||||
{
|
||||
p++;
|
||||
}
|
||||
|
||||
if (*p == '\0')
|
||||
{
|
||||
// It's looking promising, we haven't found any invalid characters
|
||||
p = aIPAddrString;
|
||||
int segment =0;
|
||||
int segmentValue =0;
|
||||
while (*p && (segment < 4))
|
||||
{
|
||||
if (*p == '.')
|
||||
{
|
||||
// We've reached the end of a segment
|
||||
if (segmentValue > 255)
|
||||
{
|
||||
// You can't have IP address segments that don't fit in a byte
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
aResult[segment] = (byte)segmentValue;
|
||||
segment++;
|
||||
segmentValue = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Next digit
|
||||
segmentValue = (segmentValue*10)+(*p - '0');
|
||||
}
|
||||
p++;
|
||||
}
|
||||
// We've reached the end of address, but there'll still be the last
|
||||
// segment to deal with
|
||||
if ((segmentValue > 255) || (segment > 3))
|
||||
{
|
||||
// You can't have IP address segments that don't fit in a byte,
|
||||
// or more than four segments
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
aResult[segment] = (byte)segmentValue;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//Response management.
|
||||
void GSM3ShieldV1DataNetworkProvider::manageResponse(byte from, byte to)
|
||||
{
|
||||
switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
|
||||
{
|
||||
case ATTACHGPRS:
|
||||
attachGPRSContinue();
|
||||
break;
|
||||
case DETACHGPRS:
|
||||
detachGPRSContinue();
|
||||
break;
|
||||
case GETIP:
|
||||
getIPContinue();
|
||||
break;
|
||||
}
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3SHIELDV1DATANETWORKPROVIDER_
|
||||
#define _GSM3SHIELDV1DATANETWORKPROVIDER_
|
||||
|
||||
#include <GSM3MobileDataNetworkProvider.h>
|
||||
#include <GSM3ShieldV1BaseProvider.h>
|
||||
#include <GSM3ShieldV1ModemCore.h>
|
||||
#include <IPAddress.h>
|
||||
|
||||
class GSM3ShieldV1DataNetworkProvider : public GSM3MobileDataNetworkProvider, public GSM3ShieldV1BaseProvider
|
||||
{
|
||||
private:
|
||||
|
||||
char* user; // Username for GPRS
|
||||
char* passwd; // Password for GPRS
|
||||
|
||||
/** Continue to attach GPRS function
|
||||
*/
|
||||
void attachGPRSContinue();
|
||||
|
||||
/** Continue to detach GPRS function
|
||||
*/
|
||||
void detachGPRSContinue();
|
||||
|
||||
/** Parse QILOCIP response
|
||||
@param LocalIP Buffer for save local IP address
|
||||
@param LocalIPlength Buffer size
|
||||
@param rsp Returns true if expected response exists
|
||||
@return true if command executed correctly
|
||||
*/
|
||||
bool parseQILOCIP_rsp(char* LocalIP, int LocalIPlength, bool& rsp);
|
||||
|
||||
/** Continue to get IP function
|
||||
*/
|
||||
void getIPContinue();
|
||||
|
||||
/** Implementation of inet_aton standard function
|
||||
@param aIPAddrString IP address in characters buffer
|
||||
@param aResult IP address in IPAddress format
|
||||
@return 1 if the address is successfully converted, or 0 if the conversion failed
|
||||
*/
|
||||
int inet_aton(const char* aIPAddrString, IPAddress& aResult);
|
||||
|
||||
public:
|
||||
|
||||
/** Attach to GPRS/GSM network
|
||||
@param networkId APN GPRS
|
||||
@param user Username
|
||||
@param pass Password
|
||||
@return connection status
|
||||
*/
|
||||
GSM3_NetworkStatus_t networkAttach(char* networkId, char* user, char* pass)
|
||||
{
|
||||
return attachGPRS(networkId, user, pass);
|
||||
};
|
||||
|
||||
/** Detach GPRS/GSM network
|
||||
@return connection status
|
||||
*/
|
||||
GSM3_NetworkStatus_t networkDetach(){ return detachGPRS();};
|
||||
|
||||
/** Attach to GPRS service
|
||||
@param apn APN GPRS
|
||||
@param user_name Username
|
||||
@param password Password
|
||||
@param synchronous Sync mode
|
||||
@return connection status
|
||||
*/
|
||||
GSM3_NetworkStatus_t attachGPRS(char* apn, char* user_name, char* password, bool synchronous=true);
|
||||
|
||||
/** Detach GPRS service
|
||||
@param synchronous Sync mode
|
||||
@return connection status
|
||||
*/
|
||||
GSM3_NetworkStatus_t detachGPRS(bool synchronous=true);
|
||||
|
||||
/** Returns 0 if last command is still executing
|
||||
@return 1 if success, >1 if error
|
||||
*/
|
||||
int ready(){return GSM3ShieldV1BaseProvider::ready();};
|
||||
|
||||
/** Get network status (connection)
|
||||
@return status
|
||||
*/
|
||||
inline GSM3_NetworkStatus_t getStatus(){return theGSM3ShieldV1ModemCore.getStatus();};
|
||||
|
||||
/** Get actual assigned IP address
|
||||
@param LocalIP Buffer for copy IP address
|
||||
@param LocalIPlength Buffer length
|
||||
@return command error if exists
|
||||
*/
|
||||
int getIP(char* LocalIP, int LocalIPlength);
|
||||
|
||||
/** Get actual assigned IP address in IPAddress format
|
||||
@return IP address in IPAddress format
|
||||
*/
|
||||
IPAddress getIPAddress();
|
||||
|
||||
/** Manages modem response
|
||||
@param from Initial byte of buffer
|
||||
@param to Final byte of buffer
|
||||
*/
|
||||
void manageResponse(byte from, byte to);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -0,0 +1,143 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#include <GSM3ShieldV1DirectModemProvider.h>
|
||||
#include <GSM3ShieldV1ModemCore.h>
|
||||
#include <HardwareSerial.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
#define __RESETPIN__ 7
|
||||
|
||||
//Constructor
|
||||
GSM3ShieldV1DirectModemProvider::GSM3ShieldV1DirectModemProvider(bool t)
|
||||
{
|
||||
trace=t;
|
||||
};
|
||||
|
||||
void GSM3ShieldV1DirectModemProvider::begin()
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.gss.begin(9600);
|
||||
}
|
||||
|
||||
void GSM3ShieldV1DirectModemProvider::restartModem()
|
||||
{
|
||||
pinMode(__RESETPIN__, OUTPUT);
|
||||
digitalWrite(__RESETPIN__, HIGH);
|
||||
delay(12000);
|
||||
digitalWrite(__RESETPIN__, LOW);
|
||||
delay(1000);
|
||||
|
||||
}
|
||||
|
||||
//To enable the debug process
|
||||
void GSM3ShieldV1DirectModemProvider::connect()
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.registerActiveProvider(this);
|
||||
}
|
||||
|
||||
//To disable the debug process
|
||||
void GSM3ShieldV1DirectModemProvider::disconnect()
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.registerActiveProvider(0);
|
||||
}
|
||||
|
||||
//Write to the modem by means of SoftSerial
|
||||
size_t GSM3ShieldV1DirectModemProvider::write(uint8_t c)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.write(c);
|
||||
}
|
||||
|
||||
//Detect if data to be read
|
||||
int/*bool*/ GSM3ShieldV1DirectModemProvider::available()
|
||||
{
|
||||
if (theGSM3ShieldV1ModemCore.gss.cb.peek(1)) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
//Read data
|
||||
int/*char*/ GSM3ShieldV1DirectModemProvider::read()
|
||||
{
|
||||
int dataRead;
|
||||
dataRead = theGSM3ShieldV1ModemCore.gss.cb.read();
|
||||
//In case last char in xof mode.
|
||||
if (!(theGSM3ShieldV1ModemCore.gss.cb.peek(0))) {
|
||||
theGSM3ShieldV1ModemCore.gss.spaceAvailable();
|
||||
delay(100);
|
||||
}
|
||||
return dataRead;
|
||||
}
|
||||
|
||||
//Peek data
|
||||
int/*char*/ GSM3ShieldV1DirectModemProvider::peek()
|
||||
{
|
||||
return theGSM3ShieldV1ModemCore.gss.cb.peek(0);
|
||||
}
|
||||
|
||||
//Flush data
|
||||
void GSM3ShieldV1DirectModemProvider::flush()
|
||||
{
|
||||
return theGSM3ShieldV1ModemCore.gss.cb.flush();
|
||||
}
|
||||
|
||||
String GSM3ShieldV1DirectModemProvider::writeModemCommand(String ATcommand, int responseDelay)
|
||||
{
|
||||
|
||||
if(trace)
|
||||
Serial.println(ATcommand);
|
||||
|
||||
// Flush other texts
|
||||
flush();
|
||||
|
||||
//Enter debug mode.
|
||||
connect();
|
||||
//Send the AT command.
|
||||
println(ATcommand);
|
||||
|
||||
delay(responseDelay);
|
||||
|
||||
//Get response data from modem.
|
||||
String result = "";
|
||||
if(trace)
|
||||
theGSM3ShieldV1ModemCore.gss.cb.debugBuffer();
|
||||
|
||||
while (available())
|
||||
{
|
||||
char c = read();
|
||||
result += c;
|
||||
}
|
||||
if(trace)
|
||||
Serial.println(result);
|
||||
//Leave the debug mode.
|
||||
disconnect();
|
||||
return result;
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
|
||||
#ifndef __GSM3DIRECTMODEMPROVIDER__
|
||||
#define __GSM3DIRECTMODEMPROVIDER__
|
||||
|
||||
#include <GSM3SoftSerial.h>
|
||||
#include <GSM3MobileNetworkProvider.h>
|
||||
#include <GSM3ShieldV1BaseProvider.h>
|
||||
#include <Stream.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
class GSM3ShieldV1DirectModemProvider : public GSM3ShieldV1BaseProvider, public Stream
|
||||
{
|
||||
private:
|
||||
|
||||
bool trace;
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor
|
||||
@param trace if true, dumps all AT dialogue to Serial
|
||||
*/
|
||||
GSM3ShieldV1DirectModemProvider(bool trace=false);
|
||||
|
||||
/**
|
||||
*/
|
||||
void begin();
|
||||
|
||||
/**
|
||||
*/
|
||||
void restartModem();
|
||||
|
||||
/** Enable the debug process.
|
||||
*/
|
||||
void connect();
|
||||
|
||||
/** Disable the debug process.
|
||||
*/
|
||||
void disconnect();
|
||||
|
||||
/** Debug write to modem by means of SoftSerial.
|
||||
@param c Character
|
||||
@return size
|
||||
*/
|
||||
size_t write(uint8_t c);
|
||||
|
||||
/** Check for incoming bytes in buffer
|
||||
@return
|
||||
*/
|
||||
int available();
|
||||
|
||||
/** Read from circular buffer
|
||||
@return character
|
||||
*/
|
||||
int read();
|
||||
|
||||
/** Read from circular buffer, but do not delete it
|
||||
@return character
|
||||
*/
|
||||
int peek();
|
||||
|
||||
/** Empty circular buffer
|
||||
*/
|
||||
void flush();
|
||||
|
||||
/** Manages modem response
|
||||
@param from Initial byte of buffer
|
||||
@param to Final byte of buffer
|
||||
*/
|
||||
void manageResponse(byte from, byte to){};
|
||||
|
||||
/** Recognize unsolicited event
|
||||
@param from
|
||||
@return true if successful
|
||||
*/
|
||||
bool recognizeUnsolicitedEvent(byte from){return false;};
|
||||
|
||||
/** Send AT command to modem
|
||||
@param command AT command
|
||||
@param delay Time to wait for response
|
||||
@return response from modem
|
||||
*/
|
||||
String writeModemCommand(String command, int delay);
|
||||
};
|
||||
|
||||
#endif
|
198
hardware/arduino/avr/libraries/GSM/GSM3ShieldV1ModemCore.cpp
Normal file
198
hardware/arduino/avr/libraries/GSM/GSM3ShieldV1ModemCore.cpp
Normal file
@ -0,0 +1,198 @@
|
||||
#include <GSM3ShieldV1ModemCore.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
GSM3ShieldV1ModemCore theGSM3ShieldV1ModemCore;
|
||||
|
||||
char* __ok__="OK";
|
||||
|
||||
GSM3ShieldV1ModemCore::GSM3ShieldV1ModemCore() : gss()
|
||||
{
|
||||
gss.registerMgr(this);
|
||||
_dataInBufferFrom=0;
|
||||
_dataInBufferTo=0;
|
||||
commandError=1;
|
||||
commandCounter=0;
|
||||
ongoingCommand=NONE;
|
||||
takeMilliseconds();
|
||||
|
||||
for(int i=0;i<UMPROVIDERS;i++)
|
||||
UMProvider[i]=0;
|
||||
}
|
||||
|
||||
void GSM3ShieldV1ModemCore::registerUMProvider(GSM3ShieldV1BaseProvider* provider)
|
||||
{
|
||||
for(int i=0;i<UMPROVIDERS;i++)
|
||||
{
|
||||
if(UMProvider[i]==0)
|
||||
{
|
||||
UMProvider[i]=provider;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void GSM3ShieldV1ModemCore::unRegisterUMProvider(GSM3ShieldV1BaseProvider* provider)
|
||||
{
|
||||
for(int i=0;i<UMPROVIDERS;i++)
|
||||
{
|
||||
if(UMProvider[i]==provider)
|
||||
{
|
||||
UMProvider[i]=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Response parse.
|
||||
bool GSM3ShieldV1ModemCore::genericParse_rsp(bool& rsp, char* string, char* string2)
|
||||
{
|
||||
if((string==0) && (string2==0))
|
||||
string=__ok__;
|
||||
|
||||
rsp=theBuffer().locate(string);
|
||||
|
||||
if((!rsp)&&(string2!=0))
|
||||
rsp=theBuffer().locate(string2);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void GSM3ShieldV1ModemCore::closeCommand(int code)
|
||||
{
|
||||
// If we were configuring the modem,
|
||||
// and there's been an error
|
||||
// we don't know exactly where we are
|
||||
if((code!=1)&&(theGSM3ShieldV1ModemCore.getOngoingCommand()==MODEMCONFIG))
|
||||
theGSM3ShieldV1ModemCore.setStatus(ERROR);
|
||||
|
||||
setCommandError(code);
|
||||
ongoingCommand=NONE;
|
||||
activeProvider=0;
|
||||
commandCounter=1;
|
||||
}
|
||||
|
||||
//Generic command (stored in flash).
|
||||
void GSM3ShieldV1ModemCore::genericCommand_rq(PROGMEM prog_char str[], bool addCR)
|
||||
{
|
||||
theBuffer().flush();
|
||||
writePGM(str, addCR);
|
||||
}
|
||||
|
||||
//Generic command (const string).
|
||||
void GSM3ShieldV1ModemCore::genericCommand_rqc(const char* str, bool addCR)
|
||||
{
|
||||
theBuffer().flush();
|
||||
print(str);
|
||||
if(addCR)
|
||||
print("\r");
|
||||
}
|
||||
|
||||
// If we are not debugging, lets manage data in interrupt time
|
||||
// but if we are not, just take note.
|
||||
void GSM3ShieldV1ModemCore::manageMsg(byte from, byte to)
|
||||
{
|
||||
if(_debug)
|
||||
{
|
||||
_dataInBufferFrom=from;
|
||||
_dataInBufferTo=to;
|
||||
}
|
||||
else
|
||||
{
|
||||
manageMsgNow(from, to);
|
||||
}
|
||||
}
|
||||
|
||||
void GSM3ShieldV1ModemCore::manageReceivedData()
|
||||
{
|
||||
if(_debug)
|
||||
{
|
||||
/* Serial.print(theBuffer().getHead());
|
||||
Serial.print(" ");
|
||||
Serial.println(theBuffer().getTail());*/
|
||||
if(_dataInBufferFrom != _dataInBufferTo)
|
||||
{
|
||||
theBuffer().debugBuffer();
|
||||
manageMsgNow(_dataInBufferFrom, _dataInBufferTo);
|
||||
_dataInBufferFrom=0;
|
||||
_dataInBufferTo=0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Just debugging the non debugging
|
||||
// Serial.println();
|
||||
// Serial.print("Com:");
|
||||
// Serial.print(ongoingCommand);
|
||||
// Serial.print(" Step:");
|
||||
// Serial.print(commandCounter);
|
||||
}
|
||||
}
|
||||
|
||||
//Select between URC or response.
|
||||
void GSM3ShieldV1ModemCore::manageMsgNow(byte from, byte to)
|
||||
{
|
||||
bool recognized=false;
|
||||
|
||||
for(int i=0;(i<UMPROVIDERS)&&(!recognized);i++)
|
||||
{
|
||||
if(UMProvider[i])
|
||||
recognized=UMProvider[i]->recognizeUnsolicitedEvent(from);
|
||||
}
|
||||
if((!recognized)&&(activeProvider))
|
||||
activeProvider->manageResponse(from, to);
|
||||
}
|
||||
|
||||
|
||||
void GSM3ShieldV1ModemCore::openCommand(GSM3ShieldV1BaseProvider* provider, GSM3_commandType_e c)
|
||||
{
|
||||
activeProvider=provider;
|
||||
commandError=0;
|
||||
commandCounter=1;
|
||||
ongoingCommand=c;
|
||||
_dataInBufferFrom=0;
|
||||
_dataInBufferTo=0;
|
||||
|
||||
};
|
||||
|
||||
size_t GSM3ShieldV1ModemCore::writePGM(PROGMEM prog_char str[], bool CR)
|
||||
{
|
||||
int i=0;
|
||||
char c;
|
||||
|
||||
do
|
||||
{
|
||||
c=pgm_read_byte_near(str + i);
|
||||
if(c!=0)
|
||||
write(c);
|
||||
i++;
|
||||
} while (c!=0);
|
||||
if(CR)
|
||||
print("\r");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t GSM3ShieldV1ModemCore::write(uint8_t c)
|
||||
{
|
||||
if(_debug)
|
||||
GSM3CircularBuffer::printCharDebug(c);
|
||||
return gss.write(c);
|
||||
}
|
||||
|
||||
unsigned long GSM3ShieldV1ModemCore::takeMilliseconds()
|
||||
{
|
||||
unsigned long now=millis();
|
||||
unsigned long delta;
|
||||
delta=now-milliseconds;
|
||||
milliseconds=now;
|
||||
return delta;
|
||||
}
|
||||
|
||||
void GSM3ShieldV1ModemCore::delayInsideInterrupt(unsigned long milliseconds)
|
||||
{
|
||||
for (unsigned long k=0;k<milliseconds;k++)
|
||||
theGSM3ShieldV1ModemCore.gss.tunedDelay(1000);
|
||||
}
|
260
hardware/arduino/avr/libraries/GSM/GSM3ShieldV1ModemCore.h
Normal file
260
hardware/arduino/avr/libraries/GSM/GSM3ShieldV1ModemCore.h
Normal file
@ -0,0 +1,260 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
|
||||
#ifndef __GSM3_SHIELDV1MODEMCORE__
|
||||
#define __GSM3_SHIELDV1MODEMCORE__
|
||||
|
||||
#include <GSM3SoftSerial.h>
|
||||
#include <GSM3ShieldV1BaseProvider.h>
|
||||
#include <GSM3MobileAccessProvider.h>
|
||||
#include <Print.h>
|
||||
|
||||
#define UMPROVIDERS 3
|
||||
|
||||
class GSM3ShieldV1ModemCore : public GSM3SoftSerialMgr, public Print
|
||||
{
|
||||
private:
|
||||
|
||||
// Phone number, used when calling, sending SMS and reading calling numbers
|
||||
// Also PIN in modem configuration
|
||||
// Also APN
|
||||
// Also remote server
|
||||
char* phoneNumber;
|
||||
|
||||
// Working port. Port used in the ongoing command, while opening a server
|
||||
// Also for IP address length
|
||||
int port;
|
||||
|
||||
// 0 = ongoing
|
||||
// 1 = OK
|
||||
// 2 = Error. Incorrect state
|
||||
// 3 = Unexpected modem message
|
||||
// 4 = OK but not available data.
|
||||
uint8_t commandError;
|
||||
|
||||
// Counts the steps by the command
|
||||
uint8_t commandCounter;
|
||||
|
||||
// Presently ongoing command
|
||||
GSM3_commandType_e ongoingCommand;
|
||||
|
||||
// Enable/disable debug
|
||||
bool _debug;
|
||||
byte _dataInBufferFrom;
|
||||
byte _dataInBufferTo;
|
||||
|
||||
// This is the modem (known) status
|
||||
GSM3_NetworkStatus_t _status;
|
||||
|
||||
GSM3ShieldV1BaseProvider* UMProvider[UMPROVIDERS];
|
||||
GSM3ShieldV1BaseProvider* activeProvider;
|
||||
|
||||
// Private function for anage message
|
||||
void manageMsgNow(byte from, byte to);
|
||||
|
||||
unsigned long milliseconds;
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
GSM3ShieldV1ModemCore();
|
||||
|
||||
GSM3SoftSerial gss; // Direct access to modem
|
||||
|
||||
/** Get phone number
|
||||
@return phone number
|
||||
*/
|
||||
char *getPhoneNumber(){return phoneNumber;};
|
||||
|
||||
/** Establish a new phone number
|
||||
@param n Phone number
|
||||
*/
|
||||
void setPhoneNumber(char *n){phoneNumber=n;};
|
||||
|
||||
/** Get port used
|
||||
@return port
|
||||
*/
|
||||
int getPort(){return port;};
|
||||
|
||||
/** Establish a new port for use
|
||||
@param p Port
|
||||
*/
|
||||
void setPort(int p){port=p;};
|
||||
|
||||
/** Get command error
|
||||
@return command error
|
||||
*/
|
||||
uint8_t getCommandError(){return commandError;};
|
||||
|
||||
/** Establish a command error
|
||||
@param n Command error
|
||||
*/
|
||||
void setCommandError(uint8_t n){commandError=n;};
|
||||
|
||||
/** Get command counter
|
||||
@return command counter
|
||||
*/
|
||||
uint8_t getCommandCounter(){return commandCounter;};
|
||||
|
||||
/** Set command counter
|
||||
@param c Initial value
|
||||
*/
|
||||
void setCommandCounter(uint8_t c){commandCounter=c;};
|
||||
|
||||
/** Get ongoing command
|
||||
@return command
|
||||
*/
|
||||
GSM3_commandType_e getOngoingCommand(){return ongoingCommand;};
|
||||
|
||||
/** Set ongoing command
|
||||
@param c New ongoing command
|
||||
*/
|
||||
void setOngoingCommand(GSM3_commandType_e c){ongoingCommand=c;};
|
||||
|
||||
/** Open command
|
||||
@param activeProvider Active provider
|
||||
@param c Command for open
|
||||
*/
|
||||
void openCommand(GSM3ShieldV1BaseProvider* activeProvider, GSM3_commandType_e c);
|
||||
|
||||
/** Close command
|
||||
@param code Close code
|
||||
*/
|
||||
void closeCommand(int code);
|
||||
|
||||
// These functions allow writing to the SoftwareSerial
|
||||
// If debug is set, dump to the console
|
||||
|
||||
/** Write a character in serial
|
||||
@param c Character
|
||||
@return size
|
||||
*/
|
||||
size_t write(uint8_t c);
|
||||
|
||||
/** Write PGM
|
||||
@param str Buffer for write
|
||||
@param CR Carriadge return adding automatically
|
||||
@return size
|
||||
*/
|
||||
virtual size_t writePGM(PROGMEM prog_char str[], bool CR=true);
|
||||
|
||||
/** Establish debug mode
|
||||
@param db Boolean that indicates debug on or off
|
||||
*/
|
||||
void setDebug(bool db){_debug=db;};
|
||||
|
||||
/** Generic response parser
|
||||
@param rsp Returns true if expected response exists
|
||||
@param string Substring expected in response
|
||||
@param string2 Second substring expected in response
|
||||
@return true if parsed correctly
|
||||
*/
|
||||
bool genericParse_rsp(bool& rsp, char* string=0, char* string2=0);
|
||||
|
||||
/** Generates a generic AT command request from PROGMEM prog_char buffer
|
||||
@param str Buffer with AT command
|
||||
@param addCR Carriadge return adding automatically
|
||||
*/
|
||||
void genericCommand_rq(PROGMEM prog_char str[], bool addCR=true);
|
||||
|
||||
/** Generates a generic AT command request from a simple char buffer
|
||||
@param str Buffer with AT command
|
||||
@param addCR Carriadge return adding automatically
|
||||
*/
|
||||
void genericCommand_rqc(const char* str, bool addCR=true);
|
||||
|
||||
/** Generates a generic AT command request from characters buffer
|
||||
@param str Buffer with AT command
|
||||
@param addCR Carriadge return adding automatically
|
||||
*/
|
||||
void genericCommand_rq(const char* str, bool addCR=true);
|
||||
|
||||
/** Returns the circular buffer
|
||||
@return circular buffer
|
||||
*/
|
||||
inline GSM3CircularBuffer& theBuffer(){return gss.cb;};
|
||||
|
||||
/** Establish a new network status
|
||||
@param status Network status
|
||||
*/
|
||||
inline void setStatus(GSM3_NetworkStatus_t status) { _status = status; };
|
||||
|
||||
/** Returns actual network status
|
||||
@return network status
|
||||
*/
|
||||
inline GSM3_NetworkStatus_t getStatus() { return _status; };
|
||||
|
||||
/** Register provider as willing to receive unsolicited messages
|
||||
@param provider Pointer to provider able to receive unsolicited messages
|
||||
*/
|
||||
void registerUMProvider(GSM3ShieldV1BaseProvider* provider);
|
||||
|
||||
/** unegister provider as willing to receive unsolicited messages
|
||||
@param provider Pointer to provider able to receive unsolicited messages
|
||||
*/
|
||||
void unRegisterUMProvider(GSM3ShieldV1BaseProvider* provider);
|
||||
|
||||
|
||||
/** Register a provider as "dialoguing" talking in facto with the modem
|
||||
@param provider Pointer to provider receiving responses
|
||||
*/
|
||||
void registerActiveProvider(GSM3ShieldV1BaseProvider* provider){activeProvider=provider;};
|
||||
|
||||
/** Needed to manage the SoftSerial. Receives the call when received data
|
||||
If _debugging, no code is called
|
||||
@param from Starting byte to read
|
||||
@param to Last byte to read
|
||||
*/
|
||||
void manageMsg(byte from, byte to);
|
||||
|
||||
/** If _debugging, this call is assumed to be made out of interrupts
|
||||
Prints incoming info and calls manageMsgNow
|
||||
*/
|
||||
void manageReceivedData();
|
||||
|
||||
/** Chronometer. Measure milliseconds from last call
|
||||
@return milliseconds from las time function was called
|
||||
*/
|
||||
unsigned long takeMilliseconds();
|
||||
|
||||
/** Delay for interrupts
|
||||
@param milliseconds Delay time in milliseconds
|
||||
*/
|
||||
void delayInsideInterrupt(unsigned long milliseconds);
|
||||
|
||||
};
|
||||
|
||||
extern GSM3ShieldV1ModemCore theGSM3ShieldV1ModemCore;
|
||||
|
||||
#endif
|
@ -0,0 +1,79 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
|
||||
#include <GSM3ShieldV1ModemVerification.h>
|
||||
|
||||
// constructor
|
||||
GSM3ShieldV1ModemVerification::GSM3ShieldV1ModemVerification()
|
||||
{
|
||||
};
|
||||
|
||||
// reset the modem for direct access
|
||||
int GSM3ShieldV1ModemVerification::begin()
|
||||
{
|
||||
int result=0;
|
||||
String modemResponse;
|
||||
|
||||
// check modem response
|
||||
modemAccess.begin();
|
||||
|
||||
// reset hardware
|
||||
modemAccess.restartModem();
|
||||
|
||||
modemResponse=modemAccess.writeModemCommand("AT", 1000);
|
||||
if(modemResponse.indexOf("OK")>=0)
|
||||
result=1;
|
||||
modemResponse=modemAccess.writeModemCommand("ATE0", 1000);
|
||||
return result;
|
||||
}
|
||||
|
||||
// get IMEI
|
||||
String GSM3ShieldV1ModemVerification::getIMEI()
|
||||
{
|
||||
String number;
|
||||
// AT command for obtain IMEI
|
||||
String modemResponse = modemAccess.writeModemCommand("AT+GSN", 2000);
|
||||
// Parse and check response
|
||||
char res_to_compare[modemResponse.length()];
|
||||
modemResponse.toCharArray(res_to_compare, modemResponse.length());
|
||||
if(strstr(res_to_compare,"OK") == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
number = modemResponse.substring(1, 17);
|
||||
return number;
|
||||
}
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef _GSM3SHIELDV1MODEMVERIFICATION_
|
||||
#define _GSM3SHIELDV1MODEMVERIFICATION_
|
||||
|
||||
#include <GSM3ShieldV1AccessProvider.h>
|
||||
#include <GSM3ShieldV1DirectModemProvider.h>
|
||||
|
||||
class GSM3ShieldV1ModemVerification
|
||||
{
|
||||
|
||||
private:
|
||||
|
||||
GSM3ShieldV1DirectModemProvider modemAccess;
|
||||
GSM3ShieldV1AccessProvider gsm; // Access provider to GSM/GPRS network
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
GSM3ShieldV1ModemVerification();
|
||||
|
||||
/** Check modem response and restart it
|
||||
*/
|
||||
int begin();
|
||||
|
||||
/** Obtain modem IMEI (command AT)
|
||||
@return modem IMEI number
|
||||
*/
|
||||
String getIMEI();
|
||||
|
||||
};
|
||||
|
||||
#endif;
|
@ -0,0 +1,583 @@
|
||||
#include <GSM3ShieldV1MultiClientProvider.h>
|
||||
#include <GSM3ShieldV1ModemCore.h>
|
||||
|
||||
char _command_MultiQISRVC[] PROGMEM = "AT+QISRVC=";
|
||||
|
||||
#define __TOUTFLUSH__ 10000
|
||||
|
||||
GSM3ShieldV1MultiClientProvider::GSM3ShieldV1MultiClientProvider()
|
||||
{
|
||||
theGSM3MobileClientProvider=this;
|
||||
theGSM3ShieldV1ModemCore.registerUMProvider(this);
|
||||
};
|
||||
|
||||
//Response management.
|
||||
void GSM3ShieldV1MultiClientProvider::manageResponse(byte from, byte to)
|
||||
{
|
||||
switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
|
||||
{
|
||||
case XON:
|
||||
if (flagReadingSocket)
|
||||
{
|
||||
// flagReadingSocket = 0;
|
||||
fullBufferSocket = (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()<3);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.setOngoingCommand(NONE);
|
||||
break;
|
||||
case NONE:
|
||||
theGSM3ShieldV1ModemCore.gss.cb.deleteToTheEnd(from);
|
||||
break;
|
||||
case CONNECTTCPCLIENT:
|
||||
connectTCPClientContinue();
|
||||
break;
|
||||
case DISCONNECTTCP:
|
||||
disconnectTCPContinue();
|
||||
break;
|
||||
case BEGINWRITESOCKET:
|
||||
beginWriteSocketContinue();
|
||||
break;
|
||||
case ENDWRITESOCKET:
|
||||
endWriteSocketContinue();
|
||||
break;
|
||||
case AVAILABLESOCKET:
|
||||
availableSocketContinue();
|
||||
break;
|
||||
case FLUSHSOCKET:
|
||||
fullBufferSocket = (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()<3);
|
||||
flushSocketContinue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Connect TCP main function.
|
||||
int GSM3ShieldV1MultiClientProvider::connectTCPClient(const char* server, int port, int id_socket)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setPort(port);
|
||||
idSocket = id_socket;
|
||||
|
||||
theGSM3ShieldV1ModemCore.setPhoneNumber((char*)server);
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,CONNECTTCPCLIENT);
|
||||
connectTCPClientContinue();
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
int GSM3ShieldV1MultiClientProvider::connectTCPClient(IPAddress add, int port, int id_socket)
|
||||
{
|
||||
remoteIP=add;
|
||||
theGSM3ShieldV1ModemCore.setPhoneNumber(0);
|
||||
return connectTCPClient(0, port, id_socket);
|
||||
}
|
||||
|
||||
//Connect TCP continue function.
|
||||
void GSM3ShieldV1MultiClientProvider::connectTCPClientContinue()
|
||||
{
|
||||
bool resp;
|
||||
// 0: Dot or DNS notation activation
|
||||
// 1: Disable SW flow control
|
||||
// 2: Waiting for IFC OK
|
||||
// 3: Start-up TCP connection "AT+QIOPEN"
|
||||
// 4: Wait for connection OK
|
||||
// 5: Wait for CONNECT
|
||||
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIDNSIP="), false);
|
||||
if ((theGSM3ShieldV1ModemCore.getPhoneNumber()!=0)&&
|
||||
((*(theGSM3ShieldV1ModemCore.getPhoneNumber())<'0')||((*(theGSM3ShieldV1ModemCore.getPhoneNumber())>'9'))))
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.print('1');
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
}
|
||||
else
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.print('0');
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
}
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
break;
|
||||
case 2:
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
//Response received
|
||||
if(resp)
|
||||
{
|
||||
// AT+QIOPEN
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIOPEN="),false);
|
||||
theGSM3ShieldV1ModemCore.print(idSocket);
|
||||
theGSM3ShieldV1ModemCore.print(",\"TCP\",\"");
|
||||
if(theGSM3ShieldV1ModemCore.getPhoneNumber()!=0)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.print(theGSM3ShieldV1ModemCore.getPhoneNumber());
|
||||
}
|
||||
else
|
||||
{
|
||||
remoteIP.printTo(theGSM3ShieldV1ModemCore);
|
||||
}
|
||||
theGSM3ShieldV1ModemCore.print('"');
|
||||
theGSM3ShieldV1ModemCore.print(',');
|
||||
theGSM3ShieldV1ModemCore.print(theGSM3ShieldV1ModemCore.getPort());
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(3);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
|
||||
case 3:
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
// Response received
|
||||
if(resp)
|
||||
{
|
||||
// OK Received
|
||||
// Great. Go for the next step
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(4);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
char auxLocate [12];
|
||||
prepareAuxLocate(PSTR("CONNECT OK"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp,auxLocate))
|
||||
{
|
||||
// Response received
|
||||
if(resp)
|
||||
{
|
||||
// Received CONNECT OK
|
||||
// Great. We're done
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
}
|
||||
else
|
||||
theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//Disconnect TCP main function.
|
||||
int GSM3ShieldV1MultiClientProvider::disconnectTCP(bool client1Server0, int id_socket)
|
||||
{
|
||||
idSocket = id_socket;
|
||||
|
||||
// First of all, we will flush the socket synchronously
|
||||
unsigned long m;
|
||||
m=millis();
|
||||
flushSocket();
|
||||
while(((millis()-m)< __TOUTFLUSH__ )&&(ready()==0))
|
||||
delay(10);
|
||||
|
||||
// Could not flush the communications... strange
|
||||
if(ready()==0)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setCommandError(2);
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
// Set up the command
|
||||
client1_server0 = client1Server0;
|
||||
flagReadingSocket=0;
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,DISCONNECTTCP);
|
||||
disconnectTCPContinue();
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
//Disconnect TCP continue function
|
||||
void GSM3ShieldV1MultiClientProvider::disconnectTCPContinue()
|
||||
{
|
||||
bool resp;
|
||||
// 1: Send AT+QISRVC
|
||||
// 2: "AT+QICLOSE"
|
||||
// 3: Wait for OK
|
||||
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_MultiQISRVC, false);
|
||||
if (client1_server0) theGSM3ShieldV1ModemCore.print('1');
|
||||
else theGSM3ShieldV1ModemCore.print('2');
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
break;
|
||||
case 2:
|
||||
// Parse response to QISRVC
|
||||
theGSM3ShieldV1ModemCore.genericParse_rsp(resp);
|
||||
if(resp)
|
||||
{
|
||||
// Send QICLOSE command
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QICLOSE="),false);
|
||||
theGSM3ShieldV1ModemCore.print(idSocket);
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(3);
|
||||
}
|
||||
else
|
||||
theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
break;
|
||||
case 3:
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(0);
|
||||
if (resp)
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
else
|
||||
theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Write socket first chain main function.
|
||||
void GSM3ShieldV1MultiClientProvider::beginWriteSocket(bool client1Server0, int id_socket)
|
||||
{
|
||||
idSocket = id_socket;
|
||||
client1_server0 = client1Server0;
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,BEGINWRITESOCKET);
|
||||
beginWriteSocketContinue();
|
||||
}
|
||||
|
||||
//Write socket first chain continue function.
|
||||
void GSM3ShieldV1MultiClientProvider::beginWriteSocketContinue()
|
||||
{
|
||||
bool resp;
|
||||
// 1: Send AT+QISRVC
|
||||
// 2: Send AT+QISEND
|
||||
// 3: wait for > and Write text
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
// AT+QISRVC
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_MultiQISRVC, false);
|
||||
if (client1_server0)
|
||||
theGSM3ShieldV1ModemCore.print('1');
|
||||
else
|
||||
theGSM3ShieldV1ModemCore.print('2');
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
break;
|
||||
case 2:
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
// Response received
|
||||
if(resp)
|
||||
{
|
||||
// AT+QISEND
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QISEND="), false);
|
||||
theGSM3ShieldV1ModemCore.print(idSocket);
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
char aux[2];
|
||||
aux[0]='>';
|
||||
aux[1]=0;
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, aux))
|
||||
{
|
||||
if(resp)
|
||||
{
|
||||
// Received ">"
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Write socket next chain function.
|
||||
void GSM3ShieldV1MultiClientProvider::writeSocket(const char* buf)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.print(buf);
|
||||
}
|
||||
|
||||
//Write socket character function.
|
||||
void GSM3ShieldV1MultiClientProvider::writeSocket(char c)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.print(c);
|
||||
}
|
||||
|
||||
//Write socket last chain main function.
|
||||
void GSM3ShieldV1MultiClientProvider::endWriteSocket()
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,ENDWRITESOCKET);
|
||||
endWriteSocketContinue();
|
||||
}
|
||||
|
||||
//Write socket last chain continue function.
|
||||
void GSM3ShieldV1MultiClientProvider::endWriteSocketContinue()
|
||||
{
|
||||
bool resp;
|
||||
// 1: Write text (ctrl-Z)
|
||||
// 2: Wait for OK
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
theGSM3ShieldV1ModemCore.write(26); // Ctrl-Z
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
break;
|
||||
case 2:
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
// OK received
|
||||
if (resp) theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Available socket main function.
|
||||
int GSM3ShieldV1MultiClientProvider::availableSocket(bool client1Server0, int id_socket)
|
||||
{
|
||||
if(flagReadingSocket==1)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setCommandError(1);
|
||||
return 1;
|
||||
}
|
||||
client1_server0 = client1Server0;
|
||||
idSocket = id_socket;
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,AVAILABLESOCKET);
|
||||
availableSocketContinue();
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
//Available socket continue function.
|
||||
void GSM3ShieldV1MultiClientProvider::availableSocketContinue()
|
||||
{
|
||||
bool resp;
|
||||
// 1: AT+QIRD
|
||||
// 2: Wait for OK and Next necessary AT+QIRD
|
||||
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QIRD=0,"),false);
|
||||
if (client1_server0)
|
||||
theGSM3ShieldV1ModemCore.print('1');
|
||||
else
|
||||
theGSM3ShieldV1ModemCore.print('2');
|
||||
theGSM3ShieldV1ModemCore.print(',');
|
||||
theGSM3ShieldV1ModemCore.print(idSocket);
|
||||
theGSM3ShieldV1ModemCore.print(",1500");
|
||||
// theGSM3ShieldV1ModemCore.print(",120");
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
break;
|
||||
case 2:
|
||||
if(parseQIRD_head(resp))
|
||||
{
|
||||
if (!resp)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.closeCommand(4);
|
||||
}
|
||||
else
|
||||
{
|
||||
flagReadingSocket=1;
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Read Socket Parse head.
|
||||
bool GSM3ShieldV1MultiClientProvider::parseQIRD_head(bool& rsp)
|
||||
{
|
||||
char _qird [8];
|
||||
prepareAuxLocate(PSTR("+QIRD:"), _qird);
|
||||
fullBufferSocket = (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()<3);
|
||||
if(theGSM3ShieldV1ModemCore.theBuffer().locate(_qird))
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.theBuffer().chopUntil(_qird, true);
|
||||
// Saving more memory, reuse _qird
|
||||
_qird[0]='\n';
|
||||
_qird[1]=0;
|
||||
theGSM3ShieldV1ModemCore.theBuffer().chopUntil(_qird, true);
|
||||
rsp = true;
|
||||
return true;
|
||||
}
|
||||
else if(theGSM3ShieldV1ModemCore.theBuffer().locate("OK"))
|
||||
{
|
||||
rsp = false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
rsp = false;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*
|
||||
//Read socket main function.
|
||||
int GSM3ShieldV1MultiClientProvider::readSocket()
|
||||
{
|
||||
char charSocket;
|
||||
charSocket = theGSM3ShieldV1ModemCore.theBuffer().read();
|
||||
//Case buffer not full
|
||||
if (!fullBufferSocket)
|
||||
{
|
||||
//The last part of the buffer after data is CRLFOKCRLF
|
||||
if (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==125)
|
||||
{
|
||||
//Start again availableSocket function.
|
||||
flagReadingSocket=0;
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,AVAILABLESOCKET);
|
||||
availableSocketContinue();
|
||||
}
|
||||
}
|
||||
else if (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==127)
|
||||
{
|
||||
// The buffer is full, no more action is possible until we have read()
|
||||
theGSM3ShieldV1ModemCore.theBuffer().flush();
|
||||
flagReadingSocket = 1;
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,XON);
|
||||
theGSM3ShieldV1ModemCore.gss.spaceAvailable();
|
||||
//A small delay to assure data received after xon.
|
||||
delay(10);
|
||||
}
|
||||
//To distinguish the case no more available data in socket.
|
||||
if (ready()==1)
|
||||
return charSocket;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
int GSM3ShieldV1MultiClientProvider::readSocket()
|
||||
{
|
||||
char charSocket;
|
||||
|
||||
if(theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==0)
|
||||
{
|
||||
Serial.println();Serial.println("*");
|
||||
return 0;
|
||||
}
|
||||
|
||||
charSocket = theGSM3ShieldV1ModemCore.theBuffer().read();
|
||||
//Case buffer not full
|
||||
if (!fullBufferSocket)
|
||||
{
|
||||
//The last part of the buffer after data is CRLFOKCRLF
|
||||
if (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()==125)
|
||||
{
|
||||
//Start again availableSocket function.
|
||||
flagReadingSocket=0;
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,AVAILABLESOCKET);
|
||||
availableSocketContinue();
|
||||
}
|
||||
}
|
||||
else if (theGSM3ShieldV1ModemCore.theBuffer().availableBytes()>=100)
|
||||
{
|
||||
// The buffer was full, we have to let the data flow again
|
||||
// theGSM3ShieldV1ModemCore.theBuffer().flush();
|
||||
flagReadingSocket = 1;
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,XON);
|
||||
theGSM3ShieldV1ModemCore.gss.spaceAvailable();
|
||||
//A small delay to assure data received after xon.
|
||||
delay(100);
|
||||
if(theGSM3ShieldV1ModemCore.theBuffer().availableBytes() >=6)
|
||||
fullBufferSocket=false;
|
||||
}
|
||||
|
||||
return charSocket;
|
||||
|
||||
}
|
||||
|
||||
//Read socket main function.
|
||||
int GSM3ShieldV1MultiClientProvider::peekSocket()
|
||||
{
|
||||
return theGSM3ShieldV1ModemCore.theBuffer().peek(0);
|
||||
}
|
||||
|
||||
|
||||
//Flush SMS main function.
|
||||
void GSM3ShieldV1MultiClientProvider::flushSocket()
|
||||
{
|
||||
flagReadingSocket=0;
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,FLUSHSOCKET);
|
||||
flushSocketContinue();
|
||||
}
|
||||
|
||||
//Send SMS continue function.
|
||||
void GSM3ShieldV1MultiClientProvider::flushSocketContinue()
|
||||
{
|
||||
bool resp;
|
||||
// 1: Deleting SMS
|
||||
// 2: wait for OK
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
//DEBUG
|
||||
//Serial.println("Flushing Socket.");
|
||||
theGSM3ShieldV1ModemCore.theBuffer().flush();
|
||||
if (fullBufferSocket)
|
||||
{
|
||||
//Serial.println("Buffer flushed.");
|
||||
theGSM3ShieldV1ModemCore.gss.spaceAvailable();
|
||||
}
|
||||
else
|
||||
{
|
||||
//Serial.println("Socket flushed completely.");
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//URC recognize.
|
||||
// Momentarily, we will not recognize "closes" in client mode
|
||||
bool GSM3ShieldV1MultiClientProvider::recognizeUnsolicitedEvent(byte oldTail)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int GSM3ShieldV1MultiClientProvider::getSocket(int socket)
|
||||
{
|
||||
if(socket==-1)
|
||||
{
|
||||
int i;
|
||||
for(i=minSocket(); i<=maxSocket(); i++)
|
||||
{
|
||||
if (!(sockets&(0x0001<<i)))
|
||||
{
|
||||
sockets|=((0x0001)<<i);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(sockets&(0x0001<<socket)))
|
||||
{
|
||||
sockets|=((0x0001)<<socket);
|
||||
return socket;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void GSM3ShieldV1MultiClientProvider::releaseSocket(int socket)
|
||||
{
|
||||
if (sockets&((0x0001)<<socket))
|
||||
sockets^=((0x0001)<<socket);
|
||||
}
|
||||
|
||||
bool GSM3ShieldV1MultiClientProvider::getStatusSocketClient(uint8_t socket)
|
||||
{
|
||||
if(socket>8)
|
||||
return 0;
|
||||
if(sockets&(0x0001<<socket))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -0,0 +1,202 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef __GSM3_SHIELDV1CLIENTPROVIDER__
|
||||
#define __GSM3_SHIELDV1CLIENTPROVIDER__
|
||||
|
||||
#include <GSM3MobileClientProvider.h>
|
||||
#include <GSM3ShieldV1BaseProvider.h>
|
||||
|
||||
class GSM3ShieldV1MultiClientProvider : public GSM3MobileClientProvider, public GSM3ShieldV1BaseProvider
|
||||
{
|
||||
private:
|
||||
|
||||
int remotePort; // Current operation remote port
|
||||
int idSocket; // Remote ID socket
|
||||
IPAddress remoteIP; // Remote IP address
|
||||
|
||||
uint16_t sockets;
|
||||
|
||||
/** Continue to connect TCP client function
|
||||
*/
|
||||
void connectTCPClientContinue();
|
||||
|
||||
/** Continue to disconnect TCP client function
|
||||
*/
|
||||
void disconnectTCPContinue();
|
||||
|
||||
/** Continue to begin socket for write function
|
||||
*/
|
||||
void beginWriteSocketContinue();
|
||||
|
||||
/** Continue to end write socket function
|
||||
*/
|
||||
void endWriteSocketContinue();
|
||||
|
||||
/** Continue to available socket function
|
||||
*/
|
||||
void availableSocketContinue();
|
||||
|
||||
/** Continue to flush socket function
|
||||
*/
|
||||
void flushSocketContinue();
|
||||
|
||||
// GATHER!
|
||||
bool flagReadingSocket; //In case socket data being read, update fullBufferSocket in the next buffer.
|
||||
bool fullBufferSocket; //To detect if the socket data being read needs another buffer.
|
||||
bool client1_server0; //1 Client, 0 Server.
|
||||
|
||||
/** Parse QIRD response
|
||||
@param rsp Returns true if expected response exists
|
||||
@return true if command executed correctly
|
||||
*/
|
||||
bool parseQIRD_head(bool& rsp);
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
GSM3ShieldV1MultiClientProvider();
|
||||
|
||||
/** Minimum socket
|
||||
@return 0
|
||||
*/
|
||||
int minSocket(){return 0;};
|
||||
|
||||
/** Maximum socket
|
||||
@return 5
|
||||
*/
|
||||
int maxSocket(){return 5;};
|
||||
|
||||
/** Connect to a remote TCP server
|
||||
@param server String with IP or server name
|
||||
@param port Remote port number
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
int connectTCPClient(const char* server, int port, int id_socket);
|
||||
|
||||
/** Connect to a remote TCP server
|
||||
@param add Remote IP address
|
||||
@param port Remote port number
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
int connectTCPClient(IPAddress add, int port, int id_socket);
|
||||
|
||||
/** Begin writing through a socket
|
||||
@param client1Server0 1 if modem acts as client, 0 if acts as server
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
void beginWriteSocket(bool client1Server0, int id_socket);
|
||||
|
||||
/** Write through a socket. MUST go after beginWriteSocket()
|
||||
@param buf characters to be written (final 0 will not be written)
|
||||
*/
|
||||
void writeSocket(const char* buf);
|
||||
|
||||
/** Write through a socket. MUST go after beginWriteSocket()
|
||||
@param c character to be written
|
||||
*/
|
||||
void writeSocket(char c);
|
||||
|
||||
/** Finish current writing
|
||||
*/
|
||||
void endWriteSocket();
|
||||
|
||||
/** Check if there are data to be read in socket.
|
||||
@param client1Server0 1 if modem acts as client, 0 if acts as server
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if there are data available, 4 if no data, otherwise error
|
||||
*/
|
||||
int availableSocket(bool client, int id_socket); // With "available" and "readSocket" ask the modem for 1500 bytes.
|
||||
|
||||
/** Read a character from socket
|
||||
@return socket
|
||||
*/
|
||||
int readSocket(); //If Read() gets to the end of the QIRD response, execute again QIRD SYNCHRONOUSLY
|
||||
|
||||
/** Flush socket
|
||||
*/
|
||||
void flushSocket();
|
||||
|
||||
/** Get a character but will not advance the buffer head
|
||||
@return character
|
||||
*/
|
||||
int peekSocket();
|
||||
|
||||
/** Close a socket
|
||||
@param client1Server0 1 if modem acts as client, 0 if acts as server
|
||||
@param id_socket Local socket number
|
||||
@return 0 if command running, 1 if success, otherwise error
|
||||
*/
|
||||
int disconnectTCP(bool client1Server0, int id_socket);
|
||||
|
||||
/** Recognize unsolicited event
|
||||
@param from
|
||||
@return true if successful
|
||||
*/
|
||||
bool recognizeUnsolicitedEvent(byte from);
|
||||
|
||||
/** Manages modem response
|
||||
@param from Initial byte of buffer
|
||||
@param to Final byte of buffer
|
||||
*/
|
||||
void manageResponse(byte from, byte to);
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
int ready(){return GSM3ShieldV1BaseProvider::ready();};
|
||||
|
||||
/** Get client socket
|
||||
@param socket
|
||||
@return socket
|
||||
*/
|
||||
int getSocket(int socket=-1);
|
||||
|
||||
/** Release socket
|
||||
@param socket Socket for release
|
||||
*/
|
||||
void releaseSocket(int socket);
|
||||
|
||||
/** Get socket client status
|
||||
@param socket Socket
|
||||
@return socket client status
|
||||
*/
|
||||
bool getStatusSocketClient(uint8_t socket);
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,357 @@
|
||||
#include <GSM3ShieldV1MultiServerProvider.h>
|
||||
#include <GSM3ShieldV1ModemCore.h>
|
||||
#include <Arduino.h>
|
||||
|
||||
#define __NCLIENTS_MAX__ 3
|
||||
|
||||
char _command_QILOCIP[] PROGMEM = "AT+QILOCIP";
|
||||
|
||||
GSM3ShieldV1MultiServerProvider::GSM3ShieldV1MultiServerProvider()
|
||||
{
|
||||
theGSM3MobileServerProvider=this;
|
||||
socketsAsServer=0;
|
||||
socketsAccepted=0;
|
||||
theGSM3ShieldV1ModemCore.registerUMProvider(this);
|
||||
};
|
||||
|
||||
//Response management.
|
||||
void GSM3ShieldV1MultiServerProvider::manageResponse(byte from, byte to)
|
||||
{
|
||||
switch(theGSM3ShieldV1ModemCore.getOngoingCommand())
|
||||
{
|
||||
case NONE:
|
||||
theGSM3ShieldV1ModemCore.gss.cb.deleteToTheEnd(from);
|
||||
break;
|
||||
case CONNECTSERVER:
|
||||
connectTCPServerContinue();
|
||||
break;
|
||||
case GETIP:
|
||||
getIPContinue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Connect Server main function.
|
||||
int GSM3ShieldV1MultiServerProvider::connectTCPServer(int port)
|
||||
{
|
||||
// We forget about LocalIP as it has no real use, the modem does whatever it likes
|
||||
theGSM3ShieldV1ModemCore.setPort(port);
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,CONNECTSERVER);
|
||||
connectTCPServerContinue();
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
//Connect Server continue function.
|
||||
void GSM3ShieldV1MultiServerProvider::connectTCPServerContinue()
|
||||
{
|
||||
|
||||
bool resp;
|
||||
// 1: Read Local IP "AT+QILOCIP"
|
||||
// 2: Waiting for IP and Set local port "AT+QILPORT"
|
||||
// 3: Waiting for QILPOR OK andConfigure as server "AT+QISERVER"
|
||||
// 4: Wait for SERVER OK
|
||||
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
//"AT+QILOCIP."
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_QILOCIP);
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
break;
|
||||
case 2:
|
||||
//Not IP storing but the command is necessary.
|
||||
//if(parseQILOCIP_rsp(local_IP, local_IP_Length, resp))
|
||||
// This awful trick saves some RAM bytes
|
||||
char aux[3];
|
||||
aux[0]='\r';aux[1]='\n';aux[2]=0;
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp, aux))
|
||||
{
|
||||
//Response received
|
||||
if(resp)
|
||||
{
|
||||
// Great. Go for the next step
|
||||
// AT+QILPORT
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QILPORT=\"TCP\","),false);
|
||||
theGSM3ShieldV1ModemCore.print( theGSM3ShieldV1ModemCore.getPort());
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(3);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
// Response received
|
||||
if(resp)
|
||||
{
|
||||
// OK received
|
||||
// Great. Go for the next step
|
||||
// AT+QISERVER
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QISERVER=0,"),false);
|
||||
theGSM3ShieldV1ModemCore.print(__NCLIENTS_MAX__);
|
||||
theGSM3ShieldV1ModemCore.print('\r');
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(4);
|
||||
}
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if(theGSM3ShieldV1ModemCore.genericParse_rsp(resp))
|
||||
{
|
||||
// Response received
|
||||
// OK received, kathapoon, chessespoon
|
||||
if (resp) theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
else theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//QILOCIP parse.
|
||||
bool GSM3ShieldV1MultiServerProvider::parseQILOCIP_rsp(char* LocalIP, int LocalIPlength, bool& rsp)
|
||||
{
|
||||
if (!(theGSM3ShieldV1ModemCore.theBuffer().extractSubstring("\r\n","\r\n", LocalIP, LocalIPlength)))
|
||||
rsp = false;
|
||||
else
|
||||
rsp = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
//Get IP main function.
|
||||
int GSM3ShieldV1MultiServerProvider::getIP(char* LocalIP, int LocalIPlength)
|
||||
{
|
||||
theGSM3ShieldV1ModemCore.setPhoneNumber(LocalIP);
|
||||
theGSM3ShieldV1ModemCore.setPort(LocalIPlength);
|
||||
theGSM3ShieldV1ModemCore.openCommand(this,GETIP);
|
||||
getIPContinue();
|
||||
return theGSM3ShieldV1ModemCore.getCommandError();
|
||||
}
|
||||
|
||||
void GSM3ShieldV1MultiServerProvider::getIPContinue()
|
||||
{
|
||||
|
||||
bool resp;
|
||||
// 1: Read Local IP "AT+QILOCIP"
|
||||
// 2: Waiting for IP.
|
||||
|
||||
switch (theGSM3ShieldV1ModemCore.getCommandCounter()) {
|
||||
case 1:
|
||||
//AT+QILOCIP
|
||||
theGSM3ShieldV1ModemCore.genericCommand_rq(_command_QILOCIP);
|
||||
theGSM3ShieldV1ModemCore.setCommandCounter(2);
|
||||
break;
|
||||
case 2:
|
||||
if(parseQILOCIP_rsp(theGSM3ShieldV1ModemCore.getPhoneNumber(), theGSM3ShieldV1ModemCore.getPort(), resp))
|
||||
{
|
||||
if (resp)
|
||||
theGSM3ShieldV1ModemCore.closeCommand(1);
|
||||
else
|
||||
theGSM3ShieldV1ModemCore.closeCommand(3);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool GSM3ShieldV1MultiServerProvider::getSocketAsServerModemStatus(int s)
|
||||
{
|
||||
if (socketsAccepted&(0x0001<<s))
|
||||
return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
|
||||
//URC recognize.
|
||||
bool GSM3ShieldV1MultiServerProvider::recognizeUnsolicitedEvent(byte oldTail)
|
||||
{
|
||||
|
||||
int nlength;
|
||||
char auxLocate [15];
|
||||
|
||||
|
||||
//REMOTE SOCKET CLOSED.
|
||||
prepareAuxLocate(PSTR("0, CLOSED\r\n"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
releaseSocket(0);
|
||||
socketsAccepted &= ~(0x0001);
|
||||
//Serial.println("JCR_DB REMOTE CLOSED");
|
||||
}
|
||||
|
||||
//REMOTE SOCKET CLOSED.
|
||||
|
||||
prepareAuxLocate(PSTR("1, CLOSED\r\n"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
releaseSocket(1);
|
||||
socketsAccepted &= ~(0x0002);
|
||||
}
|
||||
|
||||
//REMOTE SOCKET CLOSED.
|
||||
prepareAuxLocate(PSTR("2, CLOSED\r\n"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
releaseSocket(2);
|
||||
socketsAccepted &= ~(0x0004);
|
||||
}
|
||||
|
||||
//REMOTE SOCKET CLOSED.
|
||||
prepareAuxLocate(PSTR("3, CLOSED\r\n"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
releaseSocket(3);
|
||||
socketsAccepted &= ~(0x0008);
|
||||
}
|
||||
|
||||
//REMOTE SOCKET CLOSED.
|
||||
prepareAuxLocate(PSTR("4, CLOSED\r\n"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
releaseSocket(4);
|
||||
socketsAccepted &= ~(0x0010);
|
||||
}
|
||||
|
||||
//REMOTE SOCKET CLOSED.
|
||||
prepareAuxLocate(PSTR("5, CLOSED\r\n"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
releaseSocket(5);
|
||||
socketsAccepted &= ~(0x0020);
|
||||
}
|
||||
|
||||
//REMOTE SOCKET CLOSED.
|
||||
prepareAuxLocate(PSTR("6, CLOSED\r\n"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
releaseSocket(6);
|
||||
socketsAccepted &= ~(0x0040);
|
||||
}
|
||||
|
||||
//REMOTE SOCKET CLOSED.
|
||||
prepareAuxLocate(PSTR("7, CLOSED\r\n"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
releaseSocket(7);
|
||||
socketsAccepted &= ~(0x0080);
|
||||
}
|
||||
|
||||
//REMOTE SOCKET ACCEPTED.
|
||||
prepareAuxLocate(PSTR("0, REMOTE IP"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
theGSM3ShieldV1ModemCore.gss.cb.flush();
|
||||
socketsAccepted |= (0x0001);
|
||||
return true;
|
||||
}
|
||||
|
||||
//REMOTE SOCKET ACCEPTED.
|
||||
prepareAuxLocate(PSTR("1, REMOTE IP"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
theGSM3ShieldV1ModemCore.gss.cb.flush();
|
||||
socketsAccepted |= (0x0002);
|
||||
return true;
|
||||
}
|
||||
|
||||
//REMOTE SOCKET ACCEPTED.
|
||||
prepareAuxLocate(PSTR("2, REMOTE IP"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
theGSM3ShieldV1ModemCore.gss.cb.flush();
|
||||
socketsAccepted |= (0x0004);
|
||||
return true;
|
||||
}
|
||||
|
||||
//REMOTE SOCKET ACCEPTED.
|
||||
prepareAuxLocate(PSTR("3, REMOTE IP"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
theGSM3ShieldV1ModemCore.gss.cb.flush();
|
||||
socketsAccepted |= (0x0008);
|
||||
return true;
|
||||
}
|
||||
|
||||
//REMOTE SOCKET ACCEPTED.
|
||||
prepareAuxLocate(PSTR("4, REMOTE IP"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
theGSM3ShieldV1ModemCore.gss.cb.flush();
|
||||
socketsAccepted |= (0x0010);
|
||||
return true;
|
||||
}
|
||||
|
||||
//REMOTE SOCKET ACCEPTED.
|
||||
prepareAuxLocate(PSTR("5, REMOTE IP"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
theGSM3ShieldV1ModemCore.gss.cb.flush();
|
||||
socketsAccepted |= (0x0020);
|
||||
return true;
|
||||
}
|
||||
|
||||
//REMOTE SOCKET ACCEPTED.
|
||||
prepareAuxLocate(PSTR("6, REMOTE IP"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
theGSM3ShieldV1ModemCore.gss.cb.flush();
|
||||
socketsAccepted |= (0x0040);
|
||||
return true;
|
||||
}
|
||||
|
||||
//REMOTE SOCKET ACCEPTED.
|
||||
prepareAuxLocate(PSTR("7, REMOTE IP"), auxLocate);
|
||||
if(theGSM3ShieldV1ModemCore.gss.cb.locate(auxLocate))
|
||||
{
|
||||
//To detect remote socket closed for example inside socket data.
|
||||
theGSM3ShieldV1ModemCore.gss.cb.flush();
|
||||
socketsAccepted |= (0x0080);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool GSM3ShieldV1MultiServerProvider::getStatusSocketAsServer(uint8_t socket)
|
||||
{
|
||||
if(socketsAsServer&(0x0001<<socket))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
|
||||
void GSM3ShieldV1MultiServerProvider::releaseSocket(int socket)
|
||||
{
|
||||
if (socketsAsServer&((0x0001)<<socket))
|
||||
socketsAsServer^=((0x0001)<<socket);
|
||||
}
|
||||
|
||||
int GSM3ShieldV1MultiServerProvider::getNewOccupiedSocketAsServer()
|
||||
{
|
||||
int i;
|
||||
ready();
|
||||
for(i=minSocketAsServer(); i<=maxSocketAsServer(); i++)
|
||||
{
|
||||
if ((!(socketsAsServer&(0x0001<<i))) && getSocketAsServerModemStatus(i))
|
||||
{
|
||||
socketsAsServer|=((0x0001)<<i);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
// No new occupied
|
||||
return -1;
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
/*
|
||||
This file is part of the GSM3 communications library for Arduino
|
||||
-- Multi-transport communications platform
|
||||
-- Fully asynchronous
|
||||
-- Includes code for the Arduino-Telefonica GSM/GPRS Shield V1
|
||||
-- Voice calls
|
||||
-- SMS
|
||||
-- TCP/IP connections
|
||||
-- HTTP basic clients
|
||||
|
||||
This library has been developed by Telefónica Digital - PDI -
|
||||
- Physical Internet Lab, as part as its collaboration with
|
||||
Arduino and the Open Hardware Community.
|
||||
|
||||
September-December 2012
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
The latest version of this library can always be found at
|
||||
https://github.com/BlueVia/Official-Arduino
|
||||
*/
|
||||
#ifndef __GSM3_SHIELDV1SERVERPROVIDER__
|
||||
#define __GSM3_SHIELDV1SERVERPROVIDER__
|
||||
|
||||
#include <GSM3MobileServerProvider.h>
|
||||
#include <GSM3ShieldV1BaseProvider.h>
|
||||
|
||||
class GSM3ShieldV1MultiServerProvider : public GSM3MobileServerProvider, public GSM3ShieldV1BaseProvider
|
||||
{
|
||||
private:
|
||||
|
||||
// Used sockets
|
||||
uint8_t socketsAsServer;
|
||||
uint8_t socketsAccepted;
|
||||
|
||||
/** Continue to connect TCP server function
|
||||
*/
|
||||
void connectTCPServerContinue();
|
||||
|
||||
/** Continue to get IP function
|
||||
*/
|
||||
void getIPContinue();
|
||||
|
||||
/** Release socket
|
||||
@param socket Socket
|
||||
*/
|
||||
void releaseSocket(int socket);
|
||||
|
||||
/** Parse QILOCIP response
|
||||
@param LocalIP Buffer for save local IP address
|
||||
@param LocalIPlength Buffer size
|
||||
@param rsp Returns if expected response exists
|
||||
@return true if command executed correctly
|
||||
*/
|
||||
bool parseQILOCIP_rsp(char* LocalIP, int LocalIPlength, bool& rsp);
|
||||
|
||||
public:
|
||||
|
||||
/** Constructor */
|
||||
GSM3ShieldV1MultiServerProvider();
|
||||
|
||||
/** minSocketAsServer
|
||||
@return 0
|
||||
*/
|
||||
int minSocketAsServer(){return 0;};
|
||||
|
||||
/** maxSocketAsServer
|
||||
@return 0
|
||||
*/
|
||||
int maxSocketAsServer(){return 4;};
|
||||
|
||||
/** Get modem status
|
||||
@param s
|
||||
@return modem status (true if connected)
|
||||
*/
|
||||
bool getSocketAsServerModemStatus(int s);
|
||||
|
||||
/** Get new occupied socket as server
|
||||
@return command error if exists
|
||||
*/
|
||||
int getNewOccupiedSocketAsServer();
|
||||
|
||||
/** Connect server to TCP port
|
||||
@param port TCP port
|
||||
@return command error if exists
|
||||
*/
|
||||
int connectTCPServer(int port);
|
||||
|
||||
/** Get server IP address
|
||||
@param LocalIP Buffer for copy IP address
|
||||
@param LocalIPlength Length of buffer
|
||||
@return command error if exists
|
||||
*/
|
||||
int getIP(char* LocalIP, int LocalIPlength);
|
||||
|
||||
// int disconnectTCP(bool client1Server0, int id_socket);
|
||||
|
||||
/** Get last command status
|
||||
@return returns 0 if last command is still executing, 1 success, >1 error
|
||||
*/
|
||||
int ready(){return GSM3ShieldV1BaseProvider::ready();};
|
||||
|
||||
/** Get socket status as server
|
||||
@param socket Socket to get status
|
||||
@return socket status
|
||||
*/
|
||||
bool getStatusSocketAsServer(uint8_t socket);
|
||||
|
||||
/** Manages modem response
|
||||
@param from Initial byte of buffer
|
||||
@param to Final byte of buffer
|
||||
*/
|
||||
void manageResponse(byte from, byte to);
|
||||
|
||||
/** Recognize unsolicited event
|
||||
@param oldTail
|
||||
@return true if successful
|
||||
*/
|
||||
bool recognizeUnsolicitedEvent(byte oldTail);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user