| 1 | /* | 
|---|
| 2 | * Copyright (c) 2011 Martin Decky | 
|---|
| 3 | * All rights reserved. | 
|---|
| 4 | * | 
|---|
| 5 | * Redistribution and use in source and binary forms, with or without | 
|---|
| 6 | * modification, are permitted provided that the following conditions | 
|---|
| 7 | * are met: | 
|---|
| 8 | * | 
|---|
| 9 | * - Redistributions of source code must retain the above copyright | 
|---|
| 10 | *   notice, this list of conditions and the following disclaimer. | 
|---|
| 11 | * - Redistributions in binary form must reproduce the above copyright | 
|---|
| 12 | *   notice, this list of conditions and the following disclaimer in the | 
|---|
| 13 | *   documentation and/or other materials provided with the distribution. | 
|---|
| 14 | * - The name of the author may not be used to endorse or promote products | 
|---|
| 15 | *   derived from this software without specific prior written permission. | 
|---|
| 16 | * | 
|---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | 
|---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | 
|---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 
|---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | 
|---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | 
|---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 
|---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 
|---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 
|---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 
|---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 
|---|
| 27 | */ | 
|---|
| 28 |  | 
|---|
| 29 | /** @addtogroup libc | 
|---|
| 30 | * @{ | 
|---|
| 31 | */ | 
|---|
| 32 | /** @file | 
|---|
| 33 | */ | 
|---|
| 34 |  | 
|---|
| 35 | #ifndef IMGMAP_FB_H_ | 
|---|
| 36 | #define IMGMAP_FB_H_ | 
|---|
| 37 |  | 
|---|
| 38 | #include <sys/types.h> | 
|---|
| 39 | #include <async.h> | 
|---|
| 40 | #include <io/style.h> | 
|---|
| 41 | #include <io/console.h> | 
|---|
| 42 | #include <ipc/common.h> | 
|---|
| 43 |  | 
|---|
| 44 | typedef enum { | 
|---|
| 45 | /** Screen methods */ | 
|---|
| 46 | FB_GET_RESOLUTION = IPC_FIRST_USER_METHOD, | 
|---|
| 47 | FB_YIELD, | 
|---|
| 48 | FB_CLAIM, | 
|---|
| 49 | FB_POINTER_UPDATE, | 
|---|
| 50 |  | 
|---|
| 51 | /** Object methods */ | 
|---|
| 52 | FB_VP_CREATE, | 
|---|
| 53 | FB_VP_DESTROY, | 
|---|
| 54 | FB_FRONTBUF_CREATE, | 
|---|
| 55 | FB_FRONTBUF_DESTROY, | 
|---|
| 56 | FB_IMAGEMAP_CREATE, | 
|---|
| 57 | FB_IMAGEMAP_DESTROY, | 
|---|
| 58 | FB_SEQUENCE_CREATE, | 
|---|
| 59 | FB_SEQUENCE_DESTROY, | 
|---|
| 60 | FB_SEQUENCE_ADD_IMAGEMAP, | 
|---|
| 61 |  | 
|---|
| 62 | /** Viewport stateful methods */ | 
|---|
| 63 | FB_VP_FOCUS, | 
|---|
| 64 | FB_VP_CLEAR, | 
|---|
| 65 | FB_VP_GET_DIMENSIONS, | 
|---|
| 66 | FB_VP_GET_CAPS, | 
|---|
| 67 |  | 
|---|
| 68 | /** Style methods (viewport specific) */ | 
|---|
| 69 | FB_VP_CURSOR_UPDATE, | 
|---|
| 70 | FB_VP_SET_STYLE, | 
|---|
| 71 | FB_VP_SET_COLOR, | 
|---|
| 72 | FB_VP_SET_RGB_COLOR, | 
|---|
| 73 |  | 
|---|
| 74 | /** Text methods (viewport specific) */ | 
|---|
| 75 | FB_VP_PUTCHAR, | 
|---|
| 76 | FB_VP_UPDATE, | 
|---|
| 77 | FB_VP_DAMAGE, | 
|---|
| 78 |  | 
|---|
| 79 | /** Imagemap methods (viewport specific) */ | 
|---|
| 80 | FB_VP_IMAGEMAP_DAMAGE, | 
|---|
| 81 |  | 
|---|
| 82 | /** Sequence methods (viewport specific) */ | 
|---|
| 83 | FB_VP_SEQUENCE_START, | 
|---|
| 84 | FB_VP_SEQUENCE_STOP | 
|---|
| 85 | } fb_request_t; | 
|---|
| 86 |  | 
|---|
| 87 | /** Forward declarations */ | 
|---|
| 88 | struct screenbuffer; | 
|---|
| 89 | struct imgmap; | 
|---|
| 90 |  | 
|---|
| 91 | typedef struct screenbuffer screenbuffer_t; | 
|---|
| 92 | typedef struct imgmap imgmap_t; | 
|---|
| 93 |  | 
|---|
| 94 | typedef uint32_t pixel_t; | 
|---|
| 95 |  | 
|---|
| 96 | typedef sysarg_t vp_handle_t; | 
|---|
| 97 | typedef sysarg_t frontbuf_handle_t; | 
|---|
| 98 | typedef sysarg_t imagemap_handle_t; | 
|---|
| 99 | typedef sysarg_t sequence_handle_t; | 
|---|
| 100 |  | 
|---|
| 101 | extern int fb_get_resolution(async_sess_t *, sysarg_t *, sysarg_t *); | 
|---|
| 102 | extern int fb_yield(async_sess_t *); | 
|---|
| 103 | extern int fb_claim(async_sess_t *); | 
|---|
| 104 | extern int fb_pointer_update(async_sess_t *, sysarg_t, sysarg_t, bool); | 
|---|
| 105 |  | 
|---|
| 106 | extern vp_handle_t fb_vp_create(async_sess_t *, sysarg_t, sysarg_t, sysarg_t, | 
|---|
| 107 | sysarg_t); | 
|---|
| 108 | extern frontbuf_handle_t fb_frontbuf_create(async_sess_t *, screenbuffer_t *); | 
|---|
| 109 | extern imagemap_handle_t fb_imagemap_create(async_sess_t *, imgmap_t *); | 
|---|
| 110 | extern sequence_handle_t fb_sequence_create(async_sess_t *); | 
|---|
| 111 |  | 
|---|
| 112 | extern int fb_vp_get_dimensions(async_sess_t *, vp_handle_t, sysarg_t *, | 
|---|
| 113 | sysarg_t *); | 
|---|
| 114 | extern int fb_vp_get_caps(async_sess_t *, vp_handle_t, console_caps_t *); | 
|---|
| 115 | extern int fb_vp_clear(async_sess_t *, vp_handle_t); | 
|---|
| 116 |  | 
|---|
| 117 | extern int fb_vp_cursor_update(async_sess_t *, vp_handle_t, frontbuf_handle_t); | 
|---|
| 118 | extern int fb_vp_set_style(async_sess_t *, vp_handle_t, console_style_t); | 
|---|
| 119 |  | 
|---|
| 120 | extern int fb_vp_putchar(async_sess_t *, vp_handle_t, sysarg_t, sysarg_t, | 
|---|
| 121 | wchar_t); | 
|---|
| 122 | extern int fb_vp_update(async_sess_t *, vp_handle_t, frontbuf_handle_t); | 
|---|
| 123 | extern int fb_vp_damage(async_sess_t *, vp_handle_t, frontbuf_handle_t, | 
|---|
| 124 | sysarg_t, sysarg_t, sysarg_t, sysarg_t); | 
|---|
| 125 |  | 
|---|
| 126 | extern int fb_vp_imagemap_damage(async_sess_t *, vp_handle_t, imagemap_handle_t, | 
|---|
| 127 | sysarg_t, sysarg_t, sysarg_t, sysarg_t); | 
|---|
| 128 |  | 
|---|
| 129 | extern int fb_sequence_add_imagemap(async_sess_t *, sequence_handle_t, | 
|---|
| 130 | imagemap_handle_t); | 
|---|
| 131 | extern int fb_vp_sequence_start(async_sess_t *, vp_handle_t, sequence_handle_t); | 
|---|
| 132 |  | 
|---|
| 133 | #endif | 
|---|
| 134 |  | 
|---|
| 135 | /** @} | 
|---|
| 136 | */ | 
|---|