Home | History | Annotate | Line # | Download | only in ic
lcdkp_subr.h revision 1.2.134.1
      1  1.2.134.1  jruoho /* $NetBSD: lcdkp_subr.h,v 1.2.134.1 2011/06/06 09:07:53 jruoho Exp $ */
      2        1.1   soren 
      3        1.1   soren /*
      4        1.1   soren  * Copyright (c) 2002 Dennis I. Chernoivanov
      5        1.1   soren  * All rights reserved.
      6        1.1   soren  *
      7        1.1   soren  * Redistribution and use in source and binary forms, with or without
      8        1.1   soren  * modification, are permitted provided that the following conditions
      9        1.1   soren  * are met:
     10        1.1   soren  * 1. Redistributions of source code must retain the above copyright
     11        1.1   soren  *    notice, this list of conditions and the following disclaimer.
     12        1.1   soren  * 2. Redistributions in binary form must reproduce the above copyright
     13        1.1   soren  *    notice, this list of conditions and the following disclaimer in the
     14        1.1   soren  *    documentation and/or other materials provided with the distribution.
     15        1.1   soren  * 3. The name of the author may not be used to endorse or promote products
     16        1.1   soren  *    derived from this software without specific prior written permission
     17        1.1   soren  *
     18        1.1   soren  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19        1.1   soren  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20        1.1   soren  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21        1.1   soren  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     22        1.1   soren  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     23        1.1   soren  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     24        1.1   soren  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     25        1.1   soren  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     26        1.1   soren  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     27        1.1   soren  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28        1.1   soren  */
     29        1.1   soren 
     30        1.1   soren #ifndef _DEV_IC_LCDKP_SUBR_H_
     31        1.1   soren #define _DEV_IC_LCDKP_SUBR_H_
     32        1.1   soren 
     33        1.1   soren #ifdef _KERNEL
     34        1.1   soren 
     35        1.1   soren /* Key code translation */
     36        1.1   soren struct lcdkp_xlate {
     37        1.1   soren 	u_int8_t x_keycode;
     38        1.1   soren 	u_int8_t x_outcode;
     39        1.1   soren };
     40        1.1   soren 
     41        1.1   soren /* Keypad control structure */
     42        1.1   soren struct lcdkp_chip {
     43        1.1   soren 	bus_space_tag_t sc_iot;
     44        1.1   soren 	bus_space_handle_t sc_ioh;	/* keypad i/o register */
     45        1.1   soren 
     46        1.1   soren #define LCDKP_HAS_BUF	0x1
     47        1.1   soren 	u_char sc_flags;
     48        1.1   soren 	u_int8_t sc_buf;		/* pending character */
     49        1.1   soren 
     50        1.1   soren 	u_int8_t sc_knum;		/* number of buttons */
     51        1.1   soren 	struct lcdkp_xlate *sc_kpad;	/* recognized keycodes */
     52        1.1   soren 
     53        1.1   soren 	u_int8_t (* sc_rread)(bus_space_tag_t, bus_space_handle_t);
     54        1.1   soren 
     55  1.2.134.1  jruoho 	kmutex_t sc_lock;
     56        1.1   soren };
     57        1.1   soren 
     58        1.1   soren #define lcdkp_dr_read(sc) \
     59        1.1   soren 	(sc)->sc_rread((sc)->sc_iot, (sc)->sc_ioh);
     60        1.1   soren 
     61        1.1   soren void lcdkp_attach_subr(struct lcdkp_chip *);
     62        1.1   soren int  lcdkp_scankey(struct lcdkp_chip *);
     63        1.1   soren int  lcdkp_readkey(struct lcdkp_chip *, u_int8_t *);
     64        1.1   soren 
     65        1.1   soren #endif /* _KERNEL */
     66        1.1   soren 
     67        1.1   soren #endif /* _DEV_IC_LCDKP_SUBR_H_ */
     68