diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-02-21 21:55:16 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2007-02-21 21:55:16 +0000 |
commit | efc2cf23a849f7be1d65c4cdd7767f88917c46a7 (patch) | |
tree | fbe3518a364d6b9d811e00f7201e082d50ead7e3 /nuttx/include | |
parent | 94e5b72f50f3096b83fe50c7b57324a08e318f29 (diff) | |
download | px4-nuttx-efc2cf23a849f7be1d65c4cdd7767f88917c46a7.tar.gz px4-nuttx-efc2cf23a849f7be1d65c4cdd7767f88917c46a7.tar.bz2 px4-nuttx-efc2cf23a849f7be1d65c4cdd7767f88917c46a7.zip |
Progress toward clean SDCC compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@18 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/include')
-rw-r--r-- | nuttx/include/assert.h | 54 | ||||
-rw-r--r-- | nuttx/include/errno.h | 8 | ||||
-rw-r--r-- | nuttx/include/nuttx/arch.h | 4 | ||||
-rw-r--r-- | nuttx/include/nuttx/compiler.h | 1 | ||||
-rw-r--r-- | nuttx/include/nuttx/irq.h | 2 | ||||
-rw-r--r-- | nuttx/include/pthread.h | 28 | ||||
-rw-r--r-- | nuttx/include/sched.h | 8 | ||||
-rw-r--r-- | nuttx/include/sys/types.h | 20 | ||||
-rw-r--r-- | nuttx/include/wdog.h | 27 |
9 files changed, 109 insertions, 43 deletions
diff --git a/nuttx/include/assert.h b/nuttx/include/assert.h index 831b57485..022e343ca 100644 --- a/nuttx/include/assert.h +++ b/nuttx/include/assert.h @@ -53,21 +53,42 @@ #undef ASSERTCODE #undef DEBUGASSERT -#define ASSERT(f) \ - { if (!(f)) up_assert((const ubyte *)__FILE__, (uint32)__LINE__); } +#ifdef __GNUC__ -#define ASSERTCODE(f, errCode) \ - { if (!(f)) up_assert_code((const ubyte *)__FILE__, (uint32)__LINE__, errCode); } +# define ASSERT(f) \ + { if (!(f)) up_assert((const ubyte *)__FILE__, (int)__LINE__); } + +# define ASSERTCODE(f, errCode) \ + { if (!(f)) up_assert_code((const ubyte *)__FILE__, (int)__LINE__, errCode); } + +# ifdef CONFIG_DEBUG +# define DEBUGASSERT(f) \ + { if (!(f)) up_assert((const ubyte *)__FILE__, (int)__LINE__); } +# else +# define DEBUGASSERT(f) +# endif /* CONFIG_DEBUG */ + +# define PANIC(errCode) \ + up_assert_code((const ubyte *)__FILE__, (int)__LINE__, (errCode)|0x8000) -#ifdef CONFIG_DEBUG -#define DEBUGASSERT(f) \ - { if (!(f)) up_assert((const ubyte *)__FILE__, (uint32)__LINE__); } #else -#define DEBUGASSERT(f) -#endif /* CONFIG_DEBUG */ +# define ASSERT(f) \ + { if (!(f)) up_assert(); } + +# define ASSERTCODE(f, errCode) \ + { if (!(f)) up_assert_code(errCode); } + +# ifdef CONFIG_DEBUG +# define DEBUGASSERT(f) \ + { if (!(f)) up_assert(); } +# else +# define DEBUGASSERT(f) +# endif /* CONFIG_DEBUG */ -#define PANIC(errCode) \ - up_assert_code((const ubyte *)__FILE__, (uint32)__LINE__, ((errCode)|(0x8000))) +# define PANIC(errCode) \ + up_assert_code((errCode)|0x8000) + +#endif /************************************************************ * Included Files @@ -84,9 +105,14 @@ extern "C" { #define EXTERN extern #endif -EXTERN void up_assert(const ubyte *fileName, uint32 lineNum); -EXTERN void up_assert_code(const ubyte *fileName, uint32 lineNum, - uint16 errorCode); +#ifdef __GNUC__ +EXTERN void up_assert(const ubyte *fileName, int lineNum); +EXTERN void up_assert_code(const ubyte *fileName, int lineNum, + int error_code); +#else +EXTERN void up_assert(void); +EXTERN void up_assert_code(int error_code); +#endif #undef EXTERN #ifdef __cplusplus diff --git a/nuttx/include/errno.h b/nuttx/include/errno.h index 50fddfc9f..d189ccaa0 100644 --- a/nuttx/include/errno.h +++ b/nuttx/include/errno.h @@ -188,8 +188,16 @@ extern "C" { #define EXTERN extern #endif +/* Return a pointer to the thread specifid errno */ + extern int *get_errno_ptr(void); +#ifndef CONFIG_CAN_CAST_POINTERS +/* Return the value ERROR cast to (void*) */ + +extern void *get_errorptr(void); +#endif + #undef EXTERN #if defined(__cplusplus) } diff --git a/nuttx/include/nuttx/arch.h b/nuttx/include/nuttx/arch.h index cc5ad3560..5ccba7c20 100644 --- a/nuttx/include/nuttx/arch.h +++ b/nuttx/include/nuttx/arch.h @@ -150,7 +150,7 @@ EXTERN void up_initial_state(_TCB *tcb); * must be allocated. ************************************************************/ -EXTERN STATUS up_create_stack(_TCB *tcb, uint32 stack_size); +EXTERN STATUS up_create_stack(_TCB *tcb, size_t stack_size); /************************************************************ * Name: up_use_stack @@ -173,7 +173,7 @@ EXTERN STATUS up_create_stack(_TCB *tcb, uint32 stack_size); * ************************************************************/ -EXTERN STATUS up_use_stack(_TCB *tcb, uint32 *stack, uint32 stack_size); +EXTERN STATUS up_use_stack(_TCB *tcb, void *stack, size_t stack_size); /************************************************************ * Name: up_release_stack diff --git a/nuttx/include/nuttx/compiler.h b/nuttx/include/nuttx/compiler.h index 6f4e68baf..b5eafe8d9 100644 --- a/nuttx/include/nuttx/compiler.h +++ b/nuttx/include/nuttx/compiler.h @@ -52,6 +52,7 @@ # define noreturn_function __attribute__ ((noreturn)) # define reentrant_function #elif defined(__SDCC__) +# pragma disable_warning 85 # define weak_alias(name, aliasname) # define weak_function # define weak_const_function diff --git a/nuttx/include/nuttx/irq.h b/nuttx/include/nuttx/irq.h index ce3543404..82a34c760 100644 --- a/nuttx/include/nuttx/irq.h +++ b/nuttx/include/nuttx/irq.h @@ -61,7 +61,7 @@ #ifndef __ASSEMBLY__ typedef int (*xcpt_t)(int irq, void *context); -typedef int (*swint_t)(uint32 code, uint32 parm2, uint32 parm3, +typedef int (*swint_t)(int code, int parm2, int parm3, void *context); #endif diff --git a/nuttx/include/pthread.h b/nuttx/include/pthread.h index c03e2a5fa..12f0d5365 100644 --- a/nuttx/include/pthread.h +++ b/nuttx/include/pthread.h @@ -63,29 +63,33 @@ * Definitions ************************************************************/ -#define PTHREAD_PROCESS_PRIVATE 0 -#define PTHREAD_PROCESS_SHARED 1 +#define PTHREAD_PROCESS_PRIVATE 0 +#define PTHREAD_PROCESS_SHARED 1 -#define PTHREAD_STACK_MIN CONFIG_PTHREAD_STACK_MIN -#define PTHREAD_STACK_DEFAULT CONFIG_PTHREAD_STACK_DEFAULT +#define PTHREAD_STACK_MIN CONFIG_PTHREAD_STACK_MIN +#define PTHREAD_STACK_DEFAULT CONFIG_PTHREAD_STACK_DEFAULT -#define PTHREAD_INHERIT_SCHED 0 -#define PTHREAD_EXPLICIT_SCHED 1 +#define PTHREAD_INHERIT_SCHED 0 +#define PTHREAD_EXPLICIT_SCHED 1 -#define PTHREAD_PRIO_NONE 0 -#define PTHREAD_PRIO_INHERIT 1 -#define PTHREAD_PRIO_PROTECT 2 +#define PTHREAD_PRIO_NONE 0 +#define PTHREAD_PRIO_INHERIT 1 +#define PTHREAD_PRIO_PROTECT 2 #define PTHREAD_DEFAULT_PRIORITY 100 /* Cancellation states returned by pthread_cancelstate() */ -#define PTHREAD_CANCEL_ENABLE (0) -#define PTHREAD_CANCEL_DISABLE (1) +#define PTHREAD_CANCEL_ENABLE (0) +#define PTHREAD_CANCEL_DISABLE (1) /* Thread return value when a pthread is canceled */ -#define PTHREAD_CANCELED ((void*)-1) +#ifdef CONFIG_CAN_CAST_POINTERS +# define PTHREAD_CANCELED ((void*)ERROR) +#else +# define PTHREAD_CANCELED ((void*)pthread_create) +#endif /************************************************************ * Global Type Declarations diff --git a/nuttx/include/sched.h b/nuttx/include/sched.h index c5d7e1163..4266eb9c0 100644 --- a/nuttx/include/sched.h +++ b/nuttx/include/sched.h @@ -171,17 +171,19 @@ struct _TCB /* Stack-Related Fields *********************************************/ - uint32 adj_stack_size; /* Stack size after adjustment */ + size_t adj_stack_size; /* Stack size after adjustment */ /* for hardware, processor, etc. */ /* (for debug purposes only) */ - uint32 *stack_alloc_ptr; /* Pointer to allocated stack */ + void *stack_alloc_ptr; /* Pointer to allocated stack */ /* Need to deallocate stack */ - uint32 *adj_stack_ptr; /* Adjusted StatckAllocPtr for HW */ + void *adj_stack_ptr; /* Adjusted StatckAllocPtr for HW */ /* The initial stack pointer value */ /* POSIX thread Specific Data ***************************************/ +#if CONFIG_NPTHREAD_KEYS > 0 void *pthread_data[CONFIG_NPTHREAD_KEYS]; +#endif /* POSIX Semaphore Control Fields ***********************************/ diff --git a/nuttx/include/sys/types.h b/nuttx/include/sys/types.h index 37b206ee1..45971e4fd 100644 --- a/nuttx/include/sys/types.h +++ b/nuttx/include/sys/types.h @@ -112,6 +112,7 @@ * Type Declarations ************************************************************/ +#ifndef __ASSEMBLY__ #ifndef CONFIG_HAVE_DOUBLE typedef float double_t; #else @@ -120,15 +121,21 @@ typedef double double_t; /* Misc. scalar types */ -typedef uint32 mode_t; +typedef unsigned int mode_t; +#ifdef CONFIG_SMALL_MEMORY +typedef uint16 size_t; +typedef sint16 ssize_t; +typedef sint16 off_t; +#else typedef uint32 size_t; typedef sint32 ssize_t; -//typedef sint32 time_t; typedef sint32 off_t; -typedef sint32 uid_t; -typedef sint32 gid_t; -typedef uint32 dev_t; -typedef uint32 ino_t; +#endif +//typedef sint32 time_t; +typedef sint16 uid_t; +typedef sint16 gid_t; +typedef uint16 dev_t; +typedef uint16 ino_t; typedef unsigned int sig_atomic_t; typedef int pid_t; typedef int STATUS; @@ -143,6 +150,7 @@ struct sched_param { int sched_priority; }; +#endif /************************************************************ * Global Function Prototypes diff --git a/nuttx/include/wdog.h b/nuttx/include/wdog.h index 9ef16256c..a1065eaae 100644 --- a/nuttx/include/wdog.h +++ b/nuttx/include/wdog.h @@ -55,11 +55,28 @@ * Global Type Declarations ************************************************************/ +/* The arguments are passed as uint32 values. For systems + * where the sizeof(pointer) < sizeof(uint32), the following + * union defines the alignment of the pointer within the + * uint32. For example, the SDCC MCS51 general pointer is + * 24-bits, but uint32 is 32-bits (of course). + * + * For systems where sizeof(pointer) > sizeof(uint32), we will + * have to do some redesign. + */ + +union wdparm_u +{ + void *pvarg; + uint32 *dwarg; +}; +typedef union wdparm_u wdparm_t; + /* This is the form of the function that is called when the * watchdog function expires. Up to four parameters may be passed. */ -typedef void (*wdentry_t)(int arg1, ...); +typedef void (*wdentry_t)(int argc, uint32 arg1, ...); /* Watchdog 'handle' */ @@ -81,10 +98,10 @@ extern "C" { #endif EXTERN WDOG_ID wd_create(void); -EXTERN STATUS wd_delete(WDOG_ID wdId); -EXTERN STATUS wd_start(WDOG_ID wdId, int delay, wdentry_t wdentry, - int parm1, int parm2, int parm3, int parm4); -EXTERN STATUS wd_cancel(WDOG_ID wdId); +EXTERN STATUS wd_delete(WDOG_ID wdog); +EXTERN STATUS wd_start(WDOG_ID wdog, int delay, wdentry_t wdentry, + int argc, ...); +EXTERN STATUS wd_cancel(WDOG_ID wdog); #undef EXTERN #ifdef __cplusplus |