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

4.104.114.84.95
Last change on this file since 3239698 was 3239698, checked in by Ralf Corsepius <ralf.corsepius@…>, on 04/15/04 at 13:26:21

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