wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 1 | /* most of this is taken from the file */ |
| 2 | /* hal/powerpc/cogent/current/src/hal_diag.c in the */ |
| 3 | /* Cygnus eCos source. Here is the copyright notice: */ |
| 4 | /* */ |
| 5 | /*============================================================================= */ |
| 6 | /* */ |
| 7 | /* hal_diag.c */ |
| 8 | /* */ |
| 9 | /* HAL diagnostic output code */ |
| 10 | /* */ |
| 11 | /*============================================================================= */ |
| 12 | /*####COPYRIGHTBEGIN#### */ |
| 13 | /* */ |
| 14 | /* ------------------------------------------- */ |
| 15 | /* The contents of this file are subject to the Cygnus eCos Public License */ |
| 16 | /* Version 1.0 (the "License"); you may not use this file except in */ |
| 17 | /* compliance with the License. You may obtain a copy of the License at */ |
| 18 | /* http://sourceware.cygnus.com/ecos */ |
| 19 | /* */ |
| 20 | /* Software distributed under the License is distributed on an "AS IS" */ |
| 21 | /* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the */ |
| 22 | /* License for the specific language governing rights and limitations under */ |
| 23 | /* the License. */ |
| 24 | /* */ |
| 25 | /* The Original Code is eCos - Embedded Cygnus Operating System, released */ |
| 26 | /* September 30, 1998. */ |
| 27 | /* */ |
| 28 | /* The Initial Developer of the Original Code is Cygnus. Portions created */ |
| 29 | /* by Cygnus are Copyright (C) 1998,1999 Cygnus Solutions. All Rights Reserved. */ |
| 30 | /* ------------------------------------------- */ |
| 31 | /* */ |
| 32 | /*####COPYRIGHTEND#### */ |
| 33 | /*============================================================================= */ |
| 34 | /*#####DESCRIPTIONBEGIN#### */ |
| 35 | /* */ |
| 36 | /* Author(s): nickg, jskov */ |
| 37 | /* Contributors: nickg, jskov */ |
| 38 | /* Date: 1999-03-23 */ |
| 39 | /* Purpose: HAL diagnostic output */ |
| 40 | /* Description: Implementations of HAL diagnostic output support. */ |
| 41 | /* */ |
| 42 | /*####DESCRIPTIONEND#### */ |
| 43 | /* */ |
| 44 | /*============================================================================= */ |
| 45 | |
| 46 | /* FEMA 162B 16 character x 2 line LCD */ |
| 47 | |
| 48 | /* status register bit definitions */ |
| 49 | #define LCD_STAT_BUSY 0x80 /* 1 = display busy */ |
| 50 | #define LCD_STAT_ADD 0x7F /* bits 0-6 return current display address */ |
| 51 | |
| 52 | /* command register definitions */ |
| 53 | #define LCD_CMD_RST 0x01 /* clear entire display and reset display addr */ |
| 54 | #define LCD_CMD_HOME 0x02 /* reset display address and reset any shifting */ |
| 55 | #define LCD_CMD_ECL 0x04 /* move cursor left one pos on next data write */ |
| 56 | #define LCD_CMD_ESL 0x05 /* shift display left one pos on next data write */ |
| 57 | #define LCD_CMD_ECR 0x06 /* move cursor right one pos on next data write */ |
| 58 | #define LCD_CMD_ESR 0x07 /* shift disp right one pos on next data write */ |
| 59 | #define LCD_CMD_DOFF 0x08 /* display off, cursor off, blinking off */ |
| 60 | #define LCD_CMD_BL 0x09 /* blink character at current cursor position */ |
| 61 | #define LCD_CMD_CUR 0x0A /* enable cursor on */ |
| 62 | #define LCD_CMD_DON 0x0C /* turn display on */ |
| 63 | #define LCD_CMD_CL 0x10 /* move cursor left one position */ |
| 64 | #define LCD_CMD_SL 0x14 /* shift display left one position */ |
| 65 | #define LCD_CMD_CR 0x18 /* move cursor right one position */ |
| 66 | #define LCD_CMD_SR 0x1C /* shift display right one position */ |
| 67 | #define LCD_CMD_MODE 0x38 /* sets 8 bits, 2 lines, 5x7 characters */ |
| 68 | #define LCD_CMD_ACG 0x40 /* bits 0-5 sets character generator address */ |
| 69 | #define LCD_CMD_ADD 0x80 /* bits 0-6 sets display data addr to line 1 + */ |
| 70 | |
| 71 | /* LCD status values */ |
| 72 | #define LCD_OK 0x00 |
Wolfgang Denk | a1be476 | 2008-05-20 16:00:29 +0200 | [diff] [blame] | 73 | #define LCD_ERR 0x01 |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 74 | |
| 75 | #define LCD_LINE0 0x00 |
| 76 | #define LCD_LINE1 0x40 |
| 77 | |
| 78 | #define LCD_LINE_LENGTH 16 |
| 79 | |
| 80 | extern void lcd_init(void); |
| 81 | extern void lcd_write_char(const char); |
| 82 | extern void lcd_flush(void); |
| 83 | extern void lcd_write_string(const char *); |
| 84 | extern void lcd_printf(const char *, ...); |