summaryrefslogtreecommitdiff
path: root/payloads/libpayload/curses/pdcurses-backend/pdcutil.c
blob: c40e2ed1eb149c729e02184eab69ab6eefc6d2a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/* Public Domain Curses */
/* This file is BSD licensed, Copyright 2011 secunet AG */

#include "lppdc.h"
#include <curses.h>
#include <libpayload.h>

int curses_flags = F_ENABLE_SERIAL | F_ENABLE_CONSOLE;

void PDC_beep(void)
{
    PDC_LOG(("PDC_beep() - called\n"));

#ifdef CONFIG_LP_SPEAKER
    speaker_tone(1760, 500); /* 1760 == note A6 */
#endif
}

void PDC_napms(int ms)
{
    PDC_LOG(("PDC_napms() - called: ms=%d\n", ms));

    mdelay(ms);
}

const char *PDC_sysname(void)
{
    return "LIBPAYLOAD";
}

void curses_enable_serial(int enable)
{
    curses_flags = (curses_flags & ~F_ENABLE_SERIAL) | (enable * F_ENABLE_SERIAL);
}

void curses_enable_vga(int enable)
{
    curses_flags = (curses_flags & ~F_ENABLE_CONSOLE) | (enable * F_ENABLE_CONSOLE);
}

int curses_serial_enabled(void)
{
    return !!(curses_flags & F_ENABLE_SERIAL);
}

int curses_vga_enabled(void)
{
    return !!(curses_flags & F_ENABLE_CONSOLE);
}