From 8c5d809280904562aee082e2eab4ceb9f8523d9d Mon Sep 17 00:00:00 2001 From: Mimmo La Fauci Date: Sun, 10 Mar 2013 22:55:21 +0100 Subject: Updates to WiFi shield firmware. --- firmwares/wifishield/wifiHD/src/ard_utils.h | 57 +++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 15 deletions(-) (limited to 'firmwares/wifishield/wifiHD/src/ard_utils.h') diff --git a/firmwares/wifishield/wifiHD/src/ard_utils.h b/firmwares/wifishield/wifiHD/src/ard_utils.h index 4b31c46..5dee3c0 100644 --- a/firmwares/wifishield/wifiHD/src/ard_utils.h +++ b/firmwares/wifishield/wifiHD/src/ard_utils.h @@ -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,15 @@ #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 {\ + INFO_TCP("ttcp:%p tpcb:%p state:%d lpcb:%p state:%d left:%d sent:%d\n", \ + TTCP, TTCP->tpcb[0], (TTCP->tpcb[0])?TTCP->tpcb[0]->state:0, \ + TTCP->lpcb, (TTCP->lpcb)?TTCP->lpcb->state:0, \ + (TTCP)?TTCP->left:0, (TTCP)?TTCP->buff_sent:0); \ + } while(0); + +#define Mode2Str(_Mode) ((_Mode==0)?"TRANSMIT":"RECEIVE") +#define ProtMode2Str(_protMode) ((_protMode==0)?"TCP":"UDP") typedef struct sData { @@ -246,7 +263,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 +283,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_ */ -- cgit v1.2.3-18-g5258 From 41d49e97f0d93853659f37fe5e4d4e0a19c20b41 Mon Sep 17 00:00:00 2001 From: Mimmo La Fauci Date: Fri, 22 Mar 2013 13:42:12 +0100 Subject: Fix issue with multiple clients on WebServer --- firmwares/wifishield/wifiHD/src/ard_utils.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'firmwares/wifishield/wifiHD/src/ard_utils.h') diff --git a/firmwares/wifishield/wifiHD/src/ard_utils.h b/firmwares/wifishield/wifiHD/src/ard_utils.h index 5dee3c0..323b328 100644 --- a/firmwares/wifishield/wifiHD/src/ard_utils.h +++ b/firmwares/wifishield/wifiHD/src/ard_utils.h @@ -242,10 +242,11 @@ #endif #define DUMP_TCP_STATE(TTCP) do {\ - INFO_TCP("ttcp:%p tpcb:%p state:%d lpcb:%p state:%d left:%d sent:%d\n", \ - TTCP, TTCP->tpcb[0], (TTCP->tpcb[0])?TTCP->tpcb[0]->state:0, \ + 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)?TTCP->left:0, (TTCP)?TTCP->buff_sent: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") -- cgit v1.2.3-18-g5258