Added /dev/video for mapping video memory.

This commit is contained in:
Philip Homburg 2005-11-09 15:45:48 +00:00
parent 4102a5db28
commit 5556281540
3 changed files with 64 additions and 2 deletions

View file

@ -18,6 +18,8 @@
#include "../drivers.h" #include "../drivers.h"
#include <termios.h> #include <termios.h>
#include <sys/ioctl.h>
#include <sys/vm.h>
#include <minix/callnr.h> #include <minix/callnr.h>
#include <minix/com.h> #include <minix/com.h>
#include "tty.h" #include "tty.h"
@ -766,6 +768,61 @@ PRIVATE void beep()
} }
/*===========================================================================*
* do_video *
*===========================================================================*/
PUBLIC void do_video(message *m)
{
int i, n, r, ops, watch;
unsigned char c;
/* Execute the requested device driver function. */
r= EINVAL; /* just in case */
switch (m->m_type) {
case DEV_OPEN:
/* Should grant IOPL */
r= OK;
break;
case DEV_CLOSE:
r= OK;
break;
case DEV_IOCTL:
if (m->TTY_REQUEST == MIOCMAP || m->TTY_REQUEST == MIOCUNMAP)
{
int r, do_map;
struct mapreq mapreq;
do_map= (m->REQUEST == MIOCMAP); /* else unmap */
/* Get request structure */
r= sys_vircopy(m->PROC_NR, D,
(vir_bytes)m->ADDRESS,
SELF, D, (vir_bytes)&mapreq, sizeof(mapreq));
if (r != OK)
{
tty_reply(TASK_REPLY, m->m_source, m->PROC_NR,
r);
return;
}
r= sys_vm_map(m->PROC_NR, do_map,
(phys_bytes)mapreq.base, mapreq.size,
mapreq.offset);
tty_reply(TASK_REPLY, m->m_source, m->PROC_NR, r);
return;
}
r= ENOTTY;
break;
default:
printf(
"Warning, TTY(video) got unexpected request %d from %d\n",
m->m_type, m->m_source);
r= EINVAL;
}
tty_reply(TASK_REPLY, m->m_source, m->PROC_NR, r);
}
/*===========================================================================* /*===========================================================================*
* beep_x * * beep_x *
*===========================================================================*/ *===========================================================================*/

View file

@ -272,6 +272,9 @@ PUBLIC void main(void)
} else if (line == KBDAUX_MINOR) { } else if (line == KBDAUX_MINOR) {
do_kbdaux(&tty_mess); do_kbdaux(&tty_mess);
continue; continue;
} else if (line == VIDEO_MINOR) {
do_video(&tty_mess);
continue;
} else if ((line - CONS_MINOR) < NR_CONS) { } else if ((line - CONS_MINOR) < NR_CONS) {
tp = tty_addr(line - CONS_MINOR); tp = tty_addr(line - CONS_MINOR);
} else if (line == LOG_MINOR) { } else if (line == LOG_MINOR) {

View file

@ -9,10 +9,11 @@
/* First minor numbers for the various classes of TTY devices. */ /* First minor numbers for the various classes of TTY devices. */
#define CONS_MINOR 0 #define CONS_MINOR 0
#define KBD_MINOR 13
#define KBDAUX_MINOR 14
#define LOG_MINOR 15 #define LOG_MINOR 15
#define RS232_MINOR 16 #define RS232_MINOR 16
#define KBD_MINOR 127
#define KBDAUX_MINOR 126
#define VIDEO_MINOR 125
#define TTYPX_MINOR 128 #define TTYPX_MINOR 128
#define PTYPX_MINOR 192 #define PTYPX_MINOR 192
@ -167,6 +168,7 @@ _PROTOTYPE( void toggle_scroll, (void) );
_PROTOTYPE( int con_loadfont, (message *m) ); _PROTOTYPE( int con_loadfont, (message *m) );
_PROTOTYPE( void select_console, (int cons_line) ); _PROTOTYPE( void select_console, (int cons_line) );
_PROTOTYPE( void beep_x, ( unsigned freq, clock_t dur) ); _PROTOTYPE( void beep_x, ( unsigned freq, clock_t dur) );
_PROTOTYPE( void do_video, (message *m) );
/* keyboard.c */ /* keyboard.c */
_PROTOTYPE( void kb_init, (struct tty *tp) ); _PROTOTYPE( void kb_init, (struct tty *tp) );