Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _MC6821_H_
0003 #define _MC6821_H_
0004 
0005 /*
0006  * This file describes the memery mapping of the MC6821 PIA.
0007  * The unions describe overlayed registers. Which of them is used is
0008  * determined by bit 2 of the corresponding control register.
0009  * this files expects the PIA_REG_PADWIDTH to be defined the numeric
0010  * value of the register spacing.
0011  *
0012  * Data came from MFC-31-Developer Kit (from Ralph Seidel,
0013  * zodiac@darkness.gun.de) and Motorola Data Sheet (from 
0014  * Richard Hirst, srh@gpt.co.uk)
0015  *
0016  * 6.11.95 copyright Joerg Dorchain (dorchain@mpi-sb.mpg.de)
0017  *
0018  */
0019 
0020 #ifndef PIA_REG_PADWIDTH
0021 #define PIA_REG_PADWIDTH 255
0022 #endif
0023 
0024 struct pia {
0025     union {
0026         volatile u_char pra;
0027         volatile u_char ddra;
0028     } ua;
0029     u_char pad1[PIA_REG_PADWIDTH];
0030     volatile u_char cra;
0031     u_char pad2[PIA_REG_PADWIDTH];
0032     union {
0033         volatile u_char prb;
0034         volatile u_char ddrb;
0035     } ub;
0036     u_char pad3[PIA_REG_PADWIDTH];
0037     volatile u_char crb;
0038     u_char pad4[PIA_REG_PADWIDTH];
0039 };
0040 
0041 #define ppra ua.pra
0042 #define pddra ua.ddra
0043 #define pprb ub.prb
0044 #define pddrb ub.ddrb
0045 
0046 #define PIA_C1_ENABLE_IRQ (1<<0)
0047 #define PIA_C1_LOW_TO_HIGH (1<<1)
0048 #define PIA_DDR (1<<2)
0049 #define PIA_IRQ2 (1<<6)
0050 #define PIA_IRQ1 (1<<7)
0051 
0052 #endif