From 98c638416dbd4ef183b9794fa4e521c699dee680 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 28 Dec 2007 22:10:14 +0000 Subject: [PATCH] Fixed for 8051 w/SDCC compiler git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@454 42af7a65-404d-4744-a932-0658087f49c3 --- ChangeLog | 3 +++ Documentation/NuttX.html | 1 + TODO | 2 +- arch/pjrc-8051/src/up_unblocktask.c | 3 +++ include/arpa/inet.h | 27 ++++++++++++++++++++------- include/stdlib.h | 4 ++-- include/sys/types.h | 2 +- lib/lib_getenv.c | 2 +- lib/lib_inetntoa.c | 13 ++++++++++++- 9 files changed, 44 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 508841dfc1..3ec6abdebe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -284,3 +284,6 @@ * NSH ifconfig command now shows uIP status was well (examples/nsh) 0.3.6 2007-xx-xx Gregory Nutt + + * Changes for use with SDCC compiler + diff --git a/Documentation/NuttX.html b/Documentation/NuttX.html index 27a436ffe8..7b2ffe3a6e 100644 --- a/Documentation/NuttX.html +++ b/Documentation/NuttX.html @@ -695,6 +695,7 @@ Other memory:
    0.3.6 2007-xx-xx Gregory Nutt + * Changes for use with SDCC compiler
diff --git a/TODO b/TODO index b6dc42e69c..69250b1692 100644 --- a/TODO +++ b/TODO @@ -18,7 +18,7 @@ NuttX TODO List (Last updated December 13, 2007) (1) ARM/DM320 (arch/arm/src/dm320/) (2) ARM/LPC214x (arch/arm/src/lpc214x/) (3) pjrc-8052 / MCS51 (arch/pjrc-8051/) - + (0) z80 (arch/z80/) o Task/Scheduler (sched/) ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/arch/pjrc-8051/src/up_unblocktask.c b/arch/pjrc-8051/src/up_unblocktask.c index 76bc693c97..303283c28b 100644 --- a/arch/pjrc-8051/src/up_unblocktask.c +++ b/arch/pjrc-8051/src/up_unblocktask.c @@ -38,10 +38,13 @@ ************************************************************/ #include + #include #include #include + #include + #include "clock_internal.h" #include "os_internal.h" #include "up_internal.h" diff --git a/include/arpa/inet.h b/include/arpa/inet.h index ee0b1be702..15871ef3cc 100644 --- a/include/arpa/inet.h +++ b/include/arpa/inet.h @@ -91,15 +91,28 @@ EXTERN uint16 htons (uint16 hs); /* Functions to manipulate address representations */ -EXTERN int inet_aton(const char *cp, struct in_addr *inp); -EXTERN in_addr_t inet_addr(const char *cp); -EXTERN in_addr_t inet_network(const char *cp); -EXTERN char *inet_ntoa(struct in_addr in); -EXTERN struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host); +EXTERN int inet_aton(FAR const char *cp, FAR struct in_addr *inp); +EXTERN in_addr_t inet_addr(FAR const char *cp); +EXTERN in_addr_t inet_network(FAR const char *cp); + +#ifdef CONFIG_CAN_PASS_STRUCTS +EXTERN FAR char *inet_ntoa(struct in_addr in); EXTERN in_addr_t inet_lnaof(struct in_addr in); EXTERN in_addr_t inet_netof(struct in_addr in); -EXTERN int inet_pton(int af, const char *cp, void *buf); -EXTERN const char *inet_ntop(int af, const void *cp, char *buf, socklen_t len); +#else +EXTERN FAR char *_inet_ntoa(in_addr_t in); +# define inet_ntoa(in) _inet_ntoa(in.s_addr); + +EXTERN in_addr_t _inet_lnaof(in_addr_t in); +# define inet_lnaof(in) _inet_lnaof(in.s_addr); + +EXTERN in_addr_t _inet_netof(in_addr_t in); +# define inet_netof(in) _inet_netof(in.s_addr); +#endif +EXTERN struct in_addr inet_makeaddr(in_addr_t net, in_addr_t host); + +EXTERN int inet_pton(int af, FAR const char *cp, FAR void *buf); +EXTERN const char *inet_ntop(int af, FAR const void *cp, FAR char *buf, socklen_t len); #undef EXTERN #ifdef __cplusplus diff --git a/include/stdlib.h b/include/stdlib.h index 6e7f441122..c1eaf28d00 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -105,8 +105,8 @@ EXTERN int rand(void); #ifndef CONFIG_DISABLE_ENIVRON EXTERN FAR char **get_environ_ptr( void ); -EXTERN FAR char *getenv(const char *name); -EXTERN int putenv(char *string); +EXTERN FAR char *getenv(FAR const char *name); +EXTERN int putenv(FAR char *string); EXTERN int clearenv(void); EXTERN int setenv(const char *name, const char *value, int overwrite); EXTERN int unsetenv(const char *name); diff --git a/include/sys/types.h b/include/sys/types.h index 1788784b50..0460c5e5c2 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -1,5 +1,5 @@ /************************************************************ - * types.h + * sys/types.h * * Copyright (C) 2007 Gregory Nutt. All rights reserved. * Author: Gregory Nutt diff --git a/lib/lib_getenv.c b/lib/lib_getenv.c index bddd2cb0aa..2be69ba3c4 100644 --- a/lib/lib_getenv.c +++ b/lib/lib_getenv.c @@ -96,7 +96,7 @@ static const char environment[] = ""; * ************************************************************/ -char *getenv(const char *name) +FAR char *getenv(FAR const char *name) { const char *penv = environment; int size = sizeof(environment); diff --git a/lib/lib_inetntoa.c b/lib/lib_inetntoa.c index 4aea7826ab..c94f25a52f 100644 --- a/lib/lib_inetntoa.c +++ b/lib/lib_inetntoa.c @@ -56,10 +56,21 @@ * ****************************************************************************/ -char *inet_ntoa(struct in_addr in) +#ifdef CONFIG_CAN_PASS_STRUCTS +FAR char *inet_ntoa(struct in_addr in) { static char buffer[18]; char *ptr = (char*)&in.s_addr; sprintf(buffer, "%d.%d.%d.%d", ptr[0], ptr[1], ptr[2], ptr[3]); return buffer; } +#else +FAR char *_inet_ntoa(in_addr_t in) +{ + static char buffer[18]; + FAR char *ptr = (FAR char*)∈ + sprintf(buffer, "%d.%d.%d.%d", ptr[0], ptr[1], ptr[2], ptr[3]); + return buffer; +} +#endif +