1 /* 2 * Mach Operating System 3 * Copyright (c) 1992 Carnegie Mellon University 4 * All Rights Reserved. 5 * 6 * Permission to use, copy, modify and distribute this software and its 7 * documentation is hereby granted, provided that both the copyright 8 * notice and this permission notice appear in all copies of the 9 * software, derivative works or modified versions, and any portions 10 * thereof, and that both notices appear in supporting documentation. 11 * 12 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 13 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR 14 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 15 * 16 * Carnegie Mellon requests users of this software to return to 17 * 18 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU 19 * School of Computer Science 20 * Carnegie Mellon University 21 * Pittsburgh PA 15213-3890 22 * 23 * any improvements or extensions that they make and grant Carnegie Mellon 24 * the rights to redistribute these changes. 25 */ 26 /* This is a rewrite (retype) of the Amiga's CIA chip register map, based 27 on the Hardware Reference Manual. It is NOT based on the Amiga's 28 hardware/cia.h. */ 29 30 #ifndef _amiga_cia_ 31 #define _amiga_cia_ 32 33 #define PHYS_CIAA 0xbfe001 34 #define PHYS_CIAB 0xbfd000 35 36 37 struct CIA 38 { 39 volatile unsigned char pra; char pad0[0xff]; 40 volatile unsigned char prb; char pad1[0xff]; 41 volatile unsigned char ddra; char pad2[0xff]; 42 volatile unsigned char ddrb; char pad3[0xff]; 43 volatile unsigned char talo; char pad4[0xff]; 44 volatile unsigned char tahi; char pad5[0xff]; 45 volatile unsigned char tblo; char pad6[0xff]; 46 volatile unsigned char tbhi; char pad7[0xff]; 47 volatile unsigned char todlo; char pad8[0xff]; 48 volatile unsigned char todmid; char pad9[0xff]; 49 volatile unsigned char todhi; char pada[0x1ff]; 50 volatile unsigned char sdr; char padc[0xff]; 51 volatile unsigned char icr; char padd[0xff]; 52 volatile unsigned char cra; char pade[0xff]; 53 volatile unsigned char crb; char padf[0xff]; 54 }; 55 56 57 #ifdef KERNEL 58 #ifndef LOCORE 59 extern caddr_t CIAAbase, CIABbase; 60 #endif 61 62 #define ciaa (*((volatile struct CIA *)CIAAbase)) 63 #define ciab (*((volatile struct CIA *)CIABbase)) 64 #endif 65 66 /* bits in CIA-B */ 67 #define CIAB_PRA_BUSY (1<<0) 68 #define CIAB_PRA_POUT (1<<1) 69 #define CIAB_PRA_SEL (1<<2) 70 #define CIAB_PRA_DSR (1<<3) 71 #define CIAB_PRA_CTS (1<<4) 72 #define CIAB_PRA_CD (1<<5) 73 #define CIAB_PRA_RTS (1<<6) 74 #define CIAB_PRA_DTR (1<<7) 75 76 #define CIAB_PRB_STEP (1<<0) 77 #define CIAB_PRB_DIR (1<<1) 78 #define CIAB_PRB_SIDE (1<<2) 79 #define CIAB_PRB_SEL0 (1<<3) 80 #define CIAB_PRB_SEL1 (1<<4) 81 #define CIAB_PRB_SEL2 (1<<5) 82 #define CIAB_PRB_SEL3 (1<<6) 83 #define CIAB_PRB_MTR (1<<7) 84 85 /* bits in CIA-A */ 86 #define CIAA_PRA_OVL (1<<0) 87 #define CIAA_PRA_LED (1<<1) 88 #define CIAA_PRA_CHNG (1<<2) 89 #define CIAA_PRA_WPRO (1<<3) 90 #define CIAA_PRA_TK0 (1<<4) 91 #define CIAA_PRA_RDY (1<<5) 92 #define CIAA_PRA_FIR0 (1<<6) 93 #define CIAA_PRA_FIR1 (1<<7) 94 95 /* ciaa-prb is centronics interface */ 96 97 98 /* since many CIA signals are low-active, these defines should make the 99 code more readable */ 100 #define SETDCD(c) (c &= ~CIAB_PRA_CD) 101 #define CLRDCD(c) (c |= CIAB_PRA_CD) 102 #define ISDCD(c) (!(c & CIAB_PRA_CD)) 103 104 #define SETCTS(c) (c &= ~CIAB_PRA_CTS) 105 #define CLRCTS(c) (c |= CIAB_PRA_CTS) 106 #define ISCTS(c) (!(c & CIAB_PRA_CTS)) 107 108 #define SETRTS(c) (c &= ~CIAB_PRA_RTS) 109 #define CLRRTS(c) (c |= CIAB_PRA_RTS) 110 #define ISRTS(c) (!(c & CIAB_PRA_RTS)) 111 112 #define SETDTR(c) (c &= ~CIAB_PRA_DTR) 113 #define CLRDTR(c) (c |= CIAB_PRA_DTR) 114 #define ISDTR(c) (!(c & CIAB_PRA_DTR)) 115 116 #define SETDSR(c) (c &= ~CIAB_PRA_DSR) 117 #define CLRDSR(c) (c |= CIAB_PRA_DSR) 118 #define ISDSR(c) (!(c & CIAB_PRA_DSR)) 119 120 #endif _amiga_cia_ 121