1 /*-------------------------------------------------------------------------
2 z180.h - definitions on the built in I/O ports for the Z180/HD64180
5 Copyright (C) 2003, Peter Townson <Peter.Townson AT tattsgroup.com>
7 This library is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this library; see the file COPYING. If not, write to the
19 Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
22 As a special exception, if you link this library with other files,
23 some of which are compiled with SDCC, to produce an executable,
24 this library does not by itself cause the resulting executable to
25 be covered by the GNU General Public License. This exception does
26 not however invalidate any other reasons why the executable file
27 might be covered by the GNU General Public License.
28 -------------------------------------------------------------------------*/
30 #if !defined( __Z180_H__ )
33 #if !defined( Z180_IO_BASE )
34 #define Z180_IO_BASE 0 /* zero is the Reset default */
37 /* will want this to be the case by default (I think) */
40 static void _ENABLE_Z180_ASSEMBLER_(void) __naked
{ __asm
.hd64 __endasm
; }
43 *---------------------------------------------------------------------------
44 * Z180/HD64180 internal port addresses
46 __sfr
__at (Z180_IO_BASE
+0x00) CNTLA0
; /* ASCI control register A channel 0 */
47 __sfr
__at (Z180_IO_BASE
+0x01) CNTLA1
; /* ASCI control register A channel 1 */
48 __sfr
__at (Z180_IO_BASE
+0x02) CNTLB0
; /* ASCI control register B channel 0 */
49 __sfr
__at (Z180_IO_BASE
+0x03) CNTLB1
; /* ASCI control register B channel 0 */
50 __sfr
__at (Z180_IO_BASE
+0x04) STAT0
; /* ASCI status register channel 0 */
51 __sfr
__at (Z180_IO_BASE
+0x05) STAT1
; /* ASCI status register channel 1 */
52 __sfr
__at (Z180_IO_BASE
+0x06) TDR0
; /* ASCI transmit data reg, channel 0 */
53 __sfr
__at (Z180_IO_BASE
+0x07) TDR1
; /* ASCI transmit data reg, channel 1 */
54 __sfr
__at (Z180_IO_BASE
+0x08) RDR0
; /* ASCI receive data reg, channel 0 */
55 __sfr
__at (Z180_IO_BASE
+0x09) RDR1
; /* ASCI receive data reg, channel 0 */
56 __sfr
__at (Z180_IO_BASE
+0x0A) CNTR
; /* CSI/0 control register */
57 __sfr
__at (Z180_IO_BASE
+0x0B) TRDR
; /* CSI/0 transmit/receive data reg */
59 __sfr
__at (Z180_IO_BASE
+0x0C) TMDR0L
; /* Timer data register, channel 0L */
60 __sfr
__at (Z180_IO_BASE
+0x0D) TMDR0H
; /* Timer data register, channel 0H */
61 __sfr
__at (Z180_IO_BASE
+0x0E) RLDR0L
; /* Timer reload register, channel 0L */
62 __sfr
__at (Z180_IO_BASE
+0x0F) RLDR0H
; /* Timer reload register, channel 0H */
63 __sfr
__at (Z180_IO_BASE
+0x10) TCR
; /* Timer control register */
64 __sfr
__at (Z180_IO_BASE
+0x14) TMDR1L
; /* Timer data register, channel 1L */
65 __sfr
__at (Z180_IO_BASE
+0x15) TMDR1H
; /* Timer data register, channel 1H */
66 __sfr
__at (Z180_IO_BASE
+0x16) RLDR1L
; /* Timer reload register, channel 1L */
67 __sfr
__at (Z180_IO_BASE
+0x17) RLDR1H
; /* Timer reload register, channel 1H */
68 __sfr
__at (Z180_IO_BASE
+0x18) FRC
; /* Timer Free running counter */
70 __sfr
__at (Z180_IO_BASE
+0x20) SAR0L
; /* DMA source address reg, channel 0L */
71 __sfr
__at (Z180_IO_BASE
+0x21) SAR0H
; /* DMA source address reg, channel 0H */
72 __sfr
__at (Z180_IO_BASE
+0x22) SAR0B
; /* DMA source address reg, channel 0B */
73 __sfr
__at (Z180_IO_BASE
+0x23) DAR0L
; /* DMA dest address reg, channel 0L */
74 __sfr
__at (Z180_IO_BASE
+0x24) DAR0H
; /* DMA dest address reg, channel 0H */
75 __sfr
__at (Z180_IO_BASE
+0x25) DAR0B
; /* DMA dest address reg, channel 0B */
76 __sfr
__at (Z180_IO_BASE
+0x26) BCR0L
; /* DMA byte count reg, channel 0L */
77 __sfr
__at (Z180_IO_BASE
+0x27) BCR0H
; /* DMA byte count reg, channel 0H */
78 __sfr
__at (Z180_IO_BASE
+0x28) MAR1L
; /* DMA memory address reg, channel 1L */
79 __sfr
__at (Z180_IO_BASE
+0x29) MAR1H
; /* DMA memory address reg, channel 1H */
80 __sfr
__at (Z180_IO_BASE
+0x2A) MAR1B
; /* DMA memory address reg, channel 1B */
81 __sfr
__at (Z180_IO_BASE
+0x2B) IAR1L
; /* DMA I/O address reg, channel 1L */
82 __sfr
__at (Z180_IO_BASE
+0x2C) IAR1H
; /* DMA I/O address reg, channel 1H */
83 __sfr
__at (Z180_IO_BASE
+0x2E) BCR1L
; /* DMA byte count reg, channel 1L */
84 __sfr
__at (Z180_IO_BASE
+0x2F) BCR1H
; /* DMA byte count reg, channel 1H */
85 __sfr
__at (Z180_IO_BASE
+0x30) DSTAT
; /* DMA status register */
86 __sfr
__at (Z180_IO_BASE
+0x31) DMODE
; /* DMA mode register */
87 __sfr
__at (Z180_IO_BASE
+0x32) DCNTL
; /* DMA/WAIT control register */
89 __sfr
__at (Z180_IO_BASE
+0x33) IL
; /* Interrupt vector low register */
90 __sfr
__at (Z180_IO_BASE
+0x34) ITC
; /* INT/TRAP control register */
92 __sfr
__at (Z180_IO_BASE
+0x36) RCR
; /* Refresh control register */
94 __sfr
__at (Z180_IO_BASE
+0x38) CBR
; /* MMU common base register */
95 __sfr
__at (Z180_IO_BASE
+0x39) BBR
; /* MMU bank base register */
96 __sfr
__at (Z180_IO_BASE
+0x3A) CBAR
; /* MMU common/bank area register */
98 __sfr
__at (Z180_IO_BASE
+0x3E) OMCR
; /* Operation mode control register */
100 __sfr __at
0x3F ICR
; /* I/O base control register - does not move */
103 *---------------------------------------------------------------------------
104 * Interrupt vectors (offsets) for Z180/HD64180 internal interrupts
106 #define INT1_VECTOR 0x00 /* external /INT1 */
107 #define INT2_VECTOR 0x02 /* external /INT2 */
108 #define PRT0_VECTOR 0x04 /* PRT channel 0 */
109 #define PRT1_VECTOR 0x06 /* PRT channel 1 */
110 #define DMA0_VECTOR 0x08 /* DMA channel 0 */ /* ???? */
111 #define DMA1_VECTOR 0x0A /* DMA Channel 1 */
112 #define CSIO_VECTOR 0x0C /* Clocked serial I/O */
113 #define ASCI0_VECTOR 0x0E /* Async channel 0 */
114 #define ASCI1_VECTOR 0x10 /* Async channel 1 */
115 #define INCAP_VECTOR 0x12 /* input capture */
116 #define OUTCMP_VECTOR 0x14 /* output compare */
117 #define TIMOV_VECTOR 0x16 /* timer overflow */
119 *---------------------------------------------------------------------------
121 #endif /* __Z180_H__ */