summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/termios_printk_cnf.h
blob: 29943f57b67c5161251d237b531c7cd7a8c346c0 (plain) (blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
 * @file
 *
 * @brief Adds printk Support via Polled termios
 */

/*
 * Copyright (c) 2002 Ingenieurbuero fuer Microcomputertechnik Th. Doerfler
 * All rights reserved.
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rtems.org/license/LICENSE.
 */

#ifndef _TERMIOS_PRINTK_CNF_H
#define _TERMIOS_PRINTK_CNF_H

#include <rtems/termios_printk.h>

#ifdef __cplusplus
extern "C" {
#endif

#ifdef CONFIGURE_INIT

/*
 * fallback for baud rate to use
 */
#ifndef CONFIGURE_TERMIOS_PRINTK_BAUDRATE
#define CONFIGURE_TERMIOS_PRINTK_BAUDRATE 9600
#endif

/*
 * fallback for device name to use
 */
#ifndef CONFIGURE_TERMIOS_PRINTK_DEVNAME
#define CONFIGURE_TERMIOS_PRINTK_DEVNAME "/dev/console"
#endif

#ifdef CONFIGURE_USE_TERMIOS_PRINTK
/*
 * fill in termios_printk_conf structure
 */
termios_printk_conf_t termios_printk_conf = {
  CONFIGURE_TERMIOS_PRINTK_BAUDRATE,

#ifdef CONFIGURE_TERMIOS_PRINTK_CALLOUT
  CONFIGURE_TERMIOS_PRINTK_CALLOUT,
#else
  NULL,
#endif
  CONFIGURE_TERMIOS_PRINTK_DEVNAME,
};
#endif

int termios_printk_init(void) {
#ifdef CONFIGURE_USE_TERMIOS_PRINTK
  return termios_printk_open(termios_printk_conf.devname,
			     termios_printk_conf.baudrate);
#else
  return 0;
#endif
}

#endif /* CONFIGURE_INIT */

#ifdef __cplusplus
}
#endif

#endif /* _TERMIOS_PRINTK_CNF_H */