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

4.104.114.84.95
Last change on this file since 550c3df7 was 550c3df7, checked in by Ralf Corsepius <ralf.corsepius@…>, on Jul 8, 2003 at 8:39:16 AM

2003-07-08 Ralf Corsepius <corsepiu@…>

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