1 /* $NetBSD: wsfontdev.c,v 1.13 2006/11/16 01:33:31 christos Exp $ */
5 * Matthias Drochner. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #include <sys/cdefs.h>
30 __KERNEL_RCSID(0, "$NetBSD: wsfontdev.c,v 1.13 2006/11/16 01:33:31 christos Exp $");
32 #include <sys/param.h>
33 #include <sys/systm.h>
35 #include <sys/ioctl.h>
36 #include <sys/malloc.h>
37 #include <sys/event.h>
39 #include <dev/wsfont/wsfont.h>
40 #include <dev/wscons/wsconsio.h> /* XXX */
42 void wsfontattach(int);
44 static int wsfont_isopen
;
54 wsfontopen(dev_t dev
, int flag
, int mode
,
65 wsfontclose(dev_t dev
, int flag
, int mode
,
74 wsfontioctl(dev_t dev
, u_long cmd
, void *data
, int flag
,
82 case WSDISPLAYIO_LDFONT
:
83 #define d ((struct wsdisplay_font *)data)
85 res
= copyinstr(d
->name
, nbuf
, sizeof(nbuf
), 0);
90 d
->name
= "loaded"; /* ??? */
91 buf
= malloc(d
->fontheight
* d
->stride
* d
->numchars
,
93 res
= copyin(d
->data
, buf
,
94 d
->fontheight
* d
->stride
* d
->numchars
);
100 res
= wsfont_add(d
, 1);
109 const struct cdevsw wsfont_cdevsw
= {
110 wsfontopen
, wsfontclose
, noread
, nowrite
, wsfontioctl
,
111 nostop
, notty
, nopoll
, nommap
, nokqfilter
, D_OTHER
,