2 * Copyright 2010 Sergey Poselenov, Emcraft Systems, <sposelenov@emcraft.com>
3 * Copyright 2010 Ilya Yanok, Emcraft Systems, <yanok@emcraft.com>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21 #include <led-display.h>
24 #ifdef CONFIG_CMD_DISPLAY
25 #define CWORD_CLEAR 0x80
26 #define CLEAR_DELAY (110 * 2)
27 #define DISPLAY_SIZE 8
29 static int pos; /* Current display position */
31 /* Handle different display commands */
32 void display_set(int cmd)
34 if (cmd & DISPLAY_CLEAR) {
35 out_8((unsigned char *)CONFIG_SYS_DISP_CWORD, CWORD_CLEAR);
36 udelay(1000 * CLEAR_DELAY);
39 if (cmd & DISPLAY_HOME) {
45 * Display a character at the current display position.
46 * Characters beyond the display size are ignored.
48 int display_putc(char c)
50 if (pos >= DISPLAY_SIZE)
53 out_8((unsigned char *)CONFIG_SYS_DISP_CHR_RAM + pos++, c);