Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/sh3/include add SH-internal memory mapped register ...



details:   https://anonhg.NetBSD.org/src/rev/14f0c0102fb1
branches:  trunk
changeset: 521915:14f0c0102fb1
user:      uch <uch%NetBSD.org@localhost>
date:      Fri Feb 08 06:11:16 2002 +0000

description:
add SH-internal memory mapped register access method.

diffstat:

 sys/arch/sh3/include/cpufunc.h |  24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 deletions(-)

diffs (38 lines):

diff -r f424cadb55fe -r 14f0c0102fb1 sys/arch/sh3/include/cpufunc.h
--- a/sys/arch/sh3/include/cpufunc.h    Fri Feb 08 05:17:49 2002 +0000
+++ b/sys/arch/sh3/include/cpufunc.h    Fri Feb 08 06:11:16 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpufunc.h,v 1.7 2001/06/24 05:32:55 msaitoh Exp $      */
+/*     $NetBSD: cpufunc.h,v 1.8 2002/02/08 06:11:16 uch Exp $  */
 
 /*
  * Copyright (c) 1993 Charles Hannum.
@@ -48,6 +48,28 @@
 #include <sh3/mmureg.h>
 
 #ifdef _KERNEL
+/*
+ * memory-mapped register access method.
+ */
+#define _wb_flush()    /* not required */
+#define        _reg_read_1(a)          (*(__volatile__ u_int8_t *)((vaddr_t)(a)))
+#define        _reg_read_2(a)          (*(__volatile__ u_int16_t *)((vaddr_t)(a)))
+#define        _reg_read_4(a)          (*(__volatile__ u_int32_t *)((vaddr_t)(a)))
+#define        _reg_write_1(a, v)                                              \
+{                                                                      \
+       *(__volatile__ u_int8_t *)(a) = (u_int8_t)(v);                  \
+       _wb_flush();                                                    \
+}
+#define        _reg_write_2(a, v)                                              \
+{                                                                      \
+       *(__volatile__ u_int16_t *)(a) = (u_int16_t)(v);                \
+       _wb_flush();                                                    \
+}
+#define        _reg_write_4(a, v)                                              \
+{                                                                      \
+       *(__volatile__ u_int32_t *)(a) = (u_int32_t)(v);                \
+       _wb_flush();                                                    \
+}
 
 void enable_ext_intr __P((void));
 void disable_ext_intr __P((void));



Home | Main Index | Thread Index | Old Index