*** empty log message ***
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@597 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
94ef1222d8
commit
3dc0fee9ba
5
TODO
5
TODO
@ -383,6 +383,7 @@ o z16 (arch/z16)
|
|||||||
Priority: Medium. A polled, write-only serial driver is used in the
|
Priority: Medium. A polled, write-only serial driver is used in the
|
||||||
interim for system testing.
|
interim for system testing.
|
||||||
|
|
||||||
Description: Signals are not functional
|
Description: The system delays do not appear to be correct with the
|
||||||
|
examples/ostest/timedmqueue.c test.
|
||||||
Status: Open
|
Status: Open
|
||||||
Priority: Medium
|
Priority: Medium-High
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
|
|
||||||
#define IN_INTERRUPT (current_regs != NULL)
|
#define IN_INTERRUPT (current_regs != NULL)
|
||||||
#define SAVE_IRQCONTEXT(tcb) up_copystate((tcb)->xcp.regs, current_regs)
|
#define SAVE_IRQCONTEXT(tcb) up_copystate((tcb)->xcp.regs, current_regs)
|
||||||
#define SET_IRQCONTEXT(tcb) up_copystate(current_regs, (tcb)->xcp.regs)
|
#define SET_IRQCONTEXT(tcb) do { current_regs = (tcb)->xcp.regs; } while (0)
|
||||||
#define SAVE_USERCONTEXT(tcb) up_saveusercontext((tcb)->xcp.regs)
|
#define SAVE_USERCONTEXT(tcb) up_saveusercontext((tcb)->xcp.regs)
|
||||||
#define RESTORE_USERCONTEXT(tcb) up_restoreusercontext((tcb)->xcp.regs)
|
#define RESTORE_USERCONTEXT(tcb) up_restoreusercontext((tcb)->xcp.regs)
|
||||||
#define SIGNAL_RETURN(regs) up_restoreusercontext(regs)
|
#define SIGNAL_RETURN(regs) up_restoreusercontext(regs)
|
||||||
|
@ -133,19 +133,19 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
|
|||||||
sigdeliver(tcb);
|
sigdeliver(tcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CASE 2: We are in an interrupt handler AND the
|
/* CASE 2: We are in an interrupt handler AND the interrupted
|
||||||
* interrupted task is the same as the one that
|
* task is the same as the one that must receive the signal, then
|
||||||
* must receive the signal, then we will have to modify
|
* we will have to modify the return state as well as the state
|
||||||
* the return state as well as the state in the TCB.
|
* in the TCB.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FAR uint32 *current_pc = (FAR uint32*)¤t_regs[REG_PC];
|
FAR uint32 *current_pc = (FAR uint32*)¤t_regs[REG_PC];
|
||||||
|
|
||||||
/* Save the return address and interrupt state.
|
/* Save the return address and interrupt state. These will be
|
||||||
* These will be restored by the signal trampoline after
|
* restored by the signal trampoline after the signals have
|
||||||
* the signals have been delivered.
|
* been delivered.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
tcb->xcp.sigdeliver = sigdeliver;
|
tcb->xcp.sigdeliver = sigdeliver;
|
||||||
@ -159,23 +159,22 @@ void up_schedule_sigaction(FAR _TCB *tcb, sig_deliver_t sigdeliver)
|
|||||||
*current_pc = (uint32)up_sigdeliver;
|
*current_pc = (uint32)up_sigdeliver;
|
||||||
current_regs[REG_FLAGS] = 0;
|
current_regs[REG_FLAGS] = 0;
|
||||||
|
|
||||||
/* And make sure that the saved context in the TCB
|
/* And make sure that the saved context in the TCB is the
|
||||||
* is the same as the interrupt return context.
|
* same as the interrupt return context.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
up_copystate(tcb->xcp.regs, current_regs);
|
up_copystate(tcb->xcp.regs, current_regs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, we are (1) signaling a task is not running
|
/* Otherwise, we are (1) signaling a task is not running from an
|
||||||
* from an interrupt handler or (2) we are not in an
|
* interrupt handler or (2) we are not in an interrupt handler
|
||||||
* interrupt handler and the running task is signalling
|
* and the running task is signalling some non-running task.
|
||||||
* some non-running task.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32 *saved_pc = (uint32*)&tcb->xcp.regs[REG_PC];
|
FAR uint32 *saved_pc = (FAR uint32*)&tcb->xcp.regs[REG_PC];
|
||||||
|
|
||||||
/* Save the return lr and cpsr and one scratch register
|
/* Save the return lr and cpsr and one scratch register
|
||||||
* These will be restored by the signal trampoline after
|
* These will be restored by the signal trampoline after
|
||||||
|
@ -72,10 +72,9 @@
|
|||||||
* Name: up_sigdeliver
|
* Name: up_sigdeliver
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This is the a signal handling trampoline. When a
|
* This is the a signal handling trampoline. When a signal action was
|
||||||
* signal action was posted. The task context was mucked
|
* posted. The task context was mucked with and forced to branch to this
|
||||||
* with and forced to branch to this location with interrupts
|
* location with interrupts disabled.
|
||||||
* disabled.
|
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
@ -106,10 +105,9 @@ void up_sigdeliver(void)
|
|||||||
regs32[REG_PC/2] = rtcb->xcp.saved_pc;
|
regs32[REG_PC/2] = rtcb->xcp.saved_pc;
|
||||||
regs[REG_FLAGS] = rtcb->xcp.saved_i;
|
regs[REG_FLAGS] = rtcb->xcp.saved_i;
|
||||||
|
|
||||||
/* Get a local copy of the sigdeliver function pointer.
|
/* Get a local copy of the sigdeliver function pointer. We do this so
|
||||||
* we do this so that we can nullify the sigdeliver
|
* that we can nullify the sigdeliver function point in the TCB and
|
||||||
* function point in the TCB and accept more signal
|
* accept more signal deliveries while processing the current pending
|
||||||
* deliveries while processing the current pending
|
|
||||||
* signals.
|
* signals.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -127,10 +125,9 @@ void up_sigdeliver(void)
|
|||||||
|
|
||||||
sigdeliver(rtcb);
|
sigdeliver(rtcb);
|
||||||
|
|
||||||
/* Output any debug messaged BEFORE restoring errno
|
/* Output any debug messaged BEFORE restoring errno (because they may
|
||||||
* (because they may alter errno), then restore the
|
* alter errno), then restore the original errno that is needed by
|
||||||
* original errno that is needed by the user logic
|
* the user logic (it is probably EINTR).
|
||||||
* (it is probably EINTR).
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
dbg("Resuming\n");
|
dbg("Resuming\n");
|
||||||
|
@ -456,7 +456,7 @@ _common_isr:
|
|||||||
* to use to return from the interrupt in r0. This may or may not be the
|
* to use to return from the interrupt in r0. This may or may not be the
|
||||||
* same value as sp.
|
* same value as sp.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
cp r0, sp /* Check if we are performing a context switch */
|
cp r0, sp /* Check if we are performing a context switch */
|
||||||
jp nz, _common_switch /* Jump if yes, else use faster return */
|
jp nz, _common_switch /* Jump if yes, else use faster return */
|
||||||
popmhi <r8-r14> /* Restore r8-r14 */
|
popmhi <r8-r14> /* Restore r8-r14 */
|
||||||
|
@ -1,112 +1,103 @@
|
|||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* arch/z16/src/z16f/z16f_restoreusercontext.asm
|
* arch/z16/src/z16f/z16f_restoreusercontext.asm
|
||||||
*
|
*
|
||||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions
|
* modification, are permitted provided that the following conditions
|
||||||
* are met:
|
* are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer.
|
* notice, this list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
* notice, this list of conditions and the following disclaimer in
|
* notice, this list of conditions and the following disclaimer in
|
||||||
* the documentation and/or other materials provided with the
|
* the documentation and/or other materials provided with the
|
||||||
* distribution.
|
* distribution.
|
||||||
* 3. Neither the name NuttX 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
|
* used to endorse or promote products derived from this software
|
||||||
* without specific prior written permission.
|
* without specific prior written permission.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSeqUENTIAL DAMAGES (INCLUDING,
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSeqUENTIAL DAMAGES (INCLUDING,
|
||||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* Included Files
|
* Included Files
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
#include <nuttx/config.h>
|
#include <nuttx/config.h>
|
||||||
#include <arch/irq.h>
|
#include <arch/irq.h>
|
||||||
#include "chip/chip.h"
|
#include "chip/chip.h"
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* External References / External Definitions
|
* External References / External Definitions
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
xdef _up_restoreusercontext
|
xdef _up_restoreusercontext
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* Data Allocation
|
* Data Allocation
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
define CODESEG, SPACE=EROM
|
define CODESEG, SPACE=EROM
|
||||||
segment CODESEG
|
segment CODESEG
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* Code
|
* Code
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* Name: up_restoreusercontext
|
* Name: up_restoreusercontext
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Restore the current user context.
|
* Restore the current user context.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* r1: pointer to the register save array in the XCPT structure
|
* r1: pointer to the register save array in the XCPT structure
|
||||||
*
|
*
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
_up_restoreusercontext:
|
_up_restoreusercontext:
|
||||||
/* Disable interrupts while we are accessing the TCB's register
|
/* Disable interrupts while we are accessing the TCB's register
|
||||||
* save structure
|
* save structure. The correct interrupt state will be retored by
|
||||||
*/
|
* the iret instruction below
|
||||||
|
*/
|
||||||
di
|
|
||||||
|
di
|
||||||
/* Set up the stack for return */
|
|
||||||
|
/* Set up the stack for return from 'interrupt' */
|
||||||
ld sp, 2*REG_SP(r1) /* sp=Value of SP on return */
|
|
||||||
ld r2, 2*REG_PC(r1) /* r2=return address */
|
ld sp, 2*REG_SP(r1) /* sp=Value of SP on return */
|
||||||
push r2 /* Push the return address onto the stack */
|
ld.w r2, 2*REG_FLAGS(r1) /* r1=padded flags value */
|
||||||
ld r7, 2*REG_R7(r1) /* r7=saved value of r7 */
|
push.w r2 /* Push padded flags value onto the stack */
|
||||||
push r7 /* Save this so that we can use r7 */
|
ld r2, 2*REG_PC(r1) /* r2=return address */
|
||||||
ld r7, sp /* r7=saved SP value */
|
push r2 /* Push the return address onto the stack */
|
||||||
|
ld r7, 2*REG_R7(r1) /* r7=saved value of r7 */
|
||||||
/* Retore r8-r14 */
|
push r7 /* Save this so that we can use r7 */
|
||||||
|
ld r7, sp /* r7=saved SP value */
|
||||||
ld sp, r1 /* sp=Points to register save structure */
|
|
||||||
popmhi <r8-r14> /* Restore r8-r14 */
|
/* Restore registers and return from interrupt */
|
||||||
add sp, #4 /* Skip over r15=sp */
|
|
||||||
|
ld sp, r1 /* sp=Pointer to register save structure */
|
||||||
/* Test if interrupts should be enabled upon return */
|
popmhi <r8-r14> /* Restore r8-r14 */
|
||||||
|
add sp, #4 /* Skip over restore of r15=sp */
|
||||||
ld.w r2, 2*REG_FLAGS(r1) /* r2=padded flags value */
|
popmlo <r0-r6> /* Restore r0-r6 */
|
||||||
tm r2, #Z16F_CNTRL_FLAGS_IRQE /* Test IRQE bit (Z-bit == 0 if disabled) */
|
ld sp, r7 /* Switch to the correct stack for return */
|
||||||
popmlo <r0-r6> /* Restore r0-r6 (retains Z-bit) */
|
pop r7 /* Recover the saved value of r7 from the stack */
|
||||||
ld sp, r7 /* Recover the correct SP value (retains Z-bit) */
|
iret2 /* Return from interrupt */
|
||||||
pop r7 /* Get the saved value of r7 (retains Z-bit)*/
|
|
||||||
jp z, _up_returndisabled /* Jump if interrupts should remain disabled */
|
end
|
||||||
|
|
||||||
/* Return with interrupts enabled. Note that at this point in the logic,
|
|
||||||
* we are finished accessing the TCB. Therefore, any interrupt level context
|
|
||||||
* switches that may modify the TCB should be OK
|
|
||||||
*/
|
|
||||||
|
|
||||||
ei /* Enable interrupts */
|
|
||||||
|
|
||||||
_up_returndisabled:
|
|
||||||
ret
|
|
||||||
end
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* mqueue.c
|
* examples/ostest/mqueue.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2007, 2008 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
@ -380,7 +380,7 @@ void timedmqueue_test(void)
|
|||||||
|
|
||||||
/* Wait for the receiving thread to complete */
|
/* Wait for the receiving thread to complete */
|
||||||
|
|
||||||
printf("timedmqueue_test: Waiting for sender to complete\n");
|
printf("timedmqueue_test: Waiting for receiver to complete\n");
|
||||||
pthread_join(receiver, &result);
|
pthread_join(receiver, &result);
|
||||||
if (result != (void*)0)
|
if (result != (void*)0)
|
||||||
{
|
{
|
||||||
|
@ -263,7 +263,7 @@
|
|||||||
# define FAR _Far
|
# define FAR _Far
|
||||||
# define NEAR _Near
|
# define NEAR _Near
|
||||||
# define DSEG _Far
|
# define DSEG _Far
|
||||||
# define CODE _Far
|
# define CODE _Erom
|
||||||
|
|
||||||
/* Select the large, 32-bit addressing model */
|
/* Select the large, 32-bit addressing model */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user