Linux-libre 4.19.123-gnu
[librecmc/linux-libre.git] / arch / m68k / include / asm / atarihw.h
1 /*
2 ** linux/atarihw.h -- This header defines some macros and pointers for
3 **                    the various Atari custom hardware registers.
4 **
5 ** Copyright 1994 by Björn Brauel
6 **
7 ** 5/1/94 Roman Hodek:
8 **   Added definitions for TT specific chips.
9 **
10 ** 1996-09-13 lars brinkhoff <f93labr@dd.chalmers.se>:
11 **   Finally added definitions for the matrix/codec and the DSP56001 host
12 **   interface.
13 **
14 ** This file is subject to the terms and conditions of the GNU General Public
15 ** License.  See the file COPYING in the main directory of this archive
16 ** for more details.
17 **
18 */
19
20 #ifndef _LINUX_ATARIHW_H_
21 #define _LINUX_ATARIHW_H_
22
23 #include <linux/types.h>
24 #include <asm/bootinfo-atari.h>
25 #include <asm/kmap.h>
26
27 extern u_long atari_mch_cookie;
28 extern u_long atari_mch_type;
29 extern u_long atari_switches;
30 extern int atari_rtc_year_offset;
31 extern int atari_dont_touch_floppy_select;
32
33 extern int atari_SCC_reset_done;
34
35 /* convenience macros for testing machine type */
36 #define MACH_IS_ST      ((atari_mch_cookie >> 16) == ATARI_MCH_ST)
37 #define MACH_IS_STE     ((atari_mch_cookie >> 16) == ATARI_MCH_STE && \
38                          (atari_mch_cookie & 0xffff) == 0)
39 #define MACH_IS_MSTE    ((atari_mch_cookie >> 16) == ATARI_MCH_STE && \
40                          (atari_mch_cookie & 0xffff) == 0x10)
41 #define MACH_IS_TT      ((atari_mch_cookie >> 16) == ATARI_MCH_TT)
42 #define MACH_IS_FALCON  ((atari_mch_cookie >> 16) == ATARI_MCH_FALCON)
43 #define MACH_IS_MEDUSA  (atari_mch_type == ATARI_MACH_MEDUSA)
44 #define MACH_IS_AB40    (atari_mch_type == ATARI_MACH_AB40)
45
46 /* values for atari_switches */
47 #define ATARI_SWITCH_IKBD       0x01
48 #define ATARI_SWITCH_MIDI       0x02
49 #define ATARI_SWITCH_SND6       0x04
50 #define ATARI_SWITCH_SND7       0x08
51 #define ATARI_SWITCH_OVSC_SHIFT 16
52 #define ATARI_SWITCH_OVSC_IKBD  (ATARI_SWITCH_IKBD << ATARI_SWITCH_OVSC_SHIFT)
53 #define ATARI_SWITCH_OVSC_MIDI  (ATARI_SWITCH_MIDI << ATARI_SWITCH_OVSC_SHIFT)
54 #define ATARI_SWITCH_OVSC_SND6  (ATARI_SWITCH_SND6 << ATARI_SWITCH_OVSC_SHIFT)
55 #define ATARI_SWITCH_OVSC_SND7  (ATARI_SWITCH_SND7 << ATARI_SWITCH_OVSC_SHIFT)
56 #define ATARI_SWITCH_OVSC_MASK  0xffff0000
57
58 /*
59  * Define several Hardware-Chips for indication so that for the ATARI we do
60  * no longer decide whether it is a Falcon or other machine . It's just
61  * important what hardware the machine uses
62  */
63
64 /* ++roman 08/08/95: rewritten from ORing constants to a C bitfield */
65
66 #define ATARIHW_DECLARE(name)   unsigned name : 1
67 #define ATARIHW_SET(name)       (atari_hw_present.name = 1)
68 #define ATARIHW_PRESENT(name)   (atari_hw_present.name)
69
70 struct atari_hw_present {
71     /* video hardware */
72     ATARIHW_DECLARE(STND_SHIFTER);      /* ST-Shifter - no base low ! */
73     ATARIHW_DECLARE(EXTD_SHIFTER);      /* STe-Shifter - 24 bit address */
74     ATARIHW_DECLARE(TT_SHIFTER);        /* TT-Shifter */
75     ATARIHW_DECLARE(VIDEL_SHIFTER);     /* Falcon-Shifter */
76     /* sound hardware */
77     ATARIHW_DECLARE(YM_2149);           /* Yamaha YM 2149 */
78     ATARIHW_DECLARE(PCM_8BIT);          /* PCM-Sound in STe-ATARI */
79     ATARIHW_DECLARE(CODEC);             /* CODEC Sound (Falcon) */
80     /* disk storage interfaces */
81     ATARIHW_DECLARE(TT_SCSI);           /* Directly mapped NCR5380 */
82     ATARIHW_DECLARE(ST_SCSI);           /* NCR5380 via ST-DMA (Falcon) */
83     ATARIHW_DECLARE(ACSI);              /* Standard ACSI like in STs */
84     ATARIHW_DECLARE(IDE);               /* IDE Interface */
85     ATARIHW_DECLARE(FDCSPEED);          /* 8/16 MHz switch for FDC */
86     /* other I/O hardware */
87     ATARIHW_DECLARE(ST_MFP);            /* The ST-MFP (there should be no Atari
88                                            without it... but who knows?) */
89     ATARIHW_DECLARE(TT_MFP);            /* 2nd MFP */
90     ATARIHW_DECLARE(SCC);               /* Serial Communications Contr. */
91     ATARIHW_DECLARE(ST_ESCC);           /* SCC Z83230 in an ST */
92     ATARIHW_DECLARE(ANALOG_JOY);        /* Paddle Interface for STe
93                                            and Falcon */
94     ATARIHW_DECLARE(MICROWIRE);         /* Microwire Interface */
95     /* DMA */
96     ATARIHW_DECLARE(STND_DMA);          /* 24 Bit limited ST-DMA */
97     ATARIHW_DECLARE(EXTD_DMA);          /* 32 Bit ST-DMA */
98     ATARIHW_DECLARE(SCSI_DMA);          /* DMA for the NCR5380 */
99     ATARIHW_DECLARE(SCC_DMA);           /* DMA for the SCC */
100     /* real time clocks */
101     ATARIHW_DECLARE(TT_CLK);            /* TT compatible clock chip */
102     ATARIHW_DECLARE(MSTE_CLK);          /* Mega ST(E) clock chip */
103     /* supporting hardware */
104     ATARIHW_DECLARE(SCU);               /* System Control Unit */
105     ATARIHW_DECLARE(BLITTER);           /* Blitter */
106     ATARIHW_DECLARE(VME);               /* VME Bus */
107     ATARIHW_DECLARE(DSP56K);            /* DSP56k processor in Falcon */
108 };
109
110 extern struct atari_hw_present atari_hw_present;
111
112
113 /* Reading the MFP port register gives a machine independent delay, since the
114  * MFP always has a 8 MHz clock. This avoids problems with the varying length
115  * of nops on various machines. Somebody claimed that the tstb takes 600 ns.
116  */
117 #define MFPDELAY() \
118         __asm__ __volatile__ ( "tstb %0" : : "m" (st_mfp.par_dt_reg) : "cc" );
119
120 /* Do cache push/invalidate for DMA read/write. This function obeys the
121  * snooping on some machines (Medusa) and processors: The Medusa itself can
122  * snoop, but only the '040 can source data from its cache to DMA writes i.e.,
123  * reads from memory). Both '040 and '060 invalidate cache entries on snooped
124  * DMA reads (i.e., writes to memory).
125  */
126
127
128 #include <linux/mm.h>
129 #include <asm/cacheflush.h>
130
131 static inline void dma_cache_maintenance( unsigned long paddr,
132                                           unsigned long len,
133                                           int writeflag )
134
135 {
136         if (writeflag) {
137                 if (!MACH_IS_MEDUSA || CPU_IS_060)
138                         cache_push( paddr, len );
139         }
140         else {
141                 if (!MACH_IS_MEDUSA)
142                         cache_clear( paddr, len );
143         }
144 }
145
146
147 /*
148 ** Shifter
149  */
150 #define ST_LOW  0
151 #define ST_MID  1
152 #define ST_HIGH 2
153 #define TT_LOW  7
154 #define TT_MID  4
155 #define TT_HIGH 6
156
157 #define SHF_BAS (0xffff8200)
158 struct SHIFTER
159  {
160         u_char pad1;
161         u_char bas_hi;
162         u_char pad2;
163         u_char bas_md;
164         u_char pad3;
165         u_char volatile vcounthi;
166         u_char pad4;
167         u_char volatile vcountmid;
168         u_char pad5;
169         u_char volatile vcountlow;
170         u_char volatile syncmode;
171         u_char pad6;
172         u_char pad7;
173         u_char bas_lo;
174  };
175 # define shifter ((*(volatile struct SHIFTER *)SHF_BAS))
176
177 #define SHF_FBAS (0xffff820e)
178 struct SHIFTER_F030
179  {
180   u_short off_next;
181   u_short scn_width;
182  };
183 # define shifter_f030 ((*(volatile struct SHIFTER_F030 *)SHF_FBAS))
184
185
186 #define SHF_TBAS (0xffff8200)
187 struct SHIFTER_TT {
188         u_char  char_dummy0;
189         u_char  bas_hi;                 /* video mem base addr, high and mid byte */
190         u_char  char_dummy1;
191         u_char  bas_md;
192         u_char  char_dummy2;
193         u_char  vcount_hi;              /* pointer to currently displayed byte */
194         u_char  char_dummy3;
195         u_char  vcount_md;
196         u_char  char_dummy4;
197         u_char  vcount_lo;
198         u_short st_sync;                /* ST compatible sync mode register, unused */
199         u_char  char_dummy5;
200         u_char  bas_lo;                 /* video mem addr, low byte */
201         u_char  char_dummy6[2+3*16];
202         /* $ffff8240: */
203         u_short color_reg[16];  /* 16 color registers */
204         u_char  st_shiftmode;   /* ST compatible shift mode register, unused */
205         u_char  char_dummy7;
206         u_short tt_shiftmode;   /* TT shift mode register */
207
208
209 };
210 #define shifter_tt      ((*(volatile struct SHIFTER_TT *)SHF_TBAS))
211
212 /* values for shifter_tt->tt_shiftmode */
213 #define TT_SHIFTER_STLOW                0x0000
214 #define TT_SHIFTER_STMID                0x0100
215 #define TT_SHIFTER_STHIGH               0x0200
216 #define TT_SHIFTER_TTLOW                0x0700
217 #define TT_SHIFTER_TTMID                0x0400
218 #define TT_SHIFTER_TTHIGH               0x0600
219 #define TT_SHIFTER_MODEMASK     0x0700
220 #define TT_SHIFTER_NUMMODE      0x0008
221 #define TT_SHIFTER_PALETTE_MASK 0x000f
222 #define TT_SHIFTER_GRAYMODE             0x1000
223
224 /* 256 TT palette registers */
225 #define TT_PALETTE_BASE (0xffff8400)
226 #define tt_palette      ((volatile u_short *)TT_PALETTE_BASE)
227
228 #define TT_PALETTE_RED_MASK             0x0f00
229 #define TT_PALETTE_GREEN_MASK   0x00f0
230 #define TT_PALETTE_BLUE_MASK    0x000f
231
232 /*
233 ** Falcon030 VIDEL Video Controller
234 ** for description see File 'linux\tools\atari\hardware.txt
235  */
236 #define f030_col ((u_long *)            0xffff9800)
237 #define f030_xreg ((u_short*)           0xffff8282)
238 #define f030_yreg ((u_short*)           0xffff82a2)
239 #define f030_creg ((u_short*)           0xffff82c0)
240 #define f030_sreg ((u_short*)           0xffff8260)
241 #define f030_mreg ((u_short*)           0xffff820a)
242 #define f030_linewidth ((u_short*)      0xffff820e)
243 #define f030_hscroll ((u_char*)         0xffff8265)
244
245 #define VIDEL_BAS (0xffff8260)
246 struct VIDEL {
247         u_short st_shift;
248         u_short pad1;
249         u_char  xoffset_s;
250         u_char  xoffset;
251         u_short f_shift;
252         u_char  pad2[0x1a];
253         u_short hht;
254         u_short hbb;
255         u_short hbe;
256         u_short hdb;
257         u_short hde;
258         u_short hss;
259         u_char  pad3[0x14];
260         u_short vft;
261         u_short vbb;
262         u_short vbe;
263         u_short vdb;
264         u_short vde;
265         u_short vss;
266         u_char  pad4[0x12];
267         u_short control;
268         u_short mode;
269 };
270 #define videl   ((*(volatile struct VIDEL *)VIDEL_BAS))
271
272 /*
273 ** DMA/WD1772 Disk Controller
274  */
275
276 #define FWD_BAS (0xffff8604)
277 struct DMA_WD
278  {
279   u_short fdc_acces_seccount;
280   u_short dma_mode_status;
281   u_char dma_vhi;       /* Some extended ST-DMAs can handle 32 bit addresses */
282   u_char dma_hi;
283   u_char char_dummy2;
284   u_char dma_md;
285   u_char char_dummy3;
286   u_char dma_lo;
287   u_short fdc_speed;
288  };
289 # define dma_wd ((*(volatile struct DMA_WD *)FWD_BAS))
290 /* alias */
291 #define st_dma dma_wd
292 /* The two highest bytes of an extended DMA as a short; this is a must
293  * for the Medusa.
294  */
295 #define st_dma_ext_dmahi (*((volatile unsigned short *)0xffff8608))
296
297 /*
298 ** YM2149 Sound Chip
299 ** access in bytes
300  */
301
302 #define YM_BAS (0xffff8800)
303 struct SOUND_YM
304  {
305   u_char rd_data_reg_sel;
306   u_char char_dummy1;
307   u_char wd_data;
308  };
309 #define sound_ym ((*(volatile struct SOUND_YM *)YM_BAS))
310
311 /* TT SCSI DMA */
312
313 #define TT_SCSI_DMA_BAS (0xffff8700)
314 struct TT_DMA {
315         u_char  char_dummy0;
316         u_char  dma_addr_hi;
317         u_char  char_dummy1;
318         u_char  dma_addr_hmd;
319         u_char  char_dummy2;
320         u_char  dma_addr_lmd;
321         u_char  char_dummy3;
322         u_char  dma_addr_lo;
323         u_char  char_dummy4;
324         u_char  dma_cnt_hi;
325         u_char  char_dummy5;
326         u_char  dma_cnt_hmd;
327         u_char  char_dummy6;
328         u_char  dma_cnt_lmd;
329         u_char  char_dummy7;
330         u_char  dma_cnt_lo;
331         u_long  dma_restdata;
332         u_short dma_ctrl;
333 };
334 #define tt_scsi_dma     ((*(volatile struct TT_DMA *)TT_SCSI_DMA_BAS))
335
336 /* TT SCSI Controller 5380 */
337
338 #define TT_5380_BAS     (0xffff8781)
339 struct TT_5380 {
340         u_char  scsi_data;
341         u_char  char_dummy1;
342         u_char  scsi_icr;
343         u_char  char_dummy2;
344         u_char  scsi_mode;
345         u_char  char_dummy3;
346         u_char  scsi_tcr;
347         u_char  char_dummy4;
348         u_char  scsi_idstat;
349         u_char  char_dummy5;
350         u_char  scsi_dmastat;
351         u_char  char_dummy6;
352         u_char  scsi_targrcv;
353         u_char  char_dummy7;
354         u_char  scsi_inircv;
355 };
356 #define tt_scsi                 ((*(volatile struct TT_5380 *)TT_5380_BAS))
357 #define tt_scsi_regp    ((volatile char *)TT_5380_BAS)
358
359
360 /*
361 ** Falcon DMA Sound Subsystem
362  */
363
364 #define MATRIX_BASE (0xffff8930)
365 struct MATRIX
366 {
367   u_short source;
368   u_short destination;
369   u_char external_frequency_divider;
370   u_char internal_frequency_divider;
371 };
372 #define falcon_matrix (*(volatile struct MATRIX *)MATRIX_BASE)
373
374 #define CODEC_BASE (0xffff8936)
375 struct CODEC
376 {
377   u_char tracks;
378   u_char input_source;
379 #define CODEC_SOURCE_ADC        1
380 #define CODEC_SOURCE_MATRIX     2
381   u_char adc_source;
382 #define ADC_SOURCE_RIGHT_PSG    1
383 #define ADC_SOURCE_LEFT_PSG     2
384   u_char gain;
385 #define CODEC_GAIN_RIGHT        0x0f
386 #define CODEC_GAIN_LEFT         0xf0
387   u_char attenuation;
388 #define CODEC_ATTENUATION_RIGHT 0x0f
389 #define CODEC_ATTENUATION_LEFT  0xf0
390   u_char unused1;
391   u_char status;
392 #define CODEC_OVERFLOW_RIGHT    1
393 #define CODEC_OVERFLOW_LEFT     2
394   u_char unused2, unused3, unused4, unused5;
395   u_char gpio_directions;
396 #define CODEC_GPIO_IN           0
397 #define CODEC_GPIO_OUT          1
398   u_char unused6;
399   u_char gpio_data;
400 };
401 #define falcon_codec (*(volatile struct CODEC *)CODEC_BASE)
402
403 /*
404 ** Falcon Blitter
405 */
406
407 #define BLT_BAS (0xffff8a00)
408
409 struct BLITTER
410  {
411   u_short halftone[16];
412   u_short src_x_inc;
413   u_short src_y_inc;
414   u_long src_address;
415   u_short endmask1;
416   u_short endmask2;
417   u_short endmask3;
418   u_short dst_x_inc;
419   u_short dst_y_inc;
420   u_long dst_address;
421   u_short wd_per_line;
422   u_short ln_per_bb;
423   u_short hlf_op_reg;
424   u_short log_op_reg;
425   u_short lin_nm_reg;
426   u_short skew_reg;
427  };
428 # define blitter ((*(volatile struct BLITTER *)BLT_BAS))
429
430
431 /*
432 ** SCC Z8530
433  */
434
435 #define SCC_BAS (0xffff8c81)
436 struct SCC
437  {
438   u_char cha_a_ctrl;
439   u_char char_dummy1;
440   u_char cha_a_data;
441   u_char char_dummy2;
442   u_char cha_b_ctrl;
443   u_char char_dummy3;
444   u_char cha_b_data;
445  };
446 # define atari_scc ((*(volatile struct SCC*)SCC_BAS))
447
448 /* The ESCC (Z85230) in an Atari ST. The channels are reversed! */
449 # define st_escc ((*(volatile struct SCC*)0xfffffa31))
450 # define st_escc_dsr ((*(volatile char *)0xfffffa39))
451
452 /* TT SCC DMA Controller (same chip as SCSI DMA) */
453
454 #define TT_SCC_DMA_BAS  (0xffff8c00)
455 #define tt_scc_dma      ((*(volatile struct TT_DMA *)TT_SCC_DMA_BAS))
456
457 /*
458 ** VIDEL Palette Register
459  */
460
461 #define FPL_BAS (0xffff9800)
462 struct VIDEL_PALETTE
463  {
464   u_long reg[256];
465  };
466 # define videl_palette ((*(volatile struct VIDEL_PALETTE*)FPL_BAS))
467
468
469 /*
470 ** Falcon DSP Host Interface
471  */
472
473 #define DSP56K_HOST_INTERFACE_BASE (0xffffa200)
474 struct DSP56K_HOST_INTERFACE {
475   u_char icr;
476 #define DSP56K_ICR_RREQ 0x01
477 #define DSP56K_ICR_TREQ 0x02
478 #define DSP56K_ICR_HF0  0x08
479 #define DSP56K_ICR_HF1  0x10
480 #define DSP56K_ICR_HM0  0x20
481 #define DSP56K_ICR_HM1  0x40
482 #define DSP56K_ICR_INIT 0x80
483
484   u_char cvr;
485 #define DSP56K_CVR_HV_MASK 0x1f
486 #define DSP56K_CVR_HC   0x80
487
488   u_char isr;
489 #define DSP56K_ISR_RXDF 0x01
490 #define DSP56K_ISR_TXDE 0x02
491 #define DSP56K_ISR_TRDY 0x04
492 #define DSP56K_ISR_HF2  0x08
493 #define DSP56K_ISR_HF3  0x10
494 #define DSP56K_ISR_DMA  0x40
495 #define DSP56K_ISR_HREQ 0x80
496
497   u_char ivr;
498
499   union {
500     u_char b[4];
501     u_short w[2];
502     u_long l;
503   } data;
504 };
505 #define dsp56k_host_interface ((*(volatile struct DSP56K_HOST_INTERFACE *)DSP56K_HOST_INTERFACE_BASE))
506
507 /*
508 ** MFP 68901
509  */
510
511 #define MFP_BAS (0xfffffa01)
512 struct MFP
513  {
514   u_char par_dt_reg;
515   u_char char_dummy1;
516   u_char active_edge;
517   u_char char_dummy2;
518   u_char data_dir;
519   u_char char_dummy3;
520   u_char int_en_a;
521   u_char char_dummy4;
522   u_char int_en_b;
523   u_char char_dummy5;
524   u_char int_pn_a;
525   u_char char_dummy6;
526   u_char int_pn_b;
527   u_char char_dummy7;
528   u_char int_sv_a;
529   u_char char_dummy8;
530   u_char int_sv_b;
531   u_char char_dummy9;
532   u_char int_mk_a;
533   u_char char_dummy10;
534   u_char int_mk_b;
535   u_char char_dummy11;
536   u_char vec_adr;
537   u_char char_dummy12;
538   u_char tim_ct_a;
539   u_char char_dummy13;
540   u_char tim_ct_b;
541   u_char char_dummy14;
542   u_char tim_ct_cd;
543   u_char char_dummy15;
544   u_char tim_dt_a;
545   u_char char_dummy16;
546   u_char tim_dt_b;
547   u_char char_dummy17;
548   u_char tim_dt_c;
549   u_char char_dummy18;
550   u_char tim_dt_d;
551   u_char char_dummy19;
552   u_char sync_char;
553   u_char char_dummy20;
554   u_char usart_ctr;
555   u_char char_dummy21;
556   u_char rcv_stat;
557   u_char char_dummy22;
558   u_char trn_stat;
559   u_char char_dummy23;
560   u_char usart_dta;
561  };
562 # define st_mfp ((*(volatile struct MFP*)MFP_BAS))
563
564 /* TT's second MFP */
565
566 #define TT_MFP_BAS      (0xfffffa81)
567 # define tt_mfp ((*(volatile struct MFP*)TT_MFP_BAS))
568
569
570 /* TT System Control Unit */
571
572 #define TT_SCU_BAS      (0xffff8e01)
573 struct TT_SCU {
574         u_char  sys_mask;
575         u_char  char_dummy1;
576         u_char  sys_stat;
577         u_char  char_dummy2;
578         u_char  softint;
579         u_char  char_dummy3;
580         u_char  vmeint;
581         u_char  char_dummy4;
582         u_char  gp_reg1;
583         u_char  char_dummy5;
584         u_char  gp_reg2;
585         u_char  char_dummy6;
586         u_char  vme_mask;
587         u_char  char_dummy7;
588         u_char  vme_stat;
589 };
590 #define tt_scu  ((*(volatile struct TT_SCU *)TT_SCU_BAS))
591
592 /* TT real time clock */
593
594 #define TT_RTC_BAS      (0xffff8961)
595 struct TT_RTC {
596         u_char  regsel;
597         u_char  dummy;
598         u_char  data;
599 };
600 #define tt_rtc  ((*(volatile struct TT_RTC *)TT_RTC_BAS))
601
602
603 /*
604 ** ACIA 6850
605  */
606 /* constants for the ACIA registers */
607
608 /* baudrate selection and reset (Baudrate = clock/factor) */
609 #define ACIA_DIV1  0
610 #define ACIA_DIV16 1
611 #define ACIA_DIV64 2
612 #define ACIA_RESET 3
613
614 /* character format */
615 #define ACIA_D7E2S (0<<2)       /* 7 data, even parity, 2 stop */
616 #define ACIA_D7O2S (1<<2)       /* 7 data, odd parity, 2 stop */
617 #define ACIA_D7E1S (2<<2)       /* 7 data, even parity, 1 stop */
618 #define ACIA_D7O1S (3<<2)       /* 7 data, odd parity, 1 stop */
619 #define ACIA_D8N2S (4<<2)       /* 8 data, no parity, 2 stop */
620 #define ACIA_D8N1S (5<<2)       /* 8 data, no parity, 1 stop */
621 #define ACIA_D8E1S (6<<2)       /* 8 data, even parity, 1 stop */
622 #define ACIA_D8O1S (7<<2)       /* 8 data, odd parity, 1 stop */
623
624 /* transmit control */
625 #define ACIA_RLTID (0<<5)       /* RTS low, TxINT disabled */
626 #define ACIA_RLTIE (1<<5)       /* RTS low, TxINT enabled */
627 #define ACIA_RHTID (2<<5)       /* RTS high, TxINT disabled */
628 #define ACIA_RLTIDSB (3<<5)     /* RTS low, TxINT disabled, send break */
629
630 /* receive control */
631 #define ACIA_RID (0<<7)         /* RxINT disabled */
632 #define ACIA_RIE (1<<7)         /* RxINT enabled */
633
634 /* status fields of the ACIA */
635 #define ACIA_RDRF 1             /* Receive Data Register Full */
636 #define ACIA_TDRE (1<<1)        /* Transmit Data Register Empty */
637 #define ACIA_DCD  (1<<2)        /* Data Carrier Detect */
638 #define ACIA_CTS  (1<<3)        /* Clear To Send */
639 #define ACIA_FE   (1<<4)        /* Framing Error */
640 #define ACIA_OVRN (1<<5)        /* Receiver Overrun */
641 #define ACIA_PE   (1<<6)        /* Parity Error */
642 #define ACIA_IRQ  (1<<7)        /* Interrupt Request */
643
644 #define ACIA_BAS (0xfffffc00)
645 struct ACIA
646  {
647   u_char key_ctrl;
648   u_char char_dummy1;
649   u_char key_data;
650   u_char char_dummy2;
651   u_char mid_ctrl;
652   u_char char_dummy3;
653   u_char mid_data;
654  };
655 # define acia ((*(volatile struct ACIA*)ACIA_BAS))
656
657 #define TT_DMASND_BAS (0xffff8900)
658 struct TT_DMASND {
659         u_char  int_ctrl;       /* Falcon: Interrupt control */
660         u_char  ctrl;
661         u_char  pad2;
662         u_char  bas_hi;
663         u_char  pad3;
664         u_char  bas_mid;
665         u_char  pad4;
666         u_char  bas_low;
667         u_char  pad5;
668         u_char  addr_hi;
669         u_char  pad6;
670         u_char  addr_mid;
671         u_char  pad7;
672         u_char  addr_low;
673         u_char  pad8;
674         u_char  end_hi;
675         u_char  pad9;
676         u_char  end_mid;
677         u_char  pad10;
678         u_char  end_low;
679         u_char  pad11[12];
680         u_char  track_select;   /* Falcon */
681         u_char  mode;
682         u_char  pad12[14];
683         /* Falcon only: */
684         u_short cbar_src;
685         u_short cbar_dst;
686         u_char  ext_div;
687         u_char  int_div;
688         u_char  rec_track_select;
689         u_char  dac_src;
690         u_char  adc_src;
691         u_char  input_gain;
692         u_short output_atten;
693 };
694 # define tt_dmasnd ((*(volatile struct TT_DMASND *)TT_DMASND_BAS))
695
696 #define DMASND_MFP_INT_REPLAY     0x01
697 #define DMASND_MFP_INT_RECORD     0x02
698 #define DMASND_TIMERA_INT_REPLAY  0x04
699 #define DMASND_TIMERA_INT_RECORD  0x08
700
701 #define DMASND_CTRL_OFF           0x00
702 #define DMASND_CTRL_ON            0x01
703 #define DMASND_CTRL_REPEAT        0x02
704 #define DMASND_CTRL_RECORD_ON     0x10
705 #define DMASND_CTRL_RECORD_OFF    0x00
706 #define DMASND_CTRL_RECORD_REPEAT 0x20
707 #define DMASND_CTRL_SELECT_REPLAY 0x00
708 #define DMASND_CTRL_SELECT_RECORD 0x80
709 #define DMASND_MODE_MONO          0x80
710 #define DMASND_MODE_STEREO        0x00
711 #define DMASND_MODE_8BIT          0x00
712 #define DMASND_MODE_16BIT         0x40  /* Falcon only */
713 #define DMASND_MODE_6KHZ          0x00  /* Falcon: mute */
714 #define DMASND_MODE_12KHZ         0x01
715 #define DMASND_MODE_25KHZ         0x02
716 #define DMASND_MODE_50KHZ         0x03
717
718
719 #define DMASNDSetBase(bufstart)                                         \
720     do {                                                                \
721         tt_dmasnd.bas_hi  = (unsigned char)(((bufstart) & 0xff0000) >> 16); \
722         tt_dmasnd.bas_mid = (unsigned char)(((bufstart) & 0x00ff00) >> 8); \
723         tt_dmasnd.bas_low = (unsigned char) ((bufstart) & 0x0000ff); \
724     } while( 0 )
725
726 #define DMASNDGetAdr() ((tt_dmasnd.addr_hi << 16) +     \
727                         (tt_dmasnd.addr_mid << 8) +     \
728                         (tt_dmasnd.addr_low))
729
730 #define DMASNDSetEnd(bufend)                            \
731     do {                                                \
732         tt_dmasnd.end_hi  = (unsigned char)(((bufend) & 0xff0000) >> 16); \
733         tt_dmasnd.end_mid = (unsigned char)(((bufend) & 0x00ff00) >> 8); \
734         tt_dmasnd.end_low = (unsigned char) ((bufend) & 0x0000ff); \
735     } while( 0 )
736
737
738 #define TT_MICROWIRE_BAS        (0xffff8922)
739 struct TT_MICROWIRE {
740         u_short data;
741         u_short mask;
742 };
743 # define tt_microwire ((*(volatile struct TT_MICROWIRE *)TT_MICROWIRE_BAS))
744
745 #define MW_LM1992_ADDR          0x0400
746
747 #define MW_LM1992_VOLUME(dB)    \
748     (0x0c0 | ((dB) < -80 ? 0 : (dB) > 0 ? 40 : (((dB) + 80) / 2)))
749 #define MW_LM1992_BALLEFT(dB)   \
750     (0x140 | ((dB) < -40 ? 0 : (dB) > 0 ? 20 : (((dB) + 40) / 2)))
751 #define MW_LM1992_BALRIGHT(dB)  \
752     (0x100 | ((dB) < -40 ? 0 : (dB) > 0 ? 20 : (((dB) + 40) / 2)))
753 #define MW_LM1992_TREBLE(dB)    \
754     (0x080 | ((dB) < -12 ? 0 : (dB) > 12 ? 12 : (((dB) / 2) + 6)))
755 #define MW_LM1992_BASS(dB)      \
756     (0x040 | ((dB) < -12 ? 0 : (dB) > 12 ? 12 : (((dB) / 2) + 6)))
757
758 #define MW_LM1992_PSG_LOW       0x000
759 #define MW_LM1992_PSG_HIGH      0x001
760 #define MW_LM1992_PSG_OFF       0x002
761
762 #define MSTE_RTC_BAS    (0xfffffc21)
763
764 struct MSTE_RTC {
765         u_char sec_ones;
766         u_char dummy1;
767         u_char sec_tens;
768         u_char dummy2;
769         u_char min_ones;
770         u_char dummy3;
771         u_char min_tens;
772         u_char dummy4;
773         u_char hr_ones;
774         u_char dummy5;
775         u_char hr_tens;
776         u_char dummy6;
777         u_char weekday;
778         u_char dummy7;
779         u_char day_ones;
780         u_char dummy8;
781         u_char day_tens;
782         u_char dummy9;
783         u_char mon_ones;
784         u_char dummy10;
785         u_char mon_tens;
786         u_char dummy11;
787         u_char year_ones;
788         u_char dummy12;
789         u_char year_tens;
790         u_char dummy13;
791         u_char mode;
792         u_char dummy14;
793         u_char test;
794         u_char dummy15;
795         u_char reset;
796 };
797
798 #define mste_rtc ((*(volatile struct MSTE_RTC *)MSTE_RTC_BAS))
799
800 /*
801 ** EtherNAT add-on card for Falcon - combined ethernet and USB adapter
802 */
803
804 #define ATARI_ETHERNAT_PHYS_ADDR        0x80000000
805
806 #endif /* linux/atarihw.h */
807