- hz dynamic
- new map /dev/video implementation - ser_putc into library
This commit is contained in:
parent
fe56202038
commit
f4d0d635fd
@ -25,6 +25,7 @@
|
|||||||
#include <minix/callnr.h>
|
#include <minix/callnr.h>
|
||||||
#include <minix/com.h>
|
#include <minix/com.h>
|
||||||
#include <minix/sys_config.h>
|
#include <minix/sys_config.h>
|
||||||
|
#include <minix/vm.h>
|
||||||
#include "tty.h"
|
#include "tty.h"
|
||||||
|
|
||||||
/* Set this to 1 if you want console output duplicated on the first
|
/* Set this to 1 if you want console output duplicated on the first
|
||||||
@ -142,10 +143,6 @@ FORWARD _PROTOTYPE( void reenable_console, (void) );
|
|||||||
FORWARD _PROTOTYPE( int ga_program, (struct sequence *seq) );
|
FORWARD _PROTOTYPE( int ga_program, (struct sequence *seq) );
|
||||||
FORWARD _PROTOTYPE( int cons_ioctl, (tty_t *tp, int) );
|
FORWARD _PROTOTYPE( int cons_ioctl, (tty_t *tp, int) );
|
||||||
|
|
||||||
#if DUP_CONS_TO_SER
|
|
||||||
FORWARD _PROTOTYPE( void ser_putc, (char c) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
FORWARD _PROTOTYPE( void get_6845, (int reg, unsigned *val) );
|
FORWARD _PROTOTYPE( void get_6845, (int reg, unsigned *val) );
|
||||||
#endif
|
#endif
|
||||||
@ -826,47 +823,6 @@ PUBLIC void do_video(message *m)
|
|||||||
case DEV_IOCTL_S:
|
case DEV_IOCTL_S:
|
||||||
safe=1;
|
safe=1;
|
||||||
switch(m->TTY_REQUEST) {
|
switch(m->TTY_REQUEST) {
|
||||||
case MIOCMAP:
|
|
||||||
case MIOCUNMAP: {
|
|
||||||
#if 0
|
|
||||||
int r, do_map;
|
|
||||||
struct mapreq mapreq;
|
|
||||||
|
|
||||||
do_map= (m->REQUEST == MIOCMAP); /* else unmap */
|
|
||||||
|
|
||||||
/* Get request structure */
|
|
||||||
if(safe) {
|
|
||||||
r = sys_safecopyfrom(m->IO_ENDPT,
|
|
||||||
(vir_bytes)m->ADDRESS, 0, (vir_bytes) &mapreq,
|
|
||||||
sizeof(mapreq), D);
|
|
||||||
} else {
|
|
||||||
r= sys_vircopy(m->IO_ENDPT, D,
|
|
||||||
(vir_bytes)m->ADDRESS,
|
|
||||||
SELF, D, (vir_bytes)&mapreq, sizeof(mapreq));
|
|
||||||
}
|
|
||||||
if (r != OK)
|
|
||||||
{
|
|
||||||
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT,
|
|
||||||
r);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* In safe ioctl mode, the POSITION field contains
|
|
||||||
* the endpt number of the original requestor.
|
|
||||||
* IO_ENDPT is always FS.
|
|
||||||
*/
|
|
||||||
|
|
||||||
r= sys_vm_map(safe ? m->POSITION : m->IO_ENDPT,
|
|
||||||
do_map, (phys_bytes)mapreq.base, mapreq.size,
|
|
||||||
mapreq.offset);
|
|
||||||
#else
|
|
||||||
r = ENOSYS;
|
|
||||||
printf("tty: %ld used old MIOCMAP interface\n",
|
|
||||||
safe ? m->POSITION : m->IO_ENDPT);
|
|
||||||
#endif
|
|
||||||
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
case TIOCMAPMEM:
|
case TIOCMAPMEM:
|
||||||
case TIOCUNMAPMEM: {
|
case TIOCUNMAPMEM: {
|
||||||
int r, do_map;
|
int r, do_map;
|
||||||
@ -876,17 +832,18 @@ PUBLIC void do_video(message *m)
|
|||||||
do_map= (m->REQUEST == TIOCMAPMEM); /* else unmap */
|
do_map= (m->REQUEST == TIOCMAPMEM); /* else unmap */
|
||||||
|
|
||||||
/* Get request structure */
|
/* Get request structure */
|
||||||
if(safe) {
|
if(!safe) {
|
||||||
r = sys_safecopyfrom(m->IO_ENDPT,
|
printf("tty: safecopy only\n");
|
||||||
(vir_bytes)m->ADDRESS, 0, (vir_bytes) &mapreqvm,
|
return;
|
||||||
sizeof(mapreqvm), D);
|
|
||||||
} else {
|
|
||||||
r= sys_vircopy(m->IO_ENDPT, D,
|
|
||||||
(vir_bytes)m->ADDRESS,
|
|
||||||
SELF, D, (vir_bytes)&mapreqvm,sizeof(mapreqvm));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r = sys_safecopyfrom(m->IO_ENDPT,
|
||||||
|
(vir_bytes)m->ADDRESS, 0, (vir_bytes) &mapreqvm,
|
||||||
|
sizeof(mapreqvm), D);
|
||||||
|
|
||||||
if (r != OK)
|
if (r != OK)
|
||||||
{
|
{
|
||||||
|
printf("tty: sys_safecopyfrom failed\n");
|
||||||
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT,
|
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT,
|
||||||
r);
|
r);
|
||||||
return;
|
return;
|
||||||
@ -898,7 +855,17 @@ PUBLIC void do_video(message *m)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
if(do_map) {
|
if(do_map) {
|
||||||
|
mapreqvm.vaddr_ret = vm_map_phys(m->POSITION,
|
||||||
|
(void *) mapreqvm.phys_offset, mapreqvm.size);
|
||||||
|
if((r = sys_safecopyto(m->IO_ENDPT,
|
||||||
|
(vir_bytes)m->ADDRESS, 0,
|
||||||
|
(vir_bytes) &mapreqvm,
|
||||||
|
sizeof(mapreqvm), D)) != OK) {
|
||||||
|
printf("tty: sys_safecopyto failed\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
r = vm_unmap_phys(m->POSITION,
|
||||||
|
mapreqvm.vaddr, mapreqvm.size);
|
||||||
}
|
}
|
||||||
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r);
|
tty_reply(TASK_REPLY, m->m_source, m->IO_ENDPT, r);
|
||||||
return;
|
return;
|
||||||
@ -1267,10 +1234,12 @@ PUBLIC void toggle_scroll()
|
|||||||
PUBLIC void cons_stop()
|
PUBLIC void cons_stop()
|
||||||
{
|
{
|
||||||
/* Prepare for halt or reboot. */
|
/* Prepare for halt or reboot. */
|
||||||
|
select_console(0);
|
||||||
|
#if 0
|
||||||
cons_org0();
|
cons_org0();
|
||||||
softscroll = 1;
|
softscroll = 1;
|
||||||
select_console(0);
|
|
||||||
cons_table[0].c_attr = cons_table[0].c_blank = BLANK_COLOR;
|
cons_table[0].c_attr = cons_table[0].c_blank = BLANK_COLOR;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
@ -1417,26 +1386,3 @@ int try;
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if DUP_CONS_TO_SER
|
|
||||||
#define COM1_BASE 0x3F8
|
|
||||||
#define COM1_THR (COM1_BASE + 0)
|
|
||||||
#define LSR_THRE 0x20
|
|
||||||
#define COM1_LSR (COM1_BASE + 5)
|
|
||||||
|
|
||||||
PRIVATE void ser_putc(char c)
|
|
||||||
{
|
|
||||||
unsigned long b;
|
|
||||||
int i;
|
|
||||||
int lsr, thr;
|
|
||||||
|
|
||||||
lsr= COM1_LSR;
|
|
||||||
thr= COM1_THR;
|
|
||||||
for (i= 0; i<10000; i++)
|
|
||||||
{
|
|
||||||
sys_inb(lsr, &b);
|
|
||||||
if (b & LSR_THRE)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sys_outb(thr, c);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
@ -371,8 +371,8 @@ message *m;
|
|||||||
if (r != OK)
|
if (r != OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
ticks= bell.kb_duration.tv_usec * HZ / 1000000;
|
ticks= bell.kb_duration.tv_usec * system_hz / 1000000;
|
||||||
ticks += bell.kb_duration.tv_sec * HZ;
|
ticks += bell.kb_duration.tv_sec * system_hz;
|
||||||
if (!ticks)
|
if (!ticks)
|
||||||
ticks++;
|
ticks++;
|
||||||
beep_x(bell.kb_pitch, ticks);
|
beep_x(bell.kb_pitch, ticks);
|
||||||
@ -669,7 +669,7 @@ PRIVATE void kbd_send()
|
|||||||
*/
|
*/
|
||||||
if ((r= getuptime(&now)) != OK)
|
if ((r= getuptime(&now)) != OK)
|
||||||
panic("TTY","Keyboard couldn't get clock's uptime.", r);
|
panic("TTY","Keyboard couldn't get clock's uptime.", r);
|
||||||
tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+HZ, kbd_watchdog,
|
tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+system_hz, kbd_watchdog,
|
||||||
NULL);
|
NULL);
|
||||||
if (tty_timers->tmr_exp_time != tty_next_timeout) {
|
if (tty_timers->tmr_exp_time != tty_next_timeout) {
|
||||||
tty_next_timeout = tty_timers->tmr_exp_time;
|
tty_next_timeout = tty_timers->tmr_exp_time;
|
||||||
@ -1269,7 +1269,7 @@ timer_t *tmrp;
|
|||||||
|
|
||||||
if ((r= getuptime(&now)) != OK)
|
if ((r= getuptime(&now)) != OK)
|
||||||
panic("TTY","Keyboard couldn't get clock's uptime.", r);
|
panic("TTY","Keyboard couldn't get clock's uptime.", r);
|
||||||
tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+HZ, kbd_watchdog,
|
tmrs_settimer(&tty_timers, &tmr_kbd_wd, now+system_hz, kbd_watchdog,
|
||||||
NULL);
|
NULL);
|
||||||
if (tty_timers->tmr_exp_time != tty_next_timeout) {
|
if (tty_timers->tmr_exp_time != tty_next_timeout) {
|
||||||
tty_next_timeout = tty_timers->tmr_exp_time;
|
tty_next_timeout = tty_timers->tmr_exp_time;
|
||||||
|
@ -138,6 +138,7 @@ PUBLIC int ccurrent; /* currently active console */
|
|||||||
PUBLIC timer_t *tty_timers; /* queue of TTY timers */
|
PUBLIC timer_t *tty_timers; /* queue of TTY timers */
|
||||||
PUBLIC clock_t tty_next_timeout; /* time that the next alarm is due */
|
PUBLIC clock_t tty_next_timeout; /* time that the next alarm is due */
|
||||||
PUBLIC struct machine machine; /* kernel environment variables */
|
PUBLIC struct machine machine; /* kernel environment variables */
|
||||||
|
PUBLIC u32_t system_hz;
|
||||||
|
|
||||||
extern PUBLIC unsigned info_location;
|
extern PUBLIC unsigned info_location;
|
||||||
extern PUBLIC phys_bytes vid_size; /* 0x2000 for color or 0x0800 for mono */
|
extern PUBLIC phys_bytes vid_size; /* 0x2000 for color or 0x0800 for mono */
|
||||||
@ -1537,6 +1538,8 @@ PRIVATE void tty_init()
|
|||||||
register tty_t *tp;
|
register tty_t *tp;
|
||||||
int s;
|
int s;
|
||||||
|
|
||||||
|
system_hz = sys_hz();
|
||||||
|
|
||||||
/* Initialize the terminal lines. */
|
/* Initialize the terminal lines. */
|
||||||
for (tp = FIRST_TTY,s=0; tp < END_TTY; tp++,s++) {
|
for (tp = FIRST_TTY,s=0; tp < END_TTY; tp++,s++) {
|
||||||
|
|
||||||
@ -1565,6 +1568,7 @@ PRIVATE void tty_init()
|
|||||||
tp->tty_minor = s - (NR_CONS+NR_RS_LINES) + TTYPX_MINOR;
|
tp->tty_minor = s - (NR_CONS+NR_RS_LINES) + TTYPX_MINOR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*===========================================================================*
|
/*===========================================================================*
|
||||||
@ -1621,7 +1625,7 @@ int enable; /* set timer if true, otherwise unset */
|
|||||||
if ((s=getuptime(&now)) != OK)
|
if ((s=getuptime(&now)) != OK)
|
||||||
panic("TTY","Couldn't get uptime from clock.", s);
|
panic("TTY","Couldn't get uptime from clock.", s);
|
||||||
if (enable) {
|
if (enable) {
|
||||||
exp_time = now + tty_ptr->tty_termios.c_cc[VTIME] * (HZ/10);
|
exp_time = now + tty_ptr->tty_termios.c_cc[VTIME] * (system_hz/10);
|
||||||
/* Set a new timer for enabling the TTY events flags. */
|
/* Set a new timer for enabling the TTY events flags. */
|
||||||
tmrs_settimer(&tty_timers, &tty_ptr->tty_tmr,
|
tmrs_settimer(&tty_timers, &tty_ptr->tty_tmr,
|
||||||
exp_time, tty_timed_out, NULL);
|
exp_time, tty_timed_out, NULL);
|
||||||
|
@ -107,6 +107,7 @@ typedef struct tty {
|
|||||||
extern tty_t tty_table[NR_CONS+NR_RS_LINES+NR_PTYS];
|
extern tty_t tty_table[NR_CONS+NR_RS_LINES+NR_PTYS];
|
||||||
extern int ccurrent; /* currently visible console */
|
extern int ccurrent; /* currently visible console */
|
||||||
extern int irq_hook_id; /* hook id for keyboard irq */
|
extern int irq_hook_id; /* hook id for keyboard irq */
|
||||||
|
extern u32_t system_hz; /* system clock frequency */
|
||||||
|
|
||||||
extern unsigned long kbd_irq_set;
|
extern unsigned long kbd_irq_set;
|
||||||
extern unsigned long rs_irq_set;
|
extern unsigned long rs_irq_set;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user