mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 06:42:32 +08:00
Integrating z80
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@463 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -231,7 +231,7 @@ o Build system
|
|||||||
Priority: Low
|
Priority: Low
|
||||||
|
|
||||||
Description: Dependencies do not work correctly under configs/<board>/src
|
Description: Dependencies do not work correctly under configs/<board>/src
|
||||||
(same as arch/<arch>/src/board).
|
(same as arch/<arch>/src/board) with SDCC.
|
||||||
Status: Open
|
Status: Open
|
||||||
Priority: Medium
|
Priority: Medium
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
|
|
||||||
/* Z80 Interrupts */
|
/* Z80 Interrupts */
|
||||||
|
|
||||||
#define Z80_IRQ_SYSTIMER (1)
|
#define Z80_IRQ_SYSTIMER (0)
|
||||||
#define NR_IRQS (1)
|
#define NR_IRQS (1)
|
||||||
|
|
||||||
/* IRQ Stack Frame Format
|
/* IRQ Stack Frame Format
|
||||||
|
|||||||
@@ -112,14 +112,21 @@ forever:
|
|||||||
di
|
di
|
||||||
|
|
||||||
; Call the interrupt decode logic. SP points to the beggining of the reg structure
|
; Call the interrupt decode logic. SP points to the beggining of the reg structure
|
||||||
|
|
||||||
ld hl, #0 ; Argument is the beginning of the reg structure
|
ld hl, #0 ; Argument is the beginning of the reg structure
|
||||||
add hl, sp ;
|
add hl, sp ;
|
||||||
push hl ;
|
push hl ; Place argument at the top of thest
|
||||||
call _up_decodeirq ; Decode the IRQ
|
call _up_decodeirq ; Decode the IRQ
|
||||||
|
|
||||||
|
; On return, HL points to the beginning of the reg structure to restore
|
||||||
|
; Note that (1) the argument pushed on the stack is not popped, and (2) the
|
||||||
|
; original stack pointer is lost. In the normal case (no context switch),
|
||||||
|
; HL will contain the value of the SP before the argument was pushed.
|
||||||
|
|
||||||
|
ld sp, hl ; Use the new stack pointer
|
||||||
|
|
||||||
; Restore registers. HL points to the beginning of the reg structure to restore
|
; Restore registers. HL points to the beginning of the reg structure to restore
|
||||||
|
|
||||||
ld sp, hl ; Use the temp stack pointer
|
|
||||||
ex af, af' ; Select alternate AF
|
ex af, af' ; Select alternate AF
|
||||||
pop af ; Offset 0: AF' = I with interrupt state in carry
|
pop af ; Offset 0: AF' = I with interrupt state in carry
|
||||||
pop bc ; Offset 1: BC
|
pop bc ; Offset 1: BC
|
||||||
|
|||||||
@@ -92,13 +92,14 @@ irqstate_t irqsave(void) __naked
|
|||||||
void irqrestore(irqstate_t flags) __naked
|
void irqrestore(irqstate_t flags) __naked
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
|
di ; Assume disabled
|
||||||
pop hl ; HL = return address
|
pop hl ; HL = return address
|
||||||
pop af ; AF Carry bit hold interrupt state
|
pop af ; AF Carry bit hold interrupt state
|
||||||
jr nc, statedisable
|
jr nc, statedisable
|
||||||
ei
|
ei
|
||||||
ret
|
|
||||||
statedisable:
|
statedisable:
|
||||||
di
|
push af ; Restore stack
|
||||||
ret
|
push hl ;
|
||||||
|
ret ; and return
|
||||||
_endasm;
|
_endasm;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,15 @@
|
|||||||
* Definitions
|
* Definitions
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|
||||||
|
/* Bits in the Z80 FLAGS register */
|
||||||
|
|
||||||
|
#define Z80_C_FLAG 0x01 /* Bit 0: Carry flag */
|
||||||
|
#define Z80_N_FLAG 0x02 /* Bit 1: Add/Subtract flag */
|
||||||
|
#define Z80_PV_FLAG 0x04 /* Bit 2: Parity/Overflow flag */
|
||||||
|
#define Z80_H_FLAG 0x10 /* Bit 4: Half carry flag */
|
||||||
|
#define Z80_Z_FLAG 0x40 /* Bit 5: Zero flag */
|
||||||
|
#define Z80_S_FLAG 0x80 /* Bit 7: Sign flag */
|
||||||
|
|
||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* Public Function Prototypes
|
* Public Function Prototypes
|
||||||
************************************************************************************/
|
************************************************************************************/
|
||||||
|
|||||||
@@ -285,5 +285,5 @@ CONFIG_CUSTOM_STACK=n
|
|||||||
CONFIG_PROC_STACK_SIZE=1024
|
CONFIG_PROC_STACK_SIZE=1024
|
||||||
CONFIG_PTHREAD_STACK_MIN=
|
CONFIG_PTHREAD_STACK_MIN=
|
||||||
CONFIG_PTHREAD_STACK_DEFAULT=
|
CONFIG_PTHREAD_STACK_DEFAULT=
|
||||||
CONFIG_HEAP_SIZE=32768
|
CONFIG_HEAP_SIZE=
|
||||||
CONFIG_HEAP_BASE=CONFIG_DRAM_SIZE-CONFIG_HEAP_SIZE
|
CONFIG_HEAP_BASE=
|
||||||
|
|||||||
@@ -76,10 +76,21 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
current_regs = NULL;
|
current_regs = NULL;
|
||||||
|
|
||||||
/* And finally, enable interrupts */
|
/* Attach the timer interrupt -- There is not special timer interrupt
|
||||||
|
* enable in the simulation so it must be enabled here before interrupts
|
||||||
|
* are enabled.
|
||||||
|
*
|
||||||
|
* NOTE: Normally, there are seperate enables for "global" interrupts
|
||||||
|
* and specific device interrupts. In such a "normal" case, the timer
|
||||||
|
* interrupt should be attached and enabled in the the function up_timerinit()
|
||||||
|
*/
|
||||||
|
|
||||||
|
irq_attach(Z80_IRQ_SYSTIMER, (xcpt_t)up_timerisr);
|
||||||
|
|
||||||
|
/* And finally, enable interrupts (including the timer) */
|
||||||
|
|
||||||
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
#ifndef CONFIG_SUPPRESS_INTERRUPTS
|
||||||
irqrestore(TRUE);
|
irqrestore(Z80_C_FLAG);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +104,7 @@ void up_irqinitialize(void)
|
|||||||
|
|
||||||
void up_disable_irq(int irq)
|
void up_disable_irq(int irq)
|
||||||
{
|
{
|
||||||
irqrestore(FALSE);
|
irqrestore(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -91,5 +91,6 @@ int up_timerisr(int irq, FAR chipreg_t *regs)
|
|||||||
|
|
||||||
void up_timerinit(void)
|
void up_timerinit(void)
|
||||||
{
|
{
|
||||||
|
/* The timer interrupt was attached in up_irqinitialize -- see comments there */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -268,7 +268,7 @@ typedef struct _TCB _TCB;
|
|||||||
|
|
||||||
/* This is the callback type used by sched_foreach() */
|
/* This is the callback type used by sched_foreach() */
|
||||||
|
|
||||||
typedef void (sched_foreach_t)(FAR _TCB *tcb, FAR void *arg);
|
typedef void (*sched_foreach_t)(FAR _TCB *tcb, FAR void *arg);
|
||||||
|
|
||||||
#endif /* __ASSEMBLY__ */
|
#endif /* __ASSEMBLY__ */
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -162,7 +162,7 @@ void mm_addregion(FAR void *heapstart, size_t heapsize)
|
|||||||
heapend = MM_ALIGN_DOWN((size_t)heapstart + (size_t)heapsize);
|
heapend = MM_ALIGN_DOWN((size_t)heapstart + (size_t)heapsize);
|
||||||
heapsize = heapend - heapbase;
|
heapsize = heapend - heapbase;
|
||||||
|
|
||||||
mlldbg("Region %d: base=%p size=%d\n", IDX+1, heapstart, heapsize);
|
mlldbg("Region %d: base=%p size=%u\n", IDX+1, heapstart, heapsize);
|
||||||
|
|
||||||
/* Add the size of this region to the total size of the heap */
|
/* Add the size of this region to the total size of the heap */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user