[BACK]Return to devreg.h CVS log [TXT][DIR] Up to [local] / sys / arch / sh / include

Annotation of sys/arch/sh/include/devreg.h, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: devreg.h,v 1.2 2007/02/11 22:56:06 martin Exp $       */
                      2: /*     $NetBSD: devreg.h,v 1.5 2006/01/21 04:57:07 uwe Exp $   */
                      3:
                      4: /*-
                      5:  * Copyright (c) 2002 The NetBSD Foundation, Inc.
                      6:  * All rights reserved.
                      7:  *
                      8:  * Redistribution and use in source and binary forms, with or without
                      9:  * modification, are permitted provided that the following conditions
                     10:  * are met:
                     11:  * 1. Redistributions of source code must retain the above copyright
                     12:  *    notice, this list of conditions and the following disclaimer.
                     13:  * 2. Redistributions in binary form must reproduce the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer in the
                     15:  *    documentation and/or other materials provided with the distribution.
                     16:  * 3. All advertising materials mentioning features or use of this software
                     17:  *    must display the following acknowledgement:
                     18:  *        This product includes software developed by the NetBSD
                     19:  *        Foundation, Inc. and its contributors.
                     20:  * 4. Neither the name of The NetBSD Foundation nor the names of its
                     21:  *    contributors may be used to endorse or promote products derived
                     22:  *    from this software without specific prior written permission.
                     23:  *
                     24:  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
                     25:  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
                     26:  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
                     27:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
                     28:  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
                     29:  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
                     30:  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
                     31:  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
                     32:  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
                     33:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
                     34:  * POSSIBILITY OF SUCH DAMAGE.
                     35:  */
                     36:
                     37: #ifndef _SH_DEVREG_H_
                     38: #define        _SH_DEVREG_H_
                     39: /*
                     40:  * SH embedded device register defines.
                     41:  */
                     42:
                     43: /*
                     44:  * Access method
                     45:  */
                     46: #define        _reg_read_1(a)          (*(volatile uint8_t *)((vaddr_t)(a)))
                     47: #define        _reg_read_2(a)          (*(volatile uint16_t *)((vaddr_t)(a)))
                     48: #define        _reg_read_4(a)          (*(volatile uint32_t *)((vaddr_t)(a)))
                     49: #define        _reg_write_1(a, v)                                              \
                     50:        (*(volatile uint8_t *)(a)  = (uint8_t)(v))
                     51: #define        _reg_write_2(a, v)                                              \
                     52:        (*(volatile uint16_t *)(a) = (uint16_t)(v))
                     53: #define        _reg_write_4(a, v)                                              \
                     54:        (*(volatile uint32_t *)(a) = (uint32_t)(v))
                     55: #define        _reg_bset_1(a, v)                                               \
                     56:        (*(volatile uint8_t *)(a)  |= (uint8_t)(v))
                     57: #define        _reg_bset_2(a, v)                                               \
                     58:        (*(volatile uint16_t *)(a) |= (uint16_t)(v))
                     59: #define        _reg_bset_4(a, v)                                               \
                     60:        (*(volatile uint32_t *)(a) |= (uint32_t)(v))
                     61: #define        _reg_bclr_1(a, v)                                               \
                     62:        (*(volatile uint8_t *)(a)  &= ~(uint8_t)(v))
                     63: #define        _reg_bclr_2(a, v)                                               \
                     64:        (*(volatile uint16_t *)(a) &= ~(uint16_t)(v))
                     65: #define        _reg_bclr_4(a, v)                                               \
                     66:        (*(volatile uint32_t *)(a) &= ~(uint32_t)(v))
                     67:
                     68: /*
                     69:  * Register address.
                     70:  */
                     71: #if defined(SH3) && defined(SH4)
                     72: #define        SH_(x)          __sh_ ## x
                     73: #elif defined(SH3)
                     74: #define        SH_(x)          SH3_ ## x
                     75: #elif defined(SH4)
                     76: #define        SH_(x)          SH4_ ## x
                     77: #endif
                     78:
                     79: #ifndef _LOCORE
                     80: /* Initialize register address for SH3 && SH4 kernel. */
                     81: void sh_devreg_init(void);
                     82: #endif
                     83: #endif /* !_SH_DEVREG_H_ */

CVSweb