mirror of
https://github.com/apache/nuttx.git
synced 2026-06-02 09:38:37 +08:00
configs/p112: Add a configuration for the Z180 P112 board
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5429 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -3780,4 +3780,6 @@
|
|||||||
* include/nuttx/arch.h: Add address environment control interfaces (for use
|
* include/nuttx/arch.h: Add address environment control interfaces (for use
|
||||||
with CPUs the provide MCUs and support process-like address environments).
|
with CPUs the provide MCUs and support process-like address environments).
|
||||||
* arch/z80/src/z180/z180_mmu.*: Add MMU support for z180 tasks.
|
* arch/z80/src/z180/z180_mmu.*: Add MMU support for z180 tasks.
|
||||||
|
* configs/p112: Add very basic board support and an examples/ostest
|
||||||
|
configuration for the venerable P112 board.
|
||||||
|
|
||||||
|
|||||||
@@ -150,6 +150,8 @@
|
|||||||
| | | |- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/olimex-strp711/include/README.txt">include/README.txt</a>
|
| | | |- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/olimex-strp711/include/README.txt">include/README.txt</a>
|
||||||
| | | |- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/olimex-strp711/src/README.txt">src/README.txt</a>
|
| | | |- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/olimex-strp711/src/README.txt">src/README.txt</a>
|
||||||
| | | `- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/olimex-strp711/README.txt"><b><i>README.txt</i></b></a>
|
| | | `- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/olimex-strp711/README.txt"><b><i>README.txt</i></b></a>
|
||||||
|
| | |- p112/
|
||||||
|
| | | `- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/p112/README.txt"><b><i>README.txt</i></b></a>
|
||||||
| | |- pcblogic-pic32mx/
|
| | |- pcblogic-pic32mx/
|
||||||
| | | `- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/pcblogic-pic32mx/README.txt"><b><i>README.txt</i></b></a>
|
| | | `- <a href="http://svn.code.sf.net/p/nuttx/code/trunk/nuttx/configs/pcblogic-pic32mx/README.txt"><b><i>README.txt</i></b></a>
|
||||||
| | |- pic32-starterkit/
|
| | |- pic32-starterkit/
|
||||||
|
|||||||
@@ -849,6 +849,8 @@ nuttx
|
|||||||
| | |- include/README.txt
|
| | |- include/README.txt
|
||||||
| | |- src/README.txt
|
| | |- src/README.txt
|
||||||
| | `- README.txt
|
| | `- README.txt
|
||||||
|
| |- p112/
|
||||||
|
| | `- README.txt
|
||||||
| |- pcblogic-pic32mx/
|
| |- pcblogic-pic32mx/
|
||||||
| | `- README.txt
|
| | `- README.txt
|
||||||
| |- pic32-starterkit/
|
| |- pic32-starterkit/
|
||||||
|
|||||||
@@ -102,6 +102,7 @@ FAR chipreg_t *up_doirq(uint8_t irq, FAR chipreg_t *regs)
|
|||||||
|
|
||||||
IRQ_LEAVE(irq);
|
IRQ_LEAVE(irq);
|
||||||
}
|
}
|
||||||
|
|
||||||
up_ledoff(LED_INIRQ);
|
up_ledoff(LED_INIRQ);
|
||||||
return regs;
|
return regs;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -145,6 +145,14 @@ void up_initialize(void)
|
|||||||
up_timerinit();
|
up_timerinit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Initialize the CPU for those that use it (only for the Z180). This
|
||||||
|
* needs to be done before any tasks are created).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if CONFIG_ADDRENV
|
||||||
|
(void)up_mmuinit();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Register devices */
|
/* Register devices */
|
||||||
|
|
||||||
#if CONFIG_NFILE_DESCRIPTORS > 0
|
#if CONFIG_NFILE_DESCRIPTORS > 0
|
||||||
|
|||||||
@@ -117,6 +117,12 @@ EXTERN FAR chipreg_t *up_doirq(uint8_t irq, FAR chipreg_t *regs);
|
|||||||
|
|
||||||
EXTERN void up_sigdeliver(void);
|
EXTERN void up_sigdeliver(void);
|
||||||
|
|
||||||
|
/* Defined in CPU-specific logic (only for Z180) */
|
||||||
|
|
||||||
|
#if CONFIG_ADDRENV
|
||||||
|
int up_mmuinit(void);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Defined in up_allocateheap.c */
|
/* Defined in up_allocateheap.c */
|
||||||
|
|
||||||
#if CONFIG_MM_REGIONS > 1
|
#if CONFIG_MM_REGIONS > 1
|
||||||
|
|||||||
@@ -137,4 +137,17 @@ config ARCH_HAVEHEAD
|
|||||||
Use a board-specific version of the "head" file in the
|
Use a board-specific version of the "head" file in the
|
||||||
configs/<board-name>/src directory
|
configs/<board-name>/src directory
|
||||||
|
|
||||||
|
menu "Z180 Peripheral Support"
|
||||||
|
|
||||||
|
config Z180_UART0
|
||||||
|
bool "UART0"
|
||||||
|
default n
|
||||||
|
select ARCH_HAVE_UART0
|
||||||
|
|
||||||
|
config Z180_UART1
|
||||||
|
bool "UART1"
|
||||||
|
default n
|
||||||
|
select ARCH_HAVE_UART1
|
||||||
|
|
||||||
|
endmenu
|
||||||
endif
|
endif
|
||||||
|
|||||||
+85
-16
@@ -44,6 +44,7 @@
|
|||||||
#include <nuttx/sched.h>
|
#include <nuttx/sched.h>
|
||||||
#include <nuttx/arch.h>
|
#include <nuttx/arch.h>
|
||||||
|
|
||||||
|
#include "z180_iomap.h"
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
@@ -58,56 +59,116 @@
|
|||||||
|
|
||||||
/* Initialize the IRQ state */
|
/* Initialize the IRQ state */
|
||||||
|
|
||||||
#define INIT_IRQCONTEXT() current_regs = NULL
|
#define INIT_IRQCONTEXT() \
|
||||||
|
current_regs = NULL
|
||||||
|
|
||||||
/* IN_INTERRUPT returns true if the system is currently operating in the interrupt
|
/* IN_INTERRUPT returns true if the system is currently operating in the interrupt
|
||||||
* context. IN_INTERRUPT is the inline equivalent of up_interrupt_context().
|
* context. IN_INTERRUPT is the inline equivalent of up_interrupt_context().
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define IN_INTERRUPT() (current_regs != NULL)
|
#define IN_INTERRUPT() \
|
||||||
|
(current_regs != NULL)
|
||||||
|
|
||||||
/* The following macro is used when the system enters interrupt handling logic */
|
/* The following macro declares the variables need by IRQ_ENTER and IRQ_LEAVE.
|
||||||
|
* These variables are used to support nested interrupts.
|
||||||
|
*
|
||||||
|
* - savestate holds the previous value of current_state.
|
||||||
|
* - savecpr holds the previous value of current_cpr.
|
||||||
|
*
|
||||||
|
* TODO: I think this logic is bad... I do not thing that this will really
|
||||||
|
* handle nested interrupts correctly. What if we are nested and then a
|
||||||
|
* context switch occurs? current_regs will not be updated correctly!
|
||||||
|
*/
|
||||||
|
|
||||||
#define DECL_SAVESTATE() \
|
#define DECL_SAVESTATE() \
|
||||||
FAR chipreg_t *savestate
|
FAR chipreg_t *savestate; \
|
||||||
|
uint8_t savecbr;
|
||||||
|
|
||||||
|
/* The following macro is used when the system enters interrupt handling logic.
|
||||||
|
* The entry values of current_regs and current_cbr and stored in local variables.
|
||||||
|
* Then current_regs and current_cbr are set to the values of the interrupted
|
||||||
|
* task.
|
||||||
|
*/
|
||||||
|
|
||||||
#define IRQ_ENTER(irq, regs) \
|
#define IRQ_ENTER(irq, regs) \
|
||||||
do { \
|
do \
|
||||||
savestate = (FAR chipreg_t *)current_regs; \
|
{ \
|
||||||
current_regs = (regs); \
|
savestate = (FAR chipreg_t *)current_regs; \
|
||||||
} while (0)
|
savecbr = current_cbr; \
|
||||||
|
current_regs = (regs); \
|
||||||
|
current_cbr = inp(Z180_MMU_CBR); \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
/* The following macro is used when the system exits interrupt handling logic */
|
/* The following macro is used when the system exits interrupt handling logic.
|
||||||
|
* The value of current_regs is restored. If we are not processing a nested
|
||||||
|
* interrupt (meaning that we going to return to the user task), then also
|
||||||
|
* set the MMU's CBR register.
|
||||||
|
*/
|
||||||
|
|
||||||
#define IRQ_LEAVE(irq) current_regs = savestate
|
#define IRQ_LEAVE(irq) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
current_regs = savestate; \
|
||||||
|
if (current_regs) \
|
||||||
|
{ \
|
||||||
|
current_cbr = savecbr; \
|
||||||
|
} \
|
||||||
|
else \
|
||||||
|
{ \
|
||||||
|
outp(Z180_MMU_CBR, savecbr); \
|
||||||
|
} \
|
||||||
|
}
|
||||||
|
|
||||||
/* The following macro is used to sample the interrupt state (as a opaque handle) */
|
/* The following macro is used to sample the interrupt state (as a opaque handle) */
|
||||||
|
|
||||||
#define IRQ_STATE() (current_regs)
|
#define IRQ_STATE() \
|
||||||
|
(current_regs)
|
||||||
|
|
||||||
/* Save the current IRQ context in the specified TCB */
|
/* Save the current IRQ context in the specified TCB */
|
||||||
|
|
||||||
#define SAVE_IRQCONTEXT(tcb) z180_copystate((tcb)->xcp.regs, (FAR chipreg_t*)current_regs)
|
#define SAVE_IRQCONTEXT(tcb) \
|
||||||
|
z180_copystate((tcb)->xcp.regs, (FAR chipreg_t*)current_regs)
|
||||||
|
|
||||||
/* Set the current IRQ context to the state specified in the TCB */
|
/* Set the current IRQ context to the state specified in the TCB */
|
||||||
|
|
||||||
#define SET_IRQCONTEXT(tcb) z180_copystate((FAR chipreg_t*)current_regs, (tcb)->xcp.regs)
|
#define SET_IRQCONTEXT(tcb) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if ((tcb)->xcp.cbr.cbr) \
|
||||||
|
{ \
|
||||||
|
current_cbr = (tcb)->xcp.cbr->cbr); \
|
||||||
|
} \
|
||||||
|
z180_copystate((FAR chipreg_t*)current_regs, (tcb)->xcp.regs); \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
/* Save the user context in the specified TCB. User context saves can be simpler
|
/* Save the user context in the specified TCB. User context saves can be simpler
|
||||||
* because only those registers normally saved in a C called need be stored.
|
* because only those registers normally saved in a C called need be stored.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SAVE_USERCONTEXT(tcb) z180_saveusercontext((tcb)->xcp.regs)
|
#define SAVE_USERCONTEXT(tcb) \
|
||||||
|
z180_saveusercontext((tcb)->xcp.regs)
|
||||||
|
|
||||||
/* Restore the full context -- either a simple user state save or the full,
|
/* Restore the full context -- either a simple user state save or the full,
|
||||||
* IRQ state save.
|
* IRQ state save.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define RESTORE_USERCONTEXT(tcb) z180_restoreusercontext((tcb)->xcp.regs)
|
#define RESTORE_USERCONTEXT(tcb) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if ((tcb)->xcp.cbr.cbr) \
|
||||||
|
{ \
|
||||||
|
outp(Z180_MMU_CBR, (tcb)->xcp.cbr->cbr); \
|
||||||
|
} \
|
||||||
|
z180_restoreusercontext((tcb)->xcp.regs); \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
/* Dump the current machine registers */
|
/* Dump the current machine registers */
|
||||||
|
|
||||||
#define _REGISTER_DUMP() z180_registerdump()
|
#define _REGISTER_DUMP() \
|
||||||
|
z180_registerdump()
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Public Types
|
* Public Types
|
||||||
@@ -123,6 +184,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
extern volatile chipreg_t *current_regs;
|
extern volatile chipreg_t *current_regs;
|
||||||
|
|
||||||
|
/* This holds the value of the MMU's CBR register. This value is set to the
|
||||||
|
* interrupted tasks's CBR on interrupt entry, changed to the new task's CBR if
|
||||||
|
* an interrrupt level context switch occurs, and restored on interrupt exit. In
|
||||||
|
* this way, the CBR is always correct on interrupt exit.
|
||||||
|
*/
|
||||||
|
|
||||||
|
extern uint8_t current_cbr;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
|
|||||||
@@ -120,15 +120,21 @@ static FAR struct z180_cbr_s *z180_mmu_findcbr(void)
|
|||||||
* called very early in the boot process to get the basic operating
|
* called very early in the boot process to get the basic operating
|
||||||
* memory configuration correct. This function does *not* perform all
|
* memory configuration correct. This function does *not* perform all
|
||||||
* necessray MMU initialization... only the basics needed at power-up.
|
* necessray MMU initialization... only the basics needed at power-up.
|
||||||
* z180_mmu_init() must be called later to complete the entire MMU
|
* up_mmuinit() must be called later to complete the entire MMU
|
||||||
* initialization.
|
* initialization.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void z180_mmu_lowinit(void) __naked
|
void z180_mmu_lowinit(void) __naked
|
||||||
{
|
{
|
||||||
|
/* Set the CBAR register to set up the virtual address of the Bank Area and
|
||||||
|
* Common Area 1. Set the BBR register to set up the physical mapping for
|
||||||
|
* the Bank Area (the physical mapping for Common Area 1 will not be done
|
||||||
|
* until the first task is started.
|
||||||
|
*/
|
||||||
|
|
||||||
__asm
|
__asm
|
||||||
ld c, #Z180_MMU_CBR ; port
|
ld c, #Z180_MMU_CBAR ; port
|
||||||
ld a, #Z180_CBAR_VALUE ; value
|
ld a, #Z180_CBAR_VALUE ; value
|
||||||
out (c), a
|
out (c), a
|
||||||
|
|
||||||
@@ -139,15 +145,15 @@ void z180_mmu_lowinit(void) __naked
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: z180_mmu_init
|
* Name: up_mmuinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Perform higher level initializatin of the MMU and physical memory
|
* Perform higher level initialization of the MMU and physical memory
|
||||||
* memory management logic.
|
* memory management logic.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int z180_mmu_init(void)
|
int up_mmuinit(void)
|
||||||
{
|
{
|
||||||
/* Here we use the granule allocator as a page allocator. We lie and
|
/* Here we use the granule allocator as a page allocator. We lie and
|
||||||
* say that 1 page is 1 byte.
|
* say that 1 page is 1 byte.
|
||||||
@@ -257,7 +263,7 @@ errout_with_irq:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_addrenv_clone
|
* Name: up_addrenv_share
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function is called from the core scheduler logic when a thread
|
* This function is called from the core scheduler logic when a thread
|
||||||
@@ -274,8 +280,7 @@ errout_with_irq:
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_ADDRENV
|
int up_addrenv_share(FAR const _TCB *ptcb, FAR _TCB *ctcb)
|
||||||
int up_addrenv_clone(FAR const _TCB *ptcb, FAR _TCB *ctcb)
|
|
||||||
{
|
{
|
||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
@@ -299,7 +304,6 @@ int up_addrenv_clone(FAR const _TCB *ptcb, FAR _TCB *ctcb)
|
|||||||
irqrestore(flags);
|
irqrestore(flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_addrenv_instantiate
|
* Name: up_addrenv_instantiate
|
||||||
@@ -316,35 +320,55 @@ int up_addrenv_clone(FAR const _TCB *ptcb, FAR _TCB *ctcb)
|
|||||||
* be instantiated.
|
* be instantiated.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
|
* A handle that may be used with up_addrenv_restore() to restore the
|
||||||
|
* address environment before up_addrenv_instantiate() was called.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
FAR void *up_addrenv_instantiate(FAR _TCB *tcb)
|
||||||
|
{
|
||||||
|
uint8_t oldcbr;
|
||||||
|
irqstate_t flags;
|
||||||
|
|
||||||
|
/* Get the current CBR value from the CBR register */
|
||||||
|
|
||||||
|
flags = irqsave();
|
||||||
|
cbr = inp(Z180_MMU_CBR);
|
||||||
|
|
||||||
|
/* Check if the task has an address environment. */
|
||||||
|
|
||||||
|
if (tcb->xcp.cbr)
|
||||||
|
{
|
||||||
|
/* Yes.. Write the new CBR value into CBR register */
|
||||||
|
|
||||||
|
outp(Z180_MMU_CBR, tcb->xcp.cbr.cbr);
|
||||||
|
}
|
||||||
|
|
||||||
|
irqrestore(flags);
|
||||||
|
return (FAR void *)cbr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_addrenv_restore
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Restore an address environment using a handle previously returned by
|
||||||
|
* up_addrenv_instantiate().
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* handle - A handle previously returned by up_addrenv_instantiate.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
* Zero (OK) on success; a negated errno value on failure.
|
* Zero (OK) on success; a negated errno value on failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_ADDRENV
|
int up_addrenv_restore(FAR void *handle)
|
||||||
int up_addrenv_instantiate(FAR _TCB *tcb)
|
|
||||||
{
|
{
|
||||||
irqstate_t flags;
|
/* Restore the CBR value */
|
||||||
|
|
||||||
/* Check if the task has an address environment. */
|
outp(Z180_MMU_CBR, (uint8_t)handle);
|
||||||
|
|
||||||
flags = irqsave();
|
|
||||||
if (tcb->xcp.cbr)
|
|
||||||
{
|
|
||||||
/* Yes... write the CBR value into CBR register */
|
|
||||||
|
|
||||||
outp(Z180_MMU_CBR, tcb->xcp.cbr.cbr);
|
|
||||||
/* Clone the CBR by incrementing the reference counting and saving a
|
|
||||||
* copy in the child thread's TCB.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ptcb->xcp.cbr.crefs++;
|
|
||||||
ctcb->xcp.cbr = ptcb->xcp.cbr;
|
|
||||||
}
|
|
||||||
|
|
||||||
irqrestore(flags);
|
|
||||||
return OK;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_addrenv_release
|
* Name: up_addrenv_release
|
||||||
@@ -364,7 +388,6 @@ int up_addrenv_instantiate(FAR _TCB *tcb)
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_ADDRENV
|
|
||||||
int up_addrenv_release(FAR _TCB *tcb)
|
int up_addrenv_release(FAR _TCB *tcb)
|
||||||
{
|
{
|
||||||
FAR struct z180_cbr_s *cbr;
|
FAR struct z180_cbr_s *cbr;
|
||||||
@@ -401,5 +424,3 @@ int up_addrenv_release(FAR _TCB *tcb)
|
|||||||
irqrestore(flags);
|
irqrestore(flags);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@
|
|||||||
* called very early in the boot process to get the basic operating
|
* called very early in the boot process to get the basic operating
|
||||||
* memory configuration correct. This function does *not* perform all
|
* memory configuration correct. This function does *not* perform all
|
||||||
* necessray MMU initialization... only the basics needed at power-up.
|
* necessray MMU initialization... only the basics needed at power-up.
|
||||||
* z180_mmu_init() must be called later to complete the entire MMU
|
* up_mmuinit() must be called later to complete the entire MMU
|
||||||
* initialization.
|
* initialization.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
void z180_mmu_lowinit(void) __naked;
|
void z180_mmu_lowinit(void) __naked;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: z180_mmu_init
|
* Name: up_mmuinit
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* Perform higher level initializatin of the MMU and physical memory
|
* Perform higher level initializatin of the MMU and physical memory
|
||||||
@@ -144,6 +144,6 @@ void z180_mmu_lowinit(void) __naked;
|
|||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
void z180_mmu_init(void);
|
void up_mmuinit(void);
|
||||||
|
|
||||||
#endif /* __ARCH_Z80_SRC_Z180_Z180_MMU_H */
|
#endif /* __ARCH_Z80_SRC_Z180_Z180_MMU_H */
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ static void z180_registerdump(void)
|
|||||||
current_regs[XCPT_IX], current_regs[XCPT_IY]);
|
current_regs[XCPT_IX], current_regs[XCPT_IY]);
|
||||||
lldbg("SP: %04x PC: %04x\n"
|
lldbg("SP: %04x PC: %04x\n"
|
||||||
current_regs[XCPT_SP], current_regs[XCPT_PC]);
|
current_regs[XCPT_SP], current_regs[XCPT_PC]);
|
||||||
|
lldbg("CBAR: %02x BBR: %02x CBR: %02x\n"
|
||||||
|
inp(Z180_MMU_CBAR), inp(Z180_MMU_BBR), inp(Z180_MMU_CBR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -346,6 +346,33 @@ config ARCH_BOARD_OLIMEX_STM32P107
|
|||||||
Linux or Cygwin. See the http://www.olimex.com for further information. This
|
Linux or Cygwin. See the http://www.olimex.com for further information. This
|
||||||
board features the STMicro STM32F107VC MCU
|
board features the STMicro STM32F107VC MCU
|
||||||
|
|
||||||
|
config ARCH_BOARD_P112
|
||||||
|
bool "P112 Z180-based platform"
|
||||||
|
depends on ARCH_CHIP_Z8018216FSG
|
||||||
|
---help---
|
||||||
|
The P112 is notable because it was the first of the hobbyist single board
|
||||||
|
computers to reach the production stage. The P112 hobbyist computers
|
||||||
|
were relatively widespread and inspired other hobbyist centered home brew
|
||||||
|
computing projects such as N8VEM home brew computing project. The P112
|
||||||
|
project still maintains many devoted enthusiasts and has an online
|
||||||
|
repository of software and other information.
|
||||||
|
|
||||||
|
The P112 computer originated as a commercial product of "D-X Designs Pty
|
||||||
|
Ltd" of Australia. They describe the computer as "The P112 is a stand-alone
|
||||||
|
8-bit CPU board. Typically running CP/M (tm) or a similar operating system,
|
||||||
|
it provides a Z80182 (Z-80 upgrade) CPU with up to 1MB of memory, serial,
|
||||||
|
parallel and diskette IO, and realtime clock, in a 3.5-inch drive form factor.
|
||||||
|
Powered solely from 5V, it draws 150mA (nominal: not including disk drives)
|
||||||
|
with a 16MHz CPU clock. Clock speeds up to 24.576MHz are possible."
|
||||||
|
|
||||||
|
The P112 board was last available new in 1996 by Dave Brooks. In late 2004
|
||||||
|
on the Usenet Newsgroup comp.os.cpm, talk about making another run of P112
|
||||||
|
boards was discussed. David Griffith decided to produce additional P112 kits
|
||||||
|
with Dave Brooks blessing and the assistance of others. In addition Terry
|
||||||
|
Gulczynski makes additional P112 derivative hobbyist home brew computers.
|
||||||
|
Hal Bower was very active in the mid 1990's on the P112 project and ported
|
||||||
|
the "Banked/Portable BIOS".
|
||||||
|
|
||||||
config ARCH_BOARD_PCBLOGICPIC32MX
|
config ARCH_BOARD_PCBLOGICPIC32MX
|
||||||
bool "PIC32MX board from PCB Logic Design Co"
|
bool "PIC32MX board from PCB Logic Design Co"
|
||||||
depends on ARCH_CHIP_PIC32MX460F512L
|
depends on ARCH_CHIP_PIC32MX460F512L
|
||||||
@@ -647,6 +674,7 @@ config ARCH_BOARD
|
|||||||
default "olimex-lpc2378" if ARCH_BOARD_OLIMEXLPC2378
|
default "olimex-lpc2378" if ARCH_BOARD_OLIMEXLPC2378
|
||||||
default "olimex-stm32-p107" if ARCH_BOARD_OLIMEX_STM32P107
|
default "olimex-stm32-p107" if ARCH_BOARD_OLIMEX_STM32P107
|
||||||
default "olimex-strp711" if ARCH_BOARD_OLIMEX_STRP711
|
default "olimex-strp711" if ARCH_BOARD_OLIMEX_STRP711
|
||||||
|
default "p112" if ARCH_BOARD_P112
|
||||||
default "pcblogic-pic32mx" if ARCH_BOARD_PCBLOGICPIC32MX
|
default "pcblogic-pic32mx" if ARCH_BOARD_PCBLOGICPIC32MX
|
||||||
default "pic32-starterkit" if ARCH_BOARD_PIC32_STARTERKIT
|
default "pic32-starterkit" if ARCH_BOARD_PIC32_STARTERKIT
|
||||||
default "pic32mx7mmb" if ARCH_BOARD_PIC32_PIC32MX7MMB
|
default "pic32mx7mmb" if ARCH_BOARD_PIC32_PIC32MX7MMB
|
||||||
|
|||||||
+24
-3
@@ -1780,14 +1780,36 @@ configs/pcblogic-pic32mx
|
|||||||
STATUS: Code complete but testing has been stalled due to tool related problems
|
STATUS: Code complete but testing has been stalled due to tool related problems
|
||||||
(PICkit 2 does not work with the PIC32).
|
(PICkit 2 does not work with the PIC32).
|
||||||
|
|
||||||
configs/pic32-starterkit
|
configs/p112
|
||||||
|
The P112 is notable because it was the first of the hobbyist single board
|
||||||
|
computers to reach the production stage. The P112 hobbyist computers
|
||||||
|
were relatively widespread and inspired other hobbyist centered home brew
|
||||||
|
computing projects such as N8VEM home brew computing project. The P112
|
||||||
|
project still maintains many devoted enthusiasts and has an online
|
||||||
|
repository of software and other information.
|
||||||
|
|
||||||
|
The P112 computer originated as a commercial product of "D-X Designs Pty
|
||||||
|
Ltd" of Australia. They describe the computer as "The P112 is a stand-alone
|
||||||
|
8-bit CPU board. Typically running CP/M (tm) or a similar operating system,
|
||||||
|
it provides a Z80182 (Z-80 upgrade) CPU with up to 1MB of memory, serial,
|
||||||
|
parallel and diskette IO, and realtime clock, in a 3.5-inch drive form factor.
|
||||||
|
Powered solely from 5V, it draws 150mA (nominal: not including disk drives)
|
||||||
|
with a 16MHz CPU clock. Clock speeds up to 24.576MHz are possible."
|
||||||
|
|
||||||
|
The P112 board was last available new in 1996 by Dave Brooks. In late 2004
|
||||||
|
on the Usenet Newsgroup comp.os.cpm, talk about making another run of P112
|
||||||
|
boards was discussed. David Griffith decided to produce additional P112 kits
|
||||||
|
with Dave Brooks blessing and the assistance of others. In addition Terry
|
||||||
|
Gulczynski makes additional P112 derivative hobbyist home brew computers.
|
||||||
|
Hal Bower was very active in the mid 1990's on the P112 project and ported
|
||||||
|
the "Banked/Portable BIOS".
|
||||||
|
|
||||||
|
configs/pic32-starterkit
|
||||||
This directory contains the port of NuttX to the Microchip PIC32 Ethernet
|
This directory contains the port of NuttX to the Microchip PIC32 Ethernet
|
||||||
Starter Kit (DM320004) with the Multimedia Expansion Board (MEB, DM320005).
|
Starter Kit (DM320004) with the Multimedia Expansion Board (MEB, DM320005).
|
||||||
See www.microchip.com for further information.
|
See www.microchip.com for further information.
|
||||||
|
|
||||||
configs/pic32mx7mmb
|
configs/pic32mx7mmb
|
||||||
|
|
||||||
This directory will (eventually) contain the port of NuttX to the
|
This directory will (eventually) contain the port of NuttX to the
|
||||||
Mikroelektronika PIC32MX7 Multimedia Board (MMB). See
|
Mikroelektronika PIC32MX7 Multimedia Board (MMB). See
|
||||||
http://www.mikroe.com/ for further information.
|
http://www.mikroe.com/ for further information.
|
||||||
@@ -1797,7 +1819,6 @@ configs/pjrc-8051
|
|||||||
and the SDCC toolchain. This port is not quite ready for prime time.
|
and the SDCC toolchain. This port is not quite ready for prime time.
|
||||||
|
|
||||||
configs/qemu-i486
|
configs/qemu-i486
|
||||||
|
|
||||||
Port of NuttX to QEMU in i486 mode. This port will also run on real i486
|
Port of NuttX to QEMU in i486 mode. This port will also run on real i486
|
||||||
hardwared (Google the Bifferboard).
|
hardwared (Google the Bifferboard).
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
#
|
||||||
|
# For a description of the syntax of this configuration file,
|
||||||
|
# see misc/tools/kconfig-language.txt.
|
||||||
|
#
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
P112 README
|
||||||
|
^^^^^^^^^^^
|
||||||
|
|
||||||
|
The P112 is notable because it was the first of the hobbyist single board
|
||||||
|
computers to reach the production stage. The P112 hobbyist computers
|
||||||
|
were relatively widespread and inspired other hobbyist centered home brew
|
||||||
|
computing projects such as N8VEM home brew computing project. The P112
|
||||||
|
project still maintains many devoted enthusiasts and has an online
|
||||||
|
repository of software and other information.
|
||||||
|
|
||||||
|
The P112 computer originated as a commercial product of "D-X Designs Pty
|
||||||
|
Ltd" of Australia. They describe the computer as "The P112 is a stand-alone
|
||||||
|
8-bit CPU board. Typically running CP/M (tm) or a similar operating system,
|
||||||
|
it provides a Z80182 (Z-80 upgrade) CPU with up to 1MB of memory, serial,
|
||||||
|
parallel and diskette IO, and realtime clock, in a 3.5-inch drive form factor.
|
||||||
|
Powered solely from 5V, it draws 150mA (nominal: not including disk drives)
|
||||||
|
with a 16MHz CPU clock. Clock speeds up to 24.576MHz are possible."
|
||||||
|
|
||||||
|
The P112 board was last available new in 1996 by Dave Brooks. In late 2004
|
||||||
|
on the Usenet Newsgroup comp.os.cpm, talk about making another run of P112
|
||||||
|
boards was discussed. David Griffith decided to produce additional P112 kits
|
||||||
|
with Dave Brooks blessing and the assistance of others. In addition Terry
|
||||||
|
Gulczynski makes additional P112 derivative hobbyist home brew computers.
|
||||||
|
Hal Bower was very active in the mid 1990's on the P112 project and ported
|
||||||
|
the "Banked/Portable BIOS".
|
||||||
|
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
/************************************************************
|
||||||
|
* configs/p112/include/board.h
|
||||||
|
*
|
||||||
|
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions
|
||||||
|
* are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in
|
||||||
|
* the documentation and/or other materials provided with the
|
||||||
|
* distribution.
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
************************************************************/
|
||||||
|
|
||||||
|
#ifndef __CONFIGS_P112_INCLUDE_BOARD_H
|
||||||
|
#define __CONFIGS_P112_INCLUDE_BOARD_H
|
||||||
|
|
||||||
|
/************************************************************
|
||||||
|
* Included Files
|
||||||
|
************************************************************/
|
||||||
|
|
||||||
|
/************************************************************
|
||||||
|
* Definitions
|
||||||
|
************************************************************/
|
||||||
|
|
||||||
|
/************************************************************
|
||||||
|
* Public Functions
|
||||||
|
************************************************************/
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__cplusplus)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* __CONFIGS_P112_INCLUDE_BOARD_H */
|
||||||
@@ -0,0 +1,167 @@
|
|||||||
|
############################################################################
|
||||||
|
# configs/p112/ostest/Make.defs
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
include ${TOPDIR}/.config
|
||||||
|
include ${TOPDIR}/tools/Config.mk
|
||||||
|
|
||||||
|
# These are the directories where the SDCC toolchain is installed. NOTE
|
||||||
|
# that short 8.3 path names are used in order to avoid spaces. On my machine
|
||||||
|
# I have:
|
||||||
|
#
|
||||||
|
# C:\PROGRA~1\ = C:\Profram Files\
|
||||||
|
# C:\PROGRA~2\ = C:\Program Files (x86)\
|
||||||
|
#
|
||||||
|
# Your PC may be configured differently.
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||||
|
SDCC_INSTALLDIR = C:\PROGRA~2\SDCC
|
||||||
|
SDCC_BINDIR = $(SDCC_INSTALLDIR)\bin
|
||||||
|
SDCC_LIBDIR = $(SDCC_INSTALLDIR)\lib\z180
|
||||||
|
else
|
||||||
|
SDCC_INSTALLDIR = /usr/local
|
||||||
|
SDCC_BINDIR = $(SDCC_INSTALLDIR)/bin
|
||||||
|
SDCC_LIBDIR = $(SDCC_INSTALLDIR)/share/sdcc/lib/z180
|
||||||
|
endif
|
||||||
|
|
||||||
|
CROSSDEV =
|
||||||
|
CC = sdcc
|
||||||
|
CPP = sdcpp
|
||||||
|
LD = sdldz80
|
||||||
|
AS = sdasz80
|
||||||
|
AR = sdar -r
|
||||||
|
ARCHCPUFLAGS = -mz180
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_DEBUG_SYMBOLS),y)
|
||||||
|
ARCHOPTIMIZATION = --debug
|
||||||
|
else
|
||||||
|
ARCHOPTIMIZATION =
|
||||||
|
endif
|
||||||
|
|
||||||
|
ARCHPICFLAGS =
|
||||||
|
ARCHWARNINGS =
|
||||||
|
ARCHDEFINES =
|
||||||
|
ARCHINCLUDES = -I. -I$(TOPDIR)$(DELIM)include
|
||||||
|
|
||||||
|
CFLAGS = $(ARCHWARNINGS) $(ARCHOPTIMIZATION) $(ARCHCPUFLAGS) $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||||
|
CPPFLAGS = $(ARCHINCLUDES) $(ARCHDEFINES) $(EXTRADEFINES)
|
||||||
|
AFLAGS = -x -a -l -o -s -g
|
||||||
|
|
||||||
|
SDCCLIB = z180.lib
|
||||||
|
|
||||||
|
ASMEXT = .asm
|
||||||
|
OBJEXT = .o
|
||||||
|
LIBEXT = .lib
|
||||||
|
EXEEXT = .hex
|
||||||
|
|
||||||
|
# Custom ASSEMBLE definition. The most common toolchain, GCC, uses the
|
||||||
|
# compiler to assemble files because this has the advantage of running the C
|
||||||
|
# Pre-Processor against. This is not possible with other SDCC; we need to
|
||||||
|
# define AS and over-ride the common definition in order to use the assembler
|
||||||
|
# directly.
|
||||||
|
|
||||||
|
define ASSEMBLE
|
||||||
|
@echo "AS: $1"
|
||||||
|
$(Q) $(AS) $(AFLAGS) $2 $1
|
||||||
|
endef
|
||||||
|
|
||||||
|
# Custom CLEAN definition
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||||
|
define CLEAN
|
||||||
|
$(Q) if exist *.o (del /f /q *.o)
|
||||||
|
$(Q) if exist *.asm (del /f /q *.asm)
|
||||||
|
$(Q) if exist *.rel (del /f /q *.rel)
|
||||||
|
$(Q) if exist *.lst (del /f /q *.lst)
|
||||||
|
$(Q) if exist *.rst (del /f /q *.rst)
|
||||||
|
$(Q) if exist *.sym (del /f /q *.sym)
|
||||||
|
$(Q) if exist *.adb (del /f /q *.adb)
|
||||||
|
$(Q) if exist *.lnk (del /f /q *.lnk)
|
||||||
|
$(Q) if exist *.map (del /f /q *.map)
|
||||||
|
$(Q) if exist *.mem (del /f /q *.mem)
|
||||||
|
$(Q) if exist *.hex (del /f /q *.hex)
|
||||||
|
$(Q) if exist *.cmd (del /f /q *.cmd)
|
||||||
|
endef
|
||||||
|
else
|
||||||
|
define CLEAN
|
||||||
|
$(Q) rm -f *.o *.asm *.rel *.lst *.rst *.sym *.adb *.lnk *.map *.mem *.hex *.cmd
|
||||||
|
endef
|
||||||
|
endif
|
||||||
|
|
||||||
|
# Windows native host tool definitions
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_WINDOWS_NATIVE),y)
|
||||||
|
HOSTCC = mingw32-gcc.exe
|
||||||
|
HOSTINCLUDES = -I.
|
||||||
|
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
|
||||||
|
HOSTLDFLAGS =
|
||||||
|
HOSTEXEEXT = .exe
|
||||||
|
|
||||||
|
# Windows-native host tools
|
||||||
|
|
||||||
|
MKDEP = $(TOPDIR)\tools\mkdeps.exe --winnative
|
||||||
|
|
||||||
|
# Use NTFS links or directory copies
|
||||||
|
|
||||||
|
ifeq ($(CONFIG_WINDOWS_MKLINK),y)
|
||||||
|
DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.bat
|
||||||
|
else
|
||||||
|
DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)copydir.bat
|
||||||
|
endif
|
||||||
|
DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.bat
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
# Linux/Cygwin host tool definitions
|
||||||
|
|
||||||
|
HOSTCC = gcc
|
||||||
|
HOSTINCLUDES = -I.
|
||||||
|
HOSTCFLAGS = -Wall -Wstrict-prototypes -Wshadow -g -pipe
|
||||||
|
HOSTLDFLAGS =
|
||||||
|
|
||||||
|
# This is the tool to use for dependencies (i.e., none)
|
||||||
|
|
||||||
|
MKDEP = $(TOPDIR)$(DELIM)tools$(DELIM)mknulldeps.sh
|
||||||
|
|
||||||
|
# SDCC for Linux, OSX, or Cygwin understands symbolic links. Windows SDCC
|
||||||
|
# running under Cygwin does not
|
||||||
|
|
||||||
|
ifeq ($(WINTOOL),y)
|
||||||
|
DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)copydir.sh
|
||||||
|
else
|
||||||
|
DIRLINK = $(TOPDIR)$(DELIM)tools$(DELIM)link.sh
|
||||||
|
endif
|
||||||
|
DIRUNLINK = $(TOPDIR)$(DELIM)tools$(DELIM)unlink.sh
|
||||||
|
|
||||||
|
endif
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,50 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
rem configs/p112/ostest/setenv.bat
|
||||||
|
rem
|
||||||
|
rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
|
rem Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
rem
|
||||||
|
rem Redistribution and use in source and binary forms, with or without
|
||||||
|
rem modification, are permitted provided that the following conditions
|
||||||
|
rem are met:
|
||||||
|
rem
|
||||||
|
rem 1. Redistributions of source code must retain the above copyright
|
||||||
|
rem notice, this list of conditions and the following disclaimer.
|
||||||
|
rem 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
rem notice, this list of conditions and the following disclaimer in
|
||||||
|
rem the documentation and/or other materials provided with the
|
||||||
|
rem distribution.
|
||||||
|
rem 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
rem used to endorse or promote products derived from this software
|
||||||
|
rem without specific prior written permission.
|
||||||
|
rem
|
||||||
|
rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
rem POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
rem This is the location where I installed in the MinGW compiler. With
|
||||||
|
rem this configuration, it is recommended that you do NOT install the
|
||||||
|
rem MSYS tools; they conflict with the GNUWin32 tools. See
|
||||||
|
rem http://www.mingw.org/ for further info.
|
||||||
|
|
||||||
|
set PATH=C:\MinGW\bin;%PATH%
|
||||||
|
|
||||||
|
rem This is the location where I installed the SDCC toolchain for windows.
|
||||||
|
|
||||||
|
set PATH=C:\Program Files (x86)\SDCC/bin;%PATH%
|
||||||
|
|
||||||
|
rem This is the location where I installed the GNUWin32 tools. See
|
||||||
|
rem http://gnuwin32.sourceforge.net/.
|
||||||
|
|
||||||
|
set PATH=C:\gnuwin32\bin;%PATH%
|
||||||
|
echo %PATH%
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
rem configs/p112/scripts/setenv.bat
|
||||||
|
rem
|
||||||
|
rem Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
|
rem Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
rem
|
||||||
|
rem Redistribution and use in source and binary forms, with or without
|
||||||
|
rem modification, are permitted provided that the following conditions
|
||||||
|
rem are met:
|
||||||
|
rem
|
||||||
|
rem 1. Redistributions of source code must retain the above copyright
|
||||||
|
rem notice, this list of conditions and the following disclaimer.
|
||||||
|
rem 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
rem notice, this list of conditions and the following disclaimer in
|
||||||
|
rem the documentation and/or other materials provided with the
|
||||||
|
rem distribution.
|
||||||
|
rem 3. Neither the name NuttX nor the names of its contributors may be
|
||||||
|
rem used to endorse or promote products derived from this software
|
||||||
|
rem without specific prior written permission.
|
||||||
|
rem
|
||||||
|
rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
rem "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
rem LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
rem FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
rem COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
rem INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
rem OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
rem AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
rem LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
rem ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
rem POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
rem This is the location where I installed in the MinGW compiler. With
|
||||||
|
rem this configuration, it is recommended that you do NOT install the
|
||||||
|
rem MSYS tools; they conflict with the GNUWin32 tools. See
|
||||||
|
rem http://www.mingw.org/ for further info.
|
||||||
|
|
||||||
|
set PATH=C:\MinGW\bin;%PATH%
|
||||||
|
|
||||||
|
rem This is the location where I installed the SDCC toolchain for windows.
|
||||||
|
|
||||||
|
set PATH=C:\Program Files (x86)\SDCC/bin;%PATH%
|
||||||
|
|
||||||
|
rem This is the location where I installed the GNUWin32 tools. See
|
||||||
|
rem http://gnuwin32.sourceforge.net/.
|
||||||
|
|
||||||
|
set PATH=C:\gnuwin32\bin;%PATH%
|
||||||
|
echo %PATH%
|
||||||
Executable
+66
@@ -0,0 +1,66 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# configs/p112/ostest/setenv.sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2007, 2008, 2012 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
|
||||||
|
if [ "$_" = "$0" ] ; then
|
||||||
|
echo "You must source this script, not run it!" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
WD=`pwd`
|
||||||
|
if [ ! -x "setenv.sh" ]; then
|
||||||
|
echo "This script must be executed from the top-level NuttX build directory"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "${PATH_ORIG}" ]; then
|
||||||
|
export PATH_ORIG="${PATH}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# This is the normal installation directory for SDCC under Linux, OSX
|
||||||
|
# or Linux:
|
||||||
|
#
|
||||||
|
export TOOLCHAIN_BIN=/usr/local/bin
|
||||||
|
|
||||||
|
#
|
||||||
|
# This is the normal installation directory for SDCC under Windows
|
||||||
|
#
|
||||||
|
#export TOOLCHAIN_BIN="/cygdrive/c/Program Files (x86)/SDCC/bin"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Add the path to the toolchain to the PATH varialble
|
||||||
|
#
|
||||||
|
export PATH="${TOOLCHAIN_BIN}":/sbin:/usr/sbin:${PATH_ORIG}
|
||||||
|
|
||||||
|
echo "PATH : ${PATH}"
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
############################################################################
|
||||||
|
# configs/p112/src/Makefile
|
||||||
|
#
|
||||||
|
# Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||||
|
# Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
#
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in
|
||||||
|
# the documentation and/or other materials provided with the
|
||||||
|
# distribution.
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||||
|
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||||
|
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||||
|
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||||
|
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||||
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||||
|
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
############################################################################
|
||||||
|
|
||||||
|
-include $(TOPDIR)/Make.defs
|
||||||
|
|
||||||
|
CFLAGS += -I$(TOPDIR)$(DELIM)sched
|
||||||
|
CFLAGS += -I$(TOPDIR)$(DELIM)arch$(DELIM)z80$(DELIM)src$(DELIM)common
|
||||||
|
CFLAGS += -I$(TOPDIR)$(DELIM)arch$(DELIM)z80$(DELIM)src$(DELIM)z180
|
||||||
|
|
||||||
|
ASRCS =
|
||||||
|
AOBJS = $(ASRCS:$(ASMEXT)=$(OBJEXT))
|
||||||
|
CSRCS =
|
||||||
|
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||||
|
|
||||||
|
SRCS = $(ASRCS) $(CSRCS)
|
||||||
|
OBJS = $(AOBJS) $(COBJS)
|
||||||
|
|
||||||
|
CFLAGS += -I $(TOPDIR)$(DELIM)arch$(DELIM)$(CONFIG_ARCH)$(DELIM)src
|
||||||
|
|
||||||
|
all: libboard$(LIBEXT)
|
||||||
|
|
||||||
|
$(AOBJS): %$(OBJEXT): %$(ASMEXT)
|
||||||
|
$(call ASSEMBLE, $<, $@)
|
||||||
|
|
||||||
|
$(COBJS) $(LINKOBJS): %$(OBJEXT): %.c
|
||||||
|
$(call COMPILE, $<, $@)
|
||||||
|
|
||||||
|
libboard$(LIBEXT): $(OBJS)
|
||||||
|
$(call ARCHIVE, $@, $(OBJS))
|
||||||
|
|
||||||
|
.depend: Makefile $(SRCS)
|
||||||
|
$(Q) $(MKDEP) $(CC) -- $(CFLAGS) -- $(SRCS) >Make.dep
|
||||||
|
$(Q) touch $@
|
||||||
|
|
||||||
|
depend: .depend
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(call DELFILE, libboard$(LIBEXT))
|
||||||
|
$(call CLEAN)
|
||||||
|
|
||||||
|
distclean: clean
|
||||||
|
$(call DELFILE, Make.dep)
|
||||||
|
$(call DELFILE, .depend)
|
||||||
|
|
||||||
|
-include Make.dep
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
-include $(TOPDIR)/Make.defs
|
-include $(TOPDIR)/Make.defs
|
||||||
|
|
||||||
CFLAGS += -I$(TOPDIR)$(DELIM)sched
|
CFLAGS += -I$(TOPDIR)$(DELIM)sched
|
||||||
CFLAGS += -I$(TOPDIR)$(DELIM)arch$(DELIM)z80$(DELIM)src$(DELIM)common -I$(TOPDIR)$(DELIM)arch$(DELIM)z80$(DELIM)src$(DELIM)z80
|
CFLAGS += -I$(TOPDIR)$(DELIM)arch$(DELIM)z80$(DELIM)src$(DELIM)common
|
||||||
CFLAGS += -I$(TOPDIR)$(DELIM)arch$(DELIM)z80$(DELIM)src$(DELIM)z80
|
CFLAGS += -I$(TOPDIR)$(DELIM)arch$(DELIM)z80$(DELIM)src$(DELIM)z80
|
||||||
|
|
||||||
ASRCS =
|
ASRCS =
|
||||||
|
|||||||
+23
-3
@@ -403,7 +403,7 @@ int up_addrenv_create(FAR _TCB *tcb, size_t envsize);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: up_addrenv_clone
|
* Name: up_addrenv_share
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* This function is called from the core scheduler logic when a thread
|
* This function is called from the core scheduler logic when a thread
|
||||||
@@ -421,7 +421,7 @@ int up_addrenv_create(FAR _TCB *tcb, size_t envsize);
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_ADDRENV
|
#ifdef CONFIG_ADDRENV
|
||||||
int up_addrenv_clone(FAR const _TCB *ptcb, FAR _TCB *ctcb);
|
int up_addrenv_share(FAR const _TCB *ptcb, FAR _TCB *ctcb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@@ -439,12 +439,32 @@ int up_addrenv_clone(FAR const _TCB *ptcb, FAR _TCB *ctcb);
|
|||||||
* be instantiated.
|
* be instantiated.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
|
* A handle that may be used with up_addrenv_restore() to restore the
|
||||||
|
* address environment before up_addrenv_instantiate() was called.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifdef CONFIG_ADDRENV
|
||||||
|
FAR void *up_addrenv_instantiate(FAR _TCB *tcb);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/****************************************************************************
|
||||||
|
* Name: up_addrenv_restore
|
||||||
|
*
|
||||||
|
* Description:
|
||||||
|
* Restore an address environment using a handle previously returned by
|
||||||
|
* up_addrenv_instantiate().
|
||||||
|
*
|
||||||
|
* Input Parameters:
|
||||||
|
* handle - A handle previously returned by up_addrenv_instantiate.
|
||||||
|
*
|
||||||
|
* Returned Value:
|
||||||
* Zero (OK) on success; a negated errno value on failure.
|
* Zero (OK) on success; a negated errno value on failure.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifdef CONFIG_ADDRENV
|
#ifdef CONFIG_ADDRENV
|
||||||
int up_addrenv_instantiate(FAR _TCB *tcb);
|
int up_addrenv_restore(FAR void *handle);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
+7
-1
@@ -22,7 +22,13 @@ config SCHED_INSTRUMENTATION
|
|||||||
bool "Monitor system performance"
|
bool "Monitor system performance"
|
||||||
default n
|
default n
|
||||||
---help---
|
---help---
|
||||||
enables instrumentation in scheduler to monitor system performance.
|
Enables instrumentation in scheduler to monitor system performance.
|
||||||
|
If enabled, then the board-specific logic must provide the following
|
||||||
|
functions (see include/sched.h):
|
||||||
|
|
||||||
|
void sched_note_start(FAR _TCB *tcb);
|
||||||
|
void sched_note_stop(FAR _TCB *tcb);
|
||||||
|
void sched_note_switch(FAR _TCB *pFromTcb, FAR _TCB *pToTcb);
|
||||||
|
|
||||||
config TASK_NAME_SIZE
|
config TASK_NAME_SIZE
|
||||||
int "Maximum task name size"
|
int "Maximum task name size"
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ EXTERN int env_dup(FAR _TCB *ptcb);
|
|||||||
EXTERN int env_share(FAR _TCB *ptcb);
|
EXTERN int env_share(FAR _TCB *ptcb);
|
||||||
EXTERN int env_release(FAR _TCB *ptcb);
|
EXTERN int env_release(FAR _TCB *ptcb);
|
||||||
|
|
||||||
/* functions used internally the environment handling logic */
|
/* functions used internally by the environment handling logic */
|
||||||
|
|
||||||
EXTERN FAR char *env_findvar(environ_t *envp, const char *pname);
|
EXTERN FAR char *env_findvar(environ_t *envp, const char *pname);
|
||||||
EXTERN int env_removevar(environ_t *envp, char *pvar);
|
EXTERN int env_removevar(environ_t *envp, char *pvar);
|
||||||
|
|||||||
+42
-23
@@ -246,7 +246,7 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
|
|||||||
{
|
{
|
||||||
FAR _TCB *ptcb;
|
FAR _TCB *ptcb;
|
||||||
FAR join_t *pjoin;
|
FAR join_t *pjoin;
|
||||||
int status;
|
int ret;
|
||||||
int priority;
|
int priority;
|
||||||
#if CONFIG_RR_INTERVAL > 0
|
#if CONFIG_RR_INTERVAL > 0
|
||||||
int policy;
|
int policy;
|
||||||
@@ -268,13 +268,27 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
|
|||||||
return ENOMEM;
|
return ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Associate file descriptors with the new task */
|
/* Share the address environment of the parent task. NOTE: Only tasks
|
||||||
|
* created throught the nuttx/binfmt loaders may have an address
|
||||||
|
* environment.
|
||||||
|
*/
|
||||||
|
|
||||||
status = sched_setuppthreadfiles(ptcb);
|
#ifdef CONFIG_ADDRENV
|
||||||
if (status != OK)
|
ret = up_addrenv_share((FAR const _TCB *)g_readytorun.head, ptcb);
|
||||||
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
sched_releasetcb(ptcb);
|
sched_releasetcb(ptcb);
|
||||||
return status;
|
return -ret;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Associate file descriptors with the new task */
|
||||||
|
|
||||||
|
ret = sched_setuppthreadfiles(ptcb);
|
||||||
|
if (ret != OK)
|
||||||
|
{
|
||||||
|
sched_releasetcb(ptcb);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Share the parent's envionment */
|
/* Share the parent's envionment */
|
||||||
@@ -292,8 +306,8 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
|
|||||||
|
|
||||||
/* Allocate the stack for the TCB */
|
/* Allocate the stack for the TCB */
|
||||||
|
|
||||||
status = up_create_stack(ptcb, attr->stacksize);
|
ret = up_create_stack(ptcb, attr->stacksize);
|
||||||
if (status != OK)
|
if (ret != OK)
|
||||||
{
|
{
|
||||||
sched_releasetcb(ptcb);
|
sched_releasetcb(ptcb);
|
||||||
sched_free(pjoin);
|
sched_free(pjoin);
|
||||||
@@ -310,8 +324,8 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
|
|||||||
/* Get the priority for this thread. */
|
/* Get the priority for this thread. */
|
||||||
|
|
||||||
struct sched_param param;
|
struct sched_param param;
|
||||||
status = sched_getparam(0, ¶m);
|
ret = sched_getparam(0, ¶m);
|
||||||
if (status == OK)
|
if (ret == OK)
|
||||||
{
|
{
|
||||||
priority = param.sched_priority;
|
priority = param.sched_priority;
|
||||||
}
|
}
|
||||||
@@ -348,11 +362,9 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
|
|||||||
|
|
||||||
/* Initialize the task control block */
|
/* Initialize the task control block */
|
||||||
|
|
||||||
status = task_schedsetup(ptcb, priority, pthread_start,
|
ret = task_schedsetup(ptcb, priority, pthread_start, (main_t)start_routine);
|
||||||
(main_t)start_routine);
|
if (ret != OK)
|
||||||
if (status != OK)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
sched_releasetcb(ptcb);
|
sched_releasetcb(ptcb);
|
||||||
sched_free(pjoin);
|
sched_free(pjoin);
|
||||||
return EBUSY;
|
return EBUSY;
|
||||||
@@ -390,21 +402,21 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
|
|||||||
|
|
||||||
/* Initialize the semaphores in the join structure to zero. */
|
/* Initialize the semaphores in the join structure to zero. */
|
||||||
|
|
||||||
status = sem_init(&pjoin->data_sem, 0, 0);
|
ret = sem_init(&pjoin->data_sem, 0, 0);
|
||||||
if (status == OK)
|
if (ret == OK)
|
||||||
{
|
{
|
||||||
status = sem_init(&pjoin->exit_sem, 0, 0);
|
ret = sem_init(&pjoin->exit_sem, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Activate the task */
|
/* Activate the task */
|
||||||
|
|
||||||
sched_lock();
|
sched_lock();
|
||||||
if (status == OK)
|
if (ret == OK)
|
||||||
{
|
{
|
||||||
status = task_activate(ptcb);
|
ret = task_activate(ptcb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == OK)
|
if (ret == OK)
|
||||||
{
|
{
|
||||||
/* Wait for the task to actually get running and to register
|
/* Wait for the task to actually get running and to register
|
||||||
* its join_t
|
* its join_t
|
||||||
@@ -414,8 +426,15 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
|
|||||||
|
|
||||||
/* Return the thread information to the caller */
|
/* Return the thread information to the caller */
|
||||||
|
|
||||||
if (thread) *thread = (pthread_t)pid;
|
if (thread)
|
||||||
if (!pjoin->started) status = ERROR;
|
{
|
||||||
|
*thread = (pthread_t)pid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!pjoin->started)
|
||||||
|
{
|
||||||
|
ret = EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
sched_unlock();
|
sched_unlock();
|
||||||
(void)sem_destroy(&pjoin->data_sem);
|
(void)sem_destroy(&pjoin->data_sem);
|
||||||
@@ -428,8 +447,8 @@ int pthread_create(FAR pthread_t *thread, FAR pthread_attr_t *attr,
|
|||||||
(void)sem_destroy(&pjoin->exit_sem);
|
(void)sem_destroy(&pjoin->exit_sem);
|
||||||
sched_releasetcb(ptcb);
|
sched_releasetcb(ptcb);
|
||||||
sched_free(pjoin);
|
sched_free(pjoin);
|
||||||
return EIO;
|
ret = EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -171,6 +171,12 @@ int sched_releasetcb(FAR _TCB *tcb)
|
|||||||
|
|
||||||
(void)env_release(tcb);
|
(void)env_release(tcb);
|
||||||
|
|
||||||
|
/* Release this thread's reference to the address environment */
|
||||||
|
|
||||||
|
#ifdef CONFIG_ADDRENV
|
||||||
|
ret = up_addrenv_release(tcb);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* And, finally, release the TCB itself */
|
/* And, finally, release the TCB itself */
|
||||||
|
|
||||||
sched_free(tcb);
|
sched_free(tcb);
|
||||||
|
|||||||
Reference in New Issue
Block a user