18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci/* include/asm-m68knommu/MC68328.h: '328 control registers
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 1999  Vladimir Gurevich <vgurevic@cisco.com>
68c2ecf20Sopenharmony_ci *                     Bear & Hare Software, Inc.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Based on include/asm-m68knommu/MC68332.h
98c2ecf20Sopenharmony_ci * Copyright (C) 1998  Kenneth Albanowski <kjahds@kjahds.com>,
108c2ecf20Sopenharmony_ci *
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci#include <linux/compiler.h>
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#ifndef _MC68328_H_
158c2ecf20Sopenharmony_ci#define _MC68328_H_
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#define BYTE_REF(addr) (*((volatile unsigned char*)addr))
188c2ecf20Sopenharmony_ci#define WORD_REF(addr) (*((volatile unsigned short*)addr))
198c2ecf20Sopenharmony_ci#define LONG_REF(addr) (*((volatile unsigned long*)addr))
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define PUT_FIELD(field, val) (((val) << field##_SHIFT) & field##_MASK)
228c2ecf20Sopenharmony_ci#define GET_FIELD(reg, field) (((reg) & field##_MASK) >> field##_SHIFT)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci/**********
258c2ecf20Sopenharmony_ci *
268c2ecf20Sopenharmony_ci * 0xFFFFF0xx -- System Control
278c2ecf20Sopenharmony_ci *
288c2ecf20Sopenharmony_ci **********/
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci/*
318c2ecf20Sopenharmony_ci * System Control Register (SCR)
328c2ecf20Sopenharmony_ci */
338c2ecf20Sopenharmony_ci#define SCR_ADDR	0xfffff000
348c2ecf20Sopenharmony_ci#define SCR		BYTE_REF(SCR_ADDR)
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define SCR_WDTH8	0x01	/* 8-Bit Width Select */
378c2ecf20Sopenharmony_ci#define SCR_DMAP	0x04	/* Double Map */
388c2ecf20Sopenharmony_ci#define SCR_SO		0x08	/* Supervisor Only */
398c2ecf20Sopenharmony_ci#define SCR_BETEN	0x10	/* Bus-Error Time-Out Enable */
408c2ecf20Sopenharmony_ci#define SCR_PRV		0x20	/* Privilege Violation */
418c2ecf20Sopenharmony_ci#define SCR_WPV		0x40	/* Write Protect Violation */
428c2ecf20Sopenharmony_ci#define SCR_BETO	0x80	/* Bus-Error TimeOut */
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/*
458c2ecf20Sopenharmony_ci * Mask Revision Register
468c2ecf20Sopenharmony_ci */
478c2ecf20Sopenharmony_ci#define MRR_ADDR 0xfffff004
488c2ecf20Sopenharmony_ci#define MRR      LONG_REF(MRR_ADDR)
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci/**********
518c2ecf20Sopenharmony_ci *
528c2ecf20Sopenharmony_ci * 0xFFFFF1xx -- Chip-Select logic
538c2ecf20Sopenharmony_ci *
548c2ecf20Sopenharmony_ci **********/
558c2ecf20Sopenharmony_ci
568c2ecf20Sopenharmony_ci/**********
578c2ecf20Sopenharmony_ci *
588c2ecf20Sopenharmony_ci * 0xFFFFF2xx -- Phase Locked Loop (PLL) & Power Control
598c2ecf20Sopenharmony_ci *
608c2ecf20Sopenharmony_ci **********/
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/*
638c2ecf20Sopenharmony_ci * Group Base Address Registers
648c2ecf20Sopenharmony_ci */
658c2ecf20Sopenharmony_ci#define GRPBASEA_ADDR	0xfffff100
668c2ecf20Sopenharmony_ci#define GRPBASEB_ADDR	0xfffff102
678c2ecf20Sopenharmony_ci#define GRPBASEC_ADDR	0xfffff104
688c2ecf20Sopenharmony_ci#define GRPBASED_ADDR	0xfffff106
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#define GRPBASEA	WORD_REF(GRPBASEA_ADDR)
718c2ecf20Sopenharmony_ci#define GRPBASEB	WORD_REF(GRPBASEB_ADDR)
728c2ecf20Sopenharmony_ci#define GRPBASEC	WORD_REF(GRPBASEC_ADDR)
738c2ecf20Sopenharmony_ci#define GRPBASED	WORD_REF(GRPBASED_ADDR)
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci#define GRPBASE_V	  0x0001	/* Valid */
768c2ecf20Sopenharmony_ci#define GRPBASE_GBA_MASK  0xfff0	/* Group Base Address (bits 31-20) */
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci/*
798c2ecf20Sopenharmony_ci * Group Base Address Mask Registers
808c2ecf20Sopenharmony_ci */
818c2ecf20Sopenharmony_ci#define GRPMASKA_ADDR	0xfffff108
828c2ecf20Sopenharmony_ci#define GRPMASKB_ADDR	0xfffff10a
838c2ecf20Sopenharmony_ci#define GRPMASKC_ADDR	0xfffff10c
848c2ecf20Sopenharmony_ci#define GRPMASKD_ADDR	0xfffff10e
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci#define GRPMASKA	WORD_REF(GRPMASKA_ADDR)
878c2ecf20Sopenharmony_ci#define GRPMASKB	WORD_REF(GRPMASKB_ADDR)
888c2ecf20Sopenharmony_ci#define GRPMASKC	WORD_REF(GRPMASKC_ADDR)
898c2ecf20Sopenharmony_ci#define GRPMASKD	WORD_REF(GRPMASKD_ADDR)
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#define GRMMASK_GMA_MASK 0xfffff0	/* Group Base Mask (bits 31-20) */
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci/*
948c2ecf20Sopenharmony_ci * Chip-Select Option Registers (group A)
958c2ecf20Sopenharmony_ci */
968c2ecf20Sopenharmony_ci#define CSA0_ADDR	0xfffff110
978c2ecf20Sopenharmony_ci#define CSA1_ADDR	0xfffff114
988c2ecf20Sopenharmony_ci#define CSA2_ADDR	0xfffff118
998c2ecf20Sopenharmony_ci#define CSA3_ADDR	0xfffff11c
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ci#define CSA0		LONG_REF(CSA0_ADDR)
1028c2ecf20Sopenharmony_ci#define CSA1		LONG_REF(CSA1_ADDR)
1038c2ecf20Sopenharmony_ci#define CSA2		LONG_REF(CSA2_ADDR)
1048c2ecf20Sopenharmony_ci#define CSA3		LONG_REF(CSA3_ADDR)
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define CSA_WAIT_MASK	0x00000007	/* Wait State Selection */
1078c2ecf20Sopenharmony_ci#define CSA_WAIT_SHIFT	0
1088c2ecf20Sopenharmony_ci#define CSA_RO		0x00000008	/* Read-Only */
1098c2ecf20Sopenharmony_ci#define CSA_AM_MASK	0x0000ff00	/* Address Mask (bits 23-16) */
1108c2ecf20Sopenharmony_ci#define CSA_AM_SHIFT	8
1118c2ecf20Sopenharmony_ci#define CSA_BUSW	0x00010000	/* Bus Width Select */
1128c2ecf20Sopenharmony_ci#define CSA_AC_MASK	0xff000000	/* Address Compare (bits 23-16) */
1138c2ecf20Sopenharmony_ci#define CSA_AC_SHIFT	24
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci/*
1168c2ecf20Sopenharmony_ci * Chip-Select Option Registers (group B)
1178c2ecf20Sopenharmony_ci */
1188c2ecf20Sopenharmony_ci#define CSB0_ADDR	0xfffff120
1198c2ecf20Sopenharmony_ci#define CSB1_ADDR	0xfffff124
1208c2ecf20Sopenharmony_ci#define CSB2_ADDR	0xfffff128
1218c2ecf20Sopenharmony_ci#define CSB3_ADDR	0xfffff12c
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci#define CSB0		LONG_REF(CSB0_ADDR)
1248c2ecf20Sopenharmony_ci#define CSB1		LONG_REF(CSB1_ADDR)
1258c2ecf20Sopenharmony_ci#define CSB2		LONG_REF(CSB2_ADDR)
1268c2ecf20Sopenharmony_ci#define CSB3		LONG_REF(CSB3_ADDR)
1278c2ecf20Sopenharmony_ci
1288c2ecf20Sopenharmony_ci#define CSB_WAIT_MASK	0x00000007	/* Wait State Selection */
1298c2ecf20Sopenharmony_ci#define CSB_WAIT_SHIFT	0
1308c2ecf20Sopenharmony_ci#define CSB_RO		0x00000008	/* Read-Only */
1318c2ecf20Sopenharmony_ci#define CSB_AM_MASK	0x0000ff00	/* Address Mask (bits 23-16) */
1328c2ecf20Sopenharmony_ci#define CSB_AM_SHIFT	8
1338c2ecf20Sopenharmony_ci#define CSB_BUSW	0x00010000	/* Bus Width Select */
1348c2ecf20Sopenharmony_ci#define CSB_AC_MASK	0xff000000	/* Address Compare (bits 23-16) */
1358c2ecf20Sopenharmony_ci#define CSB_AC_SHIFT	24
1368c2ecf20Sopenharmony_ci
1378c2ecf20Sopenharmony_ci/*
1388c2ecf20Sopenharmony_ci * Chip-Select Option Registers (group C)
1398c2ecf20Sopenharmony_ci */
1408c2ecf20Sopenharmony_ci#define CSC0_ADDR	0xfffff130
1418c2ecf20Sopenharmony_ci#define CSC1_ADDR	0xfffff134
1428c2ecf20Sopenharmony_ci#define CSC2_ADDR	0xfffff138
1438c2ecf20Sopenharmony_ci#define CSC3_ADDR	0xfffff13c
1448c2ecf20Sopenharmony_ci
1458c2ecf20Sopenharmony_ci#define CSC0		LONG_REF(CSC0_ADDR)
1468c2ecf20Sopenharmony_ci#define CSC1		LONG_REF(CSC1_ADDR)
1478c2ecf20Sopenharmony_ci#define CSC2		LONG_REF(CSC2_ADDR)
1488c2ecf20Sopenharmony_ci#define CSC3		LONG_REF(CSC3_ADDR)
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci#define CSC_WAIT_MASK	0x00000007	/* Wait State Selection */
1518c2ecf20Sopenharmony_ci#define CSC_WAIT_SHIFT	0
1528c2ecf20Sopenharmony_ci#define CSC_RO		0x00000008	/* Read-Only */
1538c2ecf20Sopenharmony_ci#define CSC_AM_MASK	0x0000fff0	/* Address Mask (bits 23-12) */
1548c2ecf20Sopenharmony_ci#define CSC_AM_SHIFT	4
1558c2ecf20Sopenharmony_ci#define CSC_BUSW	0x00010000	/* Bus Width Select */
1568c2ecf20Sopenharmony_ci#define CSC_AC_MASK	0xfff00000	/* Address Compare (bits 23-12) */
1578c2ecf20Sopenharmony_ci#define CSC_AC_SHIFT	20
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci/*
1608c2ecf20Sopenharmony_ci * Chip-Select Option Registers (group D)
1618c2ecf20Sopenharmony_ci */
1628c2ecf20Sopenharmony_ci#define CSD0_ADDR	0xfffff140
1638c2ecf20Sopenharmony_ci#define CSD1_ADDR	0xfffff144
1648c2ecf20Sopenharmony_ci#define CSD2_ADDR	0xfffff148
1658c2ecf20Sopenharmony_ci#define CSD3_ADDR	0xfffff14c
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci#define CSD0		LONG_REF(CSD0_ADDR)
1688c2ecf20Sopenharmony_ci#define CSD1		LONG_REF(CSD1_ADDR)
1698c2ecf20Sopenharmony_ci#define CSD2		LONG_REF(CSD2_ADDR)
1708c2ecf20Sopenharmony_ci#define CSD3		LONG_REF(CSD3_ADDR)
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci#define CSD_WAIT_MASK	0x00000007	/* Wait State Selection */
1738c2ecf20Sopenharmony_ci#define CSD_WAIT_SHIFT	0
1748c2ecf20Sopenharmony_ci#define CSD_RO		0x00000008	/* Read-Only */
1758c2ecf20Sopenharmony_ci#define CSD_AM_MASK	0x0000fff0	/* Address Mask (bits 23-12) */
1768c2ecf20Sopenharmony_ci#define CSD_AM_SHIFT	4
1778c2ecf20Sopenharmony_ci#define CSD_BUSW	0x00010000	/* Bus Width Select */
1788c2ecf20Sopenharmony_ci#define CSD_AC_MASK	0xfff00000	/* Address Compare (bits 23-12) */
1798c2ecf20Sopenharmony_ci#define CSD_AC_SHIFT	20
1808c2ecf20Sopenharmony_ci
1818c2ecf20Sopenharmony_ci/**********
1828c2ecf20Sopenharmony_ci *
1838c2ecf20Sopenharmony_ci * 0xFFFFF2xx -- Phase Locked Loop (PLL) & Power Control
1848c2ecf20Sopenharmony_ci *
1858c2ecf20Sopenharmony_ci **********/
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci/*
1888c2ecf20Sopenharmony_ci * PLL Control Register
1898c2ecf20Sopenharmony_ci */
1908c2ecf20Sopenharmony_ci#define PLLCR_ADDR	0xfffff200
1918c2ecf20Sopenharmony_ci#define PLLCR		WORD_REF(PLLCR_ADDR)
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci#define PLLCR_DISPLL	       0x0008	/* Disable PLL */
1948c2ecf20Sopenharmony_ci#define PLLCR_CLKEN	       0x0010	/* Clock (CLKO pin) enable */
1958c2ecf20Sopenharmony_ci#define PLLCR_SYSCLK_SEL_MASK  0x0700	/* System Clock Selection */
1968c2ecf20Sopenharmony_ci#define PLLCR_SYSCLK_SEL_SHIFT 8
1978c2ecf20Sopenharmony_ci#define PLLCR_PIXCLK_SEL_MASK  0x3800	/* LCD Clock Selection */
1988c2ecf20Sopenharmony_ci#define PLLCR_PIXCLK_SEL_SHIFT 11
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
2018c2ecf20Sopenharmony_ci#define PLLCR_LCDCLK_SEL_MASK	PLLCR_PIXCLK_SEL_MASK
2028c2ecf20Sopenharmony_ci#define PLLCR_LCDCLK_SEL_SHIFT	PLLCR_PIXCLK_SEL_SHIFT
2038c2ecf20Sopenharmony_ci
2048c2ecf20Sopenharmony_ci/*
2058c2ecf20Sopenharmony_ci * PLL Frequency Select Register
2068c2ecf20Sopenharmony_ci */
2078c2ecf20Sopenharmony_ci#define PLLFSR_ADDR	0xfffff202
2088c2ecf20Sopenharmony_ci#define PLLFSR		WORD_REF(PLLFSR_ADDR)
2098c2ecf20Sopenharmony_ci
2108c2ecf20Sopenharmony_ci#define PLLFSR_PC_MASK	0x00ff		/* P Count */
2118c2ecf20Sopenharmony_ci#define PLLFSR_PC_SHIFT 0
2128c2ecf20Sopenharmony_ci#define PLLFSR_QC_MASK	0x0f00		/* Q Count */
2138c2ecf20Sopenharmony_ci#define PLLFSR_QC_SHIFT 8
2148c2ecf20Sopenharmony_ci#define PLLFSR_PROT	0x4000		/* Protect P & Q */
2158c2ecf20Sopenharmony_ci#define PLLFSR_CLK32	0x8000		/* Clock 32 (kHz) */
2168c2ecf20Sopenharmony_ci
2178c2ecf20Sopenharmony_ci/*
2188c2ecf20Sopenharmony_ci * Power Control Register
2198c2ecf20Sopenharmony_ci */
2208c2ecf20Sopenharmony_ci#define PCTRL_ADDR	0xfffff207
2218c2ecf20Sopenharmony_ci#define PCTRL		BYTE_REF(PCTRL_ADDR)
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci#define PCTRL_WIDTH_MASK	0x1f	/* CPU Clock bursts width */
2248c2ecf20Sopenharmony_ci#define PCTRL_WIDTH_SHIFT	0
2258c2ecf20Sopenharmony_ci#define PCTRL_STOP		0x40	/* Enter power-save mode immediately */
2268c2ecf20Sopenharmony_ci#define PCTRL_PCEN		0x80	/* Power Control Enable */
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci/**********
2298c2ecf20Sopenharmony_ci *
2308c2ecf20Sopenharmony_ci * 0xFFFFF3xx -- Interrupt Controller
2318c2ecf20Sopenharmony_ci *
2328c2ecf20Sopenharmony_ci **********/
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci/*
2358c2ecf20Sopenharmony_ci * Interrupt Vector Register
2368c2ecf20Sopenharmony_ci */
2378c2ecf20Sopenharmony_ci#define IVR_ADDR	0xfffff300
2388c2ecf20Sopenharmony_ci#define IVR		BYTE_REF(IVR_ADDR)
2398c2ecf20Sopenharmony_ci
2408c2ecf20Sopenharmony_ci#define IVR_VECTOR_MASK 0xF8
2418c2ecf20Sopenharmony_ci
2428c2ecf20Sopenharmony_ci/*
2438c2ecf20Sopenharmony_ci * Interrupt control Register
2448c2ecf20Sopenharmony_ci */
2458c2ecf20Sopenharmony_ci#define ICR_ADRR	0xfffff302
2468c2ecf20Sopenharmony_ci#define ICR		WORD_REF(ICR_ADDR)
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci#define ICR_ET6		0x0100	/* Edge Trigger Select for IRQ6 */
2498c2ecf20Sopenharmony_ci#define ICR_ET3		0x0200	/* Edge Trigger Select for IRQ3 */
2508c2ecf20Sopenharmony_ci#define ICR_ET2		0x0400	/* Edge Trigger Select for IRQ2 */
2518c2ecf20Sopenharmony_ci#define ICR_ET1		0x0800	/* Edge Trigger Select for IRQ1 */
2528c2ecf20Sopenharmony_ci#define ICR_POL6	0x1000	/* Polarity Control for IRQ6 */
2538c2ecf20Sopenharmony_ci#define ICR_POL3	0x2000	/* Polarity Control for IRQ3 */
2548c2ecf20Sopenharmony_ci#define ICR_POL2	0x4000	/* Polarity Control for IRQ2 */
2558c2ecf20Sopenharmony_ci#define ICR_POL1	0x8000	/* Polarity Control for IRQ1 */
2568c2ecf20Sopenharmony_ci
2578c2ecf20Sopenharmony_ci/*
2588c2ecf20Sopenharmony_ci * Interrupt Mask Register
2598c2ecf20Sopenharmony_ci */
2608c2ecf20Sopenharmony_ci#define IMR_ADDR	0xfffff304
2618c2ecf20Sopenharmony_ci#define IMR		LONG_REF(IMR_ADDR)
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci/*
2648c2ecf20Sopenharmony_ci * Define the names for bit positions first. This is useful for
2658c2ecf20Sopenharmony_ci * request_irq
2668c2ecf20Sopenharmony_ci */
2678c2ecf20Sopenharmony_ci#define SPIM_IRQ_NUM	0	/* SPI Master interrupt */
2688c2ecf20Sopenharmony_ci#define	TMR2_IRQ_NUM	1	/* Timer 2 interrupt */
2698c2ecf20Sopenharmony_ci#define UART_IRQ_NUM	2	/* UART interrupt */
2708c2ecf20Sopenharmony_ci#define	WDT_IRQ_NUM	3	/* Watchdog Timer interrupt */
2718c2ecf20Sopenharmony_ci#define RTC_IRQ_NUM	4	/* RTC interrupt */
2728c2ecf20Sopenharmony_ci#define	KB_IRQ_NUM	6	/* Keyboard Interrupt */
2738c2ecf20Sopenharmony_ci#define PWM_IRQ_NUM	7	/* Pulse-Width Modulator int. */
2748c2ecf20Sopenharmony_ci#define	INT0_IRQ_NUM	8	/* External INT0 */
2758c2ecf20Sopenharmony_ci#define	INT1_IRQ_NUM	9	/* External INT1 */
2768c2ecf20Sopenharmony_ci#define	INT2_IRQ_NUM	10	/* External INT2 */
2778c2ecf20Sopenharmony_ci#define	INT3_IRQ_NUM	11	/* External INT3 */
2788c2ecf20Sopenharmony_ci#define	INT4_IRQ_NUM	12	/* External INT4 */
2798c2ecf20Sopenharmony_ci#define	INT5_IRQ_NUM	13	/* External INT5 */
2808c2ecf20Sopenharmony_ci#define	INT6_IRQ_NUM	14	/* External INT6 */
2818c2ecf20Sopenharmony_ci#define	INT7_IRQ_NUM	15	/* External INT7 */
2828c2ecf20Sopenharmony_ci#define IRQ1_IRQ_NUM	16	/* IRQ1 */
2838c2ecf20Sopenharmony_ci#define IRQ2_IRQ_NUM	17	/* IRQ2 */
2848c2ecf20Sopenharmony_ci#define IRQ3_IRQ_NUM	18	/* IRQ3 */
2858c2ecf20Sopenharmony_ci#define IRQ6_IRQ_NUM	19	/* IRQ6 */
2868c2ecf20Sopenharmony_ci#define PEN_IRQ_NUM	20	/* Pen Interrupt */
2878c2ecf20Sopenharmony_ci#define SPIS_IRQ_NUM	21	/* SPI Slave Interrupt */
2888c2ecf20Sopenharmony_ci#define TMR1_IRQ_NUM	22	/* Timer 1 interrupt */
2898c2ecf20Sopenharmony_ci#define IRQ7_IRQ_NUM	23	/* IRQ7 */
2908c2ecf20Sopenharmony_ci
2918c2ecf20Sopenharmony_ci/* '328-compatible definitions */
2928c2ecf20Sopenharmony_ci#define SPI_IRQ_NUM	SPIM_IRQ_NUM
2938c2ecf20Sopenharmony_ci#define TMR_IRQ_NUM	TMR1_IRQ_NUM
2948c2ecf20Sopenharmony_ci
2958c2ecf20Sopenharmony_ci/*
2968c2ecf20Sopenharmony_ci * Here go the bitmasks themselves
2978c2ecf20Sopenharmony_ci */
2988c2ecf20Sopenharmony_ci#define IMR_MSPIM 	(1 << SPIM_IRQ_NUM)	/* Mask SPI Master interrupt */
2998c2ecf20Sopenharmony_ci#define	IMR_MTMR2	(1 << TMR2_IRQ_NUM)	/* Mask Timer 2 interrupt */
3008c2ecf20Sopenharmony_ci#define IMR_MUART	(1 << UART_IRQ_NUM)	/* Mask UART interrupt */
3018c2ecf20Sopenharmony_ci#define	IMR_MWDT	(1 << WDT_IRQ_NUM)	/* Mask Watchdog Timer interrupt */
3028c2ecf20Sopenharmony_ci#define IMR_MRTC	(1 << RTC_IRQ_NUM)	/* Mask RTC interrupt */
3038c2ecf20Sopenharmony_ci#define	IMR_MKB		(1 << KB_IRQ_NUM)	/* Mask Keyboard Interrupt */
3048c2ecf20Sopenharmony_ci#define IMR_MPWM	(1 << PWM_IRQ_NUM)	/* Mask Pulse-Width Modulator int. */
3058c2ecf20Sopenharmony_ci#define	IMR_MINT0	(1 << INT0_IRQ_NUM)	/* Mask External INT0 */
3068c2ecf20Sopenharmony_ci#define	IMR_MINT1	(1 << INT1_IRQ_NUM)	/* Mask External INT1 */
3078c2ecf20Sopenharmony_ci#define	IMR_MINT2	(1 << INT2_IRQ_NUM)	/* Mask External INT2 */
3088c2ecf20Sopenharmony_ci#define	IMR_MINT3	(1 << INT3_IRQ_NUM)	/* Mask External INT3 */
3098c2ecf20Sopenharmony_ci#define	IMR_MINT4	(1 << INT4_IRQ_NUM)	/* Mask External INT4 */
3108c2ecf20Sopenharmony_ci#define	IMR_MINT5	(1 << INT5_IRQ_NUM)	/* Mask External INT5 */
3118c2ecf20Sopenharmony_ci#define	IMR_MINT6	(1 << INT6_IRQ_NUM)	/* Mask External INT6 */
3128c2ecf20Sopenharmony_ci#define	IMR_MINT7	(1 << INT7_IRQ_NUM)	/* Mask External INT7 */
3138c2ecf20Sopenharmony_ci#define IMR_MIRQ1	(1 << IRQ1_IRQ_NUM)	/* Mask IRQ1 */
3148c2ecf20Sopenharmony_ci#define IMR_MIRQ2	(1 << IRQ2_IRQ_NUM)	/* Mask IRQ2 */
3158c2ecf20Sopenharmony_ci#define IMR_MIRQ3	(1 << IRQ3_IRQ_NUM)	/* Mask IRQ3 */
3168c2ecf20Sopenharmony_ci#define IMR_MIRQ6	(1 << IRQ6_IRQ_NUM)	/* Mask IRQ6 */
3178c2ecf20Sopenharmony_ci#define IMR_MPEN	(1 << PEN_IRQ_NUM)	/* Mask Pen Interrupt */
3188c2ecf20Sopenharmony_ci#define IMR_MSPIS	(1 << SPIS_IRQ_NUM)	/* Mask SPI Slave Interrupt */
3198c2ecf20Sopenharmony_ci#define IMR_MTMR1	(1 << TMR1_IRQ_NUM)	/* Mask Timer 1 interrupt */
3208c2ecf20Sopenharmony_ci#define IMR_MIRQ7	(1 << IRQ7_IRQ_NUM)	/* Mask IRQ7 */
3218c2ecf20Sopenharmony_ci
3228c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
3238c2ecf20Sopenharmony_ci#define IMR_MSPI	IMR_MSPIM
3248c2ecf20Sopenharmony_ci#define IMR_MTMR	IMR_MTMR1
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci/*
3278c2ecf20Sopenharmony_ci * Interrupt Wake-Up Enable Register
3288c2ecf20Sopenharmony_ci */
3298c2ecf20Sopenharmony_ci#define IWR_ADDR	0xfffff308
3308c2ecf20Sopenharmony_ci#define IWR		LONG_REF(IWR_ADDR)
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci#define IWR_SPIM 	(1 << SPIM_IRQ_NUM)	/* SPI Master interrupt */
3338c2ecf20Sopenharmony_ci#define	IWR_TMR2	(1 << TMR2_IRQ_NUM)	/* Timer 2 interrupt */
3348c2ecf20Sopenharmony_ci#define IWR_UART	(1 << UART_IRQ_NUM)	/* UART interrupt */
3358c2ecf20Sopenharmony_ci#define	IWR_WDT		(1 << WDT_IRQ_NUM)	/* Watchdog Timer interrupt */
3368c2ecf20Sopenharmony_ci#define IWR_RTC		(1 << RTC_IRQ_NUM)	/* RTC interrupt */
3378c2ecf20Sopenharmony_ci#define	IWR_KB		(1 << KB_IRQ_NUM)	/* Keyboard Interrupt */
3388c2ecf20Sopenharmony_ci#define IWR_PWM		(1 << PWM_IRQ_NUM)	/* Pulse-Width Modulator int. */
3398c2ecf20Sopenharmony_ci#define	IWR_INT0	(1 << INT0_IRQ_NUM)	/* External INT0 */
3408c2ecf20Sopenharmony_ci#define	IWR_INT1	(1 << INT1_IRQ_NUM)	/* External INT1 */
3418c2ecf20Sopenharmony_ci#define	IWR_INT2	(1 << INT2_IRQ_NUM)	/* External INT2 */
3428c2ecf20Sopenharmony_ci#define	IWR_INT3	(1 << INT3_IRQ_NUM)	/* External INT3 */
3438c2ecf20Sopenharmony_ci#define	IWR_INT4	(1 << INT4_IRQ_NUM)	/* External INT4 */
3448c2ecf20Sopenharmony_ci#define	IWR_INT5	(1 << INT5_IRQ_NUM)	/* External INT5 */
3458c2ecf20Sopenharmony_ci#define	IWR_INT6	(1 << INT6_IRQ_NUM)	/* External INT6 */
3468c2ecf20Sopenharmony_ci#define	IWR_INT7	(1 << INT7_IRQ_NUM)	/* External INT7 */
3478c2ecf20Sopenharmony_ci#define IWR_IRQ1	(1 << IRQ1_IRQ_NUM)	/* IRQ1 */
3488c2ecf20Sopenharmony_ci#define IWR_IRQ2	(1 << IRQ2_IRQ_NUM)	/* IRQ2 */
3498c2ecf20Sopenharmony_ci#define IWR_IRQ3	(1 << IRQ3_IRQ_NUM)	/* IRQ3 */
3508c2ecf20Sopenharmony_ci#define IWR_IRQ6	(1 << IRQ6_IRQ_NUM)	/* IRQ6 */
3518c2ecf20Sopenharmony_ci#define IWR_PEN		(1 << PEN_IRQ_NUM)	/* Pen Interrupt */
3528c2ecf20Sopenharmony_ci#define IWR_SPIS	(1 << SPIS_IRQ_NUM)	/* SPI Slave Interrupt */
3538c2ecf20Sopenharmony_ci#define IWR_TMR1	(1 << TMR1_IRQ_NUM)	/* Timer 1 interrupt */
3548c2ecf20Sopenharmony_ci#define IWR_IRQ7	(1 << IRQ7_IRQ_NUM)	/* IRQ7 */
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci/*
3578c2ecf20Sopenharmony_ci * Interrupt Status Register
3588c2ecf20Sopenharmony_ci */
3598c2ecf20Sopenharmony_ci#define ISR_ADDR	0xfffff30c
3608c2ecf20Sopenharmony_ci#define ISR		LONG_REF(ISR_ADDR)
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ci#define ISR_SPIM 	(1 << SPIM_IRQ_NUM)	/* SPI Master interrupt */
3638c2ecf20Sopenharmony_ci#define	ISR_TMR2	(1 << TMR2_IRQ_NUM)	/* Timer 2 interrupt */
3648c2ecf20Sopenharmony_ci#define ISR_UART	(1 << UART_IRQ_NUM)	/* UART interrupt */
3658c2ecf20Sopenharmony_ci#define	ISR_WDT		(1 << WDT_IRQ_NUM)	/* Watchdog Timer interrupt */
3668c2ecf20Sopenharmony_ci#define ISR_RTC		(1 << RTC_IRQ_NUM)	/* RTC interrupt */
3678c2ecf20Sopenharmony_ci#define	ISR_KB		(1 << KB_IRQ_NUM)	/* Keyboard Interrupt */
3688c2ecf20Sopenharmony_ci#define ISR_PWM		(1 << PWM_IRQ_NUM)	/* Pulse-Width Modulator int. */
3698c2ecf20Sopenharmony_ci#define	ISR_INT0	(1 << INT0_IRQ_NUM)	/* External INT0 */
3708c2ecf20Sopenharmony_ci#define	ISR_INT1	(1 << INT1_IRQ_NUM)	/* External INT1 */
3718c2ecf20Sopenharmony_ci#define	ISR_INT2	(1 << INT2_IRQ_NUM)	/* External INT2 */
3728c2ecf20Sopenharmony_ci#define	ISR_INT3	(1 << INT3_IRQ_NUM)	/* External INT3 */
3738c2ecf20Sopenharmony_ci#define	ISR_INT4	(1 << INT4_IRQ_NUM)	/* External INT4 */
3748c2ecf20Sopenharmony_ci#define	ISR_INT5	(1 << INT5_IRQ_NUM)	/* External INT5 */
3758c2ecf20Sopenharmony_ci#define	ISR_INT6	(1 << INT6_IRQ_NUM)	/* External INT6 */
3768c2ecf20Sopenharmony_ci#define	ISR_INT7	(1 << INT7_IRQ_NUM)	/* External INT7 */
3778c2ecf20Sopenharmony_ci#define ISR_IRQ1	(1 << IRQ1_IRQ_NUM)	/* IRQ1 */
3788c2ecf20Sopenharmony_ci#define ISR_IRQ2	(1 << IRQ2_IRQ_NUM)	/* IRQ2 */
3798c2ecf20Sopenharmony_ci#define ISR_IRQ3	(1 << IRQ3_IRQ_NUM)	/* IRQ3 */
3808c2ecf20Sopenharmony_ci#define ISR_IRQ6	(1 << IRQ6_IRQ_NUM)	/* IRQ6 */
3818c2ecf20Sopenharmony_ci#define ISR_PEN		(1 << PEN_IRQ_NUM)	/* Pen Interrupt */
3828c2ecf20Sopenharmony_ci#define ISR_SPIS	(1 << SPIS_IRQ_NUM)	/* SPI Slave Interrupt */
3838c2ecf20Sopenharmony_ci#define ISR_TMR1	(1 << TMR1_IRQ_NUM)	/* Timer 1 interrupt */
3848c2ecf20Sopenharmony_ci#define ISR_IRQ7	(1 << IRQ7_IRQ_NUM)	/* IRQ7 */
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
3878c2ecf20Sopenharmony_ci#define ISR_SPI	ISR_SPIM
3888c2ecf20Sopenharmony_ci#define ISR_TMR	ISR_TMR1
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_ci/*
3918c2ecf20Sopenharmony_ci * Interrupt Pending Register
3928c2ecf20Sopenharmony_ci */
3938c2ecf20Sopenharmony_ci#define IPR_ADDR	0xfffff310
3948c2ecf20Sopenharmony_ci#define IPR		LONG_REF(IPR_ADDR)
3958c2ecf20Sopenharmony_ci
3968c2ecf20Sopenharmony_ci#define IPR_SPIM 	(1 << SPIM_IRQ_NUM)	/* SPI Master interrupt */
3978c2ecf20Sopenharmony_ci#define	IPR_TMR2	(1 << TMR2_IRQ_NUM)	/* Timer 2 interrupt */
3988c2ecf20Sopenharmony_ci#define IPR_UART	(1 << UART_IRQ_NUM)	/* UART interrupt */
3998c2ecf20Sopenharmony_ci#define	IPR_WDT		(1 << WDT_IRQ_NUM)	/* Watchdog Timer interrupt */
4008c2ecf20Sopenharmony_ci#define IPR_RTC		(1 << RTC_IRQ_NUM)	/* RTC interrupt */
4018c2ecf20Sopenharmony_ci#define	IPR_KB		(1 << KB_IRQ_NUM)	/* Keyboard Interrupt */
4028c2ecf20Sopenharmony_ci#define IPR_PWM		(1 << PWM_IRQ_NUM)	/* Pulse-Width Modulator int. */
4038c2ecf20Sopenharmony_ci#define	IPR_INT0	(1 << INT0_IRQ_NUM)	/* External INT0 */
4048c2ecf20Sopenharmony_ci#define	IPR_INT1	(1 << INT1_IRQ_NUM)	/* External INT1 */
4058c2ecf20Sopenharmony_ci#define	IPR_INT2	(1 << INT2_IRQ_NUM)	/* External INT2 */
4068c2ecf20Sopenharmony_ci#define	IPR_INT3	(1 << INT3_IRQ_NUM)	/* External INT3 */
4078c2ecf20Sopenharmony_ci#define	IPR_INT4	(1 << INT4_IRQ_NUM)	/* External INT4 */
4088c2ecf20Sopenharmony_ci#define	IPR_INT5	(1 << INT5_IRQ_NUM)	/* External INT5 */
4098c2ecf20Sopenharmony_ci#define	IPR_INT6	(1 << INT6_IRQ_NUM)	/* External INT6 */
4108c2ecf20Sopenharmony_ci#define	IPR_INT7	(1 << INT7_IRQ_NUM)	/* External INT7 */
4118c2ecf20Sopenharmony_ci#define IPR_IRQ1	(1 << IRQ1_IRQ_NUM)	/* IRQ1 */
4128c2ecf20Sopenharmony_ci#define IPR_IRQ2	(1 << IRQ2_IRQ_NUM)	/* IRQ2 */
4138c2ecf20Sopenharmony_ci#define IPR_IRQ3	(1 << IRQ3_IRQ_NUM)	/* IRQ3 */
4148c2ecf20Sopenharmony_ci#define IPR_IRQ6	(1 << IRQ6_IRQ_NUM)	/* IRQ6 */
4158c2ecf20Sopenharmony_ci#define IPR_PEN		(1 << PEN_IRQ_NUM)	/* Pen Interrupt */
4168c2ecf20Sopenharmony_ci#define IPR_SPIS	(1 << SPIS_IRQ_NUM)	/* SPI Slave Interrupt */
4178c2ecf20Sopenharmony_ci#define IPR_TMR1	(1 << TMR1_IRQ_NUM)	/* Timer 1 interrupt */
4188c2ecf20Sopenharmony_ci#define IPR_IRQ7	(1 << IRQ7_IRQ_NUM)	/* IRQ7 */
4198c2ecf20Sopenharmony_ci
4208c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
4218c2ecf20Sopenharmony_ci#define IPR_SPI	IPR_SPIM
4228c2ecf20Sopenharmony_ci#define IPR_TMR	IPR_TMR1
4238c2ecf20Sopenharmony_ci
4248c2ecf20Sopenharmony_ci/**********
4258c2ecf20Sopenharmony_ci *
4268c2ecf20Sopenharmony_ci * 0xFFFFF4xx -- Parallel Ports
4278c2ecf20Sopenharmony_ci *
4288c2ecf20Sopenharmony_ci **********/
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci/*
4318c2ecf20Sopenharmony_ci * Port A
4328c2ecf20Sopenharmony_ci */
4338c2ecf20Sopenharmony_ci#define PADIR_ADDR	0xfffff400		/* Port A direction reg */
4348c2ecf20Sopenharmony_ci#define PADATA_ADDR	0xfffff401		/* Port A data register */
4358c2ecf20Sopenharmony_ci#define PASEL_ADDR	0xfffff403		/* Port A Select register */
4368c2ecf20Sopenharmony_ci
4378c2ecf20Sopenharmony_ci#define PADIR		BYTE_REF(PADIR_ADDR)
4388c2ecf20Sopenharmony_ci#define PADATA		BYTE_REF(PADATA_ADDR)
4398c2ecf20Sopenharmony_ci#define PASEL		BYTE_REF(PASEL_ADDR)
4408c2ecf20Sopenharmony_ci
4418c2ecf20Sopenharmony_ci#define PA(x)           (1 << (x))
4428c2ecf20Sopenharmony_ci#define PA_A(x)		PA((x) - 16)	/* This is specific to PA only! */
4438c2ecf20Sopenharmony_ci
4448c2ecf20Sopenharmony_ci#define PA_A16		PA(0)		/* Use A16 as PA(0) */
4458c2ecf20Sopenharmony_ci#define PA_A17		PA(1)		/* Use A17 as PA(1) */
4468c2ecf20Sopenharmony_ci#define PA_A18		PA(2)		/* Use A18 as PA(2) */
4478c2ecf20Sopenharmony_ci#define PA_A19		PA(3)		/* Use A19 as PA(3) */
4488c2ecf20Sopenharmony_ci#define PA_A20		PA(4)		/* Use A20 as PA(4) */
4498c2ecf20Sopenharmony_ci#define PA_A21		PA(5)		/* Use A21 as PA(5) */
4508c2ecf20Sopenharmony_ci#define PA_A22		PA(6)		/* Use A22 as PA(6) */
4518c2ecf20Sopenharmony_ci#define PA_A23		PA(7)		/* Use A23 as PA(7) */
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci/*
4548c2ecf20Sopenharmony_ci * Port B
4558c2ecf20Sopenharmony_ci */
4568c2ecf20Sopenharmony_ci#define PBDIR_ADDR	0xfffff408		/* Port B direction reg */
4578c2ecf20Sopenharmony_ci#define PBDATA_ADDR	0xfffff409		/* Port B data register */
4588c2ecf20Sopenharmony_ci#define PBSEL_ADDR	0xfffff40b		/* Port B Select Register */
4598c2ecf20Sopenharmony_ci
4608c2ecf20Sopenharmony_ci#define PBDIR		BYTE_REF(PBDIR_ADDR)
4618c2ecf20Sopenharmony_ci#define PBDATA		BYTE_REF(PBDATA_ADDR)
4628c2ecf20Sopenharmony_ci#define PBSEL		BYTE_REF(PBSEL_ADDR)
4638c2ecf20Sopenharmony_ci
4648c2ecf20Sopenharmony_ci#define PB(x)           (1 << (x))
4658c2ecf20Sopenharmony_ci#define PB_D(x)		PB(x)		/* This is specific to port B only */
4668c2ecf20Sopenharmony_ci
4678c2ecf20Sopenharmony_ci#define PB_D0		PB(0)		/* Use D0 as PB(0) */
4688c2ecf20Sopenharmony_ci#define PB_D1		PB(1)		/* Use D1 as PB(1) */
4698c2ecf20Sopenharmony_ci#define PB_D2		PB(2)		/* Use D2 as PB(2) */
4708c2ecf20Sopenharmony_ci#define PB_D3		PB(3)		/* Use D3 as PB(3) */
4718c2ecf20Sopenharmony_ci#define PB_D4		PB(4)		/* Use D4 as PB(4) */
4728c2ecf20Sopenharmony_ci#define PB_D5		PB(5)		/* Use D5 as PB(5) */
4738c2ecf20Sopenharmony_ci#define PB_D6		PB(6)		/* Use D6 as PB(6) */
4748c2ecf20Sopenharmony_ci#define PB_D7		PB(7)		/* Use D7 as PB(7) */
4758c2ecf20Sopenharmony_ci
4768c2ecf20Sopenharmony_ci/*
4778c2ecf20Sopenharmony_ci * Port C
4788c2ecf20Sopenharmony_ci */
4798c2ecf20Sopenharmony_ci#define PCDIR_ADDR	0xfffff410		/* Port C direction reg */
4808c2ecf20Sopenharmony_ci#define PCDATA_ADDR	0xfffff411		/* Port C data register */
4818c2ecf20Sopenharmony_ci#define PCSEL_ADDR	0xfffff413		/* Port C Select Register */
4828c2ecf20Sopenharmony_ci
4838c2ecf20Sopenharmony_ci#define PCDIR		BYTE_REF(PCDIR_ADDR)
4848c2ecf20Sopenharmony_ci#define PCDATA		BYTE_REF(PCDATA_ADDR)
4858c2ecf20Sopenharmony_ci#define PCSEL		BYTE_REF(PCSEL_ADDR)
4868c2ecf20Sopenharmony_ci
4878c2ecf20Sopenharmony_ci#define PC(x)           (1 << (x))
4888c2ecf20Sopenharmony_ci
4898c2ecf20Sopenharmony_ci#define PC_WE		PC(6)		/* Use WE    as PC(6) */
4908c2ecf20Sopenharmony_ci#define PC_DTACK	PC(5)		/* Use DTACK as PC(5) */
4918c2ecf20Sopenharmony_ci#define PC_IRQ7		PC(4)		/* Use IRQ7  as PC(4) */
4928c2ecf20Sopenharmony_ci#define PC_LDS		PC(2)		/* Use LDS   as PC(2) */
4938c2ecf20Sopenharmony_ci#define PC_UDS		PC(1)		/* Use UDS   as PC(1) */
4948c2ecf20Sopenharmony_ci#define PC_MOCLK	PC(0)		/* Use MOCLK as PC(0) */
4958c2ecf20Sopenharmony_ci
4968c2ecf20Sopenharmony_ci/*
4978c2ecf20Sopenharmony_ci * Port D
4988c2ecf20Sopenharmony_ci */
4998c2ecf20Sopenharmony_ci#define PDDIR_ADDR	0xfffff418		/* Port D direction reg */
5008c2ecf20Sopenharmony_ci#define PDDATA_ADDR	0xfffff419		/* Port D data register */
5018c2ecf20Sopenharmony_ci#define PDPUEN_ADDR	0xfffff41a		/* Port D Pull-Up enable reg */
5028c2ecf20Sopenharmony_ci#define PDPOL_ADDR	0xfffff41c		/* Port D Polarity Register */
5038c2ecf20Sopenharmony_ci#define PDIRQEN_ADDR	0xfffff41d		/* Port D IRQ enable register */
5048c2ecf20Sopenharmony_ci#define	PDIQEG_ADDR	0xfffff41f		/* Port D IRQ Edge Register */
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci#define PDDIR		BYTE_REF(PDDIR_ADDR)
5078c2ecf20Sopenharmony_ci#define PDDATA		BYTE_REF(PDDATA_ADDR)
5088c2ecf20Sopenharmony_ci#define PDPUEN		BYTE_REF(PDPUEN_ADDR)
5098c2ecf20Sopenharmony_ci#define	PDPOL		BYTE_REF(PDPOL_ADDR)
5108c2ecf20Sopenharmony_ci#define PDIRQEN		BYTE_REF(PDIRQEN_ADDR)
5118c2ecf20Sopenharmony_ci#define PDIQEG		BYTE_REF(PDIQEG_ADDR)
5128c2ecf20Sopenharmony_ci
5138c2ecf20Sopenharmony_ci#define PD(x)           (1 << (x))
5148c2ecf20Sopenharmony_ci#define PD_KB(x)	PD(x)		/* This is specific for Port D only */
5158c2ecf20Sopenharmony_ci
5168c2ecf20Sopenharmony_ci#define PD_KB0		PD(0)	/* Use KB0 as PD(0) */
5178c2ecf20Sopenharmony_ci#define PD_KB1		PD(1)	/* Use KB1 as PD(1) */
5188c2ecf20Sopenharmony_ci#define PD_KB2		PD(2)	/* Use KB2 as PD(2) */
5198c2ecf20Sopenharmony_ci#define PD_KB3		PD(3)	/* Use KB3 as PD(3) */
5208c2ecf20Sopenharmony_ci#define PD_KB4		PD(4)	/* Use KB4 as PD(4) */
5218c2ecf20Sopenharmony_ci#define PD_KB5		PD(5)	/* Use KB5 as PD(5) */
5228c2ecf20Sopenharmony_ci#define PD_KB6		PD(6)	/* Use KB6 as PD(6) */
5238c2ecf20Sopenharmony_ci#define PD_KB7		PD(7)	/* Use KB7 as PD(7) */
5248c2ecf20Sopenharmony_ci
5258c2ecf20Sopenharmony_ci/*
5268c2ecf20Sopenharmony_ci * Port E
5278c2ecf20Sopenharmony_ci */
5288c2ecf20Sopenharmony_ci#define PEDIR_ADDR	0xfffff420		/* Port E direction reg */
5298c2ecf20Sopenharmony_ci#define PEDATA_ADDR	0xfffff421		/* Port E data register */
5308c2ecf20Sopenharmony_ci#define PEPUEN_ADDR	0xfffff422		/* Port E Pull-Up enable reg */
5318c2ecf20Sopenharmony_ci#define PESEL_ADDR	0xfffff423		/* Port E Select Register */
5328c2ecf20Sopenharmony_ci
5338c2ecf20Sopenharmony_ci#define PEDIR		BYTE_REF(PEDIR_ADDR)
5348c2ecf20Sopenharmony_ci#define PEDATA		BYTE_REF(PEDATA_ADDR)
5358c2ecf20Sopenharmony_ci#define PEPUEN		BYTE_REF(PEPUEN_ADDR)
5368c2ecf20Sopenharmony_ci#define PESEL		BYTE_REF(PESEL_ADDR)
5378c2ecf20Sopenharmony_ci
5388c2ecf20Sopenharmony_ci#define PE(x)           (1 << (x))
5398c2ecf20Sopenharmony_ci
5408c2ecf20Sopenharmony_ci#define PE_CSA1		PE(1)	/* Use CSA1 as PE(1) */
5418c2ecf20Sopenharmony_ci#define PE_CSA2		PE(2)	/* Use CSA2 as PE(2) */
5428c2ecf20Sopenharmony_ci#define PE_CSA3		PE(3)	/* Use CSA3 as PE(3) */
5438c2ecf20Sopenharmony_ci#define PE_CSB0		PE(4)	/* Use CSB0 as PE(4) */
5448c2ecf20Sopenharmony_ci#define PE_CSB1		PE(5)	/* Use CSB1 as PE(5) */
5458c2ecf20Sopenharmony_ci#define PE_CSB2		PE(6)	/* Use CSB2 as PE(6) */
5468c2ecf20Sopenharmony_ci#define PE_CSB3		PE(7)	/* Use CSB3 as PE(7) */
5478c2ecf20Sopenharmony_ci
5488c2ecf20Sopenharmony_ci/*
5498c2ecf20Sopenharmony_ci * Port F
5508c2ecf20Sopenharmony_ci */
5518c2ecf20Sopenharmony_ci#define PFDIR_ADDR	0xfffff428		/* Port F direction reg */
5528c2ecf20Sopenharmony_ci#define PFDATA_ADDR	0xfffff429		/* Port F data register */
5538c2ecf20Sopenharmony_ci#define PFPUEN_ADDR	0xfffff42a		/* Port F Pull-Up enable reg */
5548c2ecf20Sopenharmony_ci#define PFSEL_ADDR	0xfffff42b		/* Port F Select Register */
5558c2ecf20Sopenharmony_ci
5568c2ecf20Sopenharmony_ci#define PFDIR		BYTE_REF(PFDIR_ADDR)
5578c2ecf20Sopenharmony_ci#define PFDATA		BYTE_REF(PFDATA_ADDR)
5588c2ecf20Sopenharmony_ci#define PFPUEN		BYTE_REF(PFPUEN_ADDR)
5598c2ecf20Sopenharmony_ci#define PFSEL		BYTE_REF(PFSEL_ADDR)
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci#define PF(x)           (1 << (x))
5628c2ecf20Sopenharmony_ci#define PF_A(x)		PF((x) - 24)	/* This is Port F specific only */
5638c2ecf20Sopenharmony_ci
5648c2ecf20Sopenharmony_ci#define PF_A24		PF(0)	/* Use A24 as PF(0) */
5658c2ecf20Sopenharmony_ci#define PF_A25		PF(1)	/* Use A25 as PF(1) */
5668c2ecf20Sopenharmony_ci#define PF_A26		PF(2)	/* Use A26 as PF(2) */
5678c2ecf20Sopenharmony_ci#define PF_A27		PF(3)	/* Use A27 as PF(3) */
5688c2ecf20Sopenharmony_ci#define PF_A28		PF(4)	/* Use A28 as PF(4) */
5698c2ecf20Sopenharmony_ci#define PF_A29		PF(5)	/* Use A29 as PF(5) */
5708c2ecf20Sopenharmony_ci#define PF_A30		PF(6)	/* Use A30 as PF(6) */
5718c2ecf20Sopenharmony_ci#define PF_A31		PF(7)	/* Use A31 as PF(7) */
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_ci/*
5748c2ecf20Sopenharmony_ci * Port G
5758c2ecf20Sopenharmony_ci */
5768c2ecf20Sopenharmony_ci#define PGDIR_ADDR	0xfffff430		/* Port G direction reg */
5778c2ecf20Sopenharmony_ci#define PGDATA_ADDR	0xfffff431		/* Port G data register */
5788c2ecf20Sopenharmony_ci#define PGPUEN_ADDR	0xfffff432		/* Port G Pull-Up enable reg */
5798c2ecf20Sopenharmony_ci#define PGSEL_ADDR	0xfffff433		/* Port G Select Register */
5808c2ecf20Sopenharmony_ci
5818c2ecf20Sopenharmony_ci#define PGDIR		BYTE_REF(PGDIR_ADDR)
5828c2ecf20Sopenharmony_ci#define PGDATA		BYTE_REF(PGDATA_ADDR)
5838c2ecf20Sopenharmony_ci#define PGPUEN		BYTE_REF(PGPUEN_ADDR)
5848c2ecf20Sopenharmony_ci#define PGSEL		BYTE_REF(PGSEL_ADDR)
5858c2ecf20Sopenharmony_ci
5868c2ecf20Sopenharmony_ci#define PG(x)           (1 << (x))
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci#define PG_UART_TXD	PG(0)	/* Use UART_TXD as PG(0) */
5898c2ecf20Sopenharmony_ci#define PG_UART_RXD	PG(1)	/* Use UART_RXD as PG(1) */
5908c2ecf20Sopenharmony_ci#define PG_PWMOUT	PG(2)	/* Use PWMOUT   as PG(2) */
5918c2ecf20Sopenharmony_ci#define PG_TOUT2	PG(3)   /* Use TOUT2    as PG(3) */
5928c2ecf20Sopenharmony_ci#define PG_TIN2		PG(4)	/* Use TIN2     as PG(4) */
5938c2ecf20Sopenharmony_ci#define PG_TOUT1	PG(5)   /* Use TOUT1    as PG(5) */
5948c2ecf20Sopenharmony_ci#define PG_TIN1		PG(6)	/* Use TIN1     as PG(6) */
5958c2ecf20Sopenharmony_ci#define PG_RTCOUT	PG(7)	/* Use RTCOUT   as PG(7) */
5968c2ecf20Sopenharmony_ci
5978c2ecf20Sopenharmony_ci/*
5988c2ecf20Sopenharmony_ci * Port J
5998c2ecf20Sopenharmony_ci */
6008c2ecf20Sopenharmony_ci#define PJDIR_ADDR	0xfffff438		/* Port J direction reg */
6018c2ecf20Sopenharmony_ci#define PJDATA_ADDR	0xfffff439		/* Port J data register */
6028c2ecf20Sopenharmony_ci#define PJSEL_ADDR	0xfffff43b		/* Port J Select Register */
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci#define PJDIR		BYTE_REF(PJDIR_ADDR)
6058c2ecf20Sopenharmony_ci#define PJDATA		BYTE_REF(PJDATA_ADDR)
6068c2ecf20Sopenharmony_ci#define PJSEL		BYTE_REF(PJSEL_ADDR)
6078c2ecf20Sopenharmony_ci
6088c2ecf20Sopenharmony_ci#define PJ(x)           (1 << (x))
6098c2ecf20Sopenharmony_ci
6108c2ecf20Sopenharmony_ci#define PJ_CSD3		PJ(7)	/* Use CSD3 as PJ(7) */
6118c2ecf20Sopenharmony_ci
6128c2ecf20Sopenharmony_ci/*
6138c2ecf20Sopenharmony_ci * Port K
6148c2ecf20Sopenharmony_ci */
6158c2ecf20Sopenharmony_ci#define PKDIR_ADDR	0xfffff440		/* Port K direction reg */
6168c2ecf20Sopenharmony_ci#define PKDATA_ADDR	0xfffff441		/* Port K data register */
6178c2ecf20Sopenharmony_ci#define PKPUEN_ADDR	0xfffff442		/* Port K Pull-Up enable reg */
6188c2ecf20Sopenharmony_ci#define PKSEL_ADDR	0xfffff443		/* Port K Select Register */
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci#define PKDIR		BYTE_REF(PKDIR_ADDR)
6218c2ecf20Sopenharmony_ci#define PKDATA		BYTE_REF(PKDATA_ADDR)
6228c2ecf20Sopenharmony_ci#define PKPUEN		BYTE_REF(PKPUEN_ADDR)
6238c2ecf20Sopenharmony_ci#define PKSEL		BYTE_REF(PKSEL_ADDR)
6248c2ecf20Sopenharmony_ci
6258c2ecf20Sopenharmony_ci#define PK(x)           (1 << (x))
6268c2ecf20Sopenharmony_ci
6278c2ecf20Sopenharmony_ci/*
6288c2ecf20Sopenharmony_ci * Port M
6298c2ecf20Sopenharmony_ci */
6308c2ecf20Sopenharmony_ci#define PMDIR_ADDR	0xfffff438		/* Port M direction reg */
6318c2ecf20Sopenharmony_ci#define PMDATA_ADDR	0xfffff439		/* Port M data register */
6328c2ecf20Sopenharmony_ci#define PMPUEN_ADDR	0xfffff43a		/* Port M Pull-Up enable reg */
6338c2ecf20Sopenharmony_ci#define PMSEL_ADDR	0xfffff43b		/* Port M Select Register */
6348c2ecf20Sopenharmony_ci
6358c2ecf20Sopenharmony_ci#define PMDIR		BYTE_REF(PMDIR_ADDR)
6368c2ecf20Sopenharmony_ci#define PMDATA		BYTE_REF(PMDATA_ADDR)
6378c2ecf20Sopenharmony_ci#define PMPUEN		BYTE_REF(PMPUEN_ADDR)
6388c2ecf20Sopenharmony_ci#define PMSEL		BYTE_REF(PMSEL_ADDR)
6398c2ecf20Sopenharmony_ci
6408c2ecf20Sopenharmony_ci#define PM(x)           (1 << (x))
6418c2ecf20Sopenharmony_ci
6428c2ecf20Sopenharmony_ci/**********
6438c2ecf20Sopenharmony_ci *
6448c2ecf20Sopenharmony_ci * 0xFFFFF5xx -- Pulse-Width Modulator (PWM)
6458c2ecf20Sopenharmony_ci *
6468c2ecf20Sopenharmony_ci **********/
6478c2ecf20Sopenharmony_ci
6488c2ecf20Sopenharmony_ci/*
6498c2ecf20Sopenharmony_ci * PWM Control Register
6508c2ecf20Sopenharmony_ci */
6518c2ecf20Sopenharmony_ci#define PWMC_ADDR	0xfffff500
6528c2ecf20Sopenharmony_ci#define PWMC		WORD_REF(PWMC_ADDR)
6538c2ecf20Sopenharmony_ci
6548c2ecf20Sopenharmony_ci#define PWMC_CLKSEL_MASK	0x0007	/* Clock Selection */
6558c2ecf20Sopenharmony_ci#define PWMC_CLKSEL_SHIFT	0
6568c2ecf20Sopenharmony_ci#define PWMC_PWMEN		0x0010	/* Enable PWM */
6578c2ecf20Sopenharmony_ci#define PMNC_POL		0x0020	/* PWM Output Bit Polarity */
6588c2ecf20Sopenharmony_ci#define PWMC_PIN		0x0080	/* Current PWM output pin status */
6598c2ecf20Sopenharmony_ci#define PWMC_LOAD		0x0100	/* Force a new period */
6608c2ecf20Sopenharmony_ci#define PWMC_IRQEN		0x4000	/* Interrupt Request Enable */
6618c2ecf20Sopenharmony_ci#define PWMC_CLKSRC		0x8000	/* Clock Source Select */
6628c2ecf20Sopenharmony_ci
6638c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
6648c2ecf20Sopenharmony_ci#define PWMC_EN	PWMC_PWMEN
6658c2ecf20Sopenharmony_ci
6668c2ecf20Sopenharmony_ci/*
6678c2ecf20Sopenharmony_ci * PWM Period Register
6688c2ecf20Sopenharmony_ci */
6698c2ecf20Sopenharmony_ci#define PWMP_ADDR	0xfffff502
6708c2ecf20Sopenharmony_ci#define PWMP		WORD_REF(PWMP_ADDR)
6718c2ecf20Sopenharmony_ci
6728c2ecf20Sopenharmony_ci/*
6738c2ecf20Sopenharmony_ci * PWM Width Register
6748c2ecf20Sopenharmony_ci */
6758c2ecf20Sopenharmony_ci#define PWMW_ADDR	0xfffff504
6768c2ecf20Sopenharmony_ci#define PWMW		WORD_REF(PWMW_ADDR)
6778c2ecf20Sopenharmony_ci
6788c2ecf20Sopenharmony_ci/*
6798c2ecf20Sopenharmony_ci * PWM Counter Register
6808c2ecf20Sopenharmony_ci */
6818c2ecf20Sopenharmony_ci#define PWMCNT_ADDR	0xfffff506
6828c2ecf20Sopenharmony_ci#define PWMCNT		WORD_REF(PWMCNT_ADDR)
6838c2ecf20Sopenharmony_ci
6848c2ecf20Sopenharmony_ci/**********
6858c2ecf20Sopenharmony_ci *
6868c2ecf20Sopenharmony_ci * 0xFFFFF6xx -- General-Purpose Timers
6878c2ecf20Sopenharmony_ci *
6888c2ecf20Sopenharmony_ci **********/
6898c2ecf20Sopenharmony_ci
6908c2ecf20Sopenharmony_ci/*
6918c2ecf20Sopenharmony_ci * Timer Unit 1 and 2 Control Registers
6928c2ecf20Sopenharmony_ci */
6938c2ecf20Sopenharmony_ci#define TCTL1_ADDR	0xfffff600
6948c2ecf20Sopenharmony_ci#define TCTL1		WORD_REF(TCTL1_ADDR)
6958c2ecf20Sopenharmony_ci#define TCTL2_ADDR	0xfffff60c
6968c2ecf20Sopenharmony_ci#define TCTL2		WORD_REF(TCTL2_ADDR)
6978c2ecf20Sopenharmony_ci
6988c2ecf20Sopenharmony_ci#define	TCTL_TEN		0x0001	/* Timer Enable  */
6998c2ecf20Sopenharmony_ci#define TCTL_CLKSOURCE_MASK 	0x000e	/* Clock Source: */
7008c2ecf20Sopenharmony_ci#define   TCTL_CLKSOURCE_STOP	   0x0000	/* Stop count (disabled)    */
7018c2ecf20Sopenharmony_ci#define   TCTL_CLKSOURCE_SYSCLK	   0x0002	/* SYSCLK to prescaler      */
7028c2ecf20Sopenharmony_ci#define   TCTL_CLKSOURCE_SYSCLK_16 0x0004	/* SYSCLK/16 to prescaler   */
7038c2ecf20Sopenharmony_ci#define   TCTL_CLKSOURCE_TIN	   0x0006	/* TIN to prescaler         */
7048c2ecf20Sopenharmony_ci#define   TCTL_CLKSOURCE_32KHZ	   0x0008	/* 32kHz clock to prescaler */
7058c2ecf20Sopenharmony_ci#define TCTL_IRQEN		0x0010	/* IRQ Enable    */
7068c2ecf20Sopenharmony_ci#define TCTL_OM			0x0020	/* Output Mode   */
7078c2ecf20Sopenharmony_ci#define TCTL_CAP_MASK		0x00c0	/* Capture Edge: */
7088c2ecf20Sopenharmony_ci#define	  TCTL_CAP_RE		0x0040		/* Capture on rizing edge   */
7098c2ecf20Sopenharmony_ci#define   TCTL_CAP_FE		0x0080		/* Capture on falling edge  */
7108c2ecf20Sopenharmony_ci#define TCTL_FRR		0x0010	/* Free-Run Mode */
7118c2ecf20Sopenharmony_ci
7128c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
7138c2ecf20Sopenharmony_ci#define TCTL_ADDR	TCTL1_ADDR
7148c2ecf20Sopenharmony_ci#define TCTL		TCTL1
7158c2ecf20Sopenharmony_ci
7168c2ecf20Sopenharmony_ci/*
7178c2ecf20Sopenharmony_ci * Timer Unit 1 and 2 Prescaler Registers
7188c2ecf20Sopenharmony_ci */
7198c2ecf20Sopenharmony_ci#define TPRER1_ADDR	0xfffff602
7208c2ecf20Sopenharmony_ci#define TPRER1		WORD_REF(TPRER1_ADDR)
7218c2ecf20Sopenharmony_ci#define TPRER2_ADDR	0xfffff60e
7228c2ecf20Sopenharmony_ci#define TPRER2		WORD_REF(TPRER2_ADDR)
7238c2ecf20Sopenharmony_ci
7248c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
7258c2ecf20Sopenharmony_ci#define TPRER_ADDR	TPRER1_ADDR
7268c2ecf20Sopenharmony_ci#define TPRER		TPRER1
7278c2ecf20Sopenharmony_ci
7288c2ecf20Sopenharmony_ci/*
7298c2ecf20Sopenharmony_ci * Timer Unit 1 and 2 Compare Registers
7308c2ecf20Sopenharmony_ci */
7318c2ecf20Sopenharmony_ci#define TCMP1_ADDR	0xfffff604
7328c2ecf20Sopenharmony_ci#define TCMP1		WORD_REF(TCMP1_ADDR)
7338c2ecf20Sopenharmony_ci#define TCMP2_ADDR	0xfffff610
7348c2ecf20Sopenharmony_ci#define TCMP2		WORD_REF(TCMP2_ADDR)
7358c2ecf20Sopenharmony_ci
7368c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
7378c2ecf20Sopenharmony_ci#define TCMP_ADDR	TCMP1_ADDR
7388c2ecf20Sopenharmony_ci#define TCMP		TCMP1
7398c2ecf20Sopenharmony_ci
7408c2ecf20Sopenharmony_ci/*
7418c2ecf20Sopenharmony_ci * Timer Unit 1 and 2 Capture Registers
7428c2ecf20Sopenharmony_ci */
7438c2ecf20Sopenharmony_ci#define TCR1_ADDR	0xfffff606
7448c2ecf20Sopenharmony_ci#define TCR1		WORD_REF(TCR1_ADDR)
7458c2ecf20Sopenharmony_ci#define TCR2_ADDR	0xfffff612
7468c2ecf20Sopenharmony_ci#define TCR2		WORD_REF(TCR2_ADDR)
7478c2ecf20Sopenharmony_ci
7488c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
7498c2ecf20Sopenharmony_ci#define TCR_ADDR	TCR1_ADDR
7508c2ecf20Sopenharmony_ci#define TCR		TCR1
7518c2ecf20Sopenharmony_ci
7528c2ecf20Sopenharmony_ci/*
7538c2ecf20Sopenharmony_ci * Timer Unit 1 and 2 Counter Registers
7548c2ecf20Sopenharmony_ci */
7558c2ecf20Sopenharmony_ci#define TCN1_ADDR	0xfffff608
7568c2ecf20Sopenharmony_ci#define TCN1		WORD_REF(TCN1_ADDR)
7578c2ecf20Sopenharmony_ci#define TCN2_ADDR	0xfffff614
7588c2ecf20Sopenharmony_ci#define TCN2		WORD_REF(TCN2_ADDR)
7598c2ecf20Sopenharmony_ci
7608c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
7618c2ecf20Sopenharmony_ci#define TCN_ADDR	TCN1_ADDR
7628c2ecf20Sopenharmony_ci#define TCN		TCN1
7638c2ecf20Sopenharmony_ci
7648c2ecf20Sopenharmony_ci/*
7658c2ecf20Sopenharmony_ci * Timer Unit 1 and 2 Status Registers
7668c2ecf20Sopenharmony_ci */
7678c2ecf20Sopenharmony_ci#define TSTAT1_ADDR	0xfffff60a
7688c2ecf20Sopenharmony_ci#define TSTAT1		WORD_REF(TSTAT1_ADDR)
7698c2ecf20Sopenharmony_ci#define TSTAT2_ADDR	0xfffff616
7708c2ecf20Sopenharmony_ci#define TSTAT2		WORD_REF(TSTAT2_ADDR)
7718c2ecf20Sopenharmony_ci
7728c2ecf20Sopenharmony_ci#define TSTAT_COMP	0x0001		/* Compare Event occurred */
7738c2ecf20Sopenharmony_ci#define TSTAT_CAPT	0x0001		/* Capture Event occurred */
7748c2ecf20Sopenharmony_ci
7758c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
7768c2ecf20Sopenharmony_ci#define TSTAT_ADDR	TSTAT1_ADDR
7778c2ecf20Sopenharmony_ci#define TSTAT		TSTAT1
7788c2ecf20Sopenharmony_ci
7798c2ecf20Sopenharmony_ci/*
7808c2ecf20Sopenharmony_ci * Watchdog Compare Register
7818c2ecf20Sopenharmony_ci */
7828c2ecf20Sopenharmony_ci#define WRR_ADDR	0xfffff61a
7838c2ecf20Sopenharmony_ci#define WRR		WORD_REF(WRR_ADDR)
7848c2ecf20Sopenharmony_ci
7858c2ecf20Sopenharmony_ci/*
7868c2ecf20Sopenharmony_ci * Watchdog Counter Register
7878c2ecf20Sopenharmony_ci */
7888c2ecf20Sopenharmony_ci#define WCN_ADDR	0xfffff61c
7898c2ecf20Sopenharmony_ci#define WCN		WORD_REF(WCN_ADDR)
7908c2ecf20Sopenharmony_ci
7918c2ecf20Sopenharmony_ci/*
7928c2ecf20Sopenharmony_ci * Watchdog Control and Status Register
7938c2ecf20Sopenharmony_ci */
7948c2ecf20Sopenharmony_ci#define WCSR_ADDR	0xfffff618
7958c2ecf20Sopenharmony_ci#define WCSR		WORD_REF(WCSR_ADDR)
7968c2ecf20Sopenharmony_ci
7978c2ecf20Sopenharmony_ci#define WCSR_WDEN	0x0001	/* Watchdog Enable */
7988c2ecf20Sopenharmony_ci#define WCSR_FI		0x0002	/* Forced Interrupt (instead of SW reset)*/
7998c2ecf20Sopenharmony_ci#define WCSR_WRST	0x0004	/* Watchdog Reset */
8008c2ecf20Sopenharmony_ci
8018c2ecf20Sopenharmony_ci/**********
8028c2ecf20Sopenharmony_ci *
8038c2ecf20Sopenharmony_ci * 0xFFFFF7xx -- Serial Peripheral Interface Slave (SPIS)
8048c2ecf20Sopenharmony_ci *
8058c2ecf20Sopenharmony_ci **********/
8068c2ecf20Sopenharmony_ci
8078c2ecf20Sopenharmony_ci/*
8088c2ecf20Sopenharmony_ci * SPI Slave Register
8098c2ecf20Sopenharmony_ci */
8108c2ecf20Sopenharmony_ci#define SPISR_ADDR	0xfffff700
8118c2ecf20Sopenharmony_ci#define SPISR		WORD_REF(SPISR_ADDR)
8128c2ecf20Sopenharmony_ci
8138c2ecf20Sopenharmony_ci#define SPISR_DATA_ADDR	0xfffff701
8148c2ecf20Sopenharmony_ci#define SPISR_DATA	BYTE_REF(SPISR_DATA_ADDR)
8158c2ecf20Sopenharmony_ci
8168c2ecf20Sopenharmony_ci#define SPISR_DATA_MASK	 0x00ff	/* Shifted data from the external device */
8178c2ecf20Sopenharmony_ci#define SPISR_DATA_SHIFT 0
8188c2ecf20Sopenharmony_ci#define SPISR_SPISEN	 0x0100	/* SPIS module enable */
8198c2ecf20Sopenharmony_ci#define SPISR_POL	 0x0200	/* SPSCLK polarity control */
8208c2ecf20Sopenharmony_ci#define SPISR_PHA	 0x0400	/* Phase relationship between SPSCLK & SPSRxD */
8218c2ecf20Sopenharmony_ci#define SPISR_OVWR	 0x0800	/* Data buffer has been overwritten */
8228c2ecf20Sopenharmony_ci#define SPISR_DATARDY	 0x1000	/* Data ready */
8238c2ecf20Sopenharmony_ci#define SPISR_ENPOL	 0x2000	/* Enable Polarity */
8248c2ecf20Sopenharmony_ci#define SPISR_IRQEN	 0x4000	/* SPIS IRQ Enable */
8258c2ecf20Sopenharmony_ci#define SPISR_SPISIRQ	 0x8000	/* SPIS IRQ posted */
8268c2ecf20Sopenharmony_ci
8278c2ecf20Sopenharmony_ci/**********
8288c2ecf20Sopenharmony_ci *
8298c2ecf20Sopenharmony_ci * 0xFFFFF8xx -- Serial Peripheral Interface Master (SPIM)
8308c2ecf20Sopenharmony_ci *
8318c2ecf20Sopenharmony_ci **********/
8328c2ecf20Sopenharmony_ci
8338c2ecf20Sopenharmony_ci/*
8348c2ecf20Sopenharmony_ci * SPIM Data Register
8358c2ecf20Sopenharmony_ci */
8368c2ecf20Sopenharmony_ci#define SPIMDATA_ADDR	0xfffff800
8378c2ecf20Sopenharmony_ci#define SPIMDATA	WORD_REF(SPIMDATA_ADDR)
8388c2ecf20Sopenharmony_ci
8398c2ecf20Sopenharmony_ci/*
8408c2ecf20Sopenharmony_ci * SPIM Control/Status Register
8418c2ecf20Sopenharmony_ci */
8428c2ecf20Sopenharmony_ci#define SPIMCONT_ADDR	0xfffff802
8438c2ecf20Sopenharmony_ci#define SPIMCONT	WORD_REF(SPIMCONT_ADDR)
8448c2ecf20Sopenharmony_ci
8458c2ecf20Sopenharmony_ci#define SPIMCONT_BIT_COUNT_MASK	 0x000f	/* Transfer Length in Bytes */
8468c2ecf20Sopenharmony_ci#define SPIMCONT_BIT_COUNT_SHIFT 0
8478c2ecf20Sopenharmony_ci#define SPIMCONT_POL		 0x0010	/* SPMCLK Signel Polarity */
8488c2ecf20Sopenharmony_ci#define	SPIMCONT_PHA		 0x0020	/* Clock/Data phase relationship */
8498c2ecf20Sopenharmony_ci#define SPIMCONT_IRQEN		 0x0040 /* IRQ Enable */
8508c2ecf20Sopenharmony_ci#define SPIMCONT_SPIMIRQ	 0x0080	/* Interrupt Request */
8518c2ecf20Sopenharmony_ci#define SPIMCONT_XCH		 0x0100	/* Exchange */
8528c2ecf20Sopenharmony_ci#define SPIMCONT_RSPIMEN	 0x0200	/* Enable SPIM */
8538c2ecf20Sopenharmony_ci#define SPIMCONT_DATA_RATE_MASK	 0xe000	/* SPIM Data Rate */
8548c2ecf20Sopenharmony_ci#define SPIMCONT_DATA_RATE_SHIFT 13
8558c2ecf20Sopenharmony_ci
8568c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
8578c2ecf20Sopenharmony_ci#define SPIMCONT_IRQ	SPIMCONT_SPIMIRQ
8588c2ecf20Sopenharmony_ci#define SPIMCONT_ENABLE	SPIMCONT_SPIMEN
8598c2ecf20Sopenharmony_ci/**********
8608c2ecf20Sopenharmony_ci *
8618c2ecf20Sopenharmony_ci * 0xFFFFF9xx -- UART
8628c2ecf20Sopenharmony_ci *
8638c2ecf20Sopenharmony_ci **********/
8648c2ecf20Sopenharmony_ci
8658c2ecf20Sopenharmony_ci/*
8668c2ecf20Sopenharmony_ci * UART Status/Control Register
8678c2ecf20Sopenharmony_ci */
8688c2ecf20Sopenharmony_ci#define USTCNT_ADDR	0xfffff900
8698c2ecf20Sopenharmony_ci#define USTCNT		WORD_REF(USTCNT_ADDR)
8708c2ecf20Sopenharmony_ci
8718c2ecf20Sopenharmony_ci#define USTCNT_TXAVAILEN	0x0001	/* Transmitter Available Int Enable */
8728c2ecf20Sopenharmony_ci#define USTCNT_TXHALFEN		0x0002	/* Transmitter Half Empty Int Enable */
8738c2ecf20Sopenharmony_ci#define USTCNT_TXEMPTYEN	0x0004	/* Transmitter Empty Int Enable */
8748c2ecf20Sopenharmony_ci#define USTCNT_RXREADYEN	0x0008	/* Receiver Ready Interrupt Enable */
8758c2ecf20Sopenharmony_ci#define USTCNT_RXHALFEN		0x0010	/* Receiver Half-Full Int Enable */
8768c2ecf20Sopenharmony_ci#define USTCNT_RXFULLEN		0x0020	/* Receiver Full Interrupt Enable */
8778c2ecf20Sopenharmony_ci#define USTCNT_CTSDELTAEN	0x0040	/* CTS Delta Interrupt Enable */
8788c2ecf20Sopenharmony_ci#define USTCNT_GPIODELTAEN	0x0080	/* Old Data Interrupt Enable */
8798c2ecf20Sopenharmony_ci#define USTCNT_8_7		0x0100	/* Eight or seven-bit transmission */
8808c2ecf20Sopenharmony_ci#define USTCNT_STOP		0x0200	/* Stop bit transmission */
8818c2ecf20Sopenharmony_ci#define USTCNT_ODD_EVEN		0x0400	/* Odd Parity */
8828c2ecf20Sopenharmony_ci#define	USTCNT_PARITYEN		0x0800	/* Parity Enable */
8838c2ecf20Sopenharmony_ci#define USTCNT_CLKMODE		0x1000	/* Clock Mode Select */
8848c2ecf20Sopenharmony_ci#define	USTCNT_TXEN		0x2000	/* Transmitter Enable */
8858c2ecf20Sopenharmony_ci#define USTCNT_RXEN		0x4000	/* Receiver Enable */
8868c2ecf20Sopenharmony_ci#define USTCNT_UARTEN		0x8000	/* UART Enable */
8878c2ecf20Sopenharmony_ci
8888c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
8898c2ecf20Sopenharmony_ci#define USTCNT_TXAE	USTCNT_TXAVAILEN
8908c2ecf20Sopenharmony_ci#define USTCNT_TXHE	USTCNT_TXHALFEN
8918c2ecf20Sopenharmony_ci#define USTCNT_TXEE	USTCNT_TXEMPTYEN
8928c2ecf20Sopenharmony_ci#define USTCNT_RXRE	USTCNT_RXREADYEN
8938c2ecf20Sopenharmony_ci#define USTCNT_RXHE	USTCNT_RXHALFEN
8948c2ecf20Sopenharmony_ci#define USTCNT_RXFE	USTCNT_RXFULLEN
8958c2ecf20Sopenharmony_ci#define USTCNT_CTSD	USTCNT_CTSDELTAEN
8968c2ecf20Sopenharmony_ci#define USTCNT_ODD	USTCNT_ODD_EVEN
8978c2ecf20Sopenharmony_ci#define USTCNT_PEN	USTCNT_PARITYEN
8988c2ecf20Sopenharmony_ci#define USTCNT_CLKM	USTCNT_CLKMODE
8998c2ecf20Sopenharmony_ci#define USTCNT_UEN	USTCNT_UARTEN
9008c2ecf20Sopenharmony_ci
9018c2ecf20Sopenharmony_ci/*
9028c2ecf20Sopenharmony_ci * UART Baud Control Register
9038c2ecf20Sopenharmony_ci */
9048c2ecf20Sopenharmony_ci#define UBAUD_ADDR	0xfffff902
9058c2ecf20Sopenharmony_ci#define UBAUD		WORD_REF(UBAUD_ADDR)
9068c2ecf20Sopenharmony_ci
9078c2ecf20Sopenharmony_ci#define UBAUD_PRESCALER_MASK	0x003f	/* Actual divisor is 65 - PRESCALER */
9088c2ecf20Sopenharmony_ci#define UBAUD_PRESCALER_SHIFT	0
9098c2ecf20Sopenharmony_ci#define UBAUD_DIVIDE_MASK	0x0700	/* Baud Rate freq. divisor */
9108c2ecf20Sopenharmony_ci#define UBAUD_DIVIDE_SHIFT	8
9118c2ecf20Sopenharmony_ci#define UBAUD_BAUD_SRC		0x0800	/* Baud Rate Source */
9128c2ecf20Sopenharmony_ci#define UBAUD_GPIOSRC		0x1000	/* GPIO source */
9138c2ecf20Sopenharmony_ci#define UBAUD_GPIODIR		0x2000	/* GPIO Direction */
9148c2ecf20Sopenharmony_ci#define UBAUD_GPIO		0x4000	/* Current GPIO pin status */
9158c2ecf20Sopenharmony_ci#define UBAUD_GPIODELTA		0x8000	/* GPIO pin value changed */
9168c2ecf20Sopenharmony_ci
9178c2ecf20Sopenharmony_ci/*
9188c2ecf20Sopenharmony_ci * UART Receiver Register
9198c2ecf20Sopenharmony_ci */
9208c2ecf20Sopenharmony_ci#define URX_ADDR	0xfffff904
9218c2ecf20Sopenharmony_ci#define URX		WORD_REF(URX_ADDR)
9228c2ecf20Sopenharmony_ci
9238c2ecf20Sopenharmony_ci#define URX_RXDATA_ADDR	0xfffff905
9248c2ecf20Sopenharmony_ci#define URX_RXDATA	BYTE_REF(URX_RXDATA_ADDR)
9258c2ecf20Sopenharmony_ci
9268c2ecf20Sopenharmony_ci#define URX_RXDATA_MASK	 0x00ff	/* Received data */
9278c2ecf20Sopenharmony_ci#define URX_RXDATA_SHIFT 0
9288c2ecf20Sopenharmony_ci#define URX_PARITY_ERROR 0x0100	/* Parity Error */
9298c2ecf20Sopenharmony_ci#define URX_BREAK	 0x0200	/* Break Detected */
9308c2ecf20Sopenharmony_ci#define URX_FRAME_ERROR	 0x0400	/* Framing Error */
9318c2ecf20Sopenharmony_ci#define URX_OVRUN	 0x0800	/* Serial Overrun */
9328c2ecf20Sopenharmony_ci#define URX_DATA_READY	 0x2000	/* Data Ready (FIFO not empty) */
9338c2ecf20Sopenharmony_ci#define URX_FIFO_HALF	 0x4000 /* FIFO is Half-Full */
9348c2ecf20Sopenharmony_ci#define URX_FIFO_FULL	 0x8000	/* FIFO is Full */
9358c2ecf20Sopenharmony_ci
9368c2ecf20Sopenharmony_ci/*
9378c2ecf20Sopenharmony_ci * UART Transmitter Register
9388c2ecf20Sopenharmony_ci */
9398c2ecf20Sopenharmony_ci#define UTX_ADDR	0xfffff906
9408c2ecf20Sopenharmony_ci#define UTX		WORD_REF(UTX_ADDR)
9418c2ecf20Sopenharmony_ci
9428c2ecf20Sopenharmony_ci#define UTX_TXDATA_ADDR	0xfffff907
9438c2ecf20Sopenharmony_ci#define UTX_TXDATA	BYTE_REF(UTX_TXDATA_ADDR)
9448c2ecf20Sopenharmony_ci
9458c2ecf20Sopenharmony_ci#define UTX_TXDATA_MASK	 0x00ff	/* Data to be transmitted */
9468c2ecf20Sopenharmony_ci#define UTX_TXDATA_SHIFT 0
9478c2ecf20Sopenharmony_ci#define UTX_CTS_DELTA	 0x0100	/* CTS changed */
9488c2ecf20Sopenharmony_ci#define UTX_CTS_STATUS	 0x0200	/* CTS State */
9498c2ecf20Sopenharmony_ci#define	UTX_IGNORE_CTS	 0x0800	/* Ignore CTS */
9508c2ecf20Sopenharmony_ci#define UTX_SEND_BREAK	 0x1000	/* Send a BREAK */
9518c2ecf20Sopenharmony_ci#define UTX_TX_AVAIL	 0x2000	/* Transmit FIFO has a slot available */
9528c2ecf20Sopenharmony_ci#define UTX_FIFO_HALF	 0x4000	/* Transmit FIFO is half empty */
9538c2ecf20Sopenharmony_ci#define UTX_FIFO_EMPTY	 0x8000	/* Transmit FIFO is empty */
9548c2ecf20Sopenharmony_ci
9558c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
9568c2ecf20Sopenharmony_ci#define UTX_CTS_STAT	UTX_CTS_STATUS
9578c2ecf20Sopenharmony_ci#define UTX_NOCTS	UTX_IGNORE_CTS
9588c2ecf20Sopenharmony_ci
9598c2ecf20Sopenharmony_ci/*
9608c2ecf20Sopenharmony_ci * UART Miscellaneous Register
9618c2ecf20Sopenharmony_ci */
9628c2ecf20Sopenharmony_ci#define UMISC_ADDR	0xfffff908
9638c2ecf20Sopenharmony_ci#define UMISC		WORD_REF(UMISC_ADDR)
9648c2ecf20Sopenharmony_ci
9658c2ecf20Sopenharmony_ci#define UMISC_TX_POL	 0x0004	/* Transmit Polarity */
9668c2ecf20Sopenharmony_ci#define UMISC_RX_POL	 0x0008	/* Receive Polarity */
9678c2ecf20Sopenharmony_ci#define UMISC_IRDA_LOOP	 0x0010	/* IrDA Loopback Enable */
9688c2ecf20Sopenharmony_ci#define UMISC_IRDA_EN	 0x0020	/* Infra-Red Enable */
9698c2ecf20Sopenharmony_ci#define UMISC_RTS	 0x0040	/* Set RTS status */
9708c2ecf20Sopenharmony_ci#define UMISC_RTSCONT	 0x0080	/* Choose RTS control */
9718c2ecf20Sopenharmony_ci#define UMISC_LOOP	 0x1000	/* Serial Loopback Enable */
9728c2ecf20Sopenharmony_ci#define UMISC_FORCE_PERR 0x2000	/* Force Parity Error */
9738c2ecf20Sopenharmony_ci#define UMISC_CLKSRC	 0x4000	/* Clock Source */
9748c2ecf20Sopenharmony_ci
9758c2ecf20Sopenharmony_ci
9768c2ecf20Sopenharmony_ci/* generalization of uart control registers to support multiple ports: */
9778c2ecf20Sopenharmony_citypedef volatile struct {
9788c2ecf20Sopenharmony_ci  volatile unsigned short int ustcnt;
9798c2ecf20Sopenharmony_ci  volatile unsigned short int ubaud;
9808c2ecf20Sopenharmony_ci  union {
9818c2ecf20Sopenharmony_ci    volatile unsigned short int w;
9828c2ecf20Sopenharmony_ci    struct {
9838c2ecf20Sopenharmony_ci      volatile unsigned char status;
9848c2ecf20Sopenharmony_ci      volatile unsigned char rxdata;
9858c2ecf20Sopenharmony_ci    } b;
9868c2ecf20Sopenharmony_ci  } urx;
9878c2ecf20Sopenharmony_ci  union {
9888c2ecf20Sopenharmony_ci    volatile unsigned short int w;
9898c2ecf20Sopenharmony_ci    struct {
9908c2ecf20Sopenharmony_ci      volatile unsigned char status;
9918c2ecf20Sopenharmony_ci      volatile unsigned char txdata;
9928c2ecf20Sopenharmony_ci    } b;
9938c2ecf20Sopenharmony_ci  } utx;
9948c2ecf20Sopenharmony_ci  volatile unsigned short int umisc;
9958c2ecf20Sopenharmony_ci  volatile unsigned short int pad1;
9968c2ecf20Sopenharmony_ci  volatile unsigned short int pad2;
9978c2ecf20Sopenharmony_ci  volatile unsigned short int pad3;
9988c2ecf20Sopenharmony_ci} __packed m68328_uart;
9998c2ecf20Sopenharmony_ci
10008c2ecf20Sopenharmony_ci
10018c2ecf20Sopenharmony_ci/**********
10028c2ecf20Sopenharmony_ci *
10038c2ecf20Sopenharmony_ci * 0xFFFFFAxx -- LCD Controller
10048c2ecf20Sopenharmony_ci *
10058c2ecf20Sopenharmony_ci **********/
10068c2ecf20Sopenharmony_ci
10078c2ecf20Sopenharmony_ci/*
10088c2ecf20Sopenharmony_ci * LCD Screen Starting Address Register
10098c2ecf20Sopenharmony_ci */
10108c2ecf20Sopenharmony_ci#define LSSA_ADDR	0xfffffa00
10118c2ecf20Sopenharmony_ci#define LSSA		LONG_REF(LSSA_ADDR)
10128c2ecf20Sopenharmony_ci
10138c2ecf20Sopenharmony_ci#define LSSA_SSA_MASK	0xfffffffe	/* Bit 0 is reserved */
10148c2ecf20Sopenharmony_ci
10158c2ecf20Sopenharmony_ci/*
10168c2ecf20Sopenharmony_ci * LCD Virtual Page Width Register
10178c2ecf20Sopenharmony_ci */
10188c2ecf20Sopenharmony_ci#define LVPW_ADDR	0xfffffa05
10198c2ecf20Sopenharmony_ci#define LVPW		BYTE_REF(LVPW_ADDR)
10208c2ecf20Sopenharmony_ci
10218c2ecf20Sopenharmony_ci/*
10228c2ecf20Sopenharmony_ci * LCD Screen Width Register (not compatible with 'EZ328 !!!)
10238c2ecf20Sopenharmony_ci */
10248c2ecf20Sopenharmony_ci#define LXMAX_ADDR	0xfffffa08
10258c2ecf20Sopenharmony_ci#define LXMAX		WORD_REF(LXMAX_ADDR)
10268c2ecf20Sopenharmony_ci
10278c2ecf20Sopenharmony_ci#define LXMAX_XM_MASK	0x02ff		/* Bits 0-3 are reserved */
10288c2ecf20Sopenharmony_ci
10298c2ecf20Sopenharmony_ci/*
10308c2ecf20Sopenharmony_ci * LCD Screen Height Register
10318c2ecf20Sopenharmony_ci */
10328c2ecf20Sopenharmony_ci#define LYMAX_ADDR	0xfffffa0a
10338c2ecf20Sopenharmony_ci#define LYMAX		WORD_REF(LYMAX_ADDR)
10348c2ecf20Sopenharmony_ci
10358c2ecf20Sopenharmony_ci#define LYMAX_YM_MASK	0x02ff		/* Bits 10-15 are reserved */
10368c2ecf20Sopenharmony_ci
10378c2ecf20Sopenharmony_ci/*
10388c2ecf20Sopenharmony_ci * LCD Cursor X Position Register
10398c2ecf20Sopenharmony_ci */
10408c2ecf20Sopenharmony_ci#define LCXP_ADDR	0xfffffa18
10418c2ecf20Sopenharmony_ci#define LCXP		WORD_REF(LCXP_ADDR)
10428c2ecf20Sopenharmony_ci
10438c2ecf20Sopenharmony_ci#define LCXP_CC_MASK	0xc000		/* Cursor Control */
10448c2ecf20Sopenharmony_ci#define   LCXP_CC_TRAMSPARENT	0x0000
10458c2ecf20Sopenharmony_ci#define   LCXP_CC_BLACK		0x4000
10468c2ecf20Sopenharmony_ci#define   LCXP_CC_REVERSED	0x8000
10478c2ecf20Sopenharmony_ci#define   LCXP_CC_WHITE		0xc000
10488c2ecf20Sopenharmony_ci#define LCXP_CXP_MASK	0x02ff		/* Cursor X position */
10498c2ecf20Sopenharmony_ci
10508c2ecf20Sopenharmony_ci/*
10518c2ecf20Sopenharmony_ci * LCD Cursor Y Position Register
10528c2ecf20Sopenharmony_ci */
10538c2ecf20Sopenharmony_ci#define LCYP_ADDR	0xfffffa1a
10548c2ecf20Sopenharmony_ci#define LCYP		WORD_REF(LCYP_ADDR)
10558c2ecf20Sopenharmony_ci
10568c2ecf20Sopenharmony_ci#define LCYP_CYP_MASK	0x01ff		/* Cursor Y Position */
10578c2ecf20Sopenharmony_ci
10588c2ecf20Sopenharmony_ci/*
10598c2ecf20Sopenharmony_ci * LCD Cursor Width and Heigth Register
10608c2ecf20Sopenharmony_ci */
10618c2ecf20Sopenharmony_ci#define LCWCH_ADDR	0xfffffa1c
10628c2ecf20Sopenharmony_ci#define LCWCH		WORD_REF(LCWCH_ADDR)
10638c2ecf20Sopenharmony_ci
10648c2ecf20Sopenharmony_ci#define LCWCH_CH_MASK	0x001f		/* Cursor Height */
10658c2ecf20Sopenharmony_ci#define LCWCH_CH_SHIFT	0
10668c2ecf20Sopenharmony_ci#define LCWCH_CW_MASK	0x1f00		/* Cursor Width */
10678c2ecf20Sopenharmony_ci#define LCWCH_CW_SHIFT	8
10688c2ecf20Sopenharmony_ci
10698c2ecf20Sopenharmony_ci/*
10708c2ecf20Sopenharmony_ci * LCD Blink Control Register
10718c2ecf20Sopenharmony_ci */
10728c2ecf20Sopenharmony_ci#define LBLKC_ADDR	0xfffffa1f
10738c2ecf20Sopenharmony_ci#define LBLKC		BYTE_REF(LBLKC_ADDR)
10748c2ecf20Sopenharmony_ci
10758c2ecf20Sopenharmony_ci#define LBLKC_BD_MASK	0x7f	/* Blink Divisor */
10768c2ecf20Sopenharmony_ci#define LBLKC_BD_SHIFT	0
10778c2ecf20Sopenharmony_ci#define LBLKC_BKEN	0x80	/* Blink Enabled */
10788c2ecf20Sopenharmony_ci
10798c2ecf20Sopenharmony_ci/*
10808c2ecf20Sopenharmony_ci * LCD Panel Interface Configuration Register
10818c2ecf20Sopenharmony_ci */
10828c2ecf20Sopenharmony_ci#define LPICF_ADDR	0xfffffa20
10838c2ecf20Sopenharmony_ci#define LPICF		BYTE_REF(LPICF_ADDR)
10848c2ecf20Sopenharmony_ci
10858c2ecf20Sopenharmony_ci#define LPICF_GS_MASK	 0x01	 /* Gray-Scale Mode */
10868c2ecf20Sopenharmony_ci#define	  LPICF_GS_BW	   0x00
10878c2ecf20Sopenharmony_ci#define   LPICF_GS_GRAY_4  0x01
10888c2ecf20Sopenharmony_ci#define LPICF_PBSIZ_MASK 0x06	/* Panel Bus Width */
10898c2ecf20Sopenharmony_ci#define   LPICF_PBSIZ_1	   0x00
10908c2ecf20Sopenharmony_ci#define   LPICF_PBSIZ_2    0x02
10918c2ecf20Sopenharmony_ci#define   LPICF_PBSIZ_4    0x04
10928c2ecf20Sopenharmony_ci
10938c2ecf20Sopenharmony_ci/*
10948c2ecf20Sopenharmony_ci * LCD Polarity Configuration Register
10958c2ecf20Sopenharmony_ci */
10968c2ecf20Sopenharmony_ci#define LPOLCF_ADDR	0xfffffa21
10978c2ecf20Sopenharmony_ci#define LPOLCF		BYTE_REF(LPOLCF_ADDR)
10988c2ecf20Sopenharmony_ci
10998c2ecf20Sopenharmony_ci#define LPOLCF_PIXPOL	0x01	/* Pixel Polarity */
11008c2ecf20Sopenharmony_ci#define LPOLCF_LPPOL	0x02	/* Line Pulse Polarity */
11018c2ecf20Sopenharmony_ci#define LPOLCF_FLMPOL	0x04	/* Frame Marker Polarity */
11028c2ecf20Sopenharmony_ci#define LPOLCF_LCKPOL	0x08	/* LCD Shift Lock Polarity */
11038c2ecf20Sopenharmony_ci
11048c2ecf20Sopenharmony_ci/*
11058c2ecf20Sopenharmony_ci * LACD (LCD Alternate Crystal Direction) Rate Control Register
11068c2ecf20Sopenharmony_ci */
11078c2ecf20Sopenharmony_ci#define LACDRC_ADDR	0xfffffa23
11088c2ecf20Sopenharmony_ci#define LACDRC		BYTE_REF(LACDRC_ADDR)
11098c2ecf20Sopenharmony_ci
11108c2ecf20Sopenharmony_ci#define LACDRC_ACD_MASK	 0x0f	/* Alternate Crystal Direction Control */
11118c2ecf20Sopenharmony_ci#define LACDRC_ACD_SHIFT 0
11128c2ecf20Sopenharmony_ci
11138c2ecf20Sopenharmony_ci/*
11148c2ecf20Sopenharmony_ci * LCD Pixel Clock Divider Register
11158c2ecf20Sopenharmony_ci */
11168c2ecf20Sopenharmony_ci#define LPXCD_ADDR	0xfffffa25
11178c2ecf20Sopenharmony_ci#define LPXCD		BYTE_REF(LPXCD_ADDR)
11188c2ecf20Sopenharmony_ci
11198c2ecf20Sopenharmony_ci#define	LPXCD_PCD_MASK	0x3f 	/* Pixel Clock Divider */
11208c2ecf20Sopenharmony_ci#define LPXCD_PCD_SHIFT	0
11218c2ecf20Sopenharmony_ci
11228c2ecf20Sopenharmony_ci/*
11238c2ecf20Sopenharmony_ci * LCD Clocking Control Register
11248c2ecf20Sopenharmony_ci */
11258c2ecf20Sopenharmony_ci#define LCKCON_ADDR	0xfffffa27
11268c2ecf20Sopenharmony_ci#define LCKCON		BYTE_REF(LCKCON_ADDR)
11278c2ecf20Sopenharmony_ci
11288c2ecf20Sopenharmony_ci#define LCKCON_PCDS	 0x01	/* Pixel Clock Divider Source Select */
11298c2ecf20Sopenharmony_ci#define LCKCON_DWIDTH	 0x02	/* Display Memory Width  */
11308c2ecf20Sopenharmony_ci#define LCKCON_DWS_MASK	 0x3c	/* Display Wait-State */
11318c2ecf20Sopenharmony_ci#define LCKCON_DWS_SHIFT 2
11328c2ecf20Sopenharmony_ci#define LCKCON_DMA16	 0x40	/* DMA burst length */
11338c2ecf20Sopenharmony_ci#define LCKCON_LCDON	 0x80	/* Enable LCD Controller */
11348c2ecf20Sopenharmony_ci
11358c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
11368c2ecf20Sopenharmony_ci#define LCKCON_DW_MASK	LCKCON_DWS_MASK
11378c2ecf20Sopenharmony_ci#define LCKCON_DW_SHIFT	LCKCON_DWS_SHIFT
11388c2ecf20Sopenharmony_ci
11398c2ecf20Sopenharmony_ci/*
11408c2ecf20Sopenharmony_ci * LCD Last Buffer Address Register
11418c2ecf20Sopenharmony_ci */
11428c2ecf20Sopenharmony_ci#define LLBAR_ADDR	0xfffffa29
11438c2ecf20Sopenharmony_ci#define LLBAR		BYTE_REF(LLBAR_ADDR)
11448c2ecf20Sopenharmony_ci
11458c2ecf20Sopenharmony_ci#define LLBAR_LBAR_MASK	 0x7f	/* Number of memory words to fill 1 line */
11468c2ecf20Sopenharmony_ci#define LLBAR_LBAR_SHIFT 0
11478c2ecf20Sopenharmony_ci
11488c2ecf20Sopenharmony_ci/*
11498c2ecf20Sopenharmony_ci * LCD Octet Terminal Count Register
11508c2ecf20Sopenharmony_ci */
11518c2ecf20Sopenharmony_ci#define LOTCR_ADDR	0xfffffa2b
11528c2ecf20Sopenharmony_ci#define LOTCR		BYTE_REF(LOTCR_ADDR)
11538c2ecf20Sopenharmony_ci
11548c2ecf20Sopenharmony_ci/*
11558c2ecf20Sopenharmony_ci * LCD Panning Offset Register
11568c2ecf20Sopenharmony_ci */
11578c2ecf20Sopenharmony_ci#define LPOSR_ADDR	0xfffffa2d
11588c2ecf20Sopenharmony_ci#define LPOSR		BYTE_REF(LPOSR_ADDR)
11598c2ecf20Sopenharmony_ci
11608c2ecf20Sopenharmony_ci#define LPOSR_BOS	0x08	/* Byte offset (for B/W mode only */
11618c2ecf20Sopenharmony_ci#define LPOSR_POS_MASK	0x07	/* Pixel Offset Code */
11628c2ecf20Sopenharmony_ci#define LPOSR_POS_SHIFT	0
11638c2ecf20Sopenharmony_ci
11648c2ecf20Sopenharmony_ci/*
11658c2ecf20Sopenharmony_ci * LCD Frame Rate Control Modulation Register
11668c2ecf20Sopenharmony_ci */
11678c2ecf20Sopenharmony_ci#define LFRCM_ADDR	0xfffffa31
11688c2ecf20Sopenharmony_ci#define LFRCM		BYTE_REF(LFRCM_ADDR)
11698c2ecf20Sopenharmony_ci
11708c2ecf20Sopenharmony_ci#define LFRCM_YMOD_MASK	 0x0f	/* Vertical Modulation */
11718c2ecf20Sopenharmony_ci#define LFRCM_YMOD_SHIFT 0
11728c2ecf20Sopenharmony_ci#define LFRCM_XMOD_MASK	 0xf0	/* Horizontal Modulation */
11738c2ecf20Sopenharmony_ci#define LFRCM_XMOD_SHIFT 4
11748c2ecf20Sopenharmony_ci
11758c2ecf20Sopenharmony_ci/*
11768c2ecf20Sopenharmony_ci * LCD Gray Palette Mapping Register
11778c2ecf20Sopenharmony_ci */
11788c2ecf20Sopenharmony_ci#define LGPMR_ADDR	0xfffffa32
11798c2ecf20Sopenharmony_ci#define LGPMR		WORD_REF(LGPMR_ADDR)
11808c2ecf20Sopenharmony_ci
11818c2ecf20Sopenharmony_ci#define LGPMR_GLEVEL3_MASK	0x000f
11828c2ecf20Sopenharmony_ci#define LGPMR_GLEVEL3_SHIFT	0
11838c2ecf20Sopenharmony_ci#define LGPMR_GLEVEL2_MASK	0x00f0
11848c2ecf20Sopenharmony_ci#define LGPMR_GLEVEL2_SHIFT	4
11858c2ecf20Sopenharmony_ci#define LGPMR_GLEVEL0_MASK	0x0f00
11868c2ecf20Sopenharmony_ci#define LGPMR_GLEVEL0_SHIFT	8
11878c2ecf20Sopenharmony_ci#define LGPMR_GLEVEL1_MASK	0xf000
11888c2ecf20Sopenharmony_ci#define LGPMR_GLEVEL1_SHIFT	12
11898c2ecf20Sopenharmony_ci
11908c2ecf20Sopenharmony_ci/**********
11918c2ecf20Sopenharmony_ci *
11928c2ecf20Sopenharmony_ci * 0xFFFFFBxx -- Real-Time Clock (RTC)
11938c2ecf20Sopenharmony_ci *
11948c2ecf20Sopenharmony_ci **********/
11958c2ecf20Sopenharmony_ci
11968c2ecf20Sopenharmony_ci/*
11978c2ecf20Sopenharmony_ci * RTC Hours Minutes and Seconds Register
11988c2ecf20Sopenharmony_ci */
11998c2ecf20Sopenharmony_ci#define RTCTIME_ADDR	0xfffffb00
12008c2ecf20Sopenharmony_ci#define RTCTIME		LONG_REF(RTCTIME_ADDR)
12018c2ecf20Sopenharmony_ci
12028c2ecf20Sopenharmony_ci#define RTCTIME_SECONDS_MASK	0x0000003f	/* Seconds */
12038c2ecf20Sopenharmony_ci#define RTCTIME_SECONDS_SHIFT	0
12048c2ecf20Sopenharmony_ci#define RTCTIME_MINUTES_MASK	0x003f0000	/* Minutes */
12058c2ecf20Sopenharmony_ci#define RTCTIME_MINUTES_SHIFT	16
12068c2ecf20Sopenharmony_ci#define RTCTIME_HOURS_MASK	0x1f000000	/* Hours */
12078c2ecf20Sopenharmony_ci#define RTCTIME_HOURS_SHIFT	24
12088c2ecf20Sopenharmony_ci
12098c2ecf20Sopenharmony_ci/*
12108c2ecf20Sopenharmony_ci *  RTC Alarm Register
12118c2ecf20Sopenharmony_ci */
12128c2ecf20Sopenharmony_ci#define RTCALRM_ADDR    0xfffffb04
12138c2ecf20Sopenharmony_ci#define RTCALRM         LONG_REF(RTCALRM_ADDR)
12148c2ecf20Sopenharmony_ci
12158c2ecf20Sopenharmony_ci#define RTCALRM_SECONDS_MASK    0x0000003f      /* Seconds */
12168c2ecf20Sopenharmony_ci#define RTCALRM_SECONDS_SHIFT   0
12178c2ecf20Sopenharmony_ci#define RTCALRM_MINUTES_MASK    0x003f0000      /* Minutes */
12188c2ecf20Sopenharmony_ci#define RTCALRM_MINUTES_SHIFT   16
12198c2ecf20Sopenharmony_ci#define RTCALRM_HOURS_MASK      0x1f000000      /* Hours */
12208c2ecf20Sopenharmony_ci#define RTCALRM_HOURS_SHIFT     24
12218c2ecf20Sopenharmony_ci
12228c2ecf20Sopenharmony_ci/*
12238c2ecf20Sopenharmony_ci * RTC Control Register
12248c2ecf20Sopenharmony_ci */
12258c2ecf20Sopenharmony_ci#define RTCCTL_ADDR	0xfffffb0c
12268c2ecf20Sopenharmony_ci#define RTCCTL		WORD_REF(RTCCTL_ADDR)
12278c2ecf20Sopenharmony_ci
12288c2ecf20Sopenharmony_ci#define RTCCTL_384	0x0020	/* Crystal Selection */
12298c2ecf20Sopenharmony_ci#define RTCCTL_ENABLE	0x0080	/* RTC Enable */
12308c2ecf20Sopenharmony_ci
12318c2ecf20Sopenharmony_ci/* 'EZ328-compatible definitions */
12328c2ecf20Sopenharmony_ci#define RTCCTL_XTL	RTCCTL_384
12338c2ecf20Sopenharmony_ci#define RTCCTL_EN	RTCCTL_ENABLE
12348c2ecf20Sopenharmony_ci
12358c2ecf20Sopenharmony_ci/*
12368c2ecf20Sopenharmony_ci * RTC Interrupt Status Register
12378c2ecf20Sopenharmony_ci */
12388c2ecf20Sopenharmony_ci#define RTCISR_ADDR	0xfffffb0e
12398c2ecf20Sopenharmony_ci#define RTCISR		WORD_REF(RTCISR_ADDR)
12408c2ecf20Sopenharmony_ci
12418c2ecf20Sopenharmony_ci#define RTCISR_SW	0x0001	/* Stopwatch timed out */
12428c2ecf20Sopenharmony_ci#define RTCISR_MIN	0x0002	/* 1-minute interrupt has occurred */
12438c2ecf20Sopenharmony_ci#define RTCISR_ALM	0x0004	/* Alarm interrupt has occurred */
12448c2ecf20Sopenharmony_ci#define RTCISR_DAY	0x0008	/* 24-hour rollover interrupt has occurred */
12458c2ecf20Sopenharmony_ci#define RTCISR_1HZ	0x0010	/* 1Hz interrupt has occurred */
12468c2ecf20Sopenharmony_ci
12478c2ecf20Sopenharmony_ci/*
12488c2ecf20Sopenharmony_ci * RTC Interrupt Enable Register
12498c2ecf20Sopenharmony_ci */
12508c2ecf20Sopenharmony_ci#define RTCIENR_ADDR	0xfffffb10
12518c2ecf20Sopenharmony_ci#define RTCIENR		WORD_REF(RTCIENR_ADDR)
12528c2ecf20Sopenharmony_ci
12538c2ecf20Sopenharmony_ci#define RTCIENR_SW	0x0001	/* Stopwatch interrupt enable */
12548c2ecf20Sopenharmony_ci#define RTCIENR_MIN	0x0002	/* 1-minute interrupt enable */
12558c2ecf20Sopenharmony_ci#define RTCIENR_ALM	0x0004	/* Alarm interrupt enable */
12568c2ecf20Sopenharmony_ci#define RTCIENR_DAY	0x0008	/* 24-hour rollover interrupt enable */
12578c2ecf20Sopenharmony_ci#define RTCIENR_1HZ	0x0010	/* 1Hz interrupt enable */
12588c2ecf20Sopenharmony_ci
12598c2ecf20Sopenharmony_ci/*
12608c2ecf20Sopenharmony_ci * Stopwatch Minutes Register
12618c2ecf20Sopenharmony_ci */
12628c2ecf20Sopenharmony_ci#define STPWCH_ADDR	0xfffffb12
12638c2ecf20Sopenharmony_ci#define STPWCH		WORD_REF(STPWCH)
12648c2ecf20Sopenharmony_ci
12658c2ecf20Sopenharmony_ci#define STPWCH_CNT_MASK	 0x00ff	/* Stopwatch countdown value */
12668c2ecf20Sopenharmony_ci#define SPTWCH_CNT_SHIFT 0
12678c2ecf20Sopenharmony_ci
12688c2ecf20Sopenharmony_ci#endif /* _MC68328_H_ */
1269