1
0

wolfssl_MDK_ARM.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* wolfssl_MDK_ARM.h
  2. *
  3. * Copyright (C) 2006-2024 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. /** This file is for defining types, values for specific to KEIL-MDK-ARM. **/
  23. /******************************************************************************/
  24. #ifndef WOLFSSL_KEIL_ARM_H
  25. #define WOLFSSL_KEIL_ARM_H
  26. #include <stdio.h>
  27. #define SOCKET_T int
  28. /*** #include <socket.h> ***/
  29. #define NUMBITSPERBYTE 8
  30. #define FD_SETSIZE 10
  31. typedef long fd_mask;
  32. #define NFDBITS (sizeof(fd_mask) * NUMBITSPERBYTE) /* bits per mask */
  33. typedef struct fd_set {
  34. fd_mask fds_bits[(FD_SETSIZE + NFDBITS - 1) / NFDBITS];
  35. } fd_set;
  36. /*** #include <sys/types.h> ***/
  37. struct timeval {
  38. long tv_sec; /* seconds */
  39. long tv_usec; /* microseconds */
  40. };
  41. #if defined(WOLFSSL_KEIL_TCP_NET)
  42. #define SCK_EWOULDBLOCK BSD_ERROR_WOULDBLOCK
  43. #define SCK_ETIMEOUT BSD_ERROR_TIMEOUT
  44. #include "rl_net.h"
  45. typedef int socklen_t ;
  46. /* for avoiding conflict with KEIL-TCPnet BSD socket */
  47. /* Bodies are in cyassl_KEIL_RL.c */
  48. #if defined(HAVE_KEIL_RTX)
  49. #define sleep(t) os_dly_wait(t/1000+1) ;
  50. #elif defined (WOLFSSL_CMSIS_RTOS)
  51. #define sleep(t) osDelay(t/1000+1) ;
  52. #endif
  53. /* for avoiding conflicting with KEIL-TCPnet TCP socket */
  54. /* Bodies are in test.h */
  55. #define tcp_connect wolfssl_tcp_connect
  56. #define tcp_socket wolfssl_tcp_soket
  57. #define tcp_listen wolfssl_tcp_listen
  58. #define connect(a,b,c) connect(a, (SOCKADDR *)(b), c)
  59. #define SOCKADDR struct sockaddr
  60. /** KEIL-RL TCPnet ****/
  61. /* TCPnet BSD socket does not have following functions. */
  62. extern char *inet_ntoa(struct in_addr in);
  63. extern unsigned long inet_addr(const char *cp);
  64. extern int select(int nfds, fd_set *readfds, fd_set *writefds,
  65. fd_set *exceptfds, const struct timeval *timeout);
  66. #endif /* WOLFSSL_KEIL_TCP_NET */
  67. #endif /* WOLFSSL_KEIL_ARM_H */