1300829Sgrehan/*-
2336189Saraujo * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3336189Saraujo *
4300829Sgrehan * Copyright (c) 2015 Tycho Nightingale <tycho.nightingale@pluribusnetworks.com>
5300829Sgrehan * All rights reserved.
6300829Sgrehan *
7300829Sgrehan * Redistribution and use in source and binary forms, with or without
8300829Sgrehan * modification, are permitted provided that the following conditions
9300829Sgrehan * are met:
10300829Sgrehan * 1. Redistributions of source code must retain the above copyright
11300829Sgrehan *    notice, this list of conditions and the following disclaimer.
12300829Sgrehan * 2. Redistributions in binary form must reproduce the above copyright
13300829Sgrehan *    notice, this list of conditions and the following disclaimer in the
14300829Sgrehan *    documentation and/or other materials provided with the distribution.
15300829Sgrehan *
16300829Sgrehan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
17300829Sgrehan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18300829Sgrehan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19300829Sgrehan * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20300829Sgrehan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21300829Sgrehan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22300829Sgrehan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23300829Sgrehan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24300829Sgrehan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25300829Sgrehan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26300829Sgrehan * SUCH DAMAGE.
27300829Sgrehan *
28300829Sgrehan * $FreeBSD: stable/11/usr.sbin/bhyve/console.h 336189 2018-07-11 07:16:13Z araujo $
29300829Sgrehan */
30300829Sgrehan
31300829Sgrehan#ifndef _CONSOLE_H_
32300829Sgrehan#define	_CONSOLE_H_
33300829Sgrehan
34300829Sgrehanstruct bhyvegc;
35300829Sgrehan
36300829Sgrehantypedef void (*fb_render_func_t)(struct bhyvegc *gc, void *arg);
37300829Sgrehantypedef void (*kbd_event_func_t)(int down, uint32_t keysym, void *arg);
38300829Sgrehantypedef void (*ptr_event_func_t)(uint8_t mask, int x, int y, void *arg);
39300829Sgrehan
40336161Saraujovoid console_init(int w, int h, void *fbaddr);
41300829Sgrehan
42336161Saraujovoid console_set_fbaddr(void *fbaddr);
43300829Sgrehan
44300829Sgrehanstruct bhyvegc_image *console_get_image(void);
45300829Sgrehan
46336161Saraujovoid console_fb_register(fb_render_func_t render_cb, void *arg);
47336161Saraujovoid console_refresh(void);
48300829Sgrehan
49336161Saraujovoid console_kbd_register(kbd_event_func_t event_cb, void *arg, int pri);
50336161Saraujovoid console_key_event(int down, uint32_t keysym);
51300829Sgrehan
52336161Saraujovoid console_ptr_register(ptr_event_func_t event_cb, void *arg, int pri);
53336161Saraujovoid console_ptr_event(uint8_t button, int x, int y);
54300829Sgrehan
55300829Sgrehan#endif /* _CONSOLE_H_ */
56