summaryrefslogtreecommitdiff
path: root/nuttx/arch
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-12-30 18:13:22 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2007-12-30 18:13:22 +0000
commit3eb484bd4d79de731b743d9dccf9a2535b82699f (patch)
treed1294e332ccb95febfb82745a73d1cfcb29366bd /nuttx/arch
parentc5ba5065cbf2b43101f4c311f56d55a0ff99bad6 (diff)
downloadpx4-nuttx-3eb484bd4d79de731b743d9dccf9a2535b82699f.tar.gz
px4-nuttx-3eb484bd4d79de731b743d9dccf9a2535b82699f.tar.bz2
px4-nuttx-3eb484bd4d79de731b743d9dccf9a2535b82699f.zip
Integrating z80
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@463 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/arch')
-rw-r--r--nuttx/arch/z80/include/z80/irq.h2
-rw-r--r--nuttx/arch/z80/src/common/up_head.asm13
-rw-r--r--nuttx/arch/z80/src/common/up_irq.c7
-rw-r--r--nuttx/arch/z80/src/z80/chip.h9
4 files changed, 24 insertions, 7 deletions
diff --git a/nuttx/arch/z80/include/z80/irq.h b/nuttx/arch/z80/include/z80/irq.h
index a187fd4c3..12dd502c1 100644
--- a/nuttx/arch/z80/include/z80/irq.h
+++ b/nuttx/arch/z80/include/z80/irq.h
@@ -51,7 +51,7 @@
/* Z80 Interrupts */
-#define Z80_IRQ_SYSTIMER (1)
+#define Z80_IRQ_SYSTIMER (0)
#define NR_IRQS (1)
/* IRQ Stack Frame Format
diff --git a/nuttx/arch/z80/src/common/up_head.asm b/nuttx/arch/z80/src/common/up_head.asm
index 36a145be7..fd3bf20a1 100644
--- a/nuttx/arch/z80/src/common/up_head.asm
+++ b/nuttx/arch/z80/src/common/up_head.asm
@@ -111,15 +111,22 @@ forever:
push af ; Offset 0: I with interrupt state in carry
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
add hl, sp ;
- push hl ;
+ push hl ; Place argument at the top of thest
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
- ld sp, hl ; Use the temp stack pointer
ex af, af' ; Select alternate AF
pop af ; Offset 0: AF' = I with interrupt state in carry
pop bc ; Offset 1: BC
diff --git a/nuttx/arch/z80/src/common/up_irq.c b/nuttx/arch/z80/src/common/up_irq.c
index 5f8897a41..ef7c8c1c6 100644
--- a/nuttx/arch/z80/src/common/up_irq.c
+++ b/nuttx/arch/z80/src/common/up_irq.c
@@ -92,13 +92,14 @@ irqstate_t irqsave(void) __naked
void irqrestore(irqstate_t flags) __naked
{
_asm
+ di ; Assume disabled
pop hl ; HL = return address
pop af ; AF Carry bit hold interrupt state
jr nc, statedisable
ei
- ret
statedisable:
- di
- ret
+ push af ; Restore stack
+ push hl ;
+ ret ; and return
_endasm;
}
diff --git a/nuttx/arch/z80/src/z80/chip.h b/nuttx/arch/z80/src/z80/chip.h
index 9f85f1475..d5c36bd19 100644
--- a/nuttx/arch/z80/src/z80/chip.h
+++ b/nuttx/arch/z80/src/z80/chip.h
@@ -45,6 +45,15 @@
* 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
************************************************************************************/