9
0
Fork 0

Add z80 signals

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@472 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2007-12-31 15:45:58 +00:00
parent 8566c0d0a7
commit 3d5e7dd968
12 changed files with 119 additions and 79 deletions

View File

@ -417,6 +417,10 @@
The level of network reliability is at a strong beta release level. The
baseline functionality of NuttX continues to mature and remains at
post-beta or production level.
Extensive testing has been done for the ARM architecture using the GCC
compiler/toolchain.
Other architectures and the SDCC toolchain are also supported but not as
well exercised.
</p>
<p>
@ -773,13 +777,14 @@ Other memory:
</tr>
</table>
<ul>
<li>ARM, ARM7 ARM7TDMI, ARM9, ARM926EJS are trademarks of Advanced RISC Machines, Limited.</li>
<li>Cygwin is a trademark of Red Hat, Incorporated.</li>
<li>Linux is a registered trademark of Linus Torvalds.</li>
<li>LPC2148 is a trademark of NXP Semiconductors.</li>
<li>TI is a tradename of Texas Instruments Incorporated.</li>
<li>UNIX is a registered trademark of The Open Group.</li>
<li>VxWorks is a registered trademark of Wind River Systems, Incorporated.</li>
<li>ARM, ARM7 ARM7TDMI, ARM9, ARM926EJS are trademarks of Advanced RISC Machines, Limited.</li>
<li>Cygwin is a trademark of Red Hat, Incorporated.</li>
<li>Linux is a registered trademark of Linus Torvalds.</li>
<li>LPC2148 is a trademark of NXP Semiconductors.</li>
<li>TI is a tradename of Texas Instruments Incorporated.</li>
<li>UNIX is a registered trademark of The Open Group.</li>
<li>VxWorks is a registered trademark of Wind River Systems, Incorporated.</li>
<li>Z80 is a registered trademark of Zilog, Inc.</li>
</ul>
<p>
NOTE: NuttX is <i>not</i> licensed to use the POSIX trademark. NuttX uses the POSIX

View File

@ -8,7 +8,7 @@ NuttX TODO List (Last updated December 13, 2007)
(1) C++ Support
(10) Network (net/, netutils/)
(2) USB (drivers/usbdev)
(2) Libraries (lib/)
(3) Libraries (lib/)
(2) File system (fs/, drivers/)
(2) Documentation (Documentation/)
(3) Build system
@ -194,7 +194,12 @@ o Libraries (lib/)
work as it should. This is because the underlying
representation of the environment is not an arry of pointers.
Status: Open
Priority: Mediam
Priority: Medium
Description: There are two different copies of getenv(): One in
sched/env_getenv.c and one in lib/lib_getenv(). Keep one.
Status: Open
Priority: Low
o File system (fs/, drivers/)
^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -159,9 +159,14 @@ arch/m68322
arch/pjrc-8051
8051 Microcontroller. This port is not quite ready for prime time.
arch/z80
z80 Microcontroller.
STATUS: Functional with no known defects. There are still several
OS features that have not yet been tested (e.g., networking).
The following architecture directories are deprecated. They have been
replaced by the logic in arm/arm and will deleted when arch/arm is fully
verified.
replaced by the logic in arm/arm and will deleted at some point in the
future.
arch/c5471
Replaced with arch/arm/include/c5471 and arch/arm/src/c5471

View File

@ -106,6 +106,11 @@ struct xcptcontext
#ifndef CONFIG_DISABLE_SIGNALS
void *sigdeliver; /* Actual type is sig_deliver_t */
/* The following retains that state during signal execution */
uint16 saved_pc; /* Saved return address */
uint16 saved_i; /* Saved interrupt state */
#endif
};
#endif

View File

@ -126,11 +126,12 @@ $(COBJS): %$(OBJEXT): %.c
$(SDCCLIBDIR)/myz80.lib: $(SDCCLIBDIR)/$(SDCCLIB)
@cat $(SDCCLIBDIR)/$(SDCCLIB) | \
grep -v calloc | grep -v malloc | grep -v realloc | \
grep -v free | grep -v vprintf | grep -v _strncpy | \
grep -v _strchr | grep -v _strlen | grep -v _strcmp | \
grep -v _strcpy | grep -v _memcmp | grep -v _memcpy | \
grep -v _memset | grep -v crt0 \
grep -v calloc | grep -v malloc | grep -v realloc | \
grep -v free | grep -v getenv | grep -v vprintf | \
grep -v sprintf | grep -v _strncpy | grep -v _strchr | \
grep -v _strlen | grep -v _strcmp | grep -v _strcpy | \
grep -v _memcmp | grep -v _memcpy | grep -v _memset | \
grep -v crt0 \
> myz80.lib
@sudo mv -f myz80.lib $(SDCCLIBDIR)/myz80.lib

View File

@ -65,6 +65,7 @@
#define SET_IRQCONTEXT(tcb) up_copystate(current_regs, (tcb)->xcp.regs)
#define SAVE_USERCONTEXT(tcb) up_saveusercontext((tcb)->xcp.regs)
#define RESTORE_USERCONTEXT(tcb) up_restoreusercontext((tcb)->xcp.regs)
#define SIGNAL_RETURN(regs) up_restoreusercontext(regs)
/****************************************************************************
* Public Types

View File

@ -1,4 +1,4 @@
/************************************************************
/****************************************************************************
* common/up_schedulesigaction.c
*
* Copyright (C) 2007,2008 Gregory Nutt. All rights reserved.
@ -31,38 +31,43 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Included Files
************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/arch.h>
#include <arch/irq.h>
#include "os_internal.h"
#include "up_internal.h"
#include "up_arch.h"
/************************************************************
#ifndef CONFIG_DISABLE_SIGNALS
/****************************************************************************
* Private Definitions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Data
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Public Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Name: up_schedule_sigaction
*
* Description:
@ -93,13 +98,13 @@
* currently executing task -- just call the signal
* handler now.
*
************************************************************/
****************************************************************************/
void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
{
/* Refuse to handle nested signal actions */
dbg("tcb=0x%p sigdeliver=0x%p\n", tcb, sigdeliver);
dbg("tcb=0x%p sigdeliver=0x%04x\n", tcb, (uint16)sigdeliver);
if (!tcb->xcp.sigdeliver)
{
@ -115,7 +120,7 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
dbg("rtcb=0x%p current_regs=0x%p\n", g_readytorun.head, current_regs);
if (tcb == (_TCB*)g_readytorun.head)
if (tcb == (FAR _TCB*)g_readytorun.head)
{
/* CASE 1: We are not in an interrupt handler and
* a task is signalling itself for some reason.
@ -136,21 +141,21 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
else
{
/* Save the return lr and cpsr and one scratch register
/* Save the return address and interrupt state.
* These will be restored by the signal trampoline after
* the signals have been delivered.
*/
tcb->xcp.sigdeliver = sigdeliver;
tcb->xcp.saved_pc = current_regs[REG_PC];
tcb->xcp.saved_cpsr = current_regs[REG_CPSR];
tcb->xcp.saved_pc = current_regs[XCPT_PC];
tcb->xcp.saved_i = current_regs[XCPT_I];
/* Then set up to vector to the trampoline with interrupts
* disabled
*/
current_regs[REG_PC] = (uint32)up_sigdeliver;
current_regs[REG_CPSR] = SVC_MODE | PSR_I_BIT | PSR_F_BIT;
current_regs[XCPT_PC] = (uint16)up_sigdeliver;
current_regs[XCPT_I] = 0;
/* And make sure that the saved context in the TCB
* is the same as the interrupt return context.
@ -174,17 +179,20 @@ void up_schedule_sigaction(_TCB *tcb, sig_deliver_t sigdeliver)
*/
tcb->xcp.sigdeliver = sigdeliver;
tcb->xcp.saved_pc = tcb->xcp.regs[REG_PC];
tcb->xcp.saved_cpsr = tcb->xcp.regs[REG_CPSR];
tcb->xcp.saved_pc = tcb->xcp.regs[XCPT_PC];
tcb->xcp.saved_i = tcb->xcp.regs[XCPT_I];
/* Then set up to vector to the trampoline with interrupts
* disabled
*/
tcb->xcp.regs[REG_PC] = (uint32)up_sigdeliver;
tcb->xcp.regs[REG_CPSR] = SVC_MODE | PSR_I_BIT | PSR_F_BIT;
tcb->xcp.regs[XCPT_PC] = (uint16)up_sigdeliver;
tcb->xcp.regs[XCPT_I] = 0;
}
irqrestore(flags);
}
}
#endif /* CONFIG_DISABLE_SIGNALS */

View File

@ -1,7 +1,7 @@
/************************************************************
/****************************************************************************
* common/up_sigdeliver.c
*
* Copyright (C) 2007 Gregory Nutt. All rights reserved.
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
*
* Redistribution and use in source and binary forms, with or without
@ -14,7 +14,7 @@
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name Gregory Nutt nor the names of its contributors may be
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -31,39 +31,43 @@
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Included Files
************************************************************/
****************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <sched.h>
#include <debug.h>
#include <nuttx/irq.h>
#include <nuttx/arch.h>
#include "os_internal.h"
#include "up_internal.h"
#include "up_arch.h"
/************************************************************
#ifndef CONFIG_DISABLE_SIGNALS
/****************************************************************************
* Definitions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Data
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Private Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Public Functions
************************************************************/
****************************************************************************/
/************************************************************
/****************************************************************************
* Name: up_sigdeliver
*
* Description:
@ -72,7 +76,7 @@
* with and forced to branch to this location with interrupts
* disabled.
*
************************************************************/
****************************************************************************/
void up_sigdeliver(void)
{
@ -81,9 +85,9 @@ void up_sigdeliver(void)
uint32 regs[XCPTCONTEXT_REGS];
sig_deliver_t sigdeliver;
/* Save the errno. This must be preserved throughout the
* signal handling so that the the user code final gets
* the correct errno value (probably EINTR).
/* Save the errno. This must be preserved throughout the signal handling
* so that the the user code final gets the correct errno value (probably
* EINTR).
*/
int saved_errno = rtcb->errno;
@ -97,8 +101,8 @@ void up_sigdeliver(void)
/* Save the real return state on the stack. */
up_copystate(regs, rtcb->xcp.regs);
regs[REG_PC] = rtcb->xcp.saved_pc;
regs[REG_CPSR] = rtcb->xcp.saved_cpsr;
regs[XCPT_PC] = rtcb->xcp.saved_pc;
regs[XCPT_I] = rtcb->xcp.saved_i;
/* Get a local copy of the sigdeliver function pointer.
* we do this so that we can nullify the sigdeliver
@ -112,7 +116,7 @@ void up_sigdeliver(void)
/* Then restore the task interrupt state. */
irqrestore(regs[REG_CPSR]);
irqrestore(regs[XCPT_I]);
/* Deliver the signals */
@ -132,6 +136,8 @@ void up_sigdeliver(void)
*/
up_ledoff(LED_SIGNAL);
up_fullcontextrestore(regs);
SIGNAL_RETURN(regs);
#endif
}
#endif /* CONFIG_DISABLE_SIGNALS */

View File

@ -41,12 +41,9 @@ CMN_CSRCS = up_initialize.c up_allocateheap.c up_initialstate.c \
up_blocktask.c up_unblocktask.c up_exit.c up_releasepending.c \
up_reprioritizertr.c up_copystate.c up_irq.c up_idle.c \
up_assert.c up_mdelay.c up_udelay.c \
up_schedulesigaction.c up_sigdeliver.c \
up_registerdump.c up_usestack.c
ifneq ($(CONFIG_DISABLE_SIGNALS),y)
CMD_CSRCS += up_schedulesigaction.c up_sigdeliver.c
endif
CHIP_ASRCS =
CHIP_CSRCS =

View File

@ -313,6 +313,13 @@ configs/pjrc-8051
8051 Microcontroller. This port uses the PJRC 87C52 development system
and the SDCC toolchain. This port is not quite ready for prime time.
configs/z80zim
z80 Microcontroller. This port uses a Z80 instruction set simulator.
That simulator can be found in the NuttX CVS at
http://nuttx.cvs.sourceforge.net/nuttx/misc/sims/z80sim.
This port also the SDCC toolchain (http://sdcc.sourceforge.net/")
(verified with version 2.6.0).
Other ports for the for the TI TMS320DM270, M683222 and for MIPS are in various
states of progress

View File

@ -112,13 +112,13 @@ CONFIG_DEV_CONSOLE=n
# o pthread_condtimedwait() depends on signals to wake
# up waiting tasks.
#
CONFIG_DISABLE_CLOCK=n
CONFIG_DISABLE_POSIX_TIMERS=n
CONFIG_DISABLE_PTHREAD=n
CONFIG_DISABLE_SIGNALS=n
CONFIG_DISABLE_MQUEUE=n
CONFIG_DISABLE_MOUNTPOINT=n
CONFIG_DISABLE_ENVIRON=n
CONFIG_DISABLE_CLOCK=y
CONFIG_DISABLE_POSIX_TIMERS=y
CONFIG_DISABLE_PTHREAD=y
CONFIG_DISABLE_SIGNALS=y
CONFIG_DISABLE_MQUEUE=y
CONFIG_DISABLE_MOUNTPOINT=y
CONFIG_DISABLE_ENVIRON=y
#
# Misc libc settings

View File

@ -57,7 +57,7 @@
* Public Variables
****************************************************************************/
typedef void (*sig_deliver_t)(_TCB *tcb);
typedef void (*sig_deliver_t)(FAR _TCB *tcb);
/****************************************************************************
* Public Function Prototypes