1 /* $NetBSD: bcm2835_gpioreg.h,v 1.3 2014/04/22 18:51:35 kardel Exp $ */ 2 3 /* 4 * Copyright (c) 2013 Jonathan A. Kollasch 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #ifndef _BROADCOM_BCM2835_GPIOREG_H_ 30 #define _BROADCOM_BCM2835_GPIOREG_H_ 31 32 #define BCM2835_GPIO_GPFSEL(x) (0x000 + (x) * sizeof(uint32_t)) 33 #define BCM2835_GPIO_GPFSEL_PINS_PER_REGISTER 10 34 #define BCM2835_GPIO_GPFSEL_BITS_PER_PIN 3 35 36 #define BCM2835_GPIO_GPSET(x) (0x01C + (x) * sizeof(uint32_t)) 37 #define BCM2835_GPIO_GPSET_PINS_PER_REGISTER 32 38 #define BCM2835_GPIO_GPCLR(x) (0x028 + (x) * sizeof(uint32_t)) 39 #define BCM2835_GPIO_GPCLR_PINS_PER_REGISTER BCM2835_GPIO_GPSET_PINS_PER_REGISTER 40 #define BCM2835_GPIO_GPLEV(x) (0x034 + (x) * sizeof(uint32_t)) 41 #define BCM2835_GPIO_GPLEV_PINS_PER_REGISTER 32 42 #define BCM2835_GPIO_GPEDS(x) (0x040 + (x) * sizeof(uint32_t)) 43 #define BCM2835_GPIO_GPREN(x) (0x04C + (x) * sizeof(uint32_t)) 44 #define BCM2835_GPIO_GPFEN(x) (0x058 + (x) * sizeof(uint32_t)) 45 #define BCM2835_GPIO_GPHEN(x) (0x064 + (x) * sizeof(uint32_t)) 46 #define BCM2835_GPIO_GPLEN(x) (0x070 + (x) * sizeof(uint32_t)) 47 #define BCM2835_GPIO_GPAREN(x) (0x07C + (x) * sizeof(uint32_t)) 48 #define BCM2835_GPIO_GPAFEN(x) (0x088 + (x) * sizeof(uint32_t)) 49 #define BCM2835_GPIO_GPPUD (0x094) 50 #define BCM2835_GPIO_GPPUD_PULLOFF 0x0 51 #define BCM2835_GPIO_GPPUD_PULLDOWN 0x1 52 #define BCM2835_GPIO_GPPUD_PULLUP 0x2 53 #define BCM2835_GPIO_GPPUDCLK(x) (0x098 + (x) * sizeof(uint32_t)) 54 #define BCM2835_GPIO_GPPUD_PINS_PER_REGISTER 32 55 56 #define BCM2835_GPIO_IN 00 57 #define BCM2835_GPIO_OUT 01 58 #define BCM2835_GPIO_ALT5 02 59 #define BCM2835_GPIO_ALT4 03 60 #define BCM2835_GPIO_ALT0 04 61 #define BCM2835_GPIO_ALT1 05 62 #define BCM2835_GPIO_ALT2 06 63 #define BCM2835_GPIO_ALT3 07 64 65 #endif /* _BROADCOM_BCM2835_GPIOREG_H_ */ 66