mirror of
https://github.com/apache/nuttx.git
synced 2026-09-24 00:42:03 +08:00
Progress toward clean SDCC compilation
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@18 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
+40
-14
@@ -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 PANIC(errCode) \
|
||||
up_assert_code((const ubyte *)__FILE__, (uint32)__LINE__, ((errCode)|(0x8000)))
|
||||
# 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((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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
|
||||
+16
-12
@@ -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
|
||||
|
||||
+5
-3
@@ -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 ***********************************/
|
||||
|
||||
|
||||
+14
-6
@@ -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
|
||||
|
||||
+22
-5
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user