]> cloudbase.mooo.com Git - avrcpm.git/blame - avrcpm/avr/config.inc
* Initial changes for FAT16 support.
[avrcpm.git] / avrcpm / avr / config.inc
CommitLineData
9c15f366
L
1; Configuration, hardware definition, ...
2;
3; Copyright (C) 2010 Sprite_tm
4; Copyright (C) 2010 Leo C.
5;
6; This file is part of avrcpm.
7;
8; avrcpm is free software: you can redistribute it and/or modify it
9; under the terms of the GNU General Public License as published by
10; the Free Software Foundation, either version 3 of the License, or
11; (at your option) any later version.
12;
13; avrcpm is distributed in the hope that it will be useful,
14; but WITHOUT ANY WARRANTY; without even the implied warranty of
15; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16; GNU General Public License for more details.
17;
18; You should have received a copy of the GNU General Public License
19; along with avrcpm. If not, see <http://www.gnu.org/licenses/>.
20;
21; $Id$
22;
23
24
25#define VMAJOR 2 /* Version number */
26#define VMINOR 0
27
28#ifndef DRAM_8BIT
29 #define DRAM_8BIT 0 /* 1 = 8bit wide DRAM */
30#endif
31#ifndef F_CPU
32 #define F_CPU 20000000 /* system clock in Hz; defaults to 20MHz */
33#endif
34#ifndef BAUD
35 #define BAUD 38400 /* console baud rate */
36#endif
37
9c15f366
L
38#define K 1024
39#define M 1204*K
40
41;#define RAMSIZE 256*K*4 /* 1 chip 256Kx4 */
42#define RAMSIZE 4*M*4 * 2 /* 2 chips 4Mx4 */
43
44#define RAMDISKCNT 0 /* Number of RAM disks */
45#define RAMDISKNR 'I'-'A' /* Drive "letter" for first RAM disk */
46
47#define PARTID 0x52 /* Partition table id */
48 /* http://www.win.tue.nl/~aeb/partitions/partition_types-1.html */
49#define IPLADDR 0x2000 /* Bootloader load address */
50
51#define DRAM_WAITSTATES 1 /* Number of additional clock cycles for dram read access */
52#define REFR_RATE 64000 /* dram refresh rate in cycles/s. */
53 /* Most drams need 1/15.6µs. */
54#define RXBUFSIZE 128 /* USART recieve buffer size. Must be power of 2 */
55#define TXBUFSIZE 128 /* USART transmit buffer size. Must be power of 2 */
56
57
58
59#define EM_Z80 0 /* we don't have any z80 instructions yet */
60
61.equ BOOT_DEBUG = 0
62.equ MMC_DEBUG = 0 /* Increase for more debugging */
63.equ INS_DEBUG = 0
64.equ MEMTEST = 1
65.equ BOOTWAIT = 1
66.equ PORT_DEBUG = 0
67.equ DISK_DEBUG = 0 /* Increase for more debugging */
68.equ HOSTRW_DEBUG= 0
69.equ MEMFILL = 1
70.equ STACK_DBG = 0
71.equ PRINT_PC = 0
72
73#define MMC_SPI2X 1 /* 0 = SPI CLK/4, 1 = SPI CLK/2 */
74
75#define MEMFILL_VAL 0xCB /* Fill ram with cbs, which will trigger an invalid opcode error. */
76#define DBG_TRACE_BOTTOM 0x01 /* Page boundaries for INS_DEBUG and PRINT_PC */
77#define DBG_TRACE_TOP 0xdc /* Trace is off, below bottom page and above top page. */
78
79;-----------------------------------------------------------------------
80; Port declarations
81
82#if DRAM_8BIT /* Implies software uart */
83
84;Port D
85.equ RAM_D0 = 0
86.equ RAM_D1 = 1
87.equ RAM_D2 = 2
88.equ RAM_D3 = 3
89.equ RAM_D4 = 4
90.equ RAM_D5 = 5
91.equ RAM_D6 = 6
92.equ RAM_D7 = 7
93.equ RAM_A0 = 0
94.equ RAM_A1 = 1
95.equ RAM_A2 = 2
96.equ RAM_A3 = 3
97.equ RAM_A4 = 4
98.equ RAM_A5 = 5
99.equ RAM_A6 = 6
100.equ RAM_A7 = 7
101
102;Port B
103.equ MMC_MOSI = 3
104.equ MMC_MISO = 4
105.equ MMC_SCK = 5
106.equ RAM_A8 = 3
107.equ RAM_A9 = 4
108.equ RAM_A10 = 5
109
110.equ RXD = 0
111.equ TXD = 1
112.equ MMC_CS = 2
113
114.equ P_MMC_CS = PORTB
115.equ P_A8 = PORTB
116.equ P_RXD = PORTB
117
118;Port C
119.equ RAM_RAS = 0
120.equ RAM_CAS = 1
121.equ RAM_OE = 2
122.equ RAM_W = 3
123
124.equ P_RAS = PORTC
125.equ P_CAS = PORTC
126.equ P_OE = PORTC
127.equ P_W = PORTC
128
129
130#else /* 4 bit RAM, hardware uart */
131
132; Port D
133.equ RXD = 0
134.equ TXD = 1
135.equ RAM_OE = 2
136.equ RAM_A8 = 3
137.equ MMC_CS = 4
138.equ RAM_A5 = 5
139.equ RAM_A6 = 6
140.equ RAM_A7 = 7
141
142.equ P_RXD = PORTD
143.equ P_OE = PORTD
144.equ P_A8 = PORTD
145.equ P_MMC_CS = PORTD
146.equ P_AH = PORTD
147 ; RAM_A[7..5]
148.equ RAM_AH_MASK = (1<<RAM_A8)|(1<<RAM_A7)|(1<<RAM_A6)|(1<<RAM_A5)
149.equ PD_OUTPUT_MASK = (1<<MMC_CS) | (1<<RAM_OE) | RAM_AH_MASK
150
151
152;Port B
153.equ RAM_A4 = 0
154.equ RAM_A3 = 1
155.equ RAM_A2 = 2
156.equ RAM_A1 = 3
157.equ MMC_MOSI = 3
158.equ RAM_A0 = 4
159.equ MMC_MISO = 4
160.equ RAM_RAS = 5
161.equ MMC_SCK = 5
162
163.equ P_RAS = PORTB
164.equ P_AL = PORTB
165 ; RAM_A[4..0]
166.equ RAM_AL_MASK = (1<<RAM_A4)|(1<<RAM_A3)|(1<<RAM_A2)|(1<<RAM_A1)|(1<<RAM_A0)
167.equ PB_OUTPUT_MASK = (1<<RAM_ras) | RAM_AL_MASK
168
169;Port C
170.equ RAM_D0 = 0
171.equ RAM_D1 = 1
172.equ RAM_D2 = 2
173.equ RAM_D3 = 3
174.equ RAM_W = 4
175.equ RAM_CAS = 5
176
177.equ P_DQ = PORTC
178.equ P_W = PORTC
179.equ P_CAS = PORTC
180
181.equ RAM_DQ_MASK = (1<<RAM_D3)|(1<<RAM_D2)|(1<<RAM_D1)|(1<<RAM_D0)
182.equ PC_OUTPUT_MASK = (1<<RAM_CAS)|(1<<RAM_W)
183
184#endif /* DRAM_8BIT */
185
186
187;-----------------------------------------------------------------------
188;Register definitions
189
190.def _tmp0 = r0
191.def _tmp1 = r1
192
193.def _RAS0 = r2
194.def _CAS0 = r3
195.def _OE = r4
196.def _WE = r5
197.def _255 = r6
198.def _0 = r7
199.def z_a = r9
200;.def stx_bitcount = r9
201;.def stx_dr = r10
202.def srx_lastedgel = r10
203.def srx_lastedgeh = r11
204
205.def insstore= r8 ;
206;.def insop = r13 ;
207.def insdecl = r12 ;
208.def insdech = r13 ;
209.def z_spl = r14
210.def z_sph = r15 ;
211.def temp = r16 ;
212.def temp2 = r17 ;
213.def temp3 = r18
214.def temp4 = r19
215.def z_flags = r20 ;
216 ;
217.def opl = r22 ;
218.def oph = r23 ;
219.def z_pcl = r24 ;
220.def z_pch = r25 ;
221; xl ;r26
222; xh ;r27
223; yl ;r28
224; yh ;r29
225; zl ;r30 ;
226; zh ;r31 ;
227
228
229
230#if defined __ATmega8__
231.equ flags = TWBR
232.equ P_PUD = SFIOR
233#else
234.equ flags = GPIOR0
235.equ P_PUD = MCUCR
236#endif
237
238; Flags:
239 .equ hostact = 7 ;host active flag
240 .equ hostwrt = 6 ;host written flag
241 .equ rsflag = 5 ;read sector flag
242 .equ readop = 4 ;1 if read operation
243 .equ trace = 0
244
245; This is the base z80 port address for clock access
246#define TIMERPORT 0x40
247#define TIMER_CTL TIMERPORT
248#define TIMER_MSECS TIMERPORT+1
249#define TIMER_SECS TIMER_MSECS+2
250
251#define starttimercmd 1
252#define quitTimerCmd 2
253#define printTimerCmd 15
254#define uptimeCmd 16
255
256#if defined __ATmega8__
257.equ RXTXDR0 = UDR
258.equ UCSR0A = UCSRA
259.equ UDRE0 = UDRE
260.equ UCSR0B = UCSRB
261.equ RXCIE0 = RXCIE
262.equ UDRIE0 = UDRIE
263.equ RXEN0 = RXEN
264.equ TXEN0 = TXEN
265.equ UCSR0C = UCSRC
266.equ UCSZ00 = UCSZ0
267.equ UCSZ01 = UCSZ1
268.equ UBRR0H = UBRRH
269.equ UBRR0L = UBRRL
270.equ OCR2A = OCR2
271.equ OC2Aaddr= OC2addr
272.equ TCCR2A = TCCR2
273.equ TCCR2B = TCCR2
274.equ TIMSK1 = TIMSK
275.equ TIMSK2 = TIMSK
276.equ OCIE2A = OCIE2
277.equ TIFR1 = TIFR
278.equ ICIE1 = TICIE1
279#else
280.equ RXTXDR0 = UDR0
281#endif
282
283; vim:set ts=8 noet nowrap
284
285