1/* $OpenBSD: omgpiovar.h,v 1.2 2013/11/20 13:32:40 rapha Exp $ */ 2/* 3 * Copyright (c) 2007,2009 Dale Rahn <drahn@openbsd.org> 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18#ifndef OMGPIOVAR_H 19#define OMGPIOVAR_H 20 21#define OMGPIO_DIR_IN 0 22#define OMGPIO_DIR_OUT 1 23 24unsigned int omgpio_get_function(unsigned int gpio, unsigned int fn); 25void omgpio_set_function(unsigned int gpio, unsigned int fn); 26unsigned int omgpio_get_bit(unsigned int gpio); 27void omgpio_set_bit(unsigned int gpio); 28void omgpio_clear_bit(unsigned int gpio); 29void omgpio_set_dir(unsigned int gpio, unsigned int dir); 30 31int omgpio_pin_read(void *arg, int pin); 32void omgpio_pin_write(void *arg, int pin, int value); 33void omgpio_pin_ctl(void *arg, int pin, int flags); 34 35/* interrupts */ 36void omgpio_clear_intr(unsigned int gpio); 37void omgpio_intr_mask(unsigned int gpio); 38void omgpio_intr_unmask(unsigned int gpio); 39void omgpio_intr_level(unsigned int gpio, unsigned int level); 40void *omgpio_intr_establish(unsigned int gpio, int level, int spl, 41 int (*func)(void *), void *arg, char *name); 42void omgpio_intr_disestablish(void *cookie); 43 44#endif /* OMGPIOVAR_H */ 45