diff options
author | David A. Mellis <d.mellis@arduino.cc> | 2012-09-13 10:42:25 -0400 |
---|---|---|
committer | David A. Mellis <d.mellis@arduino.cc> | 2012-09-13 10:42:25 -0400 |
commit | bd45bf50c7c68ec35c3aad8c5e7bf4d3db9cafc1 (patch) | |
tree | c02065cc7b15ce5f0a8eaa9f0030a268b37c89bb /firmwares/wifishield/wifiHD/src/ard_spi.h | |
parent | 6225a8596005bfb0be68fa641f5b47d01a95c12d (diff) | |
parent | 0d9a111face4f3629bcae8e52af843792af3b453 (diff) |
Merge branch 'master' of ../wifishield
Diffstat (limited to 'firmwares/wifishield/wifiHD/src/ard_spi.h')
-rw-r--r-- | firmwares/wifishield/wifiHD/src/ard_spi.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/firmwares/wifishield/wifiHD/src/ard_spi.h b/firmwares/wifishield/wifiHD/src/ard_spi.h new file mode 100644 index 0000000..628f115 --- /dev/null +++ b/firmwares/wifishield/wifiHD/src/ard_spi.h @@ -0,0 +1,70 @@ +/* + * ard_spi.h + * + * Created on: May 27, 2010 + * Author: mlf by Metodo2 srl + */ + +#ifndef ARD_SPI_H_ +#define ARD_SPI_H_ + +#include "lwip/netif.h" +#include "console.h" +#include "wl_definitions.h" + + +typedef enum { + SPI_CMD_IDLE, + SPI_CMD_INPUT, + SPI_CMD_DONE, + SPI_CMD_INPROGRESS, + SPI_CMD_REPLING, + SPI_CMD_FAIL, +} cmd_spi_state_t; + +typedef enum { + REPLY_ERR_GET, + REPLY_ERR_SET, + REPLY_ERR_CMD, + REPLY_ERR_MSG, + REPLY_NO_ERR, +} reply_err_t; + + +typedef enum { + CMD_GET_FLAG = 0x01, + CMD_SET_FLAG = 0x02, + CMD_IMM_SET_FLAG = 0x04, +}cmd_flags; + +#define TIMEOUT_SPI 200 +#define SPI_ALIGN_ERROR 0xF0 +#define SPI_OVERRIDE_ERROR 0xF1 +#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); + +void set_result_cmd(int err) ; + +void set_result(wl_status_t _status); + +int initSpi(void); + +void initExtInt(); + +void spi_poll(struct netif* netif); + +int spi_slaveReceive(volatile avr32_spi_t *spi); + +void showTTCPstatus(); + +int getSock(void * _ttcp); + +void* getTTCP(uint8_t sock); + +void clearMapSockTcp(uint8_t sock); + +int start_server_tcp(uint16_t port, uint8_t sock); + +#endif /* ARD_SPI_H_ */ |