Still working toward clean 8051 link
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@25 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
3a4de8b8a8
commit
fb61b0b76b
10
Makefile
10
Makefile
@ -42,12 +42,11 @@ ARCH_SRC = $(ARCH_DIR)/src
|
||||
|
||||
SUBDIRS = sched lib $(ARCH_SRC) mm fs drivers examples/$(CONFIG_EXAMPLE)
|
||||
|
||||
LINKOBJS = $(ARCH_SRC)/up_head$(OBJEXT)
|
||||
LINKLIBS = sched/libsched$(LIBEXT) $(ARCH_SRC)/libarch$(LIBEXT) mm/libmm$(LIBEXT) \
|
||||
fs/libfs$(LIBEXT) drivers/libdrivers$(LIBEXT) lib/liblib$(LIBEXT) \
|
||||
examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT)
|
||||
|
||||
BIN = nuttx
|
||||
BIN = nuttx$(EXEEXT)
|
||||
|
||||
all: $(BIN)
|
||||
.PHONY: clean context clean_context distclean
|
||||
@ -83,9 +82,6 @@ lib/liblib$(LIBEXT): context
|
||||
$(ARCH_SRC)/libarch$(LIBEXT): context
|
||||
$(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) libarch$(LIBEXT)
|
||||
|
||||
$(ARCH_SRC)/up_head$(OBJEXT): context
|
||||
$(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) up_head$(OBJEXT)
|
||||
|
||||
mm/libmm$(LIBEXT): context
|
||||
$(MAKE) -C mm TOPDIR=$(TOPDIR) libmm$(LIBEXT)
|
||||
|
||||
@ -98,8 +94,8 @@ drivers/libdrivers$(LIBEXT): context
|
||||
examples/$(CONFIG_EXAMPLE)/lib$(CONFIG_EXAMPLE)$(LIBEXT): context
|
||||
$(MAKE) -C examples/$(CONFIG_EXAMPLE) TOPDIR=$(TOPDIR) lib$(CONFIG_EXAMPLE)$(LIBEXT)
|
||||
|
||||
$(BIN): context depend $(LINKOBJS) $(LINKLIBS)
|
||||
$(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) LINKOBJS="$(LINKOBJS)" LINKLIBS="$(LINKLIBS)" $(BIN)
|
||||
$(BIN): context depend $(LINKLIBS)
|
||||
$(MAKE) -C $(ARCH_SRC) TOPDIR=$(TOPDIR) LINKLIBS="$(LINKLIBS)" $(BIN)
|
||||
|
||||
depend:
|
||||
@for dir in $(SUBDIRS) ; do \
|
||||
|
@ -62,7 +62,7 @@ defconfig -- This is a configuration file similar to the Linux
|
||||
|
||||
General OS setup
|
||||
|
||||
CONFIG_EXAMPLE - identifies the subdirectgory in examples
|
||||
CONFIG_EXAMPLE - identifies the subdirectory in examples
|
||||
that will be used in the build
|
||||
CONFIG_DEBUG - enables built-in debug options
|
||||
CONFIG_DEBUG_VERBOSE - enables verbose debug output
|
||||
@ -82,7 +82,21 @@ defconfig -- This is a configuration file similar to the Linux
|
||||
CONFIG_DEV_CONSOLE - Set if architecture-specific logic
|
||||
provides /dev/console. Enables stdout, stderr, stdin.
|
||||
|
||||
Allow for artchitecture optimized implementations
|
||||
The following can be used to disable categories of APIs supported
|
||||
by the OS. If the compiler supports weak functions, then it
|
||||
should not be necessary to disable functions unless you want to
|
||||
restrict usage of those APIs.
|
||||
|
||||
There are certain dependency relationships in these features.
|
||||
|
||||
o mq_notify logic depends on signals to awaken tasks
|
||||
waiting for queues to become full or empty.
|
||||
o pthread_condtimedwait() depends on signals to wake
|
||||
up waiting tasks.
|
||||
|
||||
CONFIG_DISABLE_SIGNALS, CONFIG_DISABLE_MQUEUE
|
||||
|
||||
Allow for architecture optimized implementations
|
||||
|
||||
The architecture can provide optimized versions of the
|
||||
following to improve sysem performance
|
||||
|
@ -42,7 +42,7 @@ else
|
||||
-fomit-frame-pointer
|
||||
endif
|
||||
|
||||
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float
|
||||
ARCHCPUFLAGS = -mapcs-32 -mcpu=arm7tdmi -msoft-float -fno-builtin
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHDEFINES =
|
||||
@ -62,6 +62,7 @@ CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifeq ("${CONFIG_DEBUG}","y")
|
||||
LDFLAGS += -g
|
||||
|
@ -77,7 +77,7 @@ CONFIG_UART_MODEM_2STOP=0
|
||||
#
|
||||
# General OS setup
|
||||
#
|
||||
# CONFIG_EXAMPLE - identifies the subdirectgory in examples
|
||||
# CONFIG_EXAMPLE - identifies the subdirectory in examples
|
||||
# that will be used in the build
|
||||
# CONFIG_DEBUG - enables built-in debug options
|
||||
# CONFIG_DEBUG_VERBOSE - enables verbose debug output
|
||||
@ -111,7 +111,25 @@ CONFIG_JULIAN_TIME=n
|
||||
CONFIG_DEV_CONSOLE=y
|
||||
|
||||
#
|
||||
# Allow for artchitecture optimized implementations
|
||||
# The following can be used to disable categories of
|
||||
# APIs supported by the OS. If the compiler supports
|
||||
# weak functions, then it should not be necessary to
|
||||
# disable functions unless you want to restrict usage
|
||||
# of those APIs.
|
||||
#
|
||||
# There are certain dependency relationships in these
|
||||
# features.
|
||||
#
|
||||
# o mq_notify logic depends on signals to awaken tasks
|
||||
# waiting for queues to become full or empty.
|
||||
# o pthread_condtimedwait() depends on signals to wake
|
||||
# up waiting tasks.
|
||||
#
|
||||
CONFIG_DISABLE_SIGNALS=n
|
||||
CONFIG_DISABLE_MQUEUE=n
|
||||
|
||||
#
|
||||
# Allow for architecture optimized implementations
|
||||
#
|
||||
# The architecture can provide optimized versions of the
|
||||
# following to improve sysem performance
|
||||
|
@ -59,7 +59,7 @@ OBJS = $(AOBJS) $(COBJS)
|
||||
LDFLAGS = $(ARCHSCRIPT)
|
||||
EXTRA_LIBS =
|
||||
|
||||
LINKOBJS =
|
||||
LINKOBJS = up_head$(OBJEXT)
|
||||
LINKLIBS =
|
||||
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
|
||||
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
|
||||
@ -68,7 +68,7 @@ LIBGCC = ${shell $(CC) -print-libgcc-file-name}
|
||||
|
||||
all: up_head.o libarch$(LIBEXT)
|
||||
|
||||
$(AOBJS) up_head.o: %.o: %.S
|
||||
$(AOBJS) $(LINKOBJS): %.o: %.S
|
||||
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
|
||||
|
||||
$(COBJS): %.o: %.c
|
||||
@ -80,10 +80,9 @@ libarch$(LIBEXT): $(OBJS)
|
||||
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
|
||||
done ; )
|
||||
|
||||
nuttx:
|
||||
$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ \
|
||||
$(addprefix $(TOPDIR)/,$(LINKOBJS)) \
|
||||
--start-group $(LDLIBS) $(EXTRA_LIBS) $(LIBGCC) --end-group
|
||||
nuttx: $(LINKOBJS)
|
||||
$(LD) --entry=__start $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ $(LINKOBJS) \
|
||||
--start-group $(LDLIBS) --end-group $(EXTRA_LIBS) $(LIBGCC)
|
||||
@$(NM) $(TOPDIR)/$@ | \
|
||||
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||
sort > $(TOPDIR)/System.map
|
||||
|
@ -41,7 +41,7 @@ else
|
||||
ARCHOPTIMIZATION = -O2
|
||||
endif
|
||||
|
||||
ARCHCPUFLAGS =
|
||||
ARCHCPUFLAGS = -fno-builtin
|
||||
ARCHPICFLAGS = -fpic
|
||||
ARCHWARNINGS = -Wall -Wstrict-prototypes -Wshadow
|
||||
ARCHDEFINES =
|
||||
@ -61,6 +61,7 @@ CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) \
|
||||
|
||||
OBJEXT = .o
|
||||
LIBEXT = .a
|
||||
EXEEXT =
|
||||
|
||||
ifeq ("${CONFIG_DEBUG}","y")
|
||||
LDFLAGS += -g
|
||||
|
@ -44,7 +44,7 @@ CONFIG_ARCH_SIM=y
|
||||
#
|
||||
# General OS setup
|
||||
#
|
||||
# CONFIG_EXAMPLE - identifies the subdirectgory in examples
|
||||
# CONFIG_EXAMPLE - identifies the subdirectory in examples
|
||||
# that will be used in the build
|
||||
# CONFIG_DEBUG - enables built-in debug options
|
||||
# CONFIG_DEBUG_VERBOSE - enables verbose debug output
|
||||
@ -73,12 +73,30 @@ CONFIG_SCHED_INSTRUMENTATION=n
|
||||
CONFIG_TASK_NAME_SIZE=32
|
||||
CONFIG_START_YEAR=2007
|
||||
CONFIG_START_MONTH=2
|
||||
CONFIG_START_DAY=13
|
||||
CONFIG_START_DAY=27
|
||||
CONFIG_JULIAN_TIME=n
|
||||
CONFIG_DEV_CONSOLE=y
|
||||
|
||||
#
|
||||
# Allow for artchitecture optimized implementations
|
||||
# The following can be used to disable categories of
|
||||
# APIs supported by the OS. If the compiler supports
|
||||
# weak functions, then it should not be necessary to
|
||||
# disable functions unless you want to restrict usage
|
||||
# of those APIs.
|
||||
#
|
||||
# There are certain dependency relationships in these
|
||||
# features.
|
||||
#
|
||||
# o mq_notify logic depends on signals to awaken tasks
|
||||
# waiting for queues to become full or empty.
|
||||
# o pthread_condtimedwait() depends on signals to wake
|
||||
# up waiting tasks.
|
||||
#
|
||||
CONFIG_DISABLE_SIGNALS=n
|
||||
CONFIG_DISABLE_MQUEUE=n
|
||||
|
||||
#
|
||||
# Allow for architecture optimized implementations
|
||||
#
|
||||
# The architecture can provide optimized versions of the
|
||||
# following to improve sysem performance
|
||||
|
@ -54,7 +54,7 @@ OBJS = $(AOBJS) $(COBJS)
|
||||
LDFLAGS = $(ARCHSCRIPT)
|
||||
EXTRA_LIBS = -lc
|
||||
|
||||
LINKOBJS =
|
||||
LINKOBJS = up_head$(OBJEXT)
|
||||
LINKLIBS =
|
||||
LDPATHES = $(addprefix -L$(TOPDIR)/,$(dir $(LINKLIBS)))
|
||||
LDLIBS = $(patsubst lib%,-l%,$(basename $(notdir $(LINKLIBS))))
|
||||
@ -64,7 +64,7 @@ all: up_head$(OBJEXT) libarch$(LIBEXT)
|
||||
$(AOBJS): %$(OBJEXT): %.S
|
||||
$(CC) -c $(CFLAGS) -D__ASSEMBLY__ $< -o $@
|
||||
|
||||
$(COBJS) up_head$(OBJEXT): %$(OBJEXT): %.c
|
||||
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
|
||||
$(CC) -c $(CFLAGS) $< -o $@
|
||||
|
||||
libarch$(LIBEXT): $(OBJS)
|
||||
@ -73,10 +73,9 @@ libarch$(LIBEXT): $(OBJS)
|
||||
{ echo "$(AR) $@ $obj FAILED!" ; exit 1 ; } ; \
|
||||
done ; )
|
||||
|
||||
nuttx:
|
||||
$(CC) $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ \
|
||||
$(addprefix $(TOPDIR)/,$(LINKOBJS)) \
|
||||
-Wl,--start-group $(LDLIBS) $(EXTRA_LIBS) -Wl,--end-group
|
||||
nuttx: $(LINKOBJS)
|
||||
$(CC) $(LDFLAGS) $(LDPATHES) -o $(TOPDIR)/$@ $(LINKOBJS) \
|
||||
-Wl,--start-group $(LDLIBS) -Wl,--end-group $(EXTRA_LIBS)
|
||||
@$(NM) $(TOPDIR)/$@ | \
|
||||
grep -v '\(compiled\)\|\(\.o$$\)\|\( [aUw] \)\|\(\.\.ng$$\)\|\(LASH[RL]DI\)' | \
|
||||
sort > $(TOPDIR)/System.map
|
||||
|
@ -40,8 +40,14 @@ MKDEP = $(TOPDIR)/tools/mkdeps.sh
|
||||
|
||||
ASRCS =
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
CSRCS = main.c dev_null.c mutex.c cancel.c sem.c cond.c \
|
||||
timedwait.c mqueue.c sighand.c
|
||||
CSRCS = main.c dev_null.c mutex.c cancel.c sem.c cond.c
|
||||
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
|
||||
CSRCS += timedwait.c sighand.c
|
||||
endif
|
||||
ifneq ($(CONFIG_DISABLE_MQUEUE),y)
|
||||
CSRCS += mqueue.c
|
||||
endif
|
||||
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
|
@ -120,17 +120,25 @@ static int user_main(int argc, char *argv[])
|
||||
|
||||
cond_test();
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
/* Verify pthreads and condition variable timed waits */
|
||||
|
||||
timedwait_test();
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
/* Verify pthreads and message queues */
|
||||
|
||||
mqueue_test();
|
||||
#endif
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
/* Verify signal handlers */
|
||||
|
||||
sighand_test();
|
||||
#endif
|
||||
|
||||
printf("user_main: Exitting\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,7 @@
|
||||
|
||||
# define FAR
|
||||
# define NEAR
|
||||
# define DSEG
|
||||
|
||||
/* Select the large, 32-bit addressing model */
|
||||
|
||||
@ -127,6 +128,12 @@
|
||||
#define FAR __xdata
|
||||
#define NEAR __data
|
||||
|
||||
#if defined(SDCC_MODEL_SMALL)
|
||||
# define DSEG __data
|
||||
#else
|
||||
# define DSEG __xdata
|
||||
#endif
|
||||
|
||||
/* Select small, 16-bit address model */
|
||||
|
||||
# define CONFIG_SMALL_MEMORY 1
|
||||
@ -159,6 +166,7 @@
|
||||
|
||||
# define FAR
|
||||
# define NEAR
|
||||
# define DSEG
|
||||
|
||||
# undef CONFIG_SMALL_MEMORY
|
||||
# undef CONFIG_HAVE_INLINE
|
||||
|
@ -102,9 +102,13 @@ typedef enum tstate_e
|
||||
|
||||
TSTATE_TASK_INACTIVE = 4, /* BLOCKED - Initialized but not yet activated */
|
||||
TSTATE_WAIT_SEM = 5, /* BLOCKED - Waiting for a semaphore */
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
TSTATE_WAIT_SIG = 6, /* BLOCKED - Waiting for a signal */
|
||||
TSTATE_WAIT_MQNOTEMPTY = 7, /* BLOCKED - Waiting for a MQ to become not empty. */
|
||||
TSTATE_WAIT_MQNOTFULL = 8 /* BLOCKED - Waiting for a MQ to become not full. */
|
||||
#endif
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
TSTATE_WAIT_MQNOTEMPTY, /* BLOCKED - Waiting for a MQ to become not empty. */
|
||||
TSTATE_WAIT_MQNOTFULL /* BLOCKED - Waiting for a MQ to become not full. */
|
||||
#endif
|
||||
};
|
||||
typedef enum tstate_e tstate_t;
|
||||
|
||||
@ -113,8 +117,22 @@ typedef enum tstate_e tstate_t;
|
||||
#define FIRST_READY_TO_RUN_STATE TSTATE_TASK_READYTORUN
|
||||
#define LAST_READY_TO_RUN_STATE TSTATE_TASK_RUNNING
|
||||
#define FIRST_BLOCKED_STATE TSTATE_TASK_INACTIVE
|
||||
#define LAST_BLOCKED_STATE TSTATE_WAIT_MQNOTFULL
|
||||
#define NUM_TASK_STATES 9
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
# define LAST_BLOCKED_STATE TSTATE_WAIT_MQNOTFULL
|
||||
# ifndef CONFIG_DISABLE_SIGNALS
|
||||
# define NUM_TASK_STATES 9
|
||||
# else
|
||||
# define NUM_TASK_STATES 8
|
||||
# endif
|
||||
#else
|
||||
# ifndef CONFIG_DISABLE_SIGNALS
|
||||
# define LAST_BLOCKED_STATE TSTATE_WAIT_SIG
|
||||
# define NUM_TASK_STATES 7
|
||||
# else
|
||||
# define LAST_BLOCKED_STATE TSTATE_WAIT_SEM
|
||||
# define NUM_TASK_STATES 6
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following is the form of a thread start-up function */
|
||||
|
||||
@ -192,6 +210,7 @@ struct _TCB
|
||||
|
||||
/* POSIX Signal Control Fields **************************************/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
sigset_t sigprocmask; /* Signals that are blocked */
|
||||
sigset_t sigwaitmask; /* Waiting for pending signals */
|
||||
sq_queue_t sigactionq; /* List of actions for signals */
|
||||
@ -199,11 +218,14 @@ struct _TCB
|
||||
sq_queue_t sigpendactionq; /* List of pending signal actions */
|
||||
sq_queue_t sigpostedq; /* List of posted signals */
|
||||
siginfo_t sigunbinfo; /* Signal info when task unblocked */
|
||||
#endif
|
||||
|
||||
/* POSIX Named Message Queue Fields *********************************/
|
||||
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
sq_queue_t msgdesq; /* List of opened message queues */
|
||||
FAR msgq_t *msgwaitq; /* Waiting for this message queue */
|
||||
#endif
|
||||
|
||||
/* Library related fields *******************************************/
|
||||
|
||||
|
@ -67,9 +67,11 @@ SIGNAL_SRCS = sig_initialize.c \
|
||||
sig_releasependingsignal.c sig_lowest.c sig_mqnotempty.c \
|
||||
sig_cleanup.c sig_received.c sig_deliver.c
|
||||
MQUEUE_SRCS = mq_open.c mq_close.c mq_unlink.c mq_send.c mq_receive.c \
|
||||
mq_notify.c mq_setattr.c mq_getattr.c \
|
||||
mq_initialize.c mq_descreate.c mq_findnamed.c \
|
||||
mq_msgfree.c mq_msgqfree.c
|
||||
mq_setattr.c mq_getattr.c mq_initialize.c mq_descreate.c \
|
||||
mq_findnamed.c mq_msgfree.c mq_msgqfree.c
|
||||
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
|
||||
MQUEUE_SRCS += mq_notify.c
|
||||
endif
|
||||
PTHREAD_SRCS = pthread_attrinit.c pthread_attrdestroy.c \
|
||||
pthread_attrsetschedpolicy.c pthread_attrgetschedpolicy.c \
|
||||
pthread_attrsetinheritsched.c pthread_attrgetinheritsched.c \
|
||||
@ -83,19 +85,28 @@ PTHREAD_SRCS = pthread_attrinit.c pthread_attrdestroy.c \
|
||||
pthread_mutexlock.c pthread_mutextrylock.c pthread_mutexunlock.c \
|
||||
pthread_condinit.c pthread_conddestroy.c \
|
||||
pthread_condattrinit.c pthread_condattrdestroy.c \
|
||||
pthread_condwait.c pthread_condtimedwait.c \
|
||||
pthread_condsignal.c pthread_condbroadcast.c \
|
||||
pthread_condwait.c pthread_condsignal.c pthread_condbroadcast.c \
|
||||
pthread_cancel.c pthread_setcancelstate.c \
|
||||
pthread_keycreate.c pthread_setspecific.c pthread_getspecific.c pthread_keydelete.c \
|
||||
pthread_initialize.c pthread_completejoin.c pthread_findjoininfo.c \
|
||||
pthread_removejoininfo.c
|
||||
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
|
||||
PTHREAD_SRCS += pthread_condtimedwait.c
|
||||
endif
|
||||
SEM_SRCS = sem_initialize.c sem_init.c sem_destroy.c\
|
||||
sem_open.c sem_close.c sem_unlink.c \
|
||||
sem_wait.c sem_trywait.c sem_post.c sem_getvalue.c \
|
||||
sem_waitirq.c sem_findnamed.c
|
||||
IRQ_SRCS = irq_initialize.c irq_attach.c irq_dispatch.c irq_unexpectedisr.c
|
||||
|
||||
CSRCS = $(MISC_SRCS) $(TSK_SRCS) $(SCHED_SRCS) $(WDOG_SRCS) $(TIME_SRCS) \
|
||||
$(SIGNAL_SRCS) $(MQUEUE_SRCS) $(PTHREAD_SRCS) $(SEM_SRCS) $(IRQ_SRCS)
|
||||
$(PTHREAD_SRCS) $(SEM_SRCS) $(IRQ_SRCS)
|
||||
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
|
||||
CSRCS += $(SIGNAL_SRCS)
|
||||
endif
|
||||
ifneq ($(CONFIG_DISABLE_MQUEUE),y)
|
||||
CSRCS += $(MQUEUE_SRCS)
|
||||
endif
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
SRCS = $(ASRCS) $(CSRCS)
|
||||
|
@ -138,6 +138,7 @@ int mq_close(mqd_t mqdes)
|
||||
* the message queue via this mqdes.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
if (msgq->ntmqdes == mqdes)
|
||||
{
|
||||
msgq->ntpid = INVALID_PROCESS_ID;
|
||||
@ -145,6 +146,7 @@ int mq_close(mqd_t mqdes)
|
||||
msgq->ntvalue.sival_int = 0;
|
||||
msgq->ntmqdes = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Decrement the connection count on the message queue. */
|
||||
|
||||
|
@ -119,10 +119,12 @@ struct msgq_s
|
||||
sint16 nwaitnotempty; /* Number tasks waiting for not empty */
|
||||
ubyte maxmsgsize; /* Max size of message in message queue */
|
||||
boolean unlinked; /* TRUE if the msg queue has been unlinked */
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
FAR struct mq_des *ntmqdes; /* Notification: Owning mqdes (NULL if none) */
|
||||
pid_t ntpid; /* Notification: Receiving Task's PID */
|
||||
int ntsigno; /* Notification: Signal number */
|
||||
union sigval ntvalue; /* Notification: Signal value */
|
||||
#endif
|
||||
char name[1]; /* Start of the queue name */
|
||||
};
|
||||
|
||||
|
@ -189,7 +189,9 @@ mqd_t mq_open(const char *mq_name, int oflags, ...)
|
||||
}
|
||||
|
||||
msgq->nconnect = 1;
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
msgq->ntpid = INVALID_PROCESS_ID;
|
||||
#endif
|
||||
strcpy(msgq->name, mq_name);
|
||||
|
||||
/* Add the new message queue to the list of
|
||||
|
@ -46,7 +46,9 @@
|
||||
#include <debug.h>
|
||||
#include <nuttx/arch.h>
|
||||
#include "os_internal.h"
|
||||
#include "sig_internal.h"
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
# include "sig_internal.h"
|
||||
#endif
|
||||
#include "mq_internal.h"
|
||||
|
||||
/************************************************************
|
||||
@ -339,6 +341,7 @@ int mq_send(mqd_t mqdes, const void *msg, size_t msglen, int prio)
|
||||
* message queue
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
if (msgq->ntmqdes)
|
||||
{
|
||||
/* Remove the message notification data from the message queue. */
|
||||
@ -366,7 +369,7 @@ int mq_send(mqd_t mqdes, const void *msg, size_t msglen, int prio)
|
||||
sig_mqnotempty(pid, signo, sival_ptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Check if any tasks are waiting for the MQ not empty event. */
|
||||
|
||||
saved_state = irqsave();
|
||||
|
@ -135,7 +135,7 @@ typedef struct pidhash_s pidhash_t;
|
||||
|
||||
struct tasklist_s
|
||||
{
|
||||
NEAR dq_queue_t *list; /* Pointer to the task list */
|
||||
DSEG dq_queue_t *list; /* Pointer to the task list */
|
||||
boolean prioritized; /* TRUE if the list is prioritized */
|
||||
};
|
||||
typedef struct tasklist_s tasklist_t;
|
||||
@ -177,19 +177,25 @@ extern dq_queue_t g_waitingforsemaphore;
|
||||
|
||||
/* This is the list of all tasks that are blocked waiting for a signal */
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
extern dq_queue_t g_waitingforsignal;
|
||||
#endif
|
||||
|
||||
/* This is the list of all tasks that are blocked waiting for a message
|
||||
* queue to become non-empty.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
extern dq_queue_t g_waitingformqnotempty;
|
||||
#endif
|
||||
|
||||
/* This is the list of all tasks that are blocked waiting for a message
|
||||
* queue to become non-full.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
extern dq_queue_t g_waitingformqnotfull;
|
||||
#endif
|
||||
|
||||
/* This the list of all tasks that have been initialized, but not yet
|
||||
* activated. NOTE: This is the only list that is not prioritized.
|
||||
@ -241,7 +247,7 @@ extern STATUS _task_init(FAR _TCB *tcb, const char *name, int priority,
|
||||
extern boolean sched_addreadytorun(FAR _TCB *rtrtcb);
|
||||
extern boolean sched_removereadytorun(FAR _TCB *rtrtcb);
|
||||
extern boolean sched_addprioritized(FAR _TCB *newTcb,
|
||||
NEAR dq_queue_t *list);
|
||||
DSEG dq_queue_t *list);
|
||||
extern boolean sched_mergepending(void);
|
||||
extern void sched_addblocked(FAR _TCB *btcb, tstate_t task_state);
|
||||
extern void sched_removeblocked(FAR _TCB *btcb);
|
||||
|
@ -50,7 +50,9 @@
|
||||
#include "sig_internal.h"
|
||||
#include "wd_internal.h"
|
||||
#include "sem_internal.h"
|
||||
#include "mq_internal.h"
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
# include "mq_internal.h"
|
||||
#endif
|
||||
#include "pthread_internal.h"
|
||||
#include "clock_internal.h"
|
||||
#include "irq_internal.h"
|
||||
@ -99,19 +101,25 @@ dq_queue_t g_waitingforsemaphore;
|
||||
|
||||
/* This is the list of all tasks that are blocked waiting for a signal */
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
dq_queue_t g_waitingforsignal;
|
||||
#endif
|
||||
|
||||
/* This is the list of all tasks that are blocked waiting for a message
|
||||
* queue to become non-empty.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
dq_queue_t g_waitingformqnotempty;
|
||||
#endif
|
||||
|
||||
/* This is the list of all tasks that are blocked waiting for a message
|
||||
* queue to become non-full.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
dq_queue_t g_waitingformqnotfull;
|
||||
#endif
|
||||
|
||||
/* This the list of all tasks that have been initialized, but not yet
|
||||
* activated. NOTE: This is the only list that is not prioritized.
|
||||
@ -156,9 +164,13 @@ const tasklist_t g_tasklisttable[NUM_TASK_STATES] =
|
||||
{ &g_readytorun, TRUE }, /* TSTATE_TASK_RUNNING */
|
||||
{ &g_inactivetasks, FALSE }, /* TSTATE_TASK_INACTIVE */
|
||||
{ &g_waitingforsemaphore, TRUE }, /* TSTATE_WAIT_SEM */
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
{ &g_waitingforsignal, FALSE }, /* TSTATE_WAIT_SIG */
|
||||
#endif
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
{ &g_waitingformqnotempty, TRUE }, /* TSTATE_WAIT_MQNOTEMPTY */
|
||||
{ &g_waitingformqnotfull, TRUE } /* TSTATE_WAIT_MQNOTFULL */
|
||||
#endif
|
||||
};
|
||||
|
||||
/************************************************************
|
||||
@ -200,9 +212,13 @@ void os_start(void)
|
||||
dq_init(&g_readytorun);
|
||||
dq_init(&g_pendingtasks);
|
||||
dq_init(&g_waitingforsemaphore);
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
dq_init(&g_waitingforsignal);
|
||||
#endif
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
dq_init(&g_waitingformqnotfull);
|
||||
dq_init(&g_waitingformqnotempty);
|
||||
#endif
|
||||
dq_init(&g_inactivetasks);
|
||||
sq_init(&g_delayeddeallocations);
|
||||
|
||||
@ -300,12 +316,14 @@ void os_start(void)
|
||||
|
||||
/* Initialize the signal facility (if in link) */
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
|
||||
if (sig_initialize != NULL)
|
||||
#endif
|
||||
{
|
||||
sig_initialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize the semaphore facility. (if in link) */
|
||||
|
||||
@ -318,12 +336,14 @@ void os_start(void)
|
||||
|
||||
/* Initialize the named message queue facility (if in link) */
|
||||
|
||||
#ifndef CONFIG_DISABLE_MQUEUE
|
||||
#ifdef CONFIG_HAVE_WEAKFUNCTIONS
|
||||
if (mq_initialize != NULL)
|
||||
#endif
|
||||
{
|
||||
mq_initialize();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Initialize the thread-specific data facility (if in link) */
|
||||
|
||||
|
@ -91,7 +91,7 @@
|
||||
* match the state associated with the list.
|
||||
************************************************************/
|
||||
|
||||
boolean sched_addprioritized(FAR _TCB *tcb, NEAR dq_queue_t *list)
|
||||
boolean sched_addprioritized(FAR _TCB *tcb, DSEG dq_queue_t *list)
|
||||
{
|
||||
FAR _TCB *next;
|
||||
FAR _TCB *prev;
|
||||
|
@ -308,7 +308,9 @@ STATUS _task_init(FAR _TCB *tcb, const char *name, int priority,
|
||||
|
||||
/* Initialize other (non-zero) elements of the TCB */
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
tcb->sigprocmask = ALL_SIGNAL_SET;
|
||||
#endif
|
||||
tcb->task_state = TSTATE_TASK_INVALID;
|
||||
|
||||
/* Initialize the processor-specific portion of the TCB */
|
||||
|
@ -43,7 +43,9 @@
|
||||
#include <sched.h>
|
||||
#include <nuttx/os_external.h>
|
||||
#include "os_internal.h"
|
||||
#include "sig_internal.h"
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
# include "sig_internal.h"
|
||||
#endif
|
||||
|
||||
/************************************************************
|
||||
* Definitions
|
||||
@ -156,7 +158,9 @@ STATUS task_delete(pid_t pid)
|
||||
|
||||
/* Deallocate anything left in the TCB's queues */
|
||||
|
||||
#ifndef CONFIG_DISABLE_SIGNALS
|
||||
sig_cleanup(dtcb); /* Deallocate Signal lists */
|
||||
#endif
|
||||
|
||||
/* Deallocate its TCB */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user