add PicoTCP support

This commit is contained in:
Chris Conlon 2014-10-21 15:43:43 -06:00
parent e35e02a283
commit 50a00d4ff0
2 changed files with 37 additions and 1 deletions

View File

@ -93,6 +93,12 @@
/* Uncomment next line if using TI-RTOS settings */
/* #define CYASSL_TIRTOS */
/* Uncomment next line if building with PicoTCP */
/* #define CYASSL_PICOTCP */
/* Uncomment next line if building for PicoTCP demo bundle */
/* #define CYASSL_PICOTCP_DEMO */
#include <cyassl/ctaocrypt/visibility.h>
#ifdef IPHONE
@ -228,6 +234,24 @@
#define NO_MAIN_DRIVER
#endif
#ifdef CYASSL_PICOTCP
#define errno pico_err
#include "pico_defines.h"
#include "pico_stack.h"
#include "pico_constants.h"
#include "pico_bsd_sockets.h"
#define CUSTOM_RAND_GENERATE pico_rand
#endif
#ifdef CYASSL_PICOTCP_DEMO
#define CYASSL_STM32
#define FREERTOS
#define USE_FAST_MATH
#define TFM_TIMING_RESISTANT
#define XMALLOC(s, h, type) pvPortMalloc((s))
#define XFREE(p, h, type) vPortFree((p))
#endif
#ifdef FREERTOS_WINSIM
#define FREERTOS
#define USE_WINDOWS_API

View File

@ -80,7 +80,8 @@
#include <unistd.h>
#endif
#include <fcntl.h>
#if !(defined(DEVKITPRO) || defined(HAVE_RTP_SYS) || defined(EBSNET))
#if !(defined(DEVKITPRO) || defined(HAVE_RTP_SYS) || defined(EBSNET)) \
|| defined(CYASSL_PICOTCP)
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
@ -153,6 +154,14 @@
#define SOCKET_ECONNREFUSED SCK_ERROR
#define SOCKET_ECONNABORTED SCK_ERROR
#endif
#elif defined(CYASSL_PICOTCP)
#define SOCKET_EWOULDBLOCK PICO_ERR_EAGAIN
#define SOCKET_EAGAIN PICO_ERR_EAGAIN
#define SOCKET_ECONNRESET PICO_ERR_ECONNRESET
#define SOCKET_EINTR PICO_ERR_EINTR
#define SOCKET_EPIPE PICO_ERR_EIO
#define SOCKET_ECONNREFUSED PICO_ERR_ECONNREFUSED
#define SOCKET_ECONNABORTED PICO_ERR_ESHUTDOWN
#else
#define SOCKET_EWOULDBLOCK EWOULDBLOCK
#define SOCKET_EAGAIN EAGAIN
@ -173,6 +182,9 @@
#elif defined(CYASSL_LWIP)
#define SEND_FUNCTION lwip_send
#define RECV_FUNCTION lwip_recv
#elif defined(CYASSL_PICOTCP)
#define SEND_FUNCTION pico_send
#define RECV_FUNCTION pico_recv
#else
#define SEND_FUNCTION send
#define RECV_FUNCTION recv