18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci** linux/atarihw.h -- This header defines some macros and pointers for
38c2ecf20Sopenharmony_ci**                    the various Atari custom hardware registers.
48c2ecf20Sopenharmony_ci**
58c2ecf20Sopenharmony_ci** Copyright 1994 by Björn Brauel
68c2ecf20Sopenharmony_ci**
78c2ecf20Sopenharmony_ci** 5/1/94 Roman Hodek:
88c2ecf20Sopenharmony_ci**   Added definitions for TT specific chips.
98c2ecf20Sopenharmony_ci**
108c2ecf20Sopenharmony_ci** 1996-09-13 lars brinkhoff <f93labr@dd.chalmers.se>:
118c2ecf20Sopenharmony_ci**   Finally added definitions for the matrix/codec and the DSP56001 host
128c2ecf20Sopenharmony_ci**   interface.
138c2ecf20Sopenharmony_ci**
148c2ecf20Sopenharmony_ci** This file is subject to the terms and conditions of the GNU General Public
158c2ecf20Sopenharmony_ci** License.  See the file COPYING in the main directory of this archive
168c2ecf20Sopenharmony_ci** for more details.
178c2ecf20Sopenharmony_ci**
188c2ecf20Sopenharmony_ci*/
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#ifndef _LINUX_ATARIHW_H_
218c2ecf20Sopenharmony_ci#define _LINUX_ATARIHW_H_
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci#include <linux/types.h>
248c2ecf20Sopenharmony_ci#include <asm/bootinfo-atari.h>
258c2ecf20Sopenharmony_ci#include <asm/kmap.h>
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciextern u_long atari_mch_cookie;
288c2ecf20Sopenharmony_ciextern u_long atari_mch_type;
298c2ecf20Sopenharmony_ciextern u_long atari_switches;
308c2ecf20Sopenharmony_ciextern int atari_rtc_year_offset;
318c2ecf20Sopenharmony_ciextern int atari_dont_touch_floppy_select;
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciextern int atari_SCC_reset_done;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ciextern ssize_t atari_nvram_read(char *, size_t, loff_t *);
368c2ecf20Sopenharmony_ciextern ssize_t atari_nvram_write(char *, size_t, loff_t *);
378c2ecf20Sopenharmony_ciextern ssize_t atari_nvram_get_size(void);
388c2ecf20Sopenharmony_ciextern long atari_nvram_set_checksum(void);
398c2ecf20Sopenharmony_ciextern long atari_nvram_initialize(void);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* convenience macros for testing machine type */
428c2ecf20Sopenharmony_ci#define MACH_IS_ST	((atari_mch_cookie >> 16) == ATARI_MCH_ST)
438c2ecf20Sopenharmony_ci#define MACH_IS_STE	((atari_mch_cookie >> 16) == ATARI_MCH_STE && \
448c2ecf20Sopenharmony_ci			 (atari_mch_cookie & 0xffff) == 0)
458c2ecf20Sopenharmony_ci#define MACH_IS_MSTE	((atari_mch_cookie >> 16) == ATARI_MCH_STE && \
468c2ecf20Sopenharmony_ci			 (atari_mch_cookie & 0xffff) == 0x10)
478c2ecf20Sopenharmony_ci#define MACH_IS_TT	((atari_mch_cookie >> 16) == ATARI_MCH_TT)
488c2ecf20Sopenharmony_ci#define MACH_IS_FALCON	((atari_mch_cookie >> 16) == ATARI_MCH_FALCON)
498c2ecf20Sopenharmony_ci#define MACH_IS_MEDUSA	(atari_mch_type == ATARI_MACH_MEDUSA)
508c2ecf20Sopenharmony_ci#define MACH_IS_AB40	(atari_mch_type == ATARI_MACH_AB40)
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/* values for atari_switches */
538c2ecf20Sopenharmony_ci#define ATARI_SWITCH_IKBD	0x01
548c2ecf20Sopenharmony_ci#define ATARI_SWITCH_MIDI	0x02
558c2ecf20Sopenharmony_ci#define ATARI_SWITCH_SND6	0x04
568c2ecf20Sopenharmony_ci#define ATARI_SWITCH_SND7	0x08
578c2ecf20Sopenharmony_ci#define ATARI_SWITCH_OVSC_SHIFT	16
588c2ecf20Sopenharmony_ci#define ATARI_SWITCH_OVSC_IKBD	(ATARI_SWITCH_IKBD << ATARI_SWITCH_OVSC_SHIFT)
598c2ecf20Sopenharmony_ci#define ATARI_SWITCH_OVSC_MIDI	(ATARI_SWITCH_MIDI << ATARI_SWITCH_OVSC_SHIFT)
608c2ecf20Sopenharmony_ci#define ATARI_SWITCH_OVSC_SND6	(ATARI_SWITCH_SND6 << ATARI_SWITCH_OVSC_SHIFT)
618c2ecf20Sopenharmony_ci#define ATARI_SWITCH_OVSC_SND7	(ATARI_SWITCH_SND7 << ATARI_SWITCH_OVSC_SHIFT)
628c2ecf20Sopenharmony_ci#define ATARI_SWITCH_OVSC_MASK	0xffff0000
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci/*
658c2ecf20Sopenharmony_ci * Define several Hardware-Chips for indication so that for the ATARI we do
668c2ecf20Sopenharmony_ci * no longer decide whether it is a Falcon or other machine . It's just
678c2ecf20Sopenharmony_ci * important what hardware the machine uses
688c2ecf20Sopenharmony_ci */
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci/* ++roman 08/08/95: rewritten from ORing constants to a C bitfield */
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define ATARIHW_DECLARE(name)	unsigned name : 1
738c2ecf20Sopenharmony_ci#define ATARIHW_SET(name)	(atari_hw_present.name = 1)
748c2ecf20Sopenharmony_ci#define ATARIHW_PRESENT(name)	(atari_hw_present.name)
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_cistruct atari_hw_present {
778c2ecf20Sopenharmony_ci    /* video hardware */
788c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(STND_SHIFTER);	/* ST-Shifter - no base low ! */
798c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(EXTD_SHIFTER);	/* STe-Shifter - 24 bit address */
808c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(TT_SHIFTER);	/* TT-Shifter */
818c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(VIDEL_SHIFTER);	/* Falcon-Shifter */
828c2ecf20Sopenharmony_ci    /* sound hardware */
838c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(YM_2149);		/* Yamaha YM 2149 */
848c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(PCM_8BIT);		/* PCM-Sound in STe-ATARI */
858c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(CODEC);		/* CODEC Sound (Falcon) */
868c2ecf20Sopenharmony_ci    /* disk storage interfaces */
878c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(TT_SCSI);		/* Directly mapped NCR5380 */
888c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(ST_SCSI);		/* NCR5380 via ST-DMA (Falcon) */
898c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(ACSI);		/* Standard ACSI like in STs */
908c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(IDE);		/* IDE Interface */
918c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(FDCSPEED);		/* 8/16 MHz switch for FDC */
928c2ecf20Sopenharmony_ci    /* other I/O hardware */
938c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(ST_MFP);		/* The ST-MFP (there should be no Atari
948c2ecf20Sopenharmony_ci					   without it... but who knows?) */
958c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(TT_MFP);		/* 2nd MFP */
968c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(SCC);		/* Serial Communications Contr. */
978c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(ST_ESCC);		/* SCC Z83230 in an ST */
988c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(ANALOG_JOY);	/* Paddle Interface for STe
998c2ecf20Sopenharmony_ci					   and Falcon */
1008c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(MICROWIRE);		/* Microwire Interface */
1018c2ecf20Sopenharmony_ci    /* DMA */
1028c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(STND_DMA);		/* 24 Bit limited ST-DMA */
1038c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(EXTD_DMA);		/* 32 Bit ST-DMA */
1048c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(SCSI_DMA);		/* DMA for the NCR5380 */
1058c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(SCC_DMA);		/* DMA for the SCC */
1068c2ecf20Sopenharmony_ci    /* real time clocks */
1078c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(TT_CLK);		/* TT compatible clock chip */
1088c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(MSTE_CLK);		/* Mega ST(E) clock chip */
1098c2ecf20Sopenharmony_ci    /* supporting hardware */
1108c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(SCU);		/* System Control Unit */
1118c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(BLITTER);		/* Blitter */
1128c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(VME);		/* VME Bus */
1138c2ecf20Sopenharmony_ci    ATARIHW_DECLARE(DSP56K);		/* DSP56k processor in Falcon */
1148c2ecf20Sopenharmony_ci};
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ciextern struct atari_hw_present atari_hw_present;
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci/* Reading the MFP port register gives a machine independent delay, since the
1208c2ecf20Sopenharmony_ci * MFP always has a 8 MHz clock. This avoids problems with the varying length
1218c2ecf20Sopenharmony_ci * of nops on various machines. Somebody claimed that the tstb takes 600 ns.
1228c2ecf20Sopenharmony_ci */
1238c2ecf20Sopenharmony_ci#define	MFPDELAY() \
1248c2ecf20Sopenharmony_ci	__asm__ __volatile__ ( "tstb %0" : : "m" (st_mfp.par_dt_reg) : "cc" );
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci/* Do cache push/invalidate for DMA read/write. This function obeys the
1278c2ecf20Sopenharmony_ci * snooping on some machines (Medusa) and processors: The Medusa itself can
1288c2ecf20Sopenharmony_ci * snoop, but only the '040 can source data from its cache to DMA writes i.e.,
1298c2ecf20Sopenharmony_ci * reads from memory). Both '040 and '060 invalidate cache entries on snooped
1308c2ecf20Sopenharmony_ci * DMA reads (i.e., writes to memory).
1318c2ecf20Sopenharmony_ci */
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci
1348c2ecf20Sopenharmony_ci#include <linux/mm.h>
1358c2ecf20Sopenharmony_ci#include <asm/cacheflush.h>
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_cistatic inline void dma_cache_maintenance( unsigned long paddr,
1388c2ecf20Sopenharmony_ci					  unsigned long len,
1398c2ecf20Sopenharmony_ci					  int writeflag )
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci{
1428c2ecf20Sopenharmony_ci	if (writeflag) {
1438c2ecf20Sopenharmony_ci		if (!MACH_IS_MEDUSA || CPU_IS_060)
1448c2ecf20Sopenharmony_ci			cache_push( paddr, len );
1458c2ecf20Sopenharmony_ci	}
1468c2ecf20Sopenharmony_ci	else {
1478c2ecf20Sopenharmony_ci		if (!MACH_IS_MEDUSA)
1488c2ecf20Sopenharmony_ci			cache_clear( paddr, len );
1498c2ecf20Sopenharmony_ci	}
1508c2ecf20Sopenharmony_ci}
1518c2ecf20Sopenharmony_ci
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci/*
1548c2ecf20Sopenharmony_ci** Shifter
1558c2ecf20Sopenharmony_ci */
1568c2ecf20Sopenharmony_ci#define ST_LOW  0
1578c2ecf20Sopenharmony_ci#define ST_MID  1
1588c2ecf20Sopenharmony_ci#define ST_HIGH 2
1598c2ecf20Sopenharmony_ci#define TT_LOW  7
1608c2ecf20Sopenharmony_ci#define TT_MID  4
1618c2ecf20Sopenharmony_ci#define TT_HIGH 6
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci#define SHF_BAS (0xffff8200)
1648c2ecf20Sopenharmony_cistruct SHIFTER_ST
1658c2ecf20Sopenharmony_ci {
1668c2ecf20Sopenharmony_ci	u_char pad1;
1678c2ecf20Sopenharmony_ci	u_char bas_hi;
1688c2ecf20Sopenharmony_ci	u_char pad2;
1698c2ecf20Sopenharmony_ci	u_char bas_md;
1708c2ecf20Sopenharmony_ci	u_char pad3;
1718c2ecf20Sopenharmony_ci	u_char volatile vcounthi;
1728c2ecf20Sopenharmony_ci	u_char pad4;
1738c2ecf20Sopenharmony_ci	u_char volatile vcountmid;
1748c2ecf20Sopenharmony_ci	u_char pad5;
1758c2ecf20Sopenharmony_ci	u_char volatile vcountlow;
1768c2ecf20Sopenharmony_ci	u_char volatile syncmode;
1778c2ecf20Sopenharmony_ci	u_char pad6;
1788c2ecf20Sopenharmony_ci	u_char pad7;
1798c2ecf20Sopenharmony_ci	u_char bas_lo;
1808c2ecf20Sopenharmony_ci };
1818c2ecf20Sopenharmony_ci# define shifter_st ((*(volatile struct SHIFTER_ST *)SHF_BAS))
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci#define SHF_FBAS (0xffff820e)
1848c2ecf20Sopenharmony_cistruct SHIFTER_F030
1858c2ecf20Sopenharmony_ci {
1868c2ecf20Sopenharmony_ci  u_short off_next;
1878c2ecf20Sopenharmony_ci  u_short scn_width;
1888c2ecf20Sopenharmony_ci };
1898c2ecf20Sopenharmony_ci# define shifter_f030 ((*(volatile struct SHIFTER_F030 *)SHF_FBAS))
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci
1928c2ecf20Sopenharmony_ci#define	SHF_TBAS (0xffff8200)
1938c2ecf20Sopenharmony_cistruct SHIFTER_TT {
1948c2ecf20Sopenharmony_ci	u_char	char_dummy0;
1958c2ecf20Sopenharmony_ci	u_char	bas_hi;			/* video mem base addr, high and mid byte */
1968c2ecf20Sopenharmony_ci	u_char	char_dummy1;
1978c2ecf20Sopenharmony_ci	u_char	bas_md;
1988c2ecf20Sopenharmony_ci	u_char	char_dummy2;
1998c2ecf20Sopenharmony_ci	u_char	vcount_hi;		/* pointer to currently displayed byte */
2008c2ecf20Sopenharmony_ci	u_char	char_dummy3;
2018c2ecf20Sopenharmony_ci	u_char	vcount_md;
2028c2ecf20Sopenharmony_ci	u_char	char_dummy4;
2038c2ecf20Sopenharmony_ci	u_char	vcount_lo;
2048c2ecf20Sopenharmony_ci	u_short	st_sync;		/* ST compatible sync mode register, unused */
2058c2ecf20Sopenharmony_ci	u_char	char_dummy5;
2068c2ecf20Sopenharmony_ci	u_char	bas_lo;			/* video mem addr, low byte */
2078c2ecf20Sopenharmony_ci	u_char	char_dummy6[2+3*16];
2088c2ecf20Sopenharmony_ci	/* $ffff8240: */
2098c2ecf20Sopenharmony_ci	u_short	color_reg[16];	/* 16 color registers */
2108c2ecf20Sopenharmony_ci	u_char	st_shiftmode;	/* ST compatible shift mode register, unused */
2118c2ecf20Sopenharmony_ci	u_char  char_dummy7;
2128c2ecf20Sopenharmony_ci	u_short tt_shiftmode;	/* TT shift mode register */
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci};
2168c2ecf20Sopenharmony_ci#define	shifter_tt	((*(volatile struct SHIFTER_TT *)SHF_TBAS))
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci/* values for shifter_tt->tt_shiftmode */
2198c2ecf20Sopenharmony_ci#define	TT_SHIFTER_STLOW		0x0000
2208c2ecf20Sopenharmony_ci#define	TT_SHIFTER_STMID		0x0100
2218c2ecf20Sopenharmony_ci#define	TT_SHIFTER_STHIGH		0x0200
2228c2ecf20Sopenharmony_ci#define	TT_SHIFTER_TTLOW		0x0700
2238c2ecf20Sopenharmony_ci#define	TT_SHIFTER_TTMID		0x0400
2248c2ecf20Sopenharmony_ci#define	TT_SHIFTER_TTHIGH		0x0600
2258c2ecf20Sopenharmony_ci#define	TT_SHIFTER_MODEMASK	0x0700
2268c2ecf20Sopenharmony_ci#define TT_SHIFTER_NUMMODE	0x0008
2278c2ecf20Sopenharmony_ci#define	TT_SHIFTER_PALETTE_MASK	0x000f
2288c2ecf20Sopenharmony_ci#define	TT_SHIFTER_GRAYMODE		0x1000
2298c2ecf20Sopenharmony_ci
2308c2ecf20Sopenharmony_ci/* 256 TT palette registers */
2318c2ecf20Sopenharmony_ci#define	TT_PALETTE_BASE	(0xffff8400)
2328c2ecf20Sopenharmony_ci#define	tt_palette	((volatile u_short *)TT_PALETTE_BASE)
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci#define	TT_PALETTE_RED_MASK		0x0f00
2358c2ecf20Sopenharmony_ci#define	TT_PALETTE_GREEN_MASK	0x00f0
2368c2ecf20Sopenharmony_ci#define	TT_PALETTE_BLUE_MASK	0x000f
2378c2ecf20Sopenharmony_ci
2388c2ecf20Sopenharmony_ci/*
2398c2ecf20Sopenharmony_ci** Falcon030 VIDEL Video Controller
2408c2ecf20Sopenharmony_ci** for description see File 'linux\tools\atari\hardware.txt
2418c2ecf20Sopenharmony_ci */
2428c2ecf20Sopenharmony_ci#define f030_col ((u_long *)		0xffff9800)
2438c2ecf20Sopenharmony_ci#define f030_xreg ((u_short*)		0xffff8282)
2448c2ecf20Sopenharmony_ci#define f030_yreg ((u_short*)		0xffff82a2)
2458c2ecf20Sopenharmony_ci#define f030_creg ((u_short*)		0xffff82c0)
2468c2ecf20Sopenharmony_ci#define f030_sreg ((u_short*)		0xffff8260)
2478c2ecf20Sopenharmony_ci#define f030_mreg ((u_short*)		0xffff820a)
2488c2ecf20Sopenharmony_ci#define f030_linewidth ((u_short*)      0xffff820e)
2498c2ecf20Sopenharmony_ci#define f030_hscroll ((u_char*)		0xffff8265)
2508c2ecf20Sopenharmony_ci
2518c2ecf20Sopenharmony_ci#define VIDEL_BAS (0xffff8260)
2528c2ecf20Sopenharmony_cistruct VIDEL {
2538c2ecf20Sopenharmony_ci	u_short st_shift;
2548c2ecf20Sopenharmony_ci	u_short pad1;
2558c2ecf20Sopenharmony_ci	u_char  xoffset_s;
2568c2ecf20Sopenharmony_ci	u_char  xoffset;
2578c2ecf20Sopenharmony_ci	u_short f_shift;
2588c2ecf20Sopenharmony_ci	u_char  pad2[0x1a];
2598c2ecf20Sopenharmony_ci	u_short hht;
2608c2ecf20Sopenharmony_ci	u_short hbb;
2618c2ecf20Sopenharmony_ci	u_short hbe;
2628c2ecf20Sopenharmony_ci	u_short hdb;
2638c2ecf20Sopenharmony_ci	u_short hde;
2648c2ecf20Sopenharmony_ci	u_short hss;
2658c2ecf20Sopenharmony_ci	u_char  pad3[0x14];
2668c2ecf20Sopenharmony_ci	u_short vft;
2678c2ecf20Sopenharmony_ci	u_short vbb;
2688c2ecf20Sopenharmony_ci	u_short vbe;
2698c2ecf20Sopenharmony_ci	u_short vdb;
2708c2ecf20Sopenharmony_ci	u_short vde;
2718c2ecf20Sopenharmony_ci	u_short vss;
2728c2ecf20Sopenharmony_ci	u_char  pad4[0x12];
2738c2ecf20Sopenharmony_ci	u_short control;
2748c2ecf20Sopenharmony_ci	u_short mode;
2758c2ecf20Sopenharmony_ci};
2768c2ecf20Sopenharmony_ci#define	videl	((*(volatile struct VIDEL *)VIDEL_BAS))
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci/*
2798c2ecf20Sopenharmony_ci** DMA/WD1772 Disk Controller
2808c2ecf20Sopenharmony_ci */
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci#define FWD_BAS (0xffff8604)
2838c2ecf20Sopenharmony_cistruct DMA_WD
2848c2ecf20Sopenharmony_ci {
2858c2ecf20Sopenharmony_ci  u_short fdc_acces_seccount;
2868c2ecf20Sopenharmony_ci  u_short dma_mode_status;
2878c2ecf20Sopenharmony_ci  u_char dma_vhi;	/* Some extended ST-DMAs can handle 32 bit addresses */
2888c2ecf20Sopenharmony_ci  u_char dma_hi;
2898c2ecf20Sopenharmony_ci  u_char char_dummy2;
2908c2ecf20Sopenharmony_ci  u_char dma_md;
2918c2ecf20Sopenharmony_ci  u_char char_dummy3;
2928c2ecf20Sopenharmony_ci  u_char dma_lo;
2938c2ecf20Sopenharmony_ci  u_short fdc_speed;
2948c2ecf20Sopenharmony_ci };
2958c2ecf20Sopenharmony_ci# define dma_wd ((*(volatile struct DMA_WD *)FWD_BAS))
2968c2ecf20Sopenharmony_ci/* alias */
2978c2ecf20Sopenharmony_ci#define	st_dma dma_wd
2988c2ecf20Sopenharmony_ci/* The two highest bytes of an extended DMA as a short; this is a must
2998c2ecf20Sopenharmony_ci * for the Medusa.
3008c2ecf20Sopenharmony_ci */
3018c2ecf20Sopenharmony_ci#define st_dma_ext_dmahi (*((volatile unsigned short *)0xffff8608))
3028c2ecf20Sopenharmony_ci
3038c2ecf20Sopenharmony_ci/*
3048c2ecf20Sopenharmony_ci** YM2149 Sound Chip
3058c2ecf20Sopenharmony_ci** access in bytes
3068c2ecf20Sopenharmony_ci */
3078c2ecf20Sopenharmony_ci
3088c2ecf20Sopenharmony_ci#define YM_BAS (0xffff8800)
3098c2ecf20Sopenharmony_cistruct SOUND_YM
3108c2ecf20Sopenharmony_ci {
3118c2ecf20Sopenharmony_ci  u_char rd_data_reg_sel;
3128c2ecf20Sopenharmony_ci  u_char char_dummy1;
3138c2ecf20Sopenharmony_ci  u_char wd_data;
3148c2ecf20Sopenharmony_ci };
3158c2ecf20Sopenharmony_ci#define sound_ym ((*(volatile struct SOUND_YM *)YM_BAS))
3168c2ecf20Sopenharmony_ci
3178c2ecf20Sopenharmony_ci/* TT SCSI DMA */
3188c2ecf20Sopenharmony_ci
3198c2ecf20Sopenharmony_ci#define	TT_SCSI_DMA_BAS	(0xffff8700)
3208c2ecf20Sopenharmony_cistruct TT_DMA {
3218c2ecf20Sopenharmony_ci	u_char	char_dummy0;
3228c2ecf20Sopenharmony_ci	u_char	dma_addr_hi;
3238c2ecf20Sopenharmony_ci	u_char	char_dummy1;
3248c2ecf20Sopenharmony_ci	u_char	dma_addr_hmd;
3258c2ecf20Sopenharmony_ci	u_char	char_dummy2;
3268c2ecf20Sopenharmony_ci	u_char	dma_addr_lmd;
3278c2ecf20Sopenharmony_ci	u_char	char_dummy3;
3288c2ecf20Sopenharmony_ci	u_char	dma_addr_lo;
3298c2ecf20Sopenharmony_ci	u_char	char_dummy4;
3308c2ecf20Sopenharmony_ci	u_char	dma_cnt_hi;
3318c2ecf20Sopenharmony_ci	u_char	char_dummy5;
3328c2ecf20Sopenharmony_ci	u_char	dma_cnt_hmd;
3338c2ecf20Sopenharmony_ci	u_char	char_dummy6;
3348c2ecf20Sopenharmony_ci	u_char	dma_cnt_lmd;
3358c2ecf20Sopenharmony_ci	u_char	char_dummy7;
3368c2ecf20Sopenharmony_ci	u_char	dma_cnt_lo;
3378c2ecf20Sopenharmony_ci	u_long	dma_restdata;
3388c2ecf20Sopenharmony_ci	u_short	dma_ctrl;
3398c2ecf20Sopenharmony_ci};
3408c2ecf20Sopenharmony_ci#define	tt_scsi_dma	((*(volatile struct TT_DMA *)TT_SCSI_DMA_BAS))
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci/* TT SCSI Controller 5380 */
3438c2ecf20Sopenharmony_ci
3448c2ecf20Sopenharmony_ci#define	TT_5380_BAS	(0xffff8781)
3458c2ecf20Sopenharmony_cistruct TT_5380 {
3468c2ecf20Sopenharmony_ci	u_char	scsi_data;
3478c2ecf20Sopenharmony_ci	u_char	char_dummy1;
3488c2ecf20Sopenharmony_ci	u_char	scsi_icr;
3498c2ecf20Sopenharmony_ci	u_char	char_dummy2;
3508c2ecf20Sopenharmony_ci	u_char	scsi_mode;
3518c2ecf20Sopenharmony_ci	u_char	char_dummy3;
3528c2ecf20Sopenharmony_ci	u_char	scsi_tcr;
3538c2ecf20Sopenharmony_ci	u_char	char_dummy4;
3548c2ecf20Sopenharmony_ci	u_char	scsi_idstat;
3558c2ecf20Sopenharmony_ci	u_char	char_dummy5;
3568c2ecf20Sopenharmony_ci	u_char	scsi_dmastat;
3578c2ecf20Sopenharmony_ci	u_char	char_dummy6;
3588c2ecf20Sopenharmony_ci	u_char	scsi_targrcv;
3598c2ecf20Sopenharmony_ci	u_char	char_dummy7;
3608c2ecf20Sopenharmony_ci	u_char	scsi_inircv;
3618c2ecf20Sopenharmony_ci};
3628c2ecf20Sopenharmony_ci#define	tt_scsi			((*(volatile struct TT_5380 *)TT_5380_BAS))
3638c2ecf20Sopenharmony_ci#define	tt_scsi_regp	((volatile char *)TT_5380_BAS)
3648c2ecf20Sopenharmony_ci
3658c2ecf20Sopenharmony_ci
3668c2ecf20Sopenharmony_ci/*
3678c2ecf20Sopenharmony_ci** Falcon DMA Sound Subsystem
3688c2ecf20Sopenharmony_ci */
3698c2ecf20Sopenharmony_ci
3708c2ecf20Sopenharmony_ci#define MATRIX_BASE (0xffff8930)
3718c2ecf20Sopenharmony_cistruct MATRIX
3728c2ecf20Sopenharmony_ci{
3738c2ecf20Sopenharmony_ci  u_short source;
3748c2ecf20Sopenharmony_ci  u_short destination;
3758c2ecf20Sopenharmony_ci  u_char external_frequency_divider;
3768c2ecf20Sopenharmony_ci  u_char internal_frequency_divider;
3778c2ecf20Sopenharmony_ci};
3788c2ecf20Sopenharmony_ci#define falcon_matrix (*(volatile struct MATRIX *)MATRIX_BASE)
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci#define CODEC_BASE (0xffff8936)
3818c2ecf20Sopenharmony_cistruct CODEC
3828c2ecf20Sopenharmony_ci{
3838c2ecf20Sopenharmony_ci  u_char tracks;
3848c2ecf20Sopenharmony_ci  u_char input_source;
3858c2ecf20Sopenharmony_ci#define CODEC_SOURCE_ADC        1
3868c2ecf20Sopenharmony_ci#define CODEC_SOURCE_MATRIX     2
3878c2ecf20Sopenharmony_ci  u_char adc_source;
3888c2ecf20Sopenharmony_ci#define ADC_SOURCE_RIGHT_PSG    1
3898c2ecf20Sopenharmony_ci#define ADC_SOURCE_LEFT_PSG     2
3908c2ecf20Sopenharmony_ci  u_char gain;
3918c2ecf20Sopenharmony_ci#define CODEC_GAIN_RIGHT        0x0f
3928c2ecf20Sopenharmony_ci#define CODEC_GAIN_LEFT         0xf0
3938c2ecf20Sopenharmony_ci  u_char attenuation;
3948c2ecf20Sopenharmony_ci#define CODEC_ATTENUATION_RIGHT 0x0f
3958c2ecf20Sopenharmony_ci#define CODEC_ATTENUATION_LEFT  0xf0
3968c2ecf20Sopenharmony_ci  u_char unused1;
3978c2ecf20Sopenharmony_ci  u_char status;
3988c2ecf20Sopenharmony_ci#define CODEC_OVERFLOW_RIGHT    1
3998c2ecf20Sopenharmony_ci#define CODEC_OVERFLOW_LEFT     2
4008c2ecf20Sopenharmony_ci  u_char unused2, unused3, unused4, unused5;
4018c2ecf20Sopenharmony_ci  u_char gpio_directions;
4028c2ecf20Sopenharmony_ci#define CODEC_GPIO_IN           0
4038c2ecf20Sopenharmony_ci#define CODEC_GPIO_OUT          1
4048c2ecf20Sopenharmony_ci  u_char unused6;
4058c2ecf20Sopenharmony_ci  u_char gpio_data;
4068c2ecf20Sopenharmony_ci};
4078c2ecf20Sopenharmony_ci#define falcon_codec (*(volatile struct CODEC *)CODEC_BASE)
4088c2ecf20Sopenharmony_ci
4098c2ecf20Sopenharmony_ci/*
4108c2ecf20Sopenharmony_ci** Falcon Blitter
4118c2ecf20Sopenharmony_ci*/
4128c2ecf20Sopenharmony_ci
4138c2ecf20Sopenharmony_ci#define BLT_BAS (0xffff8a00)
4148c2ecf20Sopenharmony_ci
4158c2ecf20Sopenharmony_cistruct BLITTER
4168c2ecf20Sopenharmony_ci {
4178c2ecf20Sopenharmony_ci  u_short halftone[16];
4188c2ecf20Sopenharmony_ci  u_short src_x_inc;
4198c2ecf20Sopenharmony_ci  u_short src_y_inc;
4208c2ecf20Sopenharmony_ci  u_long src_address;
4218c2ecf20Sopenharmony_ci  u_short endmask1;
4228c2ecf20Sopenharmony_ci  u_short endmask2;
4238c2ecf20Sopenharmony_ci  u_short endmask3;
4248c2ecf20Sopenharmony_ci  u_short dst_x_inc;
4258c2ecf20Sopenharmony_ci  u_short dst_y_inc;
4268c2ecf20Sopenharmony_ci  u_long dst_address;
4278c2ecf20Sopenharmony_ci  u_short wd_per_line;
4288c2ecf20Sopenharmony_ci  u_short ln_per_bb;
4298c2ecf20Sopenharmony_ci  u_short hlf_op_reg;
4308c2ecf20Sopenharmony_ci  u_short log_op_reg;
4318c2ecf20Sopenharmony_ci  u_short lin_nm_reg;
4328c2ecf20Sopenharmony_ci  u_short skew_reg;
4338c2ecf20Sopenharmony_ci };
4348c2ecf20Sopenharmony_ci# define blitter ((*(volatile struct BLITTER *)BLT_BAS))
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_ci/*
4388c2ecf20Sopenharmony_ci** SCC Z8530
4398c2ecf20Sopenharmony_ci */
4408c2ecf20Sopenharmony_ci
4418c2ecf20Sopenharmony_ci#define SCC_BAS (0xffff8c81)
4428c2ecf20Sopenharmony_cistruct SCC
4438c2ecf20Sopenharmony_ci {
4448c2ecf20Sopenharmony_ci  u_char cha_a_ctrl;
4458c2ecf20Sopenharmony_ci  u_char char_dummy1;
4468c2ecf20Sopenharmony_ci  u_char cha_a_data;
4478c2ecf20Sopenharmony_ci  u_char char_dummy2;
4488c2ecf20Sopenharmony_ci  u_char cha_b_ctrl;
4498c2ecf20Sopenharmony_ci  u_char char_dummy3;
4508c2ecf20Sopenharmony_ci  u_char cha_b_data;
4518c2ecf20Sopenharmony_ci };
4528c2ecf20Sopenharmony_ci# define atari_scc ((*(volatile struct SCC*)SCC_BAS))
4538c2ecf20Sopenharmony_ci
4548c2ecf20Sopenharmony_ci/* The ESCC (Z85230) in an Atari ST. The channels are reversed! */
4558c2ecf20Sopenharmony_ci# define st_escc ((*(volatile struct SCC*)0xfffffa31))
4568c2ecf20Sopenharmony_ci# define st_escc_dsr ((*(volatile char *)0xfffffa39))
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_ci/* TT SCC DMA Controller (same chip as SCSI DMA) */
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci#define	TT_SCC_DMA_BAS	(0xffff8c00)
4618c2ecf20Sopenharmony_ci#define	tt_scc_dma	((*(volatile struct TT_DMA *)TT_SCC_DMA_BAS))
4628c2ecf20Sopenharmony_ci
4638c2ecf20Sopenharmony_ci/*
4648c2ecf20Sopenharmony_ci** VIDEL Palette Register
4658c2ecf20Sopenharmony_ci */
4668c2ecf20Sopenharmony_ci
4678c2ecf20Sopenharmony_ci#define FPL_BAS (0xffff9800)
4688c2ecf20Sopenharmony_cistruct VIDEL_PALETTE
4698c2ecf20Sopenharmony_ci {
4708c2ecf20Sopenharmony_ci  u_long reg[256];
4718c2ecf20Sopenharmony_ci };
4728c2ecf20Sopenharmony_ci# define videl_palette ((*(volatile struct VIDEL_PALETTE*)FPL_BAS))
4738c2ecf20Sopenharmony_ci
4748c2ecf20Sopenharmony_ci
4758c2ecf20Sopenharmony_ci/*
4768c2ecf20Sopenharmony_ci** Falcon DSP Host Interface
4778c2ecf20Sopenharmony_ci */
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci#define DSP56K_HOST_INTERFACE_BASE (0xffffa200)
4808c2ecf20Sopenharmony_cistruct DSP56K_HOST_INTERFACE {
4818c2ecf20Sopenharmony_ci  u_char icr;
4828c2ecf20Sopenharmony_ci#define DSP56K_ICR_RREQ	0x01
4838c2ecf20Sopenharmony_ci#define DSP56K_ICR_TREQ	0x02
4848c2ecf20Sopenharmony_ci#define DSP56K_ICR_HF0	0x08
4858c2ecf20Sopenharmony_ci#define DSP56K_ICR_HF1	0x10
4868c2ecf20Sopenharmony_ci#define DSP56K_ICR_HM0	0x20
4878c2ecf20Sopenharmony_ci#define DSP56K_ICR_HM1	0x40
4888c2ecf20Sopenharmony_ci#define DSP56K_ICR_INIT	0x80
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci  u_char cvr;
4918c2ecf20Sopenharmony_ci#define DSP56K_CVR_HV_MASK 0x1f
4928c2ecf20Sopenharmony_ci#define DSP56K_CVR_HC	0x80
4938c2ecf20Sopenharmony_ci
4948c2ecf20Sopenharmony_ci  u_char isr;
4958c2ecf20Sopenharmony_ci#define DSP56K_ISR_RXDF	0x01
4968c2ecf20Sopenharmony_ci#define DSP56K_ISR_TXDE	0x02
4978c2ecf20Sopenharmony_ci#define DSP56K_ISR_TRDY	0x04
4988c2ecf20Sopenharmony_ci#define DSP56K_ISR_HF2	0x08
4998c2ecf20Sopenharmony_ci#define DSP56K_ISR_HF3	0x10
5008c2ecf20Sopenharmony_ci#define DSP56K_ISR_DMA	0x40
5018c2ecf20Sopenharmony_ci#define DSP56K_ISR_HREQ	0x80
5028c2ecf20Sopenharmony_ci
5038c2ecf20Sopenharmony_ci  u_char ivr;
5048c2ecf20Sopenharmony_ci
5058c2ecf20Sopenharmony_ci  union {
5068c2ecf20Sopenharmony_ci    u_char b[4];
5078c2ecf20Sopenharmony_ci    u_short w[2];
5088c2ecf20Sopenharmony_ci    u_long l;
5098c2ecf20Sopenharmony_ci  } data;
5108c2ecf20Sopenharmony_ci};
5118c2ecf20Sopenharmony_ci#define dsp56k_host_interface ((*(volatile struct DSP56K_HOST_INTERFACE *)DSP56K_HOST_INTERFACE_BASE))
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_ci/*
5148c2ecf20Sopenharmony_ci** MFP 68901
5158c2ecf20Sopenharmony_ci */
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci#define MFP_BAS (0xfffffa01)
5188c2ecf20Sopenharmony_cistruct MFP
5198c2ecf20Sopenharmony_ci {
5208c2ecf20Sopenharmony_ci  u_char par_dt_reg;
5218c2ecf20Sopenharmony_ci  u_char char_dummy1;
5228c2ecf20Sopenharmony_ci  u_char active_edge;
5238c2ecf20Sopenharmony_ci  u_char char_dummy2;
5248c2ecf20Sopenharmony_ci  u_char data_dir;
5258c2ecf20Sopenharmony_ci  u_char char_dummy3;
5268c2ecf20Sopenharmony_ci  u_char int_en_a;
5278c2ecf20Sopenharmony_ci  u_char char_dummy4;
5288c2ecf20Sopenharmony_ci  u_char int_en_b;
5298c2ecf20Sopenharmony_ci  u_char char_dummy5;
5308c2ecf20Sopenharmony_ci  u_char int_pn_a;
5318c2ecf20Sopenharmony_ci  u_char char_dummy6;
5328c2ecf20Sopenharmony_ci  u_char int_pn_b;
5338c2ecf20Sopenharmony_ci  u_char char_dummy7;
5348c2ecf20Sopenharmony_ci  u_char int_sv_a;
5358c2ecf20Sopenharmony_ci  u_char char_dummy8;
5368c2ecf20Sopenharmony_ci  u_char int_sv_b;
5378c2ecf20Sopenharmony_ci  u_char char_dummy9;
5388c2ecf20Sopenharmony_ci  u_char int_mk_a;
5398c2ecf20Sopenharmony_ci  u_char char_dummy10;
5408c2ecf20Sopenharmony_ci  u_char int_mk_b;
5418c2ecf20Sopenharmony_ci  u_char char_dummy11;
5428c2ecf20Sopenharmony_ci  u_char vec_adr;
5438c2ecf20Sopenharmony_ci  u_char char_dummy12;
5448c2ecf20Sopenharmony_ci  u_char tim_ct_a;
5458c2ecf20Sopenharmony_ci  u_char char_dummy13;
5468c2ecf20Sopenharmony_ci  u_char tim_ct_b;
5478c2ecf20Sopenharmony_ci  u_char char_dummy14;
5488c2ecf20Sopenharmony_ci  u_char tim_ct_cd;
5498c2ecf20Sopenharmony_ci  u_char char_dummy15;
5508c2ecf20Sopenharmony_ci  u_char tim_dt_a;
5518c2ecf20Sopenharmony_ci  u_char char_dummy16;
5528c2ecf20Sopenharmony_ci  u_char tim_dt_b;
5538c2ecf20Sopenharmony_ci  u_char char_dummy17;
5548c2ecf20Sopenharmony_ci  u_char tim_dt_c;
5558c2ecf20Sopenharmony_ci  u_char char_dummy18;
5568c2ecf20Sopenharmony_ci  u_char tim_dt_d;
5578c2ecf20Sopenharmony_ci  u_char char_dummy19;
5588c2ecf20Sopenharmony_ci  u_char sync_char;
5598c2ecf20Sopenharmony_ci  u_char char_dummy20;
5608c2ecf20Sopenharmony_ci  u_char usart_ctr;
5618c2ecf20Sopenharmony_ci  u_char char_dummy21;
5628c2ecf20Sopenharmony_ci  u_char rcv_stat;
5638c2ecf20Sopenharmony_ci  u_char char_dummy22;
5648c2ecf20Sopenharmony_ci  u_char trn_stat;
5658c2ecf20Sopenharmony_ci  u_char char_dummy23;
5668c2ecf20Sopenharmony_ci  u_char usart_dta;
5678c2ecf20Sopenharmony_ci };
5688c2ecf20Sopenharmony_ci# define st_mfp ((*(volatile struct MFP*)MFP_BAS))
5698c2ecf20Sopenharmony_ci
5708c2ecf20Sopenharmony_ci/* TT's second MFP */
5718c2ecf20Sopenharmony_ci
5728c2ecf20Sopenharmony_ci#define	TT_MFP_BAS	(0xfffffa81)
5738c2ecf20Sopenharmony_ci# define tt_mfp ((*(volatile struct MFP*)TT_MFP_BAS))
5748c2ecf20Sopenharmony_ci
5758c2ecf20Sopenharmony_ci
5768c2ecf20Sopenharmony_ci/* TT System Control Unit */
5778c2ecf20Sopenharmony_ci
5788c2ecf20Sopenharmony_ci#define	TT_SCU_BAS	(0xffff8e01)
5798c2ecf20Sopenharmony_cistruct TT_SCU {
5808c2ecf20Sopenharmony_ci	u_char	sys_mask;
5818c2ecf20Sopenharmony_ci	u_char	char_dummy1;
5828c2ecf20Sopenharmony_ci	u_char	sys_stat;
5838c2ecf20Sopenharmony_ci	u_char	char_dummy2;
5848c2ecf20Sopenharmony_ci	u_char	softint;
5858c2ecf20Sopenharmony_ci	u_char	char_dummy3;
5868c2ecf20Sopenharmony_ci	u_char	vmeint;
5878c2ecf20Sopenharmony_ci	u_char	char_dummy4;
5888c2ecf20Sopenharmony_ci	u_char	gp_reg1;
5898c2ecf20Sopenharmony_ci	u_char	char_dummy5;
5908c2ecf20Sopenharmony_ci	u_char	gp_reg2;
5918c2ecf20Sopenharmony_ci	u_char	char_dummy6;
5928c2ecf20Sopenharmony_ci	u_char	vme_mask;
5938c2ecf20Sopenharmony_ci	u_char	char_dummy7;
5948c2ecf20Sopenharmony_ci	u_char	vme_stat;
5958c2ecf20Sopenharmony_ci};
5968c2ecf20Sopenharmony_ci#define	tt_scu	((*(volatile struct TT_SCU *)TT_SCU_BAS))
5978c2ecf20Sopenharmony_ci
5988c2ecf20Sopenharmony_ci/* TT real time clock */
5998c2ecf20Sopenharmony_ci
6008c2ecf20Sopenharmony_ci#define	TT_RTC_BAS	(0xffff8961)
6018c2ecf20Sopenharmony_cistruct TT_RTC {
6028c2ecf20Sopenharmony_ci	u_char	regsel;
6038c2ecf20Sopenharmony_ci	u_char	dummy;
6048c2ecf20Sopenharmony_ci	u_char	data;
6058c2ecf20Sopenharmony_ci};
6068c2ecf20Sopenharmony_ci#define	tt_rtc	((*(volatile struct TT_RTC *)TT_RTC_BAS))
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ci
6098c2ecf20Sopenharmony_ci/*
6108c2ecf20Sopenharmony_ci** ACIA 6850
6118c2ecf20Sopenharmony_ci */
6128c2ecf20Sopenharmony_ci/* constants for the ACIA registers */
6138c2ecf20Sopenharmony_ci
6148c2ecf20Sopenharmony_ci/* baudrate selection and reset (Baudrate = clock/factor) */
6158c2ecf20Sopenharmony_ci#define ACIA_DIV1  0
6168c2ecf20Sopenharmony_ci#define ACIA_DIV16 1
6178c2ecf20Sopenharmony_ci#define ACIA_DIV64 2
6188c2ecf20Sopenharmony_ci#define ACIA_RESET 3
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci/* character format */
6218c2ecf20Sopenharmony_ci#define ACIA_D7E2S (0<<2)	/* 7 data, even parity, 2 stop */
6228c2ecf20Sopenharmony_ci#define ACIA_D7O2S (1<<2)	/* 7 data, odd parity, 2 stop */
6238c2ecf20Sopenharmony_ci#define ACIA_D7E1S (2<<2)	/* 7 data, even parity, 1 stop */
6248c2ecf20Sopenharmony_ci#define ACIA_D7O1S (3<<2)	/* 7 data, odd parity, 1 stop */
6258c2ecf20Sopenharmony_ci#define ACIA_D8N2S (4<<2)	/* 8 data, no parity, 2 stop */
6268c2ecf20Sopenharmony_ci#define ACIA_D8N1S (5<<2)	/* 8 data, no parity, 1 stop */
6278c2ecf20Sopenharmony_ci#define ACIA_D8E1S (6<<2)	/* 8 data, even parity, 1 stop */
6288c2ecf20Sopenharmony_ci#define ACIA_D8O1S (7<<2)	/* 8 data, odd parity, 1 stop */
6298c2ecf20Sopenharmony_ci
6308c2ecf20Sopenharmony_ci/* transmit control */
6318c2ecf20Sopenharmony_ci#define ACIA_RLTID (0<<5)	/* RTS low, TxINT disabled */
6328c2ecf20Sopenharmony_ci#define ACIA_RLTIE (1<<5)	/* RTS low, TxINT enabled */
6338c2ecf20Sopenharmony_ci#define ACIA_RHTID (2<<5)	/* RTS high, TxINT disabled */
6348c2ecf20Sopenharmony_ci#define ACIA_RLTIDSB (3<<5)	/* RTS low, TxINT disabled, send break */
6358c2ecf20Sopenharmony_ci
6368c2ecf20Sopenharmony_ci/* receive control */
6378c2ecf20Sopenharmony_ci#define ACIA_RID (0<<7)		/* RxINT disabled */
6388c2ecf20Sopenharmony_ci#define ACIA_RIE (1<<7)		/* RxINT enabled */
6398c2ecf20Sopenharmony_ci
6408c2ecf20Sopenharmony_ci/* status fields of the ACIA */
6418c2ecf20Sopenharmony_ci#define ACIA_RDRF 1		/* Receive Data Register Full */
6428c2ecf20Sopenharmony_ci#define ACIA_TDRE (1<<1)	/* Transmit Data Register Empty */
6438c2ecf20Sopenharmony_ci#define ACIA_DCD  (1<<2)	/* Data Carrier Detect */
6448c2ecf20Sopenharmony_ci#define ACIA_CTS  (1<<3)	/* Clear To Send */
6458c2ecf20Sopenharmony_ci#define ACIA_FE   (1<<4)	/* Framing Error */
6468c2ecf20Sopenharmony_ci#define ACIA_OVRN (1<<5)	/* Receiver Overrun */
6478c2ecf20Sopenharmony_ci#define ACIA_PE   (1<<6)	/* Parity Error */
6488c2ecf20Sopenharmony_ci#define ACIA_IRQ  (1<<7)	/* Interrupt Request */
6498c2ecf20Sopenharmony_ci
6508c2ecf20Sopenharmony_ci#define ACIA_BAS (0xfffffc00)
6518c2ecf20Sopenharmony_cistruct ACIA
6528c2ecf20Sopenharmony_ci {
6538c2ecf20Sopenharmony_ci  u_char key_ctrl;
6548c2ecf20Sopenharmony_ci  u_char char_dummy1;
6558c2ecf20Sopenharmony_ci  u_char key_data;
6568c2ecf20Sopenharmony_ci  u_char char_dummy2;
6578c2ecf20Sopenharmony_ci  u_char mid_ctrl;
6588c2ecf20Sopenharmony_ci  u_char char_dummy3;
6598c2ecf20Sopenharmony_ci  u_char mid_data;
6608c2ecf20Sopenharmony_ci };
6618c2ecf20Sopenharmony_ci# define acia ((*(volatile struct ACIA*)ACIA_BAS))
6628c2ecf20Sopenharmony_ci
6638c2ecf20Sopenharmony_ci#define	TT_DMASND_BAS (0xffff8900)
6648c2ecf20Sopenharmony_cistruct TT_DMASND {
6658c2ecf20Sopenharmony_ci	u_char	int_ctrl;	/* Falcon: Interrupt control */
6668c2ecf20Sopenharmony_ci	u_char	ctrl;
6678c2ecf20Sopenharmony_ci	u_char	pad2;
6688c2ecf20Sopenharmony_ci	u_char	bas_hi;
6698c2ecf20Sopenharmony_ci	u_char	pad3;
6708c2ecf20Sopenharmony_ci	u_char	bas_mid;
6718c2ecf20Sopenharmony_ci	u_char	pad4;
6728c2ecf20Sopenharmony_ci	u_char	bas_low;
6738c2ecf20Sopenharmony_ci	u_char	pad5;
6748c2ecf20Sopenharmony_ci	u_char	addr_hi;
6758c2ecf20Sopenharmony_ci	u_char	pad6;
6768c2ecf20Sopenharmony_ci	u_char	addr_mid;
6778c2ecf20Sopenharmony_ci	u_char	pad7;
6788c2ecf20Sopenharmony_ci	u_char	addr_low;
6798c2ecf20Sopenharmony_ci	u_char	pad8;
6808c2ecf20Sopenharmony_ci	u_char	end_hi;
6818c2ecf20Sopenharmony_ci	u_char	pad9;
6828c2ecf20Sopenharmony_ci	u_char	end_mid;
6838c2ecf20Sopenharmony_ci	u_char	pad10;
6848c2ecf20Sopenharmony_ci	u_char	end_low;
6858c2ecf20Sopenharmony_ci	u_char	pad11[12];
6868c2ecf20Sopenharmony_ci	u_char	track_select;	/* Falcon */
6878c2ecf20Sopenharmony_ci	u_char	mode;
6888c2ecf20Sopenharmony_ci	u_char	pad12[14];
6898c2ecf20Sopenharmony_ci	/* Falcon only: */
6908c2ecf20Sopenharmony_ci	u_short	cbar_src;
6918c2ecf20Sopenharmony_ci	u_short cbar_dst;
6928c2ecf20Sopenharmony_ci	u_char	ext_div;
6938c2ecf20Sopenharmony_ci	u_char	int_div;
6948c2ecf20Sopenharmony_ci	u_char	rec_track_select;
6958c2ecf20Sopenharmony_ci	u_char	dac_src;
6968c2ecf20Sopenharmony_ci	u_char	adc_src;
6978c2ecf20Sopenharmony_ci	u_char	input_gain;
6988c2ecf20Sopenharmony_ci	u_short	output_atten;
6998c2ecf20Sopenharmony_ci};
7008c2ecf20Sopenharmony_ci# define tt_dmasnd ((*(volatile struct TT_DMASND *)TT_DMASND_BAS))
7018c2ecf20Sopenharmony_ci
7028c2ecf20Sopenharmony_ci#define DMASND_MFP_INT_REPLAY     0x01
7038c2ecf20Sopenharmony_ci#define DMASND_MFP_INT_RECORD     0x02
7048c2ecf20Sopenharmony_ci#define DMASND_TIMERA_INT_REPLAY  0x04
7058c2ecf20Sopenharmony_ci#define DMASND_TIMERA_INT_RECORD  0x08
7068c2ecf20Sopenharmony_ci
7078c2ecf20Sopenharmony_ci#define	DMASND_CTRL_OFF		  0x00
7088c2ecf20Sopenharmony_ci#define	DMASND_CTRL_ON		  0x01
7098c2ecf20Sopenharmony_ci#define	DMASND_CTRL_REPEAT	  0x02
7108c2ecf20Sopenharmony_ci#define DMASND_CTRL_RECORD_ON     0x10
7118c2ecf20Sopenharmony_ci#define DMASND_CTRL_RECORD_OFF    0x00
7128c2ecf20Sopenharmony_ci#define DMASND_CTRL_RECORD_REPEAT 0x20
7138c2ecf20Sopenharmony_ci#define DMASND_CTRL_SELECT_REPLAY 0x00
7148c2ecf20Sopenharmony_ci#define DMASND_CTRL_SELECT_RECORD 0x80
7158c2ecf20Sopenharmony_ci#define	DMASND_MODE_MONO	  0x80
7168c2ecf20Sopenharmony_ci#define	DMASND_MODE_STEREO	  0x00
7178c2ecf20Sopenharmony_ci#define DMASND_MODE_8BIT	  0x00
7188c2ecf20Sopenharmony_ci#define DMASND_MODE_16BIT	  0x40	/* Falcon only */
7198c2ecf20Sopenharmony_ci#define	DMASND_MODE_6KHZ	  0x00	/* Falcon: mute */
7208c2ecf20Sopenharmony_ci#define	DMASND_MODE_12KHZ	  0x01
7218c2ecf20Sopenharmony_ci#define	DMASND_MODE_25KHZ	  0x02
7228c2ecf20Sopenharmony_ci#define	DMASND_MODE_50KHZ	  0x03
7238c2ecf20Sopenharmony_ci
7248c2ecf20Sopenharmony_ci
7258c2ecf20Sopenharmony_ci#define DMASNDSetBase(bufstart)						\
7268c2ecf20Sopenharmony_ci    do {								\
7278c2ecf20Sopenharmony_ci	tt_dmasnd.bas_hi  = (unsigned char)(((bufstart) & 0xff0000) >> 16); \
7288c2ecf20Sopenharmony_ci	tt_dmasnd.bas_mid = (unsigned char)(((bufstart) & 0x00ff00) >> 8); \
7298c2ecf20Sopenharmony_ci	tt_dmasnd.bas_low = (unsigned char) ((bufstart) & 0x0000ff); \
7308c2ecf20Sopenharmony_ci    } while( 0 )
7318c2ecf20Sopenharmony_ci
7328c2ecf20Sopenharmony_ci#define DMASNDGetAdr() ((tt_dmasnd.addr_hi << 16) +	\
7338c2ecf20Sopenharmony_ci			(tt_dmasnd.addr_mid << 8) +	\
7348c2ecf20Sopenharmony_ci			(tt_dmasnd.addr_low))
7358c2ecf20Sopenharmony_ci
7368c2ecf20Sopenharmony_ci#define DMASNDSetEnd(bufend)				\
7378c2ecf20Sopenharmony_ci    do {						\
7388c2ecf20Sopenharmony_ci	tt_dmasnd.end_hi  = (unsigned char)(((bufend) & 0xff0000) >> 16); \
7398c2ecf20Sopenharmony_ci	tt_dmasnd.end_mid = (unsigned char)(((bufend) & 0x00ff00) >> 8); \
7408c2ecf20Sopenharmony_ci	tt_dmasnd.end_low = (unsigned char) ((bufend) & 0x0000ff); \
7418c2ecf20Sopenharmony_ci    } while( 0 )
7428c2ecf20Sopenharmony_ci
7438c2ecf20Sopenharmony_ci
7448c2ecf20Sopenharmony_ci#define	TT_MICROWIRE_BAS	(0xffff8922)
7458c2ecf20Sopenharmony_cistruct TT_MICROWIRE {
7468c2ecf20Sopenharmony_ci	u_short	data;
7478c2ecf20Sopenharmony_ci	u_short	mask;
7488c2ecf20Sopenharmony_ci};
7498c2ecf20Sopenharmony_ci# define tt_microwire ((*(volatile struct TT_MICROWIRE *)TT_MICROWIRE_BAS))
7508c2ecf20Sopenharmony_ci
7518c2ecf20Sopenharmony_ci#define	MW_LM1992_ADDR		0x0400
7528c2ecf20Sopenharmony_ci
7538c2ecf20Sopenharmony_ci#define	MW_LM1992_VOLUME(dB)	\
7548c2ecf20Sopenharmony_ci    (0x0c0 | ((dB) < -80 ? 0 : (dB) > 0 ? 40 : (((dB) + 80) / 2)))
7558c2ecf20Sopenharmony_ci#define	MW_LM1992_BALLEFT(dB)	\
7568c2ecf20Sopenharmony_ci    (0x140 | ((dB) < -40 ? 0 : (dB) > 0 ? 20 : (((dB) + 40) / 2)))
7578c2ecf20Sopenharmony_ci#define	MW_LM1992_BALRIGHT(dB)	\
7588c2ecf20Sopenharmony_ci    (0x100 | ((dB) < -40 ? 0 : (dB) > 0 ? 20 : (((dB) + 40) / 2)))
7598c2ecf20Sopenharmony_ci#define	MW_LM1992_TREBLE(dB)	\
7608c2ecf20Sopenharmony_ci    (0x080 | ((dB) < -12 ? 0 : (dB) > 12 ? 12 : (((dB) / 2) + 6)))
7618c2ecf20Sopenharmony_ci#define	MW_LM1992_BASS(dB)	\
7628c2ecf20Sopenharmony_ci    (0x040 | ((dB) < -12 ? 0 : (dB) > 12 ? 12 : (((dB) / 2) + 6)))
7638c2ecf20Sopenharmony_ci
7648c2ecf20Sopenharmony_ci#define	MW_LM1992_PSG_LOW	0x000
7658c2ecf20Sopenharmony_ci#define	MW_LM1992_PSG_HIGH	0x001
7668c2ecf20Sopenharmony_ci#define	MW_LM1992_PSG_OFF	0x002
7678c2ecf20Sopenharmony_ci
7688c2ecf20Sopenharmony_ci#define MSTE_RTC_BAS	(0xfffffc21)
7698c2ecf20Sopenharmony_ci
7708c2ecf20Sopenharmony_cistruct MSTE_RTC {
7718c2ecf20Sopenharmony_ci	u_char sec_ones;
7728c2ecf20Sopenharmony_ci	u_char dummy1;
7738c2ecf20Sopenharmony_ci	u_char sec_tens;
7748c2ecf20Sopenharmony_ci	u_char dummy2;
7758c2ecf20Sopenharmony_ci	u_char min_ones;
7768c2ecf20Sopenharmony_ci	u_char dummy3;
7778c2ecf20Sopenharmony_ci	u_char min_tens;
7788c2ecf20Sopenharmony_ci	u_char dummy4;
7798c2ecf20Sopenharmony_ci	u_char hr_ones;
7808c2ecf20Sopenharmony_ci	u_char dummy5;
7818c2ecf20Sopenharmony_ci	u_char hr_tens;
7828c2ecf20Sopenharmony_ci	u_char dummy6;
7838c2ecf20Sopenharmony_ci	u_char weekday;
7848c2ecf20Sopenharmony_ci	u_char dummy7;
7858c2ecf20Sopenharmony_ci	u_char day_ones;
7868c2ecf20Sopenharmony_ci	u_char dummy8;
7878c2ecf20Sopenharmony_ci	u_char day_tens;
7888c2ecf20Sopenharmony_ci	u_char dummy9;
7898c2ecf20Sopenharmony_ci	u_char mon_ones;
7908c2ecf20Sopenharmony_ci	u_char dummy10;
7918c2ecf20Sopenharmony_ci	u_char mon_tens;
7928c2ecf20Sopenharmony_ci	u_char dummy11;
7938c2ecf20Sopenharmony_ci	u_char year_ones;
7948c2ecf20Sopenharmony_ci	u_char dummy12;
7958c2ecf20Sopenharmony_ci	u_char year_tens;
7968c2ecf20Sopenharmony_ci	u_char dummy13;
7978c2ecf20Sopenharmony_ci	u_char mode;
7988c2ecf20Sopenharmony_ci	u_char dummy14;
7998c2ecf20Sopenharmony_ci	u_char test;
8008c2ecf20Sopenharmony_ci	u_char dummy15;
8018c2ecf20Sopenharmony_ci	u_char reset;
8028c2ecf20Sopenharmony_ci};
8038c2ecf20Sopenharmony_ci
8048c2ecf20Sopenharmony_ci#define mste_rtc ((*(volatile struct MSTE_RTC *)MSTE_RTC_BAS))
8058c2ecf20Sopenharmony_ci
8068c2ecf20Sopenharmony_ci/*
8078c2ecf20Sopenharmony_ci** EtherNAT add-on card for Falcon - combined ethernet and USB adapter
8088c2ecf20Sopenharmony_ci*/
8098c2ecf20Sopenharmony_ci
8108c2ecf20Sopenharmony_ci#define ATARI_ETHERNAT_PHYS_ADDR	0x80000000
8118c2ecf20Sopenharmony_ci
8128c2ecf20Sopenharmony_ci#endif /* linux/atarihw.h */
8138c2ecf20Sopenharmony_ci
814