Applied SF patch #694889.
This commit is contained in:
parent
9915fca4e9
commit
6708807b38
@ -82,6 +82,7 @@ OBJS_THAT_CAN_BE_PLUGINS = \
|
||||
vga.o \
|
||||
biosdev.o \
|
||||
cmos.o \
|
||||
console.o \
|
||||
harddrv.o \
|
||||
dma.o \
|
||||
unmapped.o \
|
||||
@ -240,6 +241,7 @@ cmos.o: cmos.@CPP_SUFFIX@ ../bochs.h ../config.h ../osdep.h ../bx_debug/debug.h
|
||||
../iodev/unmapped.h ../iodev/eth.h ../iodev/ne2k.h \
|
||||
../iodev/guest2host.h ../iodev/slowdown_timer.h ../iodev/extfpuirq.h \
|
||||
../iodev/gameport.h ../instrument/stubs/instrument.h
|
||||
console.o: console.@CPP_SUFFIX@ console.h
|
||||
crc32.o: crc32.@CPP_SUFFIX@ crc32.h ../bochs.h ../config.h ../osdep.h \
|
||||
../bx_debug/debug.h ../bxversion.h ../gui/siminterface.h ../state_file.h \
|
||||
../cpu/cpu.h ../cpu/lazy_flags.h ../cpu/i387.h ../memory/memory.h \
|
||||
|
49
bochs/iodev/console.cc
Normal file
49
bochs/iodev/console.cc
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
Copyright 2003 by David N. Welton <davidw@dedasys.com>.
|
||||
|
||||
This code may be distributed under the same terms as bochs.
|
||||
*/
|
||||
|
||||
#include "bochs.h"
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <linux/kd.h>
|
||||
|
||||
bx_console_c::bx_console_c() {
|
||||
this->put("CONSOLE");
|
||||
access = 0;
|
||||
consolefd = open("/dev/console", O_WRONLY);
|
||||
if (consolefd != -1) {
|
||||
access = 1;
|
||||
this->info("Opened /dev/console");
|
||||
} else {
|
||||
this->info("Failed to open /dev/console: %s", strerror(errno));
|
||||
}
|
||||
}
|
||||
|
||||
bx_console_c::~bx_console_c() {
|
||||
if (access) {
|
||||
ioctl(consolefd, KIOCSOUND, 0);
|
||||
close(consolefd);
|
||||
}
|
||||
}
|
||||
|
||||
void bx_console_c::beep_on(float frequency)
|
||||
{
|
||||
if (access) {
|
||||
this->info("pc speaker on with frequency %f", frequency);
|
||||
ioctl(consolefd, KIOCSOUND, (int)(clock_tick_rate/frequency));
|
||||
}
|
||||
}
|
||||
|
||||
void bx_console_c::beep_off()
|
||||
{
|
||||
if (access) {
|
||||
ioctl(consolefd, KIOCSOUND, 0);
|
||||
}
|
||||
}
|
23
bochs/iodev/console.h
Normal file
23
bochs/iodev/console.h
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
Copyright David N. Welton <davidw@dedasys.com> 2003
|
||||
|
||||
This code may be distributed under the same terms as bochs.
|
||||
*/
|
||||
|
||||
/* This file defines a class to deal with the console that started
|
||||
* bochs as an output device. Currently used only to beep the system
|
||||
* speaker. */
|
||||
|
||||
|
||||
class bx_console_c : public logfunctions {
|
||||
public:
|
||||
bx_console_c();
|
||||
~bx_console_c();
|
||||
void beep_on(float frequency);
|
||||
void beep_off();
|
||||
private:
|
||||
/* Do we have access? If not, just skip everything else. */
|
||||
int access;
|
||||
unsigned int consolefd;
|
||||
const static unsigned int clock_tick_rate = 1193180;
|
||||
};
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pit.cc,v 1.15 2003-07-31 12:04:48 vruppert Exp $
|
||||
// $Id: pit.cc,v 1.16 2004-01-16 16:30:46 danielg4 Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -173,6 +173,7 @@ bx_pit_c::init( void )
|
||||
DEV_register_iowrite_handler(this, write_handler, 0x0043, "8254 PIT", 1);
|
||||
DEV_register_iowrite_handler(this, write_handler, 0x0061, "8254 PIT", 1);
|
||||
|
||||
BX_PIT_THIS console = new bx_console_c;
|
||||
BX_PIT_THIS s.speaker_data_on = 0;
|
||||
BX_PIT_THIS s.refresh_clock_div2 = 0;
|
||||
|
||||
@ -417,6 +418,10 @@ BX_INFO(("timer 0-2 mode control: comm:%02x mode:%02x bcd_mode:%u",
|
||||
|
||||
case 0x61:
|
||||
BX_PIT_THIS s.speaker_data_on = (value >> 1) & 0x01;
|
||||
if ( BX_PIT_THIS s.speaker_data_on )
|
||||
BX_PIT_THIS console->beep_on(440.0);
|
||||
else
|
||||
BX_PIT_THIS console->beep_off();
|
||||
/*??? only on AT+ */
|
||||
set_GATE(2, value & 0x01);
|
||||
#if BX_CPU_LEVEL < 2
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pit.h,v 1.10 2002-10-25 11:44:40 bdenney Exp $
|
||||
// $Id: pit.h,v 1.11 2004-01-16 16:30:46 danielg4 Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -73,7 +73,7 @@ public:
|
||||
|
||||
BX_PIT_SMF int SaveState( class state_file *fd );
|
||||
BX_PIT_SMF int LoadState( class state_file *fd );
|
||||
|
||||
bx_console_c *console;
|
||||
private:
|
||||
|
||||
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pit82c54.cc,v 1.23 2003-06-29 17:24:52 vruppert Exp $
|
||||
// $Id: pit82c54.cc,v 1.24 2004-01-16 16:30:46 danielg4 Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/*
|
||||
@ -891,3 +891,7 @@ Bit32u pit_82C54::get_next_event_time(void) {
|
||||
out=time2;
|
||||
return out;
|
||||
}
|
||||
|
||||
Bit16u pit_82C54::get_inlatch(int counternum) {
|
||||
return counter[counternum].inlatch;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pit82c54.h,v 1.12 2003-03-02 23:59:11 cbothamy Exp $
|
||||
// $Id: pit82c54.h,v 1.13 2004-01-16 16:30:46 danielg4 Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
/*
|
||||
@ -126,6 +126,7 @@ public:
|
||||
|
||||
Bit32u get_clock_event_time(Bit8u cnum);
|
||||
Bit32u get_next_event_time(void);
|
||||
Bit16u get_inlatch(int countnum);
|
||||
|
||||
void print_cnum(Bit8u cnum);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pit_wrap.cc,v 1.52 2003-08-19 00:10:38 cbothamy Exp $
|
||||
// $Id: pit_wrap.cc,v 1.53 2004-01-16 16:30:46 danielg4 Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2002 MandrakeSoft S.A.
|
||||
@ -117,6 +117,7 @@ bx_pit_c::init( void )
|
||||
|
||||
BX_DEBUG(("pit: starting init"));
|
||||
|
||||
BX_PIT_THIS console = new bx_console_c;
|
||||
BX_PIT_THIS s.speaker_data_on = 0;
|
||||
BX_PIT_THIS s.refresh_clock_div2 = 0;
|
||||
|
||||
@ -313,6 +314,11 @@ bx_pit_c::write( Bit32u address, Bit32u dvalue,
|
||||
|
||||
case 0x61:
|
||||
BX_PIT_THIS s.speaker_data_on = (value >> 1) & 0x01;
|
||||
if ( BX_PIT_THIS s.speaker_data_on ) {
|
||||
BX_PIT_THIS console->beep_on(1193180.0 / this->get_timer(2));
|
||||
} else {
|
||||
BX_PIT_THIS console->beep_off();
|
||||
}
|
||||
/*??? only on AT+ */
|
||||
BX_PIT_THIS s.timer.set_GATE(2, value & 0x01);
|
||||
#if BX_CPU_LEVEL < 2
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// $Id: pit_wrap.h,v 1.17 2003-08-19 00:10:38 cbothamy Exp $
|
||||
// $Id: pit_wrap.h,v 1.18 2004-01-16 16:30:46 danielg4 Exp $
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2001 MandrakeSoft S.A.
|
||||
@ -32,6 +32,7 @@
|
||||
#if BX_USE_NEW_PIT
|
||||
|
||||
#include "pit82c54.h"
|
||||
#include "console.h"
|
||||
|
||||
#if BX_USE_PIT_SMF
|
||||
# define BX_PIT_SMF static
|
||||
@ -55,7 +56,10 @@ public:
|
||||
|
||||
BX_PIT_SMF int SaveState( class state_file *fd );
|
||||
BX_PIT_SMF int LoadState( class state_file *fd );
|
||||
|
||||
bx_console_c *console;
|
||||
Bit16u get_timer(int Timer) {
|
||||
return s.timer.get_inlatch(Timer);
|
||||
}
|
||||
private:
|
||||
|
||||
static Bit32u read_handler(void *this_ptr, Bit32u address, unsigned io_len);
|
||||
|
Loading…
x
Reference in New Issue
Block a user