The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/fb/fbreg.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
    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  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer as
   10  *    the first lines of this file unmodified.
   11  * 2. 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  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25  *
   26  * $FreeBSD: releng/5.2/sys/dev/fb/fbreg.h 120465 2003-09-26 10:41:44Z phk $
   27  */
   28 
   29 #ifndef _DEV_FB_FBREG_H_
   30 #define _DEV_FB_FBREG_H_
   31 
   32 #ifdef _KERNEL
   33 
   34 #define V_MAX_ADAPTERS          8               /* XXX */
   35 
   36 /* some macros */
   37 #ifdef __i386__
   38 #define bcopy_io(s, d, c)       generic_bcopy((void *)(s), (void *)(d), (c))
   39 #define bcopy_toio(s, d, c)     generic_bcopy((void *)(s), (void *)(d), (c))
   40 #define bcopy_fromio(s, d, c)   generic_bcopy((void *)(s), (void *)(d), (c))
   41 #define bzero_io(d, c)          generic_bzero((void *)(d), (c))
   42 #define fill_io(p, d, c)        fill((p), (void *)(d), (c))
   43 #define fillw_io(p, d, c)       fillw((p), (void *)(d), (c))
   44 void generic_bcopy(const void *s, void *d, size_t c);
   45 void generic_bzero(void *d, size_t c);
   46 #elif __amd64__
   47 #define bcopy_io(s, d, c)       bcopy((void *)(s), (void *)(d), (c))
   48 #define bcopy_toio(s, d, c)     bcopy((void *)(s), (void *)(d), (c))
   49 #define bcopy_fromio(s, d, c)   bcopy((void *)(s), (void *)(d), (c))
   50 #define bzero_io(d, c)          bzero((void *)(d), (c))
   51 #define fill_io(p, d, c)        fill((p), (void *)(d), (c))
   52 #define fillw_io(p, d, c)       fillw((p), (void *)(d), (c))
   53 #elif __ia64__
   54 #include <machine/bus.h>
   55 #define bcopy_fromio(s, d, c)   \
   56         bus_space_read_region_1(IA64_BUS_SPACE_MEM, s, 0, (void*)(d), c)
   57 #define bcopy_io(s, d, c)       \
   58         bus_space_copy_region_1(IA64_BUS_SPACE_MEM, s, 0, d, 0, c)
   59 #define bcopy_toio(s, d, c)     \
   60         bus_space_write_region_1(IA64_BUS_SPACE_MEM, d, 0, (void*)(s), c)
   61 #define bzero_io(d, c)          \
   62         bus_space_set_region_1(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, 0, c)
   63 #define fill_io(p, d, c)        \
   64         bus_space_set_region_1(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, p, c)
   65 #define fillw_io(p, d, c)       \
   66         bus_space_set_region_2(IA64_BUS_SPACE_MEM, (intptr_t)(d), 0, p, c)
   67 #define readb(a)                bus_space_read_1(IA64_BUS_SPACE_MEM, a, 0)
   68 #define readw(a)                bus_space_read_2(IA64_BUS_SPACE_MEM, a, 0)
   69 #define writeb(a, v)            bus_space_write_1(IA64_BUS_SPACE_MEM, a, 0, v)
   70 #define writew(a, v)            bus_space_write_2(IA64_BUS_SPACE_MEM, a, 0, v)
   71 #define writel(a, v)            bus_space_write_4(IA64_BUS_SPACE_MEM, a, 0, v)
   72 static __inline void
   73 fillw(int val, uint16_t *buf, size_t size)
   74 {
   75         while (size--)
   76                 *buf++ = val;
   77 }
   78 #else /* !__i386__ && !__ia64__ && !__amd64__ */
   79 #define bcopy_io(s, d, c)       memcpy_io((d), (s), (c))
   80 #define bcopy_toio(s, d, c)     memcpy_toio((d), (void *)(s), (c))
   81 #define bcopy_fromio(s, d, c)   memcpy_fromio((void *)(d), (s), (c))
   82 #define bzero_io(d, c)          memset_io((d), 0, (c))
   83 #define fill_io(p, d, c)        memset_io((d), (p), (c))
   84 #define fillw(p, d, c)          memsetw((d), (p), (c))
   85 #define fillw_io(p, d, c)       memsetw_io((d), (p), (c))
   86 #endif /* !__i386__ */
   87 
   88 /* video function table */
   89 typedef int vi_probe_t(int unit, video_adapter_t **adpp, void *arg, int flags);
   90 typedef int vi_init_t(int unit, video_adapter_t *adp, int flags);
   91 typedef int vi_get_info_t(video_adapter_t *adp, int mode, video_info_t *info);
   92 typedef int vi_query_mode_t(video_adapter_t *adp, video_info_t *info);
   93 typedef int vi_set_mode_t(video_adapter_t *adp, int mode);
   94 typedef int vi_save_font_t(video_adapter_t *adp, int page, int size,
   95                            u_char *data, int c, int count);
   96 typedef int vi_load_font_t(video_adapter_t *adp, int page, int size,
   97                            u_char *data, int c, int count);
   98 typedef int vi_show_font_t(video_adapter_t *adp, int page);
   99 typedef int vi_save_palette_t(video_adapter_t *adp, u_char *palette);
  100 typedef int vi_load_palette_t(video_adapter_t *adp, u_char *palette);
  101 typedef int vi_set_border_t(video_adapter_t *adp, int border);
  102 typedef int vi_save_state_t(video_adapter_t *adp, void *p, size_t size);
  103 typedef int vi_load_state_t(video_adapter_t *adp, void *p);
  104 typedef int vi_set_win_org_t(video_adapter_t *adp, off_t offset);
  105 typedef int vi_read_hw_cursor_t(video_adapter_t *adp, int *col, int *row);
  106 typedef int vi_set_hw_cursor_t(video_adapter_t *adp, int col, int row);
  107 typedef int vi_set_hw_cursor_shape_t(video_adapter_t *adp, int base,
  108                                      int height, int celsize, int blink);
  109 typedef int vi_blank_display_t(video_adapter_t *adp, int mode);
  110 /* defined in sys/fbio.h
  111 #define V_DISPLAY_ON            0
  112 #define V_DISPLAY_BLANK         1
  113 #define V_DISPLAY_STAND_BY      2
  114 #define V_DISPLAY_SUSPEND       3
  115 */
  116 typedef int vi_mmap_t(video_adapter_t *adp, vm_offset_t offset,
  117                       vm_paddr_t *paddr, int prot);
  118 typedef int vi_ioctl_t(video_adapter_t *adp, u_long cmd, caddr_t data);
  119 typedef int vi_clear_t(video_adapter_t *adp);
  120 typedef int vi_fill_rect_t(video_adapter_t *adp, int val, int x, int y,
  121                            int cx, int cy);
  122 typedef int vi_bitblt_t(video_adapter_t *adp, ...);
  123 typedef int vi_diag_t(video_adapter_t *adp, int level);
  124 typedef int vi_save_cursor_palette_t(video_adapter_t *adp, u_char *palette);
  125 typedef int vi_load_cursor_palette_t(video_adapter_t *adp, u_char *palette);
  126 typedef int vi_copy_t(video_adapter_t *adp, vm_offset_t src, vm_offset_t dst,
  127                       int n);
  128 typedef int vi_putp_t(video_adapter_t *adp, vm_offset_t off, u_int32_t p,
  129                        u_int32_t a, int size, int bpp, int bit_ltor,
  130                        int byte_ltor);
  131 typedef int vi_putc_t(video_adapter_t *adp, vm_offset_t off, u_int8_t c,
  132                       u_int8_t a);
  133 typedef int vi_puts_t(video_adapter_t *adp, vm_offset_t off, u_int16_t *s,
  134                        int len);
  135 typedef int vi_putm_t(video_adapter_t *adp, int x, int y,
  136                       u_int8_t *pixel_image, u_int32_t pixel_mask, int size);
  137 
  138 typedef struct video_switch {
  139     vi_probe_t          *probe;
  140     vi_init_t           *init;
  141     vi_get_info_t       *get_info;
  142     vi_query_mode_t     *query_mode;
  143     vi_set_mode_t       *set_mode;
  144     vi_save_font_t      *save_font;
  145     vi_load_font_t      *load_font;
  146     vi_show_font_t      *show_font;
  147     vi_save_palette_t   *save_palette;
  148     vi_load_palette_t   *load_palette;
  149     vi_set_border_t     *set_border;
  150     vi_save_state_t     *save_state;
  151     vi_load_state_t     *load_state;
  152     vi_set_win_org_t    *set_win_org;
  153     vi_read_hw_cursor_t *read_hw_cursor;
  154     vi_set_hw_cursor_t  *set_hw_cursor;
  155     vi_set_hw_cursor_shape_t *set_hw_cursor_shape;
  156     vi_blank_display_t  *blank_display;
  157     vi_mmap_t           *mmap;
  158     vi_ioctl_t          *ioctl;
  159     vi_clear_t          *clear;
  160     vi_fill_rect_t      *fill_rect;
  161     vi_bitblt_t         *bitblt;
  162     int                 (*reserved1)(void);
  163     int                 (*reserved2)(void);
  164     vi_diag_t           *diag;
  165     vi_save_cursor_palette_t    *save_cursor_palette;
  166     vi_load_cursor_palette_t    *load_cursor_palette;
  167     vi_copy_t           *copy;
  168     vi_putp_t           *putp;
  169     vi_putc_t           *putc;
  170     vi_puts_t           *puts;
  171     vi_putm_t           *putm;
  172 } video_switch_t;
  173 
  174 #define save_palette(adp, pal)                          \
  175         (*vidsw[(adp)->va_index]->save_palette)((adp), (pal))
  176 #define load_palette(adp, pal)                          \
  177         (*vidsw[(adp)->va_index]->load_palette)((adp), (pal))
  178 #define get_mode_info(adp, mode, buf)                   \
  179         (*vidsw[(adp)->va_index]->get_info)((adp), (mode), (buf))
  180 #define set_video_mode(adp, mode)                       \
  181         (*vidsw[(adp)->va_index]->set_mode)((adp), (mode))
  182 #define set_border(adp, border)                         \
  183         (*vidsw[(adp)->va_index]->set_border)((adp), (border))
  184 #define set_origin(adp, o)                              \
  185         (*vidsw[(adp)->va_index]->set_win_org)(adp, o)
  186 
  187 /* XXX - add more macros */
  188 
  189 /* video driver */
  190 typedef struct video_driver {
  191     char                *name;
  192     video_switch_t      *vidsw;
  193     int                 (*configure)(int); /* backdoor for the console driver */
  194 } video_driver_t;
  195 
  196 #define VIDEO_DRIVER(name, sw, config)                  \
  197         static struct video_driver name##_driver = {    \
  198                 #name, &sw, config                      \
  199         };                                              \
  200         DATA_SET(videodriver_set, name##_driver);
  201 
  202 /* global variables */
  203 extern struct video_switch **vidsw;
  204 
  205 /* functions for the video card driver */
  206 int             vid_register(video_adapter_t *adp);
  207 int             vid_unregister(video_adapter_t *adp);
  208 video_switch_t  *vid_get_switch(char *name);
  209 void            vid_init_struct(video_adapter_t *adp, char *name, int type,
  210                                 int unit);
  211 
  212 /* functions for the video card client */
  213 int             vid_allocate(char *driver, int unit, void *id);
  214 int             vid_release(video_adapter_t *adp, void *id);
  215 int             vid_find_adapter(char *driver, int unit);
  216 video_adapter_t *vid_get_adapter(int index);
  217 
  218 /* a backdoor for the console driver to tickle the video driver XXX */
  219 int             vid_configure(int flags);
  220 #define VIO_PROBE_ONLY  (1 << 0)        /* probe only, don't initialize */
  221 
  222 #ifdef FB_INSTALL_CDEV
  223 
  224 /* virtual frame buffer driver functions */
  225 int             fb_attach(int unit, video_adapter_t *adp,
  226                           struct cdevsw *cdevsw);
  227 int             fb_detach(int unit, video_adapter_t *adp,
  228                           struct cdevsw *cdevsw);
  229 
  230 /* generic frame buffer cdev driver functions */
  231 
  232 typedef struct genfb_softc {
  233         int             gfb_flags;      /* flag/status bits */
  234 #define FB_OPEN         (1 << 0)
  235 } genfb_softc_t;
  236 
  237 int             genfbopen(genfb_softc_t *sc, video_adapter_t *adp,
  238                           int flag, int mode, struct thread *td);
  239 int             genfbclose(genfb_softc_t *sc, video_adapter_t *adp,
  240                            int flag, int mode, struct thread *td);
  241 int             genfbread(genfb_softc_t *sc, video_adapter_t *adp,
  242                           struct uio *uio, int flag);
  243 int             genfbwrite(genfb_softc_t *sc, video_adapter_t *adp,
  244                            struct uio *uio, int flag);
  245 int             genfbioctl(genfb_softc_t *sc, video_adapter_t *adp,
  246                            u_long cmd, caddr_t arg, int flag, struct thread *td);
  247 int             genfbmmap(genfb_softc_t *sc, video_adapter_t *adp,
  248                           vm_offset_t offset, vm_offset_t *paddr, int prot);
  249 
  250 #endif /* FB_INSTALL_CDEV */
  251 
  252 /* generic low-level driver functions */
  253 
  254 void            fb_dump_adp_info(char *driver, video_adapter_t *adp, int level);
  255 void            fb_dump_mode_info(char *driver, video_adapter_t *adp,
  256                                   video_info_t *info, int level);
  257 int             fb_type(int adp_type);
  258 int             fb_commonioctl(video_adapter_t *adp, u_long cmd, caddr_t arg);
  259 
  260 #endif /* _KERNEL */
  261 
  262 #endif /* !_DEV_FB_FBREG_H_ */

Cache object: 2edd629de6b6931e82ce18a1f736e474


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.