Project

General

Profile

speaker.c

Bruno Silva, 05/12/2011 19:04

Download (478 Bytes)

 
1
#include <minix/syslib.h>
2
#include <minix/drivers.h>
3

    
4
int speaker_ctrl(unsigned char on) {
5
        char val= inportb(SPEAKER_CTRL);
6
        if (on==0)
7
        {
8
                outportb(SPEAKER_CTRL, val | SPEAKER_ENABLE );
9
        }
10
        else
11
                outportb(SPEAKER_CTRL, val & ~SPEAKER_ENABLE );
12
        return 0;
13
        }
14

    
15
int speaker_timer_ctrl(unsigned char on) {
16
        char val= inportb(SPEAKER_CTRL);
17
        if (on==0)
18
        {
19
                outportb(SPEAKER_CTRL, val | TIMER2_ENABLE );
20
        }
21
        else
22
                outportb(SPEAKER_CTRL, val & ~TIMER2_ENABLE );
23
        return 0;
24
        }
25
}
26