home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2006 November (DVD) / PCWELT_11_2006.ISO / casper / filesystem.squashfs / usr / src / linux-headers-2.6.17-6 / include / asm-sh / hd64465 / gpio.h next >
Encoding:
C/C++ Source or Header  |  2006-08-11  |  1.6 KB  |  47 lines

  1. #ifndef _ASM_SH_HD64465_GPIO_
  2. #define _ASM_SH_HD64465_GPIO_ 1
  3. /*
  4.  * $Id: gpio.h,v 1.3 2003/05/04 19:30:14 lethal Exp $
  5.  *
  6.  * Hitachi HD64465 companion chip: General Purpose IO pins support.
  7.  * This layer enables other device drivers to configure GPIO
  8.  * pins, get and set their values, and register an interrupt
  9.  * routine for when input pins change in hardware.
  10.  *
  11.  * by Greg Banks <gbanks@pocketpenguins.com>
  12.  * (c) 2000 PocketPenguins Inc.
  13.  */
  14. #include <asm/hd64465.h>
  15.  
  16. /* Macro to construct a portpin number (used in all
  17.  * subsequent functions) from a port letter and a pin
  18.  * number, e.g. HD64465_GPIO_PORTPIN('A', 5).
  19.  */
  20. #define HD64465_GPIO_PORTPIN(port,pin)    (((port)-'A')<<3|(pin))
  21.  
  22. /* Pin configuration constants for _configure() */
  23. #define HD64465_GPIO_FUNCTION2    0    /* use the pin's *other* function */
  24. #define HD64465_GPIO_OUT    1    /* output */
  25. #define HD64465_GPIO_IN_PULLUP    2    /* input, pull-up MOS on */
  26. #define HD64465_GPIO_IN        3    /* input */
  27.  
  28. /* Configure a pin's direction */
  29. extern void hd64465_gpio_configure(int portpin, int direction);
  30.  
  31. /* Get, set value */
  32. extern void hd64465_gpio_set_pin(int portpin, unsigned int value);
  33. extern unsigned int hd64465_gpio_get_pin(int portpin);
  34. extern void hd64465_gpio_set_port(int port, unsigned int value);
  35. extern unsigned int hd64465_gpio_get_port(int port);
  36.  
  37. /* mode constants for _register_irq() */
  38. #define HD64465_GPIO_FALLING    0
  39. #define HD64465_GPIO_RISING    1
  40.  
  41. /* Interrupt on external value change */
  42. extern void hd64465_gpio_register_irq(int portpin, int mode,
  43.     void (*handler)(int portpin, void *dev), void *dev);
  44. extern void hd64465_gpio_unregister_irq(int portpin);
  45.  
  46. #endif /* _ASM_SH_HD64465_GPIO_  */
  47.