~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/u-boot/drivers/misc/pdsp188x.c

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2010 Sergey Poselenov, Emcraft Systems, <sposelenov@emcraft.com>
 
3
 * Copyright 2010 Ilya Yanok, Emcraft Systems, <yanok@emcraft.com>
 
4
 *
 
5
 * SPDX-License-Identifier:     GPL-2.0+
 
6
 */
 
7
 
 
8
#include <common.h>
 
9
#include <led-display.h>
 
10
#include <asm/io.h>
 
11
 
 
12
#ifdef CONFIG_CMD_DISPLAY
 
13
#define CWORD_CLEAR     0x80
 
14
#define CLEAR_DELAY     (110 * 2)
 
15
#define DISPLAY_SIZE    8
 
16
 
 
17
static int pos; /* Current display position */
 
18
 
 
19
/* Handle different display commands */
 
20
void display_set(int cmd)
 
21
{
 
22
        if (cmd & DISPLAY_CLEAR) {
 
23
                out_8((unsigned char *)CONFIG_SYS_DISP_CWORD, CWORD_CLEAR);
 
24
                udelay(1000 * CLEAR_DELAY);
 
25
        }
 
26
 
 
27
        if (cmd & DISPLAY_HOME) {
 
28
                pos = 0;
 
29
        }
 
30
}
 
31
 
 
32
/*
 
33
 * Display a character at the current display position.
 
34
 * Characters beyond the display size are ignored.
 
35
 */
 
36
int display_putc(char c)
 
37
{
 
38
        if (pos >= DISPLAY_SIZE)
 
39
                return -1;
 
40
 
 
41
        out_8((unsigned char *)CONFIG_SYS_DISP_CHR_RAM + pos++, c);
 
42
 
 
43
        return c;
 
44
}
 
45
#endif