Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

speaker.c File Reference

System speaker driver. More...

#include <const.h>
#include <arch/i386.h>
#include <kernel/clock.h>
#include <kernel/speaker.h>

Go to the source code of this file.

Functions

void sound (uint32_t frequency)
 Start a sound using the speaker.
Parameters:
frequency  The frequency of the sound.


void nosound ()
 Turn off the speaker.

void beep ()
 Play a system beep.


Detailed Description

System speaker driver.

Author:
Andrea Righi <drizzt@inwind.it>
Date:
Last update: 2003-11-02
Note:
Copyright (©) 2003 Andrea Righi

Definition in file speaker.c.


Function Documentation

void beep  
 

Play a system beep.

Definition at line 51 of file speaker.c.

00052 {
00053         sound(SYSTEM_BEEP_FREQ);
00054         delay(SYSTEM_BEEP_TIME);
00055         nosound();
00056 }

void nosound  
 

Turn off the speaker.

Definition at line 38 of file speaker.c.

00039 {
00040         dword IF;
00041 
00042         IF = GET_IF();
00043         SET_IF(0);
00044 
00045         outportb(0x61, inportb(0x61) & 0xFC);
00046 
00047         SET_IF(IF);
00048 }

void sound uint32_t    frequency
 

Start a sound using the speaker.

Parameters:
frequency  The frequency of the sound.

Definition at line 18 of file speaker.c.

00019 {
00020         dword x, IF;
00021 
00022         if ((frequency<19) || (frequency>22000)) return;
00023 
00024         x = TIMER_FREQ / frequency;
00025 
00026         IF = GET_IF();
00027         SET_IF(0);
00028 
00029         outportb(0x61, inportb(0x61) | 3);
00030         outportb(0x43, 0xB6);
00031         outportb(0x42, x & 0xFF);
00032         outportb(0x42, x >> 8);
00033 
00034         SET_IF(IF);
00035 }


Generated on Fri Feb 20 15:32:20 2004 for Minirighi by doxygen1.2.18