The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/ic/hd44780var.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* $NetBSD: hd44780var.h,v 1.5 2007/03/04 06:01:55 christos Exp $ */
    2 
    3 /*
    4  * Copyright (c) 2002 Dennis I. Chernoivanov
    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  * 3. The name of the author may not be used to endorse or promote products
   16  *    derived from this software without specific prior written permission
   17  *
   18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   28  */
   29 
   30 #ifndef _DEV_IC_HD44780VAR_H_
   31 #define _DEV_IC_HD44780VAR_H_
   32 
   33 /* IOCTL definitions */
   34 #define HLCD_DISPCTL            _IOW('h',   1, struct hd44780_dispctl)
   35 #define HLCD_RESET              _IO('h',    2)
   36 #define HLCD_CLEAR              _IO('h',    3)
   37 #define HLCD_CURSOR_LEFT        _IO('h',    4)
   38 #define HLCD_CURSOR_RIGHT       _IO('h',    5)
   39 #define HLCD_GET_CURSOR_POS     _IOR('h',   6, struct hd44780_io)
   40 #define HLCD_SET_CURSOR_POS     _IOW('h',   7, struct hd44780_io)
   41 #define HLCD_GETC               _IOR('h',   8, struct hd44780_io)
   42 #define HLCD_PUTC               _IOW('h',   9, struct hd44780_io)
   43 #define HLCD_SHIFT_LEFT         _IO('h',   10)
   44 #define HLCD_SHIFT_RIGHT        _IO('h',   11)
   45 #define HLCD_HOME               _IO('h',   12)
   46 #define HLCD_WRITE              _IOWR('h', 13, struct hd44780_io)
   47 #define HLCD_READ               _IOWR('h', 14, struct hd44780_io)
   48 #define HLCD_REDRAW             _IOW('h',  15, struct hd44780_io)
   49 #define HLCD_WRITE_INST         _IOW('h',  16, struct hd44780_io)
   50 #define HLCD_WRITE_DATA         _IOW('h',  17, struct hd44780_io)
   51 #define HLCD_GET_INFO           _IOR('h',  18, struct hd44780_info)
   52 #define HLCD_GET_CHIPNO         _IOR('h',  19, u_int8_t)
   53 #define HLCD_SET_CHIPNO         _IOW('h',  20, u_int8_t)
   54 
   55 struct hd44780_dispctl {
   56         u_int8_t chip;
   57         u_char  display_on:1,
   58                 blink_on:1,
   59                 cursor_on:1;
   60 };
   61 
   62 struct hd44780_io {
   63         u_int8_t chip;
   64         u_int8_t dat;
   65         u_int8_t len;
   66         u_int8_t buf[HD_MAX_CHARS];
   67 };
   68 
   69 struct hd44780_info {
   70         u_char  lines;
   71         u_char  phys_rows;
   72         u_char  virt_rows;
   73 
   74         u_char  is_wide:1,
   75                 is_bigfont:1,
   76                 kp_present:1;
   77 };
   78 
   79 #ifdef _KERNEL
   80 
   81 struct  hlcd_screen {
   82         int hlcd_curon;
   83         int hlcd_curx;
   84         int hlcd_cury;
   85         u_char *image;                  /* characters of screen */
   86         struct hd44780_chip *hlcd_sc;
   87 };
   88 
   89 /* HLCD driver structure */
   90 struct hd44780_chip {
   91 #define HD_8BIT                 0x01    /* 8-bit if set, 4-bit otherwise */
   92 #define HD_MULTILINE            0x02    /* 2 lines if set, 1 otherwise */
   93 #define HD_BIGFONT              0x04    /* 5x10 if set, 5x8 otherwise */
   94 #define HD_KEYPAD               0x08    /* if set, keypad is connected */
   95 #define HD_UP                   0x10    /* if set, lcd has been initialized */
   96 #define HD_TIMEDOUT             0x20    /* lcd has recently stopped talking */
   97 #define HD_MULTICHIP            0x40    /* two HD44780 controllers (4-line) */
   98         u_char sc_flags;
   99 
  100         u_char sc_cols;                 /* visible columns */
  101         u_char sc_vcols;                /* virtual columns (normally 40) */
  102         u_char sc_dev_ok;
  103         u_char sc_curchip;
  104 
  105         bus_space_tag_t sc_iot;
  106 
  107         bus_space_handle_t sc_ioir;     /* instruction register */
  108         bus_space_handle_t sc_iodr;     /* data register */
  109 
  110         struct device *sc_dev;          /* Pointer to parent device */
  111         struct hlcd_screen sc_screen;   /* currently displayed screen copy */
  112         struct hlcd_screen *sc_curscr;  /* active screen */
  113         struct callout redraw;          /* wsdisplay refresh/redraw timer */
  114 
  115         /* Generic write/read byte entries. */
  116         void     (* sc_writereg)(struct hd44780_chip *, u_int32_t, u_int32_t,
  117           u_int8_t);
  118         u_int8_t (* sc_readreg)(struct hd44780_chip *, u_int32_t, u_int32_t);
  119 };
  120 
  121 #define hd44780_ir_write(sc, en, dat) \
  122         do {                                                            \
  123                 hd44780_busy_wait(sc, (en));                                    \
  124                 (sc)->sc_writereg((sc), (en), 0, (dat));                \
  125         } while(0)
  126 
  127 #define hd44780_ir_read(sc, en) \
  128         (sc)->sc_readreg((sc), (en), 0)
  129 
  130 #define hd44780_dr_write(sc, en, dat) \
  131         (sc)->sc_writereg((sc), (en), 1, (dat))
  132 
  133 #define hd44780_dr_read(sc, en) \
  134         (sc)->sc_readreg((sc), (en), 1)
  135 
  136 void hd44780_attach_subr(struct hd44780_chip *);
  137 void hd44780_busy_wait(struct hd44780_chip *, u_int32_t);
  138 int  hd44780_init(struct hd44780_chip *);
  139 int  hd44780_chipinit(struct hd44780_chip *, u_int32_t);
  140 int  hd44780_ioctl_subr(struct hd44780_chip *, u_long, void *);
  141 void hd44780_ddram_redraw(struct hd44780_chip *, u_int32_t, struct hd44780_io *);
  142 
  143 #define HD_DDRAM_READ   0x0
  144 #define HD_DDRAM_WRITE  0x1
  145 int  hd44780_ddram_io(struct hd44780_chip *, u_int32_t, struct hd44780_io *, u_char);
  146 
  147 #if defined(HD44780_STD_WIDE) || defined(HD44780_STD_SHORT)
  148 void     hd44780_writereg(struct hd44780_chip *, u_int32_t, u_int32_t, u_int8_t);
  149 u_int8_t hd44780_readreg(struct hd44780_chip *, u_int32_t, u_int32_t);
  150 #endif
  151 
  152 #endif /* _KERNEL */
  153 
  154 #endif /* _DEV_IC_HD44780VAR_H_ */

Cache object: 375aed75565187ac0f49a1a4c90122e0


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.