Remove obsolete PC-Speaker sound driver.
This commit is contained in:
parent
8975c75c61
commit
9bb2ea78ac
|
@ -121,7 +121,6 @@ scheduler.o \
|
||||||
segment.o \
|
segment.o \
|
||||||
serialterminal.o \
|
serialterminal.o \
|
||||||
signal.o \
|
signal.o \
|
||||||
sound.o \
|
|
||||||
string.o \
|
string.o \
|
||||||
symbol.o \
|
symbol.o \
|
||||||
syscall.o \
|
syscall.o \
|
||||||
|
|
|
@ -39,8 +39,6 @@
|
||||||
|
|
||||||
#include "x86-family/idt.h"
|
#include "x86-family/idt.h"
|
||||||
|
|
||||||
#include "sound.h" // Hack for SIGSEGV
|
|
||||||
|
|
||||||
namespace Sortix {
|
namespace Sortix {
|
||||||
|
|
||||||
namespace Interrupt {
|
namespace Interrupt {
|
||||||
|
@ -266,8 +264,6 @@ void CrashHandler(CPU::InterruptRegisters* regs)
|
||||||
Log::PrintF("%s exception at ip=0x%zx (cr2=0x%p, err_code=0x%p)\n",
|
Log::PrintF("%s exception at ip=0x%zx (cr2=0x%p, err_code=0x%p)\n",
|
||||||
message, ip, regs->cr2, regs->err_code);
|
message, ip, regs->cr2, regs->err_code);
|
||||||
|
|
||||||
Sound::Mute();
|
|
||||||
|
|
||||||
// Exit the process with the right error code.
|
// Exit the process with the right error code.
|
||||||
// TODO: Sent a SIGINT, SIGBUS, or whatever instead.
|
// TODO: Sent a SIGINT, SIGBUS, or whatever instead.
|
||||||
CurrentProcess()->Exit(139);
|
CurrentProcess()->Exit(139);
|
||||||
|
|
|
@ -81,7 +81,6 @@
|
||||||
#include "initrd.h"
|
#include "initrd.h"
|
||||||
#include "vga.h"
|
#include "vga.h"
|
||||||
#include "bga.h"
|
#include "bga.h"
|
||||||
#include "sound.h"
|
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include "pipe.h"
|
#include "pipe.h"
|
||||||
#include "poll.h"
|
#include "poll.h"
|
||||||
|
@ -530,9 +529,6 @@ static void BootThread(void* /*user*/)
|
||||||
// Initialize the VGA driver.
|
// Initialize the VGA driver.
|
||||||
VGA::Init("/dev", slashdev);
|
VGA::Init("/dev", slashdev);
|
||||||
|
|
||||||
// Initialize the sound driver.
|
|
||||||
Sound::Init();
|
|
||||||
|
|
||||||
// Initialize the identity system calls.
|
// Initialize the identity system calls.
|
||||||
Identity::Init();
|
Identity::Init();
|
||||||
|
|
||||||
|
|
|
@ -1,75 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
|
|
||||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
|
||||||
|
|
||||||
This file is part of Sortix.
|
|
||||||
|
|
||||||
Sortix is free software: you can redistribute it and/or modify it under the
|
|
||||||
terms of the GNU General Public License as published by the Free Software
|
|
||||||
Foundation, either version 3 of the License, or (at your option) any later
|
|
||||||
version.
|
|
||||||
|
|
||||||
Sortix is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with
|
|
||||||
Sortix. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
sound.cpp
|
|
||||||
Implements a simple sound system.
|
|
||||||
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#include <sortix/kernel/platform.h>
|
|
||||||
#include <sortix/kernel/kthread.h>
|
|
||||||
#include <sortix/kernel/syscall.h>
|
|
||||||
#include <sortix/kernel/cpu.h>
|
|
||||||
|
|
||||||
#include "sound.h"
|
|
||||||
|
|
||||||
namespace Sortix
|
|
||||||
{
|
|
||||||
namespace Sound
|
|
||||||
{
|
|
||||||
kthread_mutex_t soundlock;
|
|
||||||
|
|
||||||
void Mute()
|
|
||||||
{
|
|
||||||
ScopedLock lock(&soundlock);
|
|
||||||
uint8_t TMP = (CPU::InPortB(0x61)) & 0xFC;
|
|
||||||
|
|
||||||
CPU::OutPortB(0x61, TMP);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Play(unsigned Frequency)
|
|
||||||
{
|
|
||||||
ScopedLock lock(&soundlock);
|
|
||||||
//Set the PIT to the desired frequency
|
|
||||||
uint32_t Div = 1193180 / Frequency;
|
|
||||||
CPU::OutPortB(0x43, 0xB6);
|
|
||||||
CPU::OutPortB(0x42, (uint8_t) (Div) );
|
|
||||||
CPU::OutPortB(0x42, (uint8_t) (Div >> 8));
|
|
||||||
|
|
||||||
// And play the sound using the PC speaker
|
|
||||||
uint8_t TMP = CPU::InPortB(0x61);
|
|
||||||
|
|
||||||
if ( TMP != (TMP | 3) )
|
|
||||||
{
|
|
||||||
CPU::OutPortB(0x61, TMP | 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SysSetFrequency(unsigned frequency)
|
|
||||||
{
|
|
||||||
if ( frequency == 0 ) { Mute(); } else { Play(frequency); }
|
|
||||||
}
|
|
||||||
|
|
||||||
void Init()
|
|
||||||
{
|
|
||||||
soundlock = KTHREAD_MUTEX_INITIALIZER;
|
|
||||||
Syscall::Register(SYSCALL_SET_FREQUENCY, (void*) SysSetFrequency);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
|
|
||||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
|
||||||
|
|
||||||
This file is part of Sortix.
|
|
||||||
|
|
||||||
Sortix is free software: you can redistribute it and/or modify it under the
|
|
||||||
terms of the GNU General Public License as published by the Free Software
|
|
||||||
Foundation, either version 3 of the License, or (at your option) any later
|
|
||||||
version.
|
|
||||||
|
|
||||||
Sortix is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
|
||||||
details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with
|
|
||||||
Sortix. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
sound.h
|
|
||||||
Implements a simple sound system.
|
|
||||||
|
|
||||||
*******************************************************************************/
|
|
||||||
|
|
||||||
#ifndef SORTIX_SOUND_H
|
|
||||||
#define SORTIX_SOUND_H
|
|
||||||
|
|
||||||
namespace Sortix
|
|
||||||
{
|
|
||||||
namespace Sound
|
|
||||||
{
|
|
||||||
void Init();
|
|
||||||
void Mute();
|
|
||||||
void Play(unsigned Frequency);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -39,8 +39,6 @@
|
||||||
#include <sortix/kernel/time.h>
|
#include <sortix/kernel/time.h>
|
||||||
#include <sortix/kernel/scheduler.h>
|
#include <sortix/kernel/scheduler.h>
|
||||||
|
|
||||||
#include "sound.h"
|
|
||||||
|
|
||||||
#ifdef PLATFORM_SERIAL
|
#ifdef PLATFORM_SERIAL
|
||||||
#include "serialterminal.h"
|
#include "serialterminal.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue