diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-02-21 02:19:19 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-02-21 02:19:19 +0000 |
commit | 94e5b72f50f3096b83fe50c7b57324a08e318f29 (patch) | |
tree | 99970ffd265837ba0a438605c929cff0b338b0ea | |
parent | f26db4e2308c961f1cb52fcb656c85a144f8fd16 (diff) | |
download | px4-nuttx-94e5b72f50f3096b83fe50c7b57324a08e318f29.tar.gz px4-nuttx-94e5b72f50f3096b83fe50c7b57324a08e318f29.tar.bz2 px4-nuttx-94e5b72f50f3096b83fe50c7b57324a08e318f29.zip |
Eliminating SDCC compilation errors
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@17 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r-- | nuttx/Documentation/NuttxUserGuide.html | 17 | ||||
-rw-r--r-- | nuttx/include/nuttx/compiler.h | 8 | ||||
-rw-r--r-- | nuttx/include/signal.h | 10 | ||||
-rw-r--r-- | nuttx/include/sys/types.h | 1 | ||||
-rw-r--r-- | nuttx/sched/clock_settime.c | 3 | ||||
-rw-r--r-- | nuttx/sched/sched_processtimer.c | 4 | ||||
-rw-r--r-- | nuttx/sched/sig_action.c | 9 | ||||
-rw-r--r-- | nuttx/sched/sig_internal.h | 2 | ||||
-rw-r--r-- | nuttx/sched/sig_queue.c | 16 |
9 files changed, 47 insertions, 23 deletions
diff --git a/nuttx/Documentation/NuttxUserGuide.html b/nuttx/Documentation/NuttxUserGuide.html index c8e26278d..213f75d75 100644 --- a/nuttx/Documentation/NuttxUserGuide.html +++ b/nuttx/Documentation/NuttxUserGuide.html @@ -4019,10 +4019,12 @@ between Nuttx and a MoBY application: <P> The following structure defines the action to take for given signal: <PRE> - struct sigaction { - union { - saHandType *_sa_handler; - saVxHandType *_sa_sigaction; + struct sigaction + { + union + { + void (*_sa_handler)(int); + void (*_sa_sigaction)(int, siginfo_t *, void *); } sa_u; sigset_t sa_mask; int sa_flags; @@ -4031,13 +4033,6 @@ The following structure defines the action to take for given signal: #define sa_sigaction sa_u._sa_sigaction </PRE> -<P> -where: -<PRE> - typedef void saHandType( int signo ); - typedef void saVxHandType( int signo, siginfo_t *info, void *context ); -</PRE> - <H3>3.4.6 struct siginfo/siginfo_t</H3> <P> diff --git a/nuttx/include/nuttx/compiler.h b/nuttx/include/nuttx/compiler.h index 1916d8b9c..6f4e68baf 100644 --- a/nuttx/include/nuttx/compiler.h +++ b/nuttx/include/nuttx/compiler.h @@ -50,11 +50,19 @@ # define weak_function __attribute__ ((weak)) # define weak_const_function __attribute__ ((weak, __const__)) # define noreturn_function __attribute__ ((noreturn)) +# define reentrant_function +#elif defined(__SDCC__) +# define weak_alias(name, aliasname) +# define weak_function +# define weak_const_function +# define noreturn_function +# define reentrant_function __reentrant #else # define weak_alias(name, aliasname) # define weak_function # define weak_const_function # define noreturn_function +# define reentrant_function #endif /************************************************************ diff --git a/nuttx/include/signal.h b/nuttx/include/signal.h index 621a6d5f3..4ec153b51 100644 --- a/nuttx/include/signal.h +++ b/nuttx/include/signal.h @@ -118,14 +118,12 @@ typedef struct siginfo /* The following structure defines the action to take for given signal */ -typedef void saHandType(int signo); -typedef void saVxHandType(int signo, siginfo_t *info, void *context); struct sigaction { union { - saHandType *_sa_handler; - saVxHandType *_sa_sigaction; + void (*_sa_handler)(int); + void (*_sa_sigaction)(int, siginfo_t *, void *); } sa_u; sigset_t sa_mask; int sa_flags; @@ -166,10 +164,10 @@ EXTERN int sigtimedwait(const sigset_t *set, struct siginfo *value, const struct timespec *timeout); #ifdef CONFIG_CAN_PASS_STRUCTS -EXTERN int sigqueue(int tid, int signo, +EXTERN int sigqueue(int pid, int signo, const union sigval value); #else -EXTERN int sigqueue(int tid, int signo, void *sival_ptr); +EXTERN int sigqueue(int pid, int signo, void *sival_ptr); #endif #undef EXTERN diff --git a/nuttx/include/sys/types.h b/nuttx/include/sys/types.h index 82f7046d2..37b206ee1 100644 --- a/nuttx/include/sys/types.h +++ b/nuttx/include/sys/types.h @@ -42,6 +42,7 @@ #include <nuttx/config.h> #include <arch/types.h> +#include <nuttx/compiler.h> /************************************************************ * Definitions diff --git a/nuttx/sched/clock_settime.c b/nuttx/sched/clock_settime.c index 5f565ea36..afd4005c5 100644 --- a/nuttx/sched/clock_settime.c +++ b/nuttx/sched/clock_settime.c @@ -101,7 +101,8 @@ int clock_settime(clockid_t clock_id, const struct timespec *tp) { /* Save the new base time. */ - g_basetime = *tp; + g_basetime.tv_sec = tp->tv_sec; + g_basetime.tv_nsec = tp->tv_nsec; /* Get the elapsed time since power up (in milliseconds) biased * as appropriate. diff --git a/nuttx/sched/sched_processtimer.c b/nuttx/sched/sched_processtimer.c index de066eb46..bb56dbacb 100644 --- a/nuttx/sched/sched_processtimer.c +++ b/nuttx/sched/sched_processtimer.c @@ -161,14 +161,18 @@ void sched_process_timer(void) { /* Increment the system time (if in the link) */ +#ifdef CONFIG_HAVE_WEAKFUNCTIONS if (clock_timer != NULL) +#endif { clock_timer(); } /* Process watchdogs (if in the link) */ +#ifdef CONFIG_HAVE_WEAKFUNCTIONS if (wd_timer != NULL) +#endif { wd_timer(); } diff --git a/nuttx/sched/sig_action.c b/nuttx/sched/sig_action.c index 14388c3d5..7f9a1c343 100644 --- a/nuttx/sched/sig_action.c +++ b/nuttx/sched/sig_action.c @@ -48,6 +48,11 @@ * Definitions ************************************************************/ +#define COPY_SIGACTION(t,f) \ + { (t)->sa_sigaction = (f)->sa_sigaction; \ + (t)->sa_mask = (f)->sa_mask; \ + (t)->sa_flags = (f)->sa_flags; } + /************************************************************ * Private Type Declarations ************************************************************/ @@ -190,7 +195,7 @@ int sigaction(int signo, const struct sigaction *act, { if (sigact) { - *oact = sigact->act; + COPY_SIGACTION(oact, &sigact->act); } else { @@ -236,7 +241,7 @@ int sigaction(int signo, const struct sigaction *act, if (act->sa_u._sa_handler) { - sigact->act = *act; + COPY_SIGACTION(&sigact->act, act); } /* No.. It is a request to remove the old handler */ diff --git a/nuttx/sched/sig_internal.h b/nuttx/sched/sig_internal.h index dcc4d3d25..b03b2ec0e 100644 --- a/nuttx/sched/sig_internal.h +++ b/nuttx/sched/sig_internal.h @@ -104,7 +104,7 @@ struct sigq_s struct sigq_s *flink; /* Forward link */ union { - saVxHandType *sighandler; + void (*sighandler)(int signo, siginfo_t *info, void *context); } action; /* Signal action */ sigset_t mask; /* Additional signals to mask while the * the signal-catching functin executes */ diff --git a/nuttx/sched/sig_queue.c b/nuttx/sched/sig_queue.c index b9abf7f39..b9d71efcc 100644 --- a/nuttx/sched/sig_queue.c +++ b/nuttx/sched/sig_queue.c @@ -37,6 +37,7 @@ * Included Files ************************************************************/ +#include <nuttx/config.h> #include <sys/types.h> #include <signal.h> #include <debug.h> @@ -96,7 +97,11 @@ * ************************************************************/ +#ifdef CONFIG_CAN_PASS_STRUCTS int sigqueue (int pid, int signo, const union sigval value) +#else +int sigqueue(int pid, int signo, void *sival_ptr) +#endif { _TCB *stcb; siginfo_t info; @@ -107,14 +112,21 @@ int sigqueue (int pid, int signo, const union sigval value) /* Get the TCB of the receiving task */ stcb = sched_gettcb(pid); - dbg("sigqueue: TCB=0x%08x signo=%d value=%d\n", - stcb, signo, value.sival_int); +#ifdef CONFIG_CAN_PASS_STRUCTS + dbg("TCB=0x%08x signo=%d value=%d\n", stcb, signo, value.sival_int); +#else + dbg("TCB=0x%08x signo=%d value=%p\n", stcb, signo, sival_ptr); +#endif /* Create the siginfo structure */ info.si_signo = signo; info.si_code = SI_QUEUE; +#ifdef CONFIG_CAN_PASS_STRUCTS info.si_value = value; +#else + info.si_value.sival_ptr = sival_ptr; +#endif /* Verify that we can perform the signalling operation */ |