/* SPDX-License-Identifier: GPL-2.0-or-later */1/*2* Character LCD driver for Linux3*4* Copyright (C) 2000-2008, Willy Tarreau <[email protected]>5* Copyright (C) 2016-2017 Glider bvba6*/78#ifndef _CHARLCD_H9#define _CHARLCD_H1011#define LCD_FLAG_B 0x0004 /* Blink on */12#define LCD_FLAG_C 0x0008 /* Cursor on */13#define LCD_FLAG_D 0x0010 /* Display on */14#define LCD_FLAG_F 0x0020 /* Large font mode */15#define LCD_FLAG_N 0x0040 /* 2-rows mode */16#define LCD_FLAG_L 0x0080 /* Backlight enabled */1718enum charlcd_onoff {19CHARLCD_OFF = 0,20CHARLCD_ON,21};2223enum charlcd_shift_dir {24CHARLCD_SHIFT_LEFT,25CHARLCD_SHIFT_RIGHT,26};2728enum charlcd_fontsize {29CHARLCD_FONTSIZE_SMALL,30CHARLCD_FONTSIZE_LARGE,31};3233enum charlcd_lines {34CHARLCD_LINES_1,35CHARLCD_LINES_2,36};3738struct charlcd_ops;3940struct charlcd {41const struct charlcd_ops *ops;42const unsigned char *char_conv; /* Optional */4344int height;45int width;4647/* Contains the LCD X and Y offset */48struct {49unsigned long x;50unsigned long y;51} addr;5253void *drvdata; /* Set by charlcd_alloc() */54};5556/**57* struct charlcd_ops - Functions used by charlcd. Drivers have to implement58* these.59* @backlight: Turn backlight on or off. Optional.60* @print: Print one character to the display at current cursor position.61* The buffered cursor position is advanced by charlcd. The cursor should not62* wrap to the next line at the end of a line.63* @gotoxy: Set cursor to x, y. The x and y values to set the cursor to are64* previously set in addr.x and addr.y by charlcd.65* @home: Set cursor to 0, 0. The values in addr.x and addr.y are set to 0, 0 by66* charlcd prior to calling this function.67* @clear_display: Clear the whole display and set the cursor to 0, 0. The68* values in addr.x and addr.y are set to 0, 0 by charlcd after to calling this69* function.70* @init_display: Initialize the display.71* @shift_cursor: Shift cursor left or right one position.72* @shift_display: Shift whole display content left or right.73* @display: Turn display on or off.74* @cursor: Turn cursor on or off.75* @blink: Turn cursor blink on or off.76* @lines: One or two lines.77* @redefine_char: Redefine the actual pixel matrix of character.78*/79struct charlcd_ops {80void (*backlight)(struct charlcd *lcd, enum charlcd_onoff on);81int (*print)(struct charlcd *lcd, int c);82int (*gotoxy)(struct charlcd *lcd, unsigned int x, unsigned int y);83int (*home)(struct charlcd *lcd);84int (*clear_display)(struct charlcd *lcd);85int (*init_display)(struct charlcd *lcd);86int (*shift_cursor)(struct charlcd *lcd, enum charlcd_shift_dir dir);87int (*shift_display)(struct charlcd *lcd, enum charlcd_shift_dir dir);88int (*display)(struct charlcd *lcd, enum charlcd_onoff on);89int (*cursor)(struct charlcd *lcd, enum charlcd_onoff on);90int (*blink)(struct charlcd *lcd, enum charlcd_onoff on);91int (*fontsize)(struct charlcd *lcd, enum charlcd_fontsize size);92int (*lines)(struct charlcd *lcd, enum charlcd_lines lines);93int (*redefine_char)(struct charlcd *lcd, char *esc);94};9596void charlcd_backlight(struct charlcd *lcd, enum charlcd_onoff on);9798struct charlcd *charlcd_alloc(unsigned int drvdata_size);99void charlcd_free(struct charlcd *lcd);100101int charlcd_register(struct charlcd *lcd);102int charlcd_unregister(struct charlcd *lcd);103104void charlcd_poke(struct charlcd *lcd);105106#endif /* CHARLCD_H */107108109