xref: /netbsd-src/sys/arch/sh3/include/wdtreg.h (revision 95e1ffb15694e54f29f8baaa4232152b703c2a5a)
1*95e1ffb1Schristos /* $NetBSD: wdtreg.h,v 1.6 2005/12/11 12:18:59 christos Exp $ */
265363da2Sitojun 
365363da2Sitojun /*-
465363da2Sitojun  * Copyright (C) 1999 SAITOH Masanobu.  All rights reserved.
565363da2Sitojun  *
665363da2Sitojun  * Redistribution and use in source and binary forms, with or without
765363da2Sitojun  * modification, are permitted provided that the following conditions
865363da2Sitojun  * are met:
965363da2Sitojun  * 1. Redistributions of source code must retain the above copyright
1065363da2Sitojun  *    notice, this list of conditions and the following disclaimer.
1165363da2Sitojun  * 2. Redistributions in binary form must reproduce the above copyright
1265363da2Sitojun  *    notice, this list of conditions and the following disclaimer in the
1365363da2Sitojun  *    documentation and/or other materials provided with the distribution.
1465363da2Sitojun  * 3. The name of the author may not be used to endorse or promote products
1565363da2Sitojun  *    derived from this software without specific prior written permission.
1665363da2Sitojun  *
1765363da2Sitojun  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1865363da2Sitojun  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1965363da2Sitojun  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2065363da2Sitojun  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2165363da2Sitojun  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2265363da2Sitojun  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2365363da2Sitojun  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2465363da2Sitojun  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2565363da2Sitojun  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2665363da2Sitojun  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2765363da2Sitojun  */
2865363da2Sitojun 
2965363da2Sitojun #ifndef _SH3_WDTREG_H_
3065363da2Sitojun #define	_SH3_WDTREG_H_
3165363da2Sitojun 
3265363da2Sitojun /* WDT registers */
3365363da2Sitojun 
3465363da2Sitojun #if !defined(SH4)
3565363da2Sitojun 
3665363da2Sitojun /* SH3 definitions */
3770d5ff6aSuwe #define	SHREG_WTCNT	0xffffff84
3870d5ff6aSuwe #define	SHREG_WTCSR	0xffffff86
3965363da2Sitojun 
4065363da2Sitojun #else
4165363da2Sitojun 
4265363da2Sitojun /* SH4 definitions */
4370d5ff6aSuwe #define	SHREG_WTCNT	0xffc00008
4470d5ff6aSuwe #define	SHREG_WTCSR	0xffc0000c
4565363da2Sitojun 
4665363da2Sitojun #endif
4765363da2Sitojun 
4870d5ff6aSuwe /* read as bytes, write as shorts with a magic number in the upper byte */
4970d5ff6aSuwe #define	SHREG_WTCNT_R	(*(volatile unsigned char  *)SHREG_WTCNT)
5070d5ff6aSuwe #define	SHREG_WTCNT_W	(*(volatile unsigned short *)SHREG_WTCNT)
5170d5ff6aSuwe #define	SHREG_WTCSR_R	(*(volatile unsigned char  *)SHREG_WTCSR)
5270d5ff6aSuwe #define	SHREG_WTCSR_W	(*(volatile unsigned short *)SHREG_WTCSR)
5370d5ff6aSuwe 
5470d5ff6aSuwe /* magic upper bytes for write access */
5565363da2Sitojun #define	WTCNT_W_M	0x5A00
5665363da2Sitojun #define	WTCSR_W_M	0xA500
5765363da2Sitojun 
5865363da2Sitojun #define	WTCSR_TME	0x80
5965363da2Sitojun #define	WTCSR_WT	0x40
6065363da2Sitojun #define	WTCSR_RSTS	0x20
6165363da2Sitojun #define	WTCSR_WOVF	0x10
6265363da2Sitojun #define	WTCSR_IOVF	0x08
6365363da2Sitojun #define	WTCSR_CKS2	0x04
6465363da2Sitojun #define	WTCSR_CKS1	0x02
6565363da2Sitojun #define	WTCSR_CKS0	0x01
6665363da2Sitojun 
6765363da2Sitojun #define	WTCSR_CKS	0x07
688cf5a56cSmsaitoh #define	WTCSR_CKS_1	0x00
698cf5a56cSmsaitoh #define	WTCSR_CKS_4	0x01
708cf5a56cSmsaitoh #define	WTCSR_CKS_16	0x02
718cf5a56cSmsaitoh #define	WTCSR_CKS_32	0x03
728cf5a56cSmsaitoh #define	WTCSR_CKS_64	0x04
738cf5a56cSmsaitoh #define	WTCSR_CKS_256	0x05
748cf5a56cSmsaitoh #define	WTCSR_CKS_1024	0x06
758cf5a56cSmsaitoh #define	WTCSR_CKS_4096	0x07
7665363da2Sitojun 
7765363da2Sitojun #endif	/* !_SH3_WDTREG_H_ */
78