source: rtems/c/src/lib/libbsp/arm/csb337/console/fbcons.c @ c499856

4.115
Last change on this file since c499856 was c499856, checked in by Chris Johns <chrisj@…>, on 03/20/14 at 21:10:47

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 3.6 KB
Line 
1/*
2 *  LCD Console Output Driver for CSBx37
3 *
4 *  COPYRIGHT (c) 1989-2009.
5 *  On-Line Applications Research Corporation (OAR).
6 *
7 *  Modified by Fernando Nicodemos <fgnicodemos@terra.com.br>
8 *  from NCB - Sistemas Embarcados Ltda. (Brazil)
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.org/license/LICENSE.
13 */
14
15#include <bsp.h>
16#include <rtems/libio.h>
17#include <termios.h>
18
19#include <rtems/bspIo.h>
20#include <libchip/serial.h>
21#include <libchip/sersupp.h>
22#include "sed1356.h"
23
24/* static function prototypes */
25static int     fbcons_first_open(int major, int minor, void *arg);
26static int     fbcons_last_close(int major, int minor, void *arg);
27static int     fbcons_read(int minor);
28static ssize_t fbcons_write(int minor, const char *buf, size_t len);
29static void    fbcons_init(int minor);
30static void    fbcons_write_polled(int minor, char c);
31static int     fbcons_set_attributes(int minor, const struct termios *t);
32
33/* Pointers to functions for handling the UART. */
34const console_fns fbcons_fns =
35{
36  libchip_serial_default_probe,
37  fbcons_first_open,
38  fbcons_last_close,
39  fbcons_read,
40  fbcons_write,
41  fbcons_init,
42  fbcons_write_polled,   /* not used in this driver */
43  fbcons_set_attributes,
44  FALSE      /* TRUE if interrupt driven, FALSE if not. */
45};
46/*********************************************************************/
47/* Functions called via callbacks (i.e. the ones in uart_fns */
48/*********************************************************************/
49
50/*
51 * This is called the first time each device is opened. Since
52 * the driver is polled, we don't have to do anything. If the driver
53 * were interrupt driven, we'd enable interrupts here.
54 */
55static int fbcons_first_open(int major, int minor, void *arg)
56{
57  /* printk( "Frame buffer -- first open\n" ); */
58  return 0;
59}
60
61
62/*
63 * This is called the last time each device is closed.  Since
64 * the driver is polled, we don't have to do anything. If the driver
65 * were interrupt driven, we'd disable interrupts here.
66 */
67static int fbcons_last_close(int major, int minor, void *arg)
68{
69  /* printk( "Frame buffer -- last close\n" ); */
70  return 0;
71}
72
73
74/*
75 * Read one character from UART.
76 *
77 * return -1 if there's no data, otherwise return
78 * the character in lowest 8 bits of returned int.
79 */
80static int fbcons_read(int minor)
81{
82  /* printk( "Frame buffer -- read\n" ); */
83  return -1;
84}
85
86
87/*
88 * Write buffer to LCD
89 *
90 * return 1 on success, -1 on error
91 */
92static ssize_t fbcons_write(int minor, const char *buf, size_t len)
93{
94  int i;
95
96  /* printk( "Frame buffer -- write\n" ); */
97  for ( i=0 ; i<len ; i++ )
98    sed_putchar( buf[i] );
99
100  return 1;
101}
102
103
104/* Set up the LCD controller. */
105static void fbcons_init(int minor)
106{
107  /* printk( "Initializing frame buffer\n" ); */
108  sed_init();
109}
110
111/* This is used for putchark support */
112static void fbcons_write_polled(int minor, char c)
113{
114  /* printk( "frame buffer -- write polled\n" ); */
115  sed_putchar( c );
116}
117
118/* This is for setting baud rate, bits, etc. */
119static int fbcons_set_attributes(int minor, const struct termios *t)
120{
121  /* printk( "frame buffer -- set attributes\n" ); */
122  return 0;
123}
124
125/***********************************************************************/
126/*
127 * The following functions are not used by TERMIOS, but other RTEMS
128 * functions use them instead.
129 */
130/***********************************************************************/
131/*
132 * Read from UART. This is used in the exit code, and can't
133 * rely on interrupts.
134 */
135int fbcons_poll_read(int minor)
136{
137  /* printk( "frame buffer -- poll read\n" ); */
138  return -1;
139}
Note: See TracBrowser for help on using the repository browser.