xref: /netbsd/sys/arch/atari/include/scu.h (revision 6550d01e)
1 /*	$NetBSD: scu.h,v 1.2 2009/10/20 19:10:11 snj Exp $	*/
2 
3 /*
4  * Copyright (c) 1995 Leo Weppelman.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef _MACHINE_SCU_H
29 #define _MACHINE_SCU_H
30 /*
31  * Atari TT hardware:
32  * SCU registers
33  */
34 
35 #define	SCU	((struct scu *)AD_SCU)
36 
37 
38 /*
39  * System control unit
40  */
41 struct scu {
42 	volatile u_char	fil1;
43 	volatile u_char	sys_mask;	/* System interrupt mask	*/
44 	volatile u_char	fil2;
45 	volatile u_char	sys_stat;	/* System interrupt status	*/
46 	volatile u_char	fil3;
47 	volatile u_char	sys_int;	/* System interrupter		*/
48 	volatile u_char	fil4;
49 	volatile u_char	vme_int;	/* VME interrupter		*/
50 	volatile u_char	fil5;
51 	volatile u_char	gen_reg1;	/* General purpose reg. 1	*/
52 	volatile u_char	fil6;
53 	volatile u_char	gen_reg2;	/* General purpose reg. 2	*/
54 	volatile u_char	fil7;
55 	volatile u_char	vme_mask;	/* VME interrupt mask		*/
56 	volatile u_char	fil8;
57 	volatile u_char	vme_stat;	/* VME interrupt status		*/
58 };
59 
60 /*
61  * Bits for system mask & stat.
62  * Read 'sys_stat' first, reading 'sys_mask' clears pending bits in 'sys_stat'.
63  */
64 #define	SCU_SYSFAIL	0x80	/* _Sysfail in VME bus (Auto vectored)	*/
65 #define	SCU_MFP		0x40	/* MFP interrupt (Programmable)		*/
66 #define	SCU_SCC		0x20	/* SCC interrupt (Programmable)		*/
67 #define	SCU_VSYNC	0x10	/* Vertical Sync (Auto vectored)	*/
68 		     /* 0x08 Not Used */
69 #define	SCU_HSYNC	0x04	/* Horizontal Sync (Auto vectored)	*/
70 #define	SCU_SYS_SOFT	0x02	/* System Software INT (Auto vectored)	*/
71 		     /* 0x00 Not Used */
72 
73 /*
74  * Bits for VME mask & stat.
75  * Read 'vme_stat' first, reading 'vme_mask' clears pending bits in 'vme_stat'.
76  * Not that MFP/SCC interrupts are hard-wired to the mentioned VME IRQ's.
77  * (or'ed).
78  */
79 #define	SCU_IRQ7	0x80
80 #define	SCU_IQ6_MFP	0x40	/* Also MFP interrupt			*/
81 #define	SCU_IRQ5_SCC	0x20	/* Also SCC interrupt			*/
82 #define	SCU_IRQ4	0x10
83 #define	SCU_IRQ3_SOFT	0x08	/* Also VME Software interrupt		*/
84 #define	SCU_IRQ2	0x04
85 #define	SCU_IRQ1	0x02
86 		     /* 0x00 Not Used */
87 
88 /*
89  * Generate/remove Software system interrupt.
90  * Note: Will not be cleared automatically!!
91  */
92 #define	SET_SOFT_INT	(SCU->sys_int = 1)
93 #define	CLR_SOFT_INT	(SCU->sys_int = 0)
94 
95 /*
96  * Generate/remove Software VME interrupt.
97  * Note: Will not be cleared automatically!!
98  */
99 #define	SET_VME_INT	(SCU->vme_int = 1)
100 #define	CLR_VME_INT	(SCU->vme_int = 0)
101 #endif /* _MACHINE_SCU_H */
102