source: rtems/cpukit/libmisc/mw-fb/mw_fb.c @ f26145b

4.104.114.84.95
Last change on this file since f26145b was aed742c, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/16/04 at 12:06:28

Remove stray white spaces.

  • Property mode set to 100644
File size: 5.6 KB
Line 
1/*
2/////////////////////////////////////////////////////////////////////////////
3// $Header$
4//
5// Copyright (c) 2000 - Rosimildo da Silva
6//
7// MODULE DESCRIPTION:
8// Wrapper API around the ioctls calls for the Micro FrameBuffer
9// interface for Embedded Systems
10//
11// All functions returns 0 on success. Any other value should be
12// decoded as an error. A list of errors will be created over time.
13//
14// MODIFICATION/HISTORY:
15//
16// $Log$
17// Revision 1.3  2004/04/15 13:24:46  ralf
18// Remove stray white spaces.
19//
20// Revision 1.2  2003/07/08 08:38:48  ralf
21// 2003-07-08   Ralf Corsepius <corsepiu@faw.uni-ulm.de>
22//
23//      * capture/capture-cli.c: Add config-header support.
24//      * capture/capture.c: Add config-header support.
25//      * cpuuse/cpuuse.c: Add config-header support.
26//      * devnull/devnull.c: Add config-header support.
27//      * dummy/dummy.c: Add config-header support.
28//      * dumpbuf/dumpbuf.c: Add config-header support.
29//      * monitor/mon-command.c: Add config-header support.
30//      * monitor/mon-config.c: Add config-header support.
31//      * monitor/mon-dname.c: Add config-header support.
32//      * monitor/mon-driver.c: Add config-header support.
33//      * monitor/mon-extension.c: Add config-header support.
34//      * monitor/mon-itask.c: Add config-header support.
35//      * monitor/mon-manager.c: Add config-header support.
36//      * monitor/mon-monitor.c: Add config-header support.
37//      * monitor/mon-mpci.c: Add config-header support.
38//      * monitor/mon-object.c: Add config-header support.
39//      * monitor/mon-prmisc.c: Add config-header support.
40//      * monitor/mon-queue.c: Add config-header support.
41//      * monitor/mon-server.c: Add config-header support.
42//      * monitor/mon-symbols.c: Add config-header support.
43//      * monitor/mon-task.c: Add config-header support.
44//      * mw-fb/mw_fb.c: Add config-header support.
45//      * mw-fb/mw_uid.c: Add config-header support.
46//      * rtmonuse/rtmonuse.c: Add config-header support.
47//      * serdbg/serdbg.c: Add config-header support.
48//      * serdbg/serdbgio.c: Add config-header support.
49//      * serdbg/termios_printk.c: Add config-header support.
50//      * shell/cmds.c: Add config-header support.
51//      * stackchk/check.c: Add config-header support.
52//      * untar/untar.c: Add config-header support.
53//
54// Revision 1.1  2000/08/30 08:21:24  joel
55// 2000-08-26  Rosimildo da Silva  <rdasilva@connecttel.com>
56//
57//      * Added generic Micro FrameBuffer interface for MicroWindows.
58//      This interface allows MicroWindows to under RTEMS. A sample
59//      driver has been developed for the pc386 BSP. See
60//      pc386/fb_vga.c as a sample.
61//      * Added Uniform Input Device interface for MicroWindows.
62//      See PC386 bsp for sample drivers for mouse and keyboard (console).
63//      * mw-bf: New directory.
64//      * Makefile.am, configure.in, wrapup/Makefile.am: Account for mw-fb.
65//      * mw-fb/Makefile.am: New file.
66//      * mw-fb/mw_fb.c: New file.
67//      * mw-fb/mw_fb.h: New file.
68//      * mw-fb/mw_uid.c: New file.
69//      * mw-fb/mw_uid.h: New file.
70//
71//
72/////////////////////////////////////////////////////////////////////////////
73*/
74
75#ifdef HAVE_CONFIG_H
76#include "config.h"
77#endif
78
79#include <sys/ioctl.h>
80#include <rtems/mw_fb.h>
81
82
83/*
84 * This function returns the information regarding the display.
85 * It is called just after the driver be opened to get all needed
86 * information about the driver. No change in the mode of operation
87 * of the driver is done with this call.
88 */
89 int ufb_get_screen_info( int fd, struct fb_screeninfo *info )
90 {
91    return ioctl( fd, FB_SCREENINFO, ( void *)info);
92 }
93
94
95
96/*
97 * Returns the mode of the graphics subsystem
98 */
99 int ufb_get_mode( int fd, int *mode )
100 {
101    struct fb_exec_function exec;
102    exec.func_no = FB_FUNC_GET_MODE;
103    exec.param = ( void *)mode;
104    return ioctl( fd, FB_EXEC_FUNCTION , ( void *)&exec );
105 }
106
107
108/*
109 * Returns the current collor pallete
110 */
111 int ufb_get_palette( int fd, struct fb_cmap *color )
112 {
113     return ioctl( fd, FB_GETPALETTE, ( void *)color );
114 }
115
116
117/*
118 * Set the current collor pallete
119 */
120 int ufb_set_palette( int fd, struct fb_cmap *color )
121 {
122    return ioctl( fd, FB_SETPALETTE, ( void *)color );
123 }
124
125/*
126 * Does all necessary initialization to put the device in
127 * graphics mode
128 */
129 int ufb_enter_graphics( int fd, int mode )
130 {
131    struct fb_exec_function exec;
132    exec.func_no = FB_FUNC_ENTER_GRAPHICS;
133    exec.param = ( void *)mode;
134    return ioctl( fd, FB_EXEC_FUNCTION , ( void *)&exec );
135 }
136
137
138/*
139 * Switch the device back to the default mode of operation.
140 * In most cases it put the device back to plain text mode.
141 */
142 int ufb_exit_graphics( int fd )
143 {
144    struct fb_exec_function exec;
145    exec.func_no = FB_FUNC_EXIT_GRAPHICS;
146    exec.param = 0;
147    return ioctl( fd, FB_EXEC_FUNCTION , ( void *)&exec );
148 }
149
150/*
151 * Tell the driver that the "virtual buffer" is dirty, and an update
152 * of it to the real device, maybe a serial/parallel LCD or whatever
153 * is required
154 */
155 int ufb_buffer_is_dirty( int fd )
156 {
157    struct fb_exec_function exec;
158    exec.func_no = FB_FUNC_IS_DIRTY;
159    exec.param = 0;
160    return ioctl( fd, FB_EXEC_FUNCTION , ( void *)&exec );
161 }
162
163
164
165/*
166 * This function maps the physical ( kernel mode ) address of the framebuffer device
167 * and maps it to the user space address.
168 */
169 int ufb_mmap_to_user_space( int fd, void **fb_addr, void *physical_addr, unsigned long size )
170 {
171 #ifdef __rtems__
172    /* RTEMS runs in ring 0, and there is no distinction between
173       user space and kernel space, so we just return the same
174       pointer to the caller.
175     */
176      *fb_addr = physical_addr;
177      return 0;
178 #else
179 /* other kernels might want to map it to the user space,
180    maybe using mmap()
181  */
182      return 0;
183 #endif
184
185 }
186
187
188/*
189 * This function unmaps memory of the FB from the user's space
190 */
191 int ufb_unmmap_from_user_space( int fd, void *addr )
192 {
193    return 0;
194 }
Note: See TracBrowser for help on using the repository browser.