Working toward compiler independence: Removed inline funcs
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@15 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
3c0e634aee
commit
4881fed8bf
@ -149,17 +149,15 @@ include/types.h
|
||||
|
||||
include/irq.h
|
||||
This file needs to define some architecture specific functions (usually
|
||||
inline) and structure. These include:
|
||||
inline if the compiler supports inlining) and structure. These include:
|
||||
|
||||
- struct xcptcontext. This structures represents the saved context
|
||||
of a thread.
|
||||
|
||||
- static inline uint32 irqsave(void) -- Used to disable
|
||||
all interrupts.
|
||||
- uint32 irqsave(void) -- Used to disable all interrupts.
|
||||
|
||||
- static inline void irqrestore(uint32 flags) -- Used to
|
||||
restore interrupts enables to the same state as before irqsave
|
||||
was called.
|
||||
- void irqrestore(uint32 flags) -- Used to restore interrupt
|
||||
enables to the same state as before irqsave was called.
|
||||
|
||||
This file must also define NR_IRQS, the total number of IRQs supported
|
||||
by the board.
|
||||
|
@ -123,7 +123,6 @@ static int up_close(struct file *filep);
|
||||
static ssize_t up_read(struct file *filep, char *buffer, size_t buflen);
|
||||
static ssize_t up_write(struct file *filep, const char *buffer, size_t buflen);
|
||||
static int up_ioctl(struct file *filep, int cmd, unsigned long arg);
|
||||
static void up_consoleinit(up_dev_t *dev);
|
||||
static void up_uartsetup(up_dev_t *dev);
|
||||
static void up_delay(int milliseconds);
|
||||
|
||||
@ -590,7 +589,7 @@ static void up_xmitchars(up_dev_t *dev)
|
||||
* serial driver.
|
||||
*/
|
||||
|
||||
static int up_interrupt(int irq, struct xcptcontext *xcp)
|
||||
static int up_interrupt(int irq, void *context)
|
||||
{
|
||||
up_dev_t *dev;
|
||||
volatile uint32 cause;
|
||||
|
21
fs/fs_dup.c
21
fs/fs_dup.c
@ -55,23 +55,14 @@
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
#define DUP_ISOPEN(fd, list) \
|
||||
((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS && \
|
||||
list->fl_files[fd].f_inode != NULL)
|
||||
|
||||
/************************************************************
|
||||
* Private Functions
|
||||
************************************************************/
|
||||
|
||||
static inline boolean dup_isopen(int fd, struct filelist *list)
|
||||
{
|
||||
if ((unsigned int)fd >= CONFIG_NFILE_DESCRIPTORS ||
|
||||
list->fl_files[fd].f_inode == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/************************************************************
|
||||
* Global Functions
|
||||
************************************************************/
|
||||
@ -92,7 +83,7 @@ int dup(int fildes)
|
||||
|
||||
/* Verify that fildes is a valid, open file descriptor */
|
||||
|
||||
if (!dup_isopen(fildes, list))
|
||||
if (!DUP_ISOPEN(fildes, list))
|
||||
{
|
||||
*get_errno_ptr() = EBADF;
|
||||
return ERROR;
|
||||
@ -131,7 +122,7 @@ int dup2(int fildes1, int fildes2)
|
||||
|
||||
/* Verify that fildes is a valid, open file descriptor */
|
||||
|
||||
if (!dup_isopen(fildes1, list))
|
||||
if (!DUP_ISOPEN(fildes1, list))
|
||||
{
|
||||
*get_errno_ptr() = EBADF;
|
||||
return ERROR;
|
||||
|
@ -86,10 +86,7 @@ static void _files_semtake(struct filelist *list)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void _files_semgive(struct filelist *list)
|
||||
{
|
||||
sem_post(&list->fl_sem);
|
||||
}
|
||||
#define _files_semgive(list) sem_post(&list->fl_sem)
|
||||
|
||||
/************************************************************
|
||||
* Pulblic Functions
|
||||
|
@ -53,9 +53,12 @@
|
||||
#include "fs_internal.h"
|
||||
|
||||
/************************************************************
|
||||
* Private types
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
#define INODE_SEMGIVE() \
|
||||
sem_post(&tree_sem)
|
||||
|
||||
/************************************************************
|
||||
* Private Variables
|
||||
************************************************************/
|
||||
@ -86,10 +89,7 @@ static void _inode_semtake(void)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void _inode_semgive(void)
|
||||
{
|
||||
sem_post(&tree_sem);
|
||||
}
|
||||
#define _inode_semgive(void) sem_post(&tree_sem)
|
||||
|
||||
static int _inode_compare(const char *fname,
|
||||
struct inode *node)
|
||||
@ -152,20 +152,20 @@ static int _inode_compare(const char *fname,
|
||||
}
|
||||
}
|
||||
|
||||
static inline int _inode_namelen(const char *name)
|
||||
static int _inode_namelen(const char *name)
|
||||
{
|
||||
const char *tmp = name;
|
||||
while(*tmp && *tmp != '/') tmp++;
|
||||
return tmp - name;
|
||||
}
|
||||
|
||||
static inline void _inode_namecpy(char *dest, const char *src)
|
||||
static void _inode_namecpy(char *dest, const char *src)
|
||||
{
|
||||
while(*src && *src != '/') *dest++ = *src++;
|
||||
*dest='\0';
|
||||
}
|
||||
|
||||
static inline const char *_inode_nextname(const char *name)
|
||||
static const char *_inode_nextname(const char *name)
|
||||
{
|
||||
while (*name && *name != '/') name++;
|
||||
if (*name) name++;
|
||||
|
@ -63,10 +63,6 @@ extern struct file files[CONFIG_NFILE_DESCRIPTORS];
|
||||
#endif
|
||||
extern struct inode *root_inode;
|
||||
|
||||
/************************************************************
|
||||
* Inline Functions
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Pulblic Function Prototypes
|
||||
************************************************************/
|
||||
|
@ -49,10 +49,6 @@
|
||||
* Definitions
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Inline functions
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Types
|
||||
************************************************************/
|
||||
|
@ -69,10 +69,6 @@ typedef int (*swint_t)(uint32 code, uint32 parm2, uint32 parm3,
|
||||
|
||||
#include <arch/irq.h>
|
||||
|
||||
/************************************************************
|
||||
* Inline functions
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Variables
|
||||
************************************************************/
|
||||
|
@ -99,9 +99,9 @@
|
||||
|
||||
/* The first three _iob entries are reserved for standard I/O */
|
||||
|
||||
#define stdin (__stdfile(0))
|
||||
#define stdout (__stdfile(1))
|
||||
#define stderr (__stdfile(2))
|
||||
#define stdin (&sched_getstreams()->sl_streams[0])
|
||||
#define stdout (&sched_getstreams()->sl_streams[1])
|
||||
#define stderr (&sched_getstreams()->sl_streams[2])
|
||||
|
||||
/* These APIs are not implemented and/or can be synthesized from
|
||||
* supported APIs.
|
||||
@ -194,29 +194,6 @@ typedef void DIR;
|
||||
* Public Variables
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Inline Functions
|
||||
************************************************************/
|
||||
|
||||
/* Used to reference stdin, stdout, and stderr */
|
||||
|
||||
#ifdef CONFIG_HAVE_INLINE
|
||||
static inline FILE *__stdfile(int fd)
|
||||
{
|
||||
if ((unsigned int)fd < CONFIG_NFILE_DESCRIPTORS)
|
||||
{
|
||||
struct streamlist *streams = sched_getstreams();
|
||||
if (streams)
|
||||
{
|
||||
return &streams->sl_streams[fd];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
extern FILE *__stdfile(int fd);
|
||||
#endif
|
||||
|
||||
/************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************/
|
||||
|
@ -71,10 +71,7 @@ static void _lib_semtake(struct streamlist *list)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void _lib_semgive(struct streamlist *list)
|
||||
{
|
||||
sem_post(&list->sl_sem);
|
||||
}
|
||||
#define _lib_semgive(list) sem_post(&list->sl_sem)
|
||||
|
||||
/************************************************************
|
||||
* Public Functions
|
||||
|
@ -98,10 +98,6 @@ struct lib_rawstream_s
|
||||
* Public Variables
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Inline Functions
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Pulblic Function Prototypes
|
||||
************************************************************/
|
||||
|
@ -152,10 +152,6 @@ extern struct mm_allocnode_s *g_heapend;
|
||||
|
||||
extern struct mm_freenode_s g_nodelist[MM_NNODES];
|
||||
|
||||
/************************************************************
|
||||
* Inline Functions
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Pulblic Function Prototypes
|
||||
************************************************************/
|
||||
|
@ -85,10 +85,6 @@ extern volatile uint32 g_system_timer;
|
||||
extern struct timespec g_basetime;
|
||||
extern uint32 g_tickbias;
|
||||
|
||||
/************************************************************
|
||||
* Public Inline Functions
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************/
|
||||
|
@ -81,7 +81,7 @@
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
static inline time_t clock_gregorian2utc(int year, int month, int day)
|
||||
static time_t clock_gregorian2utc(int year, int month, int day)
|
||||
{
|
||||
int temp;
|
||||
|
||||
@ -95,7 +95,7 @@ static inline time_t clock_gregorian2utc(int year, int month, int day)
|
||||
}
|
||||
|
||||
#ifdef CONFIG_JULIAN_TIME
|
||||
static inline time_t clock_julian2utc(int year, int month, int day)
|
||||
static time_t clock_julian2utc(int year, int month, int day)
|
||||
{
|
||||
return 367*year
|
||||
- (7*(year + 5001 + (month-9)/7))/4
|
||||
|
@ -67,19 +67,15 @@
|
||||
* Function: mq_desfree
|
||||
*
|
||||
* Description:
|
||||
* Deallocate a message queue descriptor
|
||||
* Deallocate a message queue descriptor but returning it
|
||||
* to the free liest
|
||||
*
|
||||
* Inputs:
|
||||
* mqdes - message queue descriptor to free
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
static inline void mq_desfree(mqd_t mqdes)
|
||||
{
|
||||
/* Just put it back on the free list */
|
||||
|
||||
sq_addlast((sq_entry_t*)mqdes, &g_desfree);
|
||||
}
|
||||
#define mq_desfree(mqdes) sq_addlast((sq_entry_t*)mqdes, &g_desfree)
|
||||
|
||||
/************************************************************
|
||||
* Public Functions
|
||||
|
@ -88,7 +88,7 @@
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
static inline mqd_t mq_desalloc(void)
|
||||
static mqd_t mq_desalloc(void)
|
||||
{
|
||||
mqd_t mqdes;
|
||||
|
||||
|
@ -228,10 +228,6 @@ extern pidhash_t g_pidhash[MAX_TASKS_ALLOWED];
|
||||
|
||||
extern const tasklist_t g_tasklisttable[NUM_TASK_STATES];
|
||||
|
||||
/************************************************************
|
||||
* Public Inline Functions
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************/
|
||||
|
@ -72,7 +72,7 @@
|
||||
* Private Functions
|
||||
************************************************************/
|
||||
|
||||
static inline void sched_process_timeslice(void)
|
||||
static void sched_process_timeslice(void)
|
||||
{
|
||||
#if CONFIG_RR_INTERVAL > 0
|
||||
_TCB *rtcb;
|
||||
|
@ -149,10 +149,6 @@ extern sq_queue_t g_sigpendingsignal;
|
||||
|
||||
extern sq_queue_t g_sigpendingirqsignal;
|
||||
|
||||
/************************************************************
|
||||
* Public Inline Functions
|
||||
************************************************************/
|
||||
|
||||
/************************************************************
|
||||
* Public Function Prototypes
|
||||
************************************************************/
|
||||
|
Loading…
Reference in New Issue
Block a user