Home | History | Annotate | Line # | Download | only in dev
sh_dev.h revision 1.3.6.1
      1 /* -*-C++-*-	$NetBSD: sh_dev.h,v 1.3.6.1 2006/04/22 11:37:28 simonb Exp $	*/
      2 
      3 /*-
      4  * Copyright (c) 2002 The NetBSD Foundation, Inc.
      5  * All rights reserved.
      6  *
      7  * This code is derived from software contributed to The NetBSD Foundation
      8  * by UCHIYAMA Yasushi.
      9  *
     10  * Redistribution and use in source and binary forms, with or without
     11  * modification, are permitted provided that the following conditions
     12  * are met:
     13  * 1. Redistributions of source code must retain the above copyright
     14  *    notice, this list of conditions and the following disclaimer.
     15  * 2. Redistributions in binary form must reproduce the above copyright
     16  *    notice, this list of conditions and the following disclaimer in the
     17  *    documentation and/or other materials provided with the distribution.
     18  * 3. All advertising materials mentioning features or use of this software
     19  *    must display the following acknowledgement:
     20  *        This product includes software developed by the NetBSD
     21  *        Foundation, Inc. and its contributors.
     22  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  *    contributors may be used to endorse or promote products derived
     24  *    from this software without specific prior written permission.
     25  *
     26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  * POSSIBILITY OF SUCH DAMAGE.
     37  */
     38 
     39 #ifndef _SH3_DEV_SH_DEV_H_
     40 #define	_SH3_DEV_SH_DEV_H_
     41 #include <sh3/cpu/sh.h>
     42 
     43 class SHdev {
     44 protected:
     45 	HpcMenuInterface *_menu;
     46 	Console *_cons;
     47 	void print_stack_pointer(void);
     48 	struct intr_priority {
     49 		const char *name;
     50 		paddr_t reg;
     51 		int shift;
     52 	};
     53 
     54 	SHdev(void);
     55 	virtual uint32_t _scif_reg_read(vaddr_t) = 0;
     56 	void scif_dump(int);
     57 	void icu_dump_priority(struct intr_priority *);
     58 
     59 public:
     60 	virtual ~SHdev(void) { /* NO-OP */ }
     61 
     62 	virtual void dump(uint8_t);
     63 #define	DUMP_CPU	0x01
     64 #define	DUMP_DEV	0x02
     65 #define	DUMP_COMPANION	0x04
     66 #define	DUMP_VIDEO	0x08
     67 };
     68 
     69 class SH3dev : public SHdev {
     70 private:
     71 	typedef SHdev super;
     72 
     73 	void hd64461_dump(platid_t &);
     74 	void bsc_dump(void);
     75 	void pfc_dump(void);
     76 	void tmu_dump(void);
     77 	void tmu_channel_dump(int, paddr_t, paddr_t, paddr_t);
     78 	void icu_dump(void);
     79 	void icu_priority(void);
     80 	void icu_control(void);
     81 	static struct intr_priority _ipr_table[];
     82 
     83 	virtual uint32_t _scif_reg_read(vaddr_t va) {
     84 		return (uint32_t)_reg_read_1(va);
     85 	}
     86 
     87 public:
     88 	SH3dev(void) { /* NO-OP */ }
     89 	virtual ~SH3dev(void) { /* NO-OP */ }
     90 
     91 	virtual void dump(uint8_t);
     92 };
     93 
     94 class SH4dev : public SHdev {
     95 private:
     96 	typedef SHdev super;
     97 
     98 	static struct intr_priority _ipr_table[];
     99 
    100 	virtual uint32_t _scif_reg_read(vaddr_t va) {
    101 		return (uint32_t)_reg_read_2(va);
    102 	}
    103 
    104 public:
    105 	SH4dev(void) { /* NO-OP */ }
    106 	virtual ~SH4dev(void) { /* NO-OP */ }
    107 
    108 	virtual void dump(uint8_t);
    109 	void icu_dump(void);
    110 	void hd64465_dump(void);
    111 	void mq100_dump(void);
    112 };
    113 #endif // _SH3_DEV_SH_DEV_H_
    114