mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Thread secured the sound driver.
This commit is contained in:
parent
5f93e157d5
commit
69c23aed56
2 changed files with 8 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
/******************************************************************************
|
||||
|
||||
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011.
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of Sortix.
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
|||
******************************************************************************/
|
||||
|
||||
#include <sortix/kernel/platform.h>
|
||||
#include <sortix/kernel/kthread.h>
|
||||
#include "sound.h"
|
||||
#include "syscall.h"
|
||||
|
||||
|
@ -30,8 +31,11 @@ namespace Sortix
|
|||
{
|
||||
namespace Sound
|
||||
{
|
||||
kthread_mutex_t soundlock;
|
||||
|
||||
void Mute()
|
||||
{
|
||||
ScopedLock lock(&soundlock);
|
||||
uint8_t TMP = (CPU::InPortB(0x61)) & 0xFC;
|
||||
|
||||
CPU::OutPortB(0x61, TMP);
|
||||
|
@ -39,6 +43,7 @@ namespace Sortix
|
|||
|
||||
void Play(nat Frequency)
|
||||
{
|
||||
ScopedLock lock(&soundlock);
|
||||
//Set the PIT to the desired frequency
|
||||
uint32_t Div = 1193180 / Frequency;
|
||||
CPU::OutPortB(0x43, 0xB6);
|
||||
|
@ -61,6 +66,7 @@ namespace Sortix
|
|||
|
||||
void Init()
|
||||
{
|
||||
soundlock = KTHREAD_MUTEX_INITIALIZER;
|
||||
Syscall::Register(SYSCALL_SET_FREQUENCY, (void*) SysSetFrequency);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/******************************************************************************
|
||||
|
||||
COPYRIGHT(C) JONAS 'SORTIE' TERMANSEN 2011.
|
||||
Coypright(C) Jonas 'Sortie' Termansen 2011, 2012.
|
||||
|
||||
This file is part of Sortix.
|
||||
|
||||
|
|
Loading…
Reference in a new issue