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/ic/i128.c

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 /*      $NetBSD: i128.c,v 1.3 2008/04/29 06:53:02 martin Exp $ */
    2 
    3 /*-
    4  * Copyright (c) 2007 Michael Lorenz
    5  * All rights reserved.
    6  *
    7  * Redistribution and use in source and binary forms, with or without
    8  * modification, are permitted provided that the following conditions
    9  * are met:
   10  * 1. Redistributions of source code must retain the above copyright
   11  *    notice, this list of conditions and the following disclaimer.
   12  * 2. Redistributions in binary form must reproduce the above copyright
   13  *    notice, this list of conditions and the following disclaimer in the
   14  *    documentation and/or other materials provided with the distribution.
   15  *
   16  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
   17  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
   18  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
   19  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
   20  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
   21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
   22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
   24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
   25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
   26  * POSSIBILITY OF SUCH DAMAGE.
   27  */
   28 
   29 #include <sys/cdefs.h>
   30 __KERNEL_RCSID(0, "$NetBSD: i128.c,v 1.3 2008/04/29 06:53:02 martin Exp $");
   31 
   32 #include <sys/param.h>
   33 #include <sys/systm.h>
   34 #include <sys/buf.h>
   35 #include <sys/device.h>
   36 #include <sys/conf.h>
   37 
   38 #include <sys/bus.h>
   39 #include <machine/autoconf.h>
   40 
   41 #include <dev/ic/i128reg.h>
   42 #include <dev/ic/i128var.h>
   43 
   44 void
   45 i128_init(bus_space_tag_t tag, bus_space_handle_t regh, int stride, int depth)
   46 {
   47         /* initialize the i128's blitter */
   48         switch (depth) {
   49                 case 8:
   50                         bus_space_write_4(tag, regh, BUF_CTRL, BC_PSIZ_8B);
   51                         break;
   52                 case 16:
   53                         bus_space_write_4(tag, regh, BUF_CTRL, BC_PSIZ_16B);
   54                         break;
   55                 case 32:
   56                         bus_space_write_4(tag, regh, BUF_CTRL, BC_PSIZ_32B);
   57                         break;
   58                 default:
   59                         aprint_error("i128: unsupported colour depth (%d)\n",
   60                             depth);
   61                         return;
   62         }
   63 
   64         bus_space_write_4(tag, regh, DE_PGE, 0);
   65         bus_space_write_4(tag, regh, DE_SORG, 0);
   66         bus_space_write_4(tag, regh, DE_DORG, 0);
   67         bus_space_write_4(tag, regh, DE_MSRC, 0);
   68         bus_space_write_4(tag, regh, DE_WKEY, 0);
   69         bus_space_write_4(tag, regh, DE_SPTCH, stride);
   70         bus_space_write_4(tag, regh, DE_DPTCH, stride);
   71         bus_space_write_4(tag, regh, RMSK, 0);
   72         bus_space_write_4(tag, regh, XY4_ZM, ZOOM_NONE);
   73         bus_space_write_4(tag, regh, LPAT, 0xffffffff);
   74         bus_space_write_4(tag, regh, ACNTRL, 0);
   75         bus_space_write_4(tag, regh, INTM, 3);
   76         bus_space_write_4(tag, regh, CLPTL, 0x00000000);
   77         bus_space_write_4(tag, regh, CLPBR, 0x1fff0fff);
   78         bus_space_write_4(tag, regh, MASK, 0xffffffff);
   79 }
   80 
   81 void
   82 i128_bitblt(bus_space_tag_t tag, bus_space_handle_t regh, int xs, int ys,
   83     int xd, int yd, int wi, int he, int rop)
   84 {
   85         int dir = 0;
   86 
   87         if (xs < xd) {
   88                 dir |= DIR_RL;
   89                 xs += wi - 1;
   90                 xd += wi - 1;
   91         }
   92         if (ys < yd) {
   93                 dir |= DIR_BT;
   94                 ys += he - 1;
   95                 yd += he - 1;
   96         }
   97 
   98         I128_READY(tag, regh);
   99         bus_space_write_4(tag, regh, CMD,
  100             (rop & 0xff) << 8 | CO_BITBLT);
  101         bus_space_write_4(tag, regh, XY3_DIR, dir);
  102         bus_space_write_4(tag, regh, XY2_WH, (wi << 16) | he);
  103         bus_space_write_4(tag, regh, XY0_SRC, (xs << 16) | ys);
  104         bus_space_write_4(tag, regh, XY1_DST, (xd << 16) | yd);
  105         I128_DONE(tag, regh);
  106 }
  107 
  108 void
  109 i128_rectfill(bus_space_tag_t tag, bus_space_handle_t regh, int x, int y,
  110     int wi, int he, uint32_t color)
  111 {
  112 
  113         I128_READY(tag, regh);
  114         bus_space_write_4(tag, regh, CMD,
  115             CS_SOLID << 16 | (CR_COPY) << 8 | CO_BITBLT);
  116         bus_space_write_4(tag, regh, FORE, color);
  117         bus_space_write_4(tag, regh, XY3_DIR, 0);
  118         bus_space_write_4(tag, regh, XY2_WH, (wi << 16) | he);
  119         bus_space_write_4(tag, regh, XY0_SRC, 0);
  120         bus_space_write_4(tag, regh, XY1_DST, (x << 16) | y);
  121         I128_DONE(tag, regh);
  122 }

Cache object: e7283319c6552e7b9ca63bab041a3589


[ 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.