wolfssl_MDK_ARM.h
1 /* wolfssl_KEIL_ARM.h
2  *
3  * Copyright (C) 2006-2020 wolfSSL Inc.
4  *
5  * This file is part of wolfSSL.
6  *
7  * wolfSSL is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * wolfSSL is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20  */
21 
22 /******************************************************************************/
24 /******************************************************************************/
25 #ifndef WOLFSSL_KEIL_ARM_H
26 #define WOLFSSL_KEIL_ARM_H
27 
28 #include <stdio.h>
29 
30 #define SOCKET_T int
31 
32 /*** #include <socket.h> ***/
33 #define NUMBITSPERBYTE 8
34 #define FD_SETSIZE 10
35 
36 typedef long fd_mask;
37 #define NFDBITS (sizeof(fd_mask) * NUMBITSPERBYTE) /* bits per mask */
38 
39 typedef struct fd_set {
40  fd_mask fds_bits[(FD_SETSIZE + NFDBITS - 1) / NFDBITS];
41 } fd_set;
42 
43 /*** #include <sys/types.h> ***/
44 struct timeval {
45  long tv_sec; /* seconds */
46  long tv_usec; /* microseconds */
47 };
48 
49 
50 #if defined(WOLFSSL_KEIL_TCP_NET)
51 
52 #define SCK_EWOULDBLOCK BSD_ERROR_WOULDBLOCK
53 #define SCK_ETIMEOUT BSD_ERROR_TIMEOUT
54 #include "rl_net.h"
55 
56 typedef int socklen_t ;
57 
58 /* for avoiding conflict with KEIL-TCPnet BSD socket */
59 /* Bodies are in cyassl_KEIL_RL.c */
60 #if defined(HAVE_KEIL_RTX)
61  #define sleep(t) os_dly_wait(t/1000+1) ;
62 #elif defined (WOLFSSL_CMSIS_RTOS)
63  #define sleep(t) osDelay(t/1000+1) ;
64 #endif
65 
66 /* for avoiding conflicting with KEIL-TCPnet TCP socket */
67 /* Bodies are in test.h */
68 #define tcp_connect wolfssl_tcp_connect
69 #define tcp_socket wolfssl_tcp_soket
70 #define tcp_listen wolfssl_tcp_listen
71 #define connect(a,b,c) connect(a, (SOCKADDR *)(b), c)
72 #define SOCKADDR struct sockaddr
73 
75 /* TCPnet BSD socket does not have following functions. */
76 extern char *inet_ntoa(struct in_addr in);
77 extern unsigned long inet_addr(const char *cp);
78 extern int select(int nfds, fd_set *readfds, fd_set *writefds,
79  fd_set *exceptfds, const struct timeval *timeout);
80 
81 #endif /* WOLFSSL_KEIL_TCP_NET */
82 
83 #endif /* WOLFSSL_KEIL_ARM_H */
Definition: wolfssl_MDK_ARM.h:46
Definition: wolfssl_MDK_ARM.h:51