From 5857da3fa8f88d7028d80fe270d03e779706e533 Mon Sep 17 00:00:00 2001 From: Vijay Kumar Banerjee Date: Mon, 14 Jun 2021 18:42:56 -0600 Subject: lwip: Add bbb and tms570 drivers + Add networking01 and telnetd01 tests --- lwip/src/api/netdb.c | 3 +- lwip/src/api/sockets.c | 8 ++ lwip/src/core/memp.c | 2 +- lwip/src/core/tcp.c | 2 + lwip/src/include/lwip/opt.h | 4 + lwip/src/include/lwip/sockets.h | 31 ++++- lwip/test/buffer_test_io.h | 21 --- lwip/test/sample_app.c | 159 ---------------------- lwip/test/tmacros.h | 283 ---------------------------------------- 9 files changed, 46 insertions(+), 467 deletions(-) delete mode 100644 lwip/test/buffer_test_io.h delete mode 100644 lwip/test/sample_app.c delete mode 100644 lwip/test/tmacros.h (limited to 'lwip') diff --git a/lwip/src/api/netdb.c b/lwip/src/api/netdb.c index dfc5203..5217602 100644 --- a/lwip/src/api/netdb.c +++ b/lwip/src/api/netdb.c @@ -45,6 +45,7 @@ #include "lwip/ip_addr.h" #include "lwip/api.h" #include "lwip/dns.h" +#include "lwip/sockets.h" #include /* memset */ #include /* atoi */ @@ -431,7 +432,7 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, char *node, /* FIXME: This return just the address value. Try resolving instead. */ if (node != NULL && nodelen > 0) { - if (inet_ntop(af, &sa_in->sin_addr, node, nodelen) == NULL) { + if (lwip_inet_ntop(af, &sa_in->sin_addr, node, nodelen) == NULL) { return EAI_FAIL; } } diff --git a/lwip/src/api/sockets.c b/lwip/src/api/sockets.c index a331206..f47e68e 100644 --- a/lwip/src/api/sockets.c +++ b/lwip/src/api/sockets.c @@ -3274,6 +3274,14 @@ lwip_setsockopt(int s, int level, int optname, const void *optval, socklen_t opt return err ? -1 : 0; } +/* +int +setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen) +{ + return lwip_setsockopt(s, level, optname, optval, optlen); +} +*/ + #if !LWIP_TCPIP_CORE_LOCKING /** lwip_setsockopt_callback: only used without CORE_LOCKING * to get into the tcpip_thread diff --git a/lwip/src/core/memp.c b/lwip/src/core/memp.c index 352ce5a..1917826 100644 --- a/lwip/src/core/memp.c +++ b/lwip/src/core/memp.c @@ -327,7 +327,7 @@ memp_malloc_pool_fn(const struct memp_desc *desc, const char *file, const int li /** * Get an element from a specific pool. - * + 1 * * @param type the pool to get an element from * * @return a pointer to the allocated memory or a NULL pointer on error diff --git a/lwip/src/core/tcp.c b/lwip/src/core/tcp.c index bd7d64e..2996ee7 100644 --- a/lwip/src/core/tcp.c +++ b/lwip/src/core/tcp.c @@ -724,12 +724,14 @@ tcp_bind(struct tcp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) #endif /* SO_REUSE */ { /* @todo: check accept_any_ip_version */ +#if 0 if ((IP_IS_V6(ipaddr) == IP_IS_V6_VAL(cpcb->local_ip)) && (ip_addr_isany(&cpcb->local_ip) || ip_addr_isany(ipaddr) || ip_addr_cmp(&cpcb->local_ip, ipaddr))) { return ERR_USE; } +#endif /* 0 */ } } } diff --git a/lwip/src/include/lwip/opt.h b/lwip/src/include/lwip/opt.h index 82c420c..b19922f 100644 --- a/lwip/src/include/lwip/opt.h +++ b/lwip/src/include/lwip/opt.h @@ -923,6 +923,10 @@ #define LWIP_DHCP 0 #endif /* !LWIP_IPV4 */ +#ifndef LWIP_DHCP_TIMEOUT +#define LWIP_DHCP_TIMEOUT 100 +#endif + /** * DHCP_DOES_ARP_CHECK==1: Do an ARP check on the offered address. */ diff --git a/lwip/src/include/lwip/sockets.h b/lwip/src/include/lwip/sockets.h index d70d36c..2917041 100644 --- a/lwip/src/include/lwip/sockets.h +++ b/lwip/src/include/lwip/sockets.h @@ -48,6 +48,7 @@ #include "lwip/err.h" #include "lwip/inet.h" #include "lwip/errno.h" +#include #include @@ -89,6 +90,7 @@ struct sockaddr_in6 { }; #endif /* LWIP_IPV6 */ +#ifndef __rtems__ struct sockaddr { u8_t sa_len; sa_family_t sa_family; @@ -104,6 +106,7 @@ struct sockaddr_storage { u32_t s2_data3[3]; #endif /* LWIP_IPV6 */ }; +#endif /* __rtems__ */ /* If your port already typedef's socklen_t, define SOCKLEN_T_DEFINED to prevent this code from redefining it. */ @@ -124,6 +127,7 @@ struct iovec { }; #endif +#ifndef __rtems__ struct msghdr { void *msg_name; socklen_t msg_namelen; @@ -144,6 +148,7 @@ struct cmsghdr { int cmsg_level; /* originating protocol */ int cmsg_type; /* protocol-specific type */ }; +#endif /* __rtems__ */ /* Data section follows header and possible padding, typically referred to as unsigned char cmsg_data[]; */ @@ -155,6 +160,7 @@ will need to increase long long */ #define ALIGN_H(size) (((size) + sizeof(long) - 1U) & ~(sizeof(long)-1U)) #define ALIGN_D(size) ALIGN_H(size) +#ifndef __rtems__ #define CMSG_FIRSTHDR(mhdr) \ ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) ? \ (struct cmsghdr *)(mhdr)->msg_control : \ @@ -178,12 +184,14 @@ will need to increase long long */ #define CMSG_LEN(length) (ALIGN_D(sizeof(struct cmsghdr)) + \ length) +#endif /* __rtems__ */ /* Set socket options argument */ #define IFNAMSIZ NETIF_NAMESIZE struct ifreq { char ifr_name[IFNAMSIZ]; /* Interface name */ }; +#ifndef __rtems__ /* Socket protocol types (TCP/UDP/RAW) */ #define SOCK_STREAM 1 #define SOCK_DGRAM 2 @@ -217,9 +225,12 @@ struct ifreq { #define SO_ERROR 0x1007 /* get error status and clear */ #define SO_TYPE 0x1008 /* get socket type */ #define SO_CONTIMEO 0x1009 /* Unimplemented: connect timeout */ +#endif /* __rtems__ */ #define SO_NO_CHECK 0x100a /* don't create UDP checksum */ #define SO_BINDTODEVICE 0x100b /* bind to device */ +#ifndef __rtems__ + /* * Structure used for manipulating linger option. */ @@ -244,6 +255,7 @@ struct linger { #define PF_INET AF_INET #define PF_INET6 AF_INET6 #define PF_UNSPEC AF_UNSPEC +#endif /* __rtems__ */ #define IPPROTO_IP 0 #define IPPROTO_ICMP 1 @@ -256,14 +268,17 @@ struct linger { #define IPPROTO_UDPLITE 136 #define IPPROTO_RAW 255 +#ifndef __rtems__ /* Flags we can use with send and recv. */ #define MSG_PEEK 0x01 /* Peeks at an incoming message */ #define MSG_WAITALL 0x02 /* Unimplemented: Requests that the function block until the full amount of data requested can be returned */ #define MSG_OOB 0x04 /* Unimplemented: Requests out-of-band data. The significance and semantics of out-of-band data are protocol-specific */ #define MSG_DONTWAIT 0x08 /* Nonblocking i/o for this operation only */ +#endif /* __rtems__ */ #define MSG_MORE 0x10 /* Sender will send more */ +#ifndef __rtems__ #define MSG_NOSIGNAL 0x20 /* Uninmplemented: Requests not to send the SIGPIPE signal if an attempt to send is made on a stream-oriented socket that is no longer connected. */ - +#endif /* __rtems__ */ /* * Options for level IPPROTO_IP @@ -400,10 +415,15 @@ typedef struct ipv6_mreq { * we restrict parameters to at most 128 bytes. */ #if !defined(FIONREAD) || !defined(FIONBIO) +#undef IOCPARM_MASK #define IOCPARM_MASK 0x7fU /* parameters must be < 128 bytes */ +#ifndef __rtems__ #define IOC_VOID 0x20000000UL /* no parameters */ #define IOC_OUT 0x40000000UL /* copy out parameters */ +#endif /* __rtems __ */ +#undef IOC_IN #define IOC_IN 0x80000000UL /* copy in parameters */ +#ifndef __rtems__ #define IOC_INOUT (IOC_IN|IOC_OUT) /* 0x20000000 distinguishes new & old ioctl's */ @@ -411,6 +431,8 @@ typedef struct ipv6_mreq { #define _IOR(x,y,t) ((long)(IOC_OUT|((sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))) +#endif /* __rtems__ */ +#undef _IOW #define _IOW(x,y,t) ((long)(IOC_IN|((sizeof(t)&IOCPARM_MASK)<<16)|((x)<<8)|(y))) #endif /* !defined(FIONREAD) || !defined(FIONBIO) */ @@ -529,6 +551,8 @@ struct timeval { void lwip_socket_thread_init(void); /* LWIP_NETCONN_SEM_PER_THREAD==1: initialize thread-local semaphore */ void lwip_socket_thread_cleanup(void); /* LWIP_NETCONN_SEM_PER_THREAD==1: destroy thread-local semaphore */ +#ifndef __rtems__ + #if LWIP_COMPAT_SOCKETS == 2 /* This helps code parsers/code completion by not having the COMPAT functions as defines */ #define lwip_accept accept @@ -572,6 +596,7 @@ int fcntl(int s, int cmd, ...); #define ioctlsocket ioctl #endif /* LWIP_POSIX_SOCKETS_IO_NAMES */ #endif /* LWIP_COMPAT_SOCKETS == 2 */ +#endif /* __rtems__ */ int lwip_accept(int s, struct sockaddr *addr, socklen_t *addrlen); int lwip_bind(int s, const struct sockaddr *name, socklen_t namelen); @@ -608,6 +633,7 @@ int lwip_fcntl(int s, int cmd, int val); const char *lwip_inet_ntop(int af, const void *src, char *dst, socklen_t size); int lwip_inet_pton(int af, const char *src, void *dst); +#ifndef __rtems__ #if LWIP_COMPAT_SOCKETS #if LWIP_COMPAT_SOCKETS != 2 /** @ingroup socket */ @@ -653,7 +679,7 @@ int lwip_inet_pton(int af, const char *src, void *dst); #define poll(fds,nfds,timeout) lwip_poll(fds,nfds,timeout) #endif /** @ingroup socket */ -#define ioctlsocket(s,cmd,argp) lwip_ioctl(s,cmd,argp) +//#define ioctlsocket(s,cmd,argp) lwip_ioctl(s,cmd,argp) /** @ingroup socket */ #define inet_ntop(af,src,dst,size) lwip_inet_ntop(af,src,dst,size) /** @ingroup socket */ @@ -676,6 +702,7 @@ int lwip_inet_pton(int af, const char *src, void *dst); #define ioctl(s,cmd,argp) lwip_ioctl(s,cmd,argp) #endif /* LWIP_POSIX_SOCKETS_IO_NAMES */ #endif /* LWIP_COMPAT_SOCKETS != 2 */ +#endif #endif /* LWIP_COMPAT_SOCKETS */ diff --git a/lwip/test/buffer_test_io.h b/lwip/test/buffer_test_io.h deleted file mode 100644 index f0eae50..0000000 --- a/lwip/test/buffer_test_io.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Support for running the test output through a buffer - */ - -#ifndef __BUFFER_TEST_IO_h -#define __BUFFER_TEST_IO_h - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define TEST_BEGIN() rtems_test_begin(rtems_test_name, TEST_STATE) -#define TEST_END() rtems_test_end(rtems_test_name) - -#ifdef __cplusplus -}; -#endif - -#endif diff --git a/lwip/test/sample_app.c b/lwip/test/sample_app.c deleted file mode 100644 index 576cd6b..0000000 --- a/lwip/test/sample_app.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright (c) 2016 embedded brains GmbH. All rights reserved. - * - * embedded brains GmbH - * Dornierstr. 4 - * 82178 Puchheim - * Germany - * - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include "lwip/netdb.h" -#include -#include -#include "tmacros.h" - -const char rtems_test_name[] = "NETWORKING 1"; - -/* forward declarations to avoid warnings */ -static rtems_task Init(rtems_task_argument argument); - -static void fill_sa(struct sockaddr *sa, sa_family_t family) -{ - memset(sa, 0, sizeof(*sa)); - sa->sa_len = sizeof(*sa); - sa->sa_family = family; -} - -static void fill_sa_in(struct sockaddr_in *sa_in, - in_addr_t addr, in_port_t port) -{ - fill_sa((struct sockaddr *)sa_in, AF_INET); - sa_in->sin_port = htons(port); - sa_in->sin_addr.s_addr = htonl(addr); -} - -static void test_getnameinfo( - const struct sockaddr *sa, - int flags, - bool ask_node, - bool ask_service, - int expected_returnvalue, - const char *expected_node, - const char *expected_service -) -{ - char node[] = "255.255.255.255"; - char service[] = "65535"; - socklen_t salen = sa->sa_len; - int rv; - - char *node_p = node; - char *service_p = service; - size_t node_l = sizeof(node); - size_t service_l = sizeof(service); - - if(ask_node == false) { - node_p = NULL; - node_l = 0; - } - - if(ask_service == false) { - service_p = NULL; - service_l = 0; - } - - rv = getnameinfo(sa, salen, node_p, node_l, service_p, service_l, flags); - rtems_test_assert(rv == expected_returnvalue); - - if(expected_node != NULL) { - rtems_test_assert(strcmp(expected_node, node) == 0); - } - - if(expected_service != NULL) { - rtems_test_assert(strcmp(expected_service, service) == 0); - } -} - -static void test(void) -{ - struct sockaddr sa; - struct sockaddr_in sa_in; - struct sockaddr *sa_in_p = (struct sockaddr *) &sa_in; - - const in_addr_t ip1_num = 0x7F000001u; - const char ip1_string[] = "127.0.0.1"; - - const in_addr_t ip2_num = 0xC0A86464u; - const char ip2_string[] = "192.168.100.100"; - - const in_port_t port1_num = 7u; - const char port1_string[] = "7"; - - const in_port_t port2_num = 65534u; - const char port2_string[] = "65534"; - - - puts("Try AF_INET6"); - fill_sa(&sa, AF_INET6); - test_getnameinfo(&sa, 0, true, true, EAI_FAMILY, NULL, NULL); - - puts("force node name"); - fill_sa_in(&sa_in, ip1_num, port1_num); - test_getnameinfo(sa_in_p, NI_NAMEREQD, true, true, EAI_NONAME, NULL, NULL); - - puts("force service name"); - fill_sa_in(&sa_in, ip1_num, port1_num); - test_getnameinfo(sa_in_p, NI_NAMEREQD, true, true, EAI_NONAME, NULL, NULL); - - puts("get node only"); - fill_sa_in(&sa_in, ip1_num, port1_num); - test_getnameinfo(sa_in_p, 0, true, false, 0, ip1_string, NULL); - - puts("get service only"); - fill_sa_in(&sa_in, ip1_num, port1_num); - test_getnameinfo(sa_in_p, 0, false, true, 0, NULL, port1_string); - - puts("get node and service"); - fill_sa_in(&sa_in, ip1_num, port1_num); - test_getnameinfo(sa_in_p, 0, true, true, 0, ip1_string, port1_string); - - puts("get node and service with maximum number of characters for IP"); - fill_sa_in(&sa_in, ip2_num, port2_num); - test_getnameinfo(sa_in_p, 0, true, true, 0, ip2_string, port2_string); -} - -static rtems_task Init(rtems_task_argument argument) -{ - TEST_BEGIN(); - test(); - TEST_END(); - - rtems_test_exit(0); -} - -#define CONFIGURE_INIT - -#define CONFIGURE_MICROSECONDS_PER_TICK 10000 - -#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER -#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER - -#define CONFIGURE_MAXIMUM_TASKS (1) - -#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION - -#define CONFIGURE_RTEMS_INIT_TASKS_TABLE - -#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT - -#include diff --git a/lwip/test/tmacros.h b/lwip/test/tmacros.h deleted file mode 100644 index 8189149..0000000 --- a/lwip/test/tmacros.h +++ /dev/null @@ -1,283 +0,0 @@ -/** - * @file - * - * This include file contains macros which are useful in the RTEMS - * test suites. - */ - -/* - * COPYRIGHT (c) 1989-2014. - * On-Line Applications Research Corporation (OAR). - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. - */ - -#ifndef __TMACROS_h -#define __TMACROS_h - -#include -#include -#include /* includes */ - -#include -#include -#include -#include -#include -#include -#include - -#include "buffer_test_io.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define FOREVER 1 /* infinite loop */ - -#ifdef CONFIGURE_INIT -#define TEST_EXTERN -#else -#define TEST_EXTERN extern -#endif - -/* - * Check that that the dispatch disable level is proper for the - * mode/state of the test. Normally it should be 0 when in task space. - */ -#define check_dispatch_disable_level( _expect ) \ - do { \ - if ( (_expect) != -1 \ - && (((!_Thread_Dispatch_is_enabled()) == false && (_expect) != 0) \ - || ((!_Thread_Dispatch_is_enabled()) && (_expect) == 0)) \ - ) { \ - printf( \ - "\n_Thread_Dispatch_disable_level is (%i)" \ - " not %d detected at %s:%d\n", \ - !_Thread_Dispatch_is_enabled(), (_expect), __FILE__, __LINE__ ); \ - rtems_test_exit( 1 ); \ - } \ - } while ( 0 ) - -/* - * Check that that the allocator mutex is not owned by the executing thread. - */ -#include -#define check_if_allocator_mutex_is_not_owned() \ - do { \ - if ( _RTEMS_Allocator_is_owner() ) { \ - printf( \ - "\nRTEMS Allocator Mutex is owned by executing thread " \ - "and should not be.\n" \ - "Detected at %s:%d\n", \ - __FILE__, \ - __LINE__ \ - ); \ - rtems_test_exit( 1 ); \ - } \ - } while ( 0 ) - -/* - * These macros properly report errors within the Classic API - */ -#define directive_failed( _dirstat, _failmsg ) \ - fatal_directive_status( _dirstat, RTEMS_SUCCESSFUL, _failmsg ) - -#define directive_failed_with_level( _dirstat, _failmsg, _level ) \ - fatal_directive_status_with_level( \ - _dirstat, RTEMS_SUCCESSFUL, _failmsg, _level ) - -#define fatal_directive_status( _stat, _desired, _msg ) \ - fatal_directive_status_with_level( _stat, _desired, _msg, 0 ) - -#define fatal_directive_check_status_only( _stat, _desired, _msg ) \ - do { \ - if ( (_stat) != (_desired) ) { \ - printf( "\n%s FAILED -- expected (%s) got (%s)\n", \ - (_msg), rtems_status_text(_desired), rtems_status_text(_stat) ); \ - rtems_test_exit( _stat ); \ - } \ - } while ( 0 ) - -#define fatal_directive_status_with_level( _stat, _desired, _msg, _level ) \ - do { \ - check_dispatch_disable_level( _level ); \ - check_if_allocator_mutex_is_not_owned(); \ - fatal_directive_check_status_only( _stat, _desired, _msg ); \ - } while ( 0 ) - -/* - * These macros properly report errors from the POSIX API - */ - -#define posix_service_failed( _dirstat, _failmsg ) \ - fatal_posix_service_status( _dirstat, 0, _failmsg ) - -#define posix_service_failed_with_level( _dirstat, _failmsg, _level ) \ - fatal_posix_service_status_with_level( _dirstat, 0, _failmsg, _level ) - -#define fatal_posix_service_status_errno( _stat, _desired, _msg ) \ - if ( (_stat != -1) && (errno) != (_desired) ) { \ - long statx = _stat; \ - check_dispatch_disable_level( 0 ); \ - check_if_allocator_mutex_is_not_owned(); \ - printf( "\n%s FAILED -- expected (%d - %s) got (%ld %d - %s)\n", \ - (_msg), _desired, strerror(_desired), \ - statx, errno, strerror(errno) ); \ - rtems_test_exit( _stat ); \ - } - -#define fatal_posix_service_status( _stat, _desired, _msg ) \ - fatal_posix_service_status_with_level( _stat, _desired, _msg, 0 ) - -#define fatal_posix_service_status_with_level( _stat, _desired, _msg, _level ) \ - do { \ - check_dispatch_disable_level( _level ); \ - check_if_allocator_mutex_is_not_owned(); \ - if ( (_stat) != (_desired) ) { \ - printf( "\n%s FAILED -- expected (%d - %s) got (%d - %s)\n", \ - (_msg), _desired, strerror(_desired), _stat, strerror(_stat) ); \ - printf( "\n FAILED -- errno (%d - %s)\n", \ - errno, strerror(errno) ); \ - rtems_test_exit( _stat ); \ - } \ - } while ( 0 ) - -/* - * This macro evaluates the semaphore id returned. - */ -#define fatal_posix_sem( _ptr, _msg ) \ - if ( (_ptr != SEM_FAILED) ) { \ - check_dispatch_disable_level( 0 ); \ - printf( "\n%s FAILED -- expected (-1) got (%p - %d/%s)\n", \ - (_msg), _ptr, errno, strerror(errno) ); \ - rtems_test_exit( -1 ); \ - } - -/* - * This macro evaluates the message queue id returned. - */ -#define fatal_posix_mqd( _ptr, _msg ) \ - if ( (_ptr != (mqd_t) -1) ) { \ - check_dispatch_disable_level( 0 ); \ - printf( "\n%s FAILED -- expected (-1) got (%" PRId32 " - %d/%s)\n", \ - (_msg), _ptr, errno, strerror(errno) ); \ - rtems_test_exit( -1 ); \ - } - -/* - * Generic integer version of the error reporting - */ - -#define int_service_failed( _dirstat, _failmsg ) \ - fatal_int_service_status( _dirstat, RTEMS_SUCCESSFUL, _failmsg ) - -#define int_service_failed_with_level( _dirstat, _failmsg, _level ) \ - fatal_int_service_status_with_level( \ - _dirstat, RTEMS_SUCCESSFUL, _failmsg, _level ) - -#define fatal_int_service_status( _stat, _desired, _msg ) \ - fatal_int_service_status_with_level( _stat, _desired, _msg, 0 ) - -#define fatal_int_service_status_with_level( _stat, _desired, _msg, _level ) \ - do { \ - check_dispatch_disable_level( _level ); \ - if ( (_stat) != (_desired) ) { \ - printf( "\n%s FAILED -- expected (%d) got (%d)\n", \ - (_msg), (_desired), (_stat) ); \ - rtems_test_exit( _stat ); \ - } \ - } while ( 0 ) - - -/* - * Print the time - */ - -#define sprint_time(_str, _s1, _tb, _s2) \ - do { \ - sprintf( (_str), "%s%02d:%02d:%02d %02d/%02d/%04d%s", \ - _s1, (_tb)->hour, (_tb)->minute, (_tb)->second, \ - (_tb)->month, (_tb)->day, (_tb)->year, _s2 ); \ - } while ( 0 ) - -#define print_time(_s1, _tb, _s2) \ - do { \ - printf( "%s%02" PRIu32 ":%02" PRIu32 ":%02" PRIu32 " %02" PRIu32 "/%02" PRIu32 "/%04" PRIu32 "%s", \ - _s1, (_tb)->hour, (_tb)->minute, (_tb)->second, \ - (_tb)->month, (_tb)->day, (_tb)->year, _s2 ); \ - } while ( 0 ) - -#define put_dot( _c ) \ - do { \ - putchar( _c ); \ - } while ( 0 ) - -#define new_line puts( "" ) - -#define puts_nocr printf - -#define put_name( name, crlf ) \ -{ int c0, c1, c2, c3; \ - c0 = (name >> 24) & 0xff; \ - c1 = (name >> 16) & 0xff; \ - c2 = (name >> 8) & 0xff; \ - c3 = name & 0xff; \ - putchar( (isprint(c0)) ? c0 : '*' ); \ - if ( c1 ) putchar( (isprint(c1)) ? c1 : '*' ); \ - if ( c2 ) putchar( (isprint(c2)) ? c2 : '*' ); \ - if ( c3 ) putchar( (isprint(c3)) ? c3 : '*' ); \ - if ( crlf ) \ - putchar( '\n' ); \ -} - -#ifndef build_time -#define build_time( TB, MON, DAY, YR, HR, MIN, SEC, TK ) \ - { (TB)->year = YR; \ - (TB)->month = MON; \ - (TB)->day = DAY; \ - (TB)->hour = HR; \ - (TB)->minute = MIN; \ - (TB)->second = SEC; \ - (TB)->ticks = TK; } -#endif - -#define task_number( tid ) \ - ( rtems_object_id_get_index( tid ) - \ - rtems_configuration_get_rtems_api_configuration()-> \ - number_of_initialization_tasks ) - -#define rtems_test_assert(__exp) \ - do { \ - if (!(__exp)) { \ - printf( "%s: %d %s\n", __FILE__, __LINE__, #__exp ); \ - rtems_test_exit(0); \ - } \ - } while (0) - -/** - * This assists in clearly disabling warnings on GCC in certain very - * specific cases. - * - * + -Wnon-null - If a method is declared as never having a NULL first - * parameter. We need to explicitly disable this compiler warning to make - * the code warning free. - */ -#ifdef __GNUC__ - #define COMPILER_DIAGNOSTIC_SETTINGS_PUSH _Pragma("GCC diagnostic push") - #define COMPILER_DIAGNOSTIC_SETTINGS_POP _Pragma("GCC diagnostic pop") - #define COMPILER_DIAGNOSTIC_SETTINGS_DISABLE_NONNULL \ - _Pragma("GCC diagnostic ignored \"-Wnonnull\"") -#else - #define COMPILER_DIAGNOSTIC_SETTINGS_PUSH - #define COMPILER_DIAGNOSTIC_SETTINGS_POP - #define COMPILER_DIAGNOSTIC_SETTINGS_DISABLE_NONNULL -#endif - -#ifdef __cplusplus -} -#endif - -#endif -- cgit v1.2.3