CS318 - Pintos
Pintos source browser for JHU CS318 course
Macros | Functions
speaker.c File Reference
#include "devices/speaker.h"
#include "devices/pit.h"
#include "threads/io.h"
#include "threads/interrupt.h"
#include "devices/timer.h"
Include dependency graph for speaker.c:

Go to the source code of this file.

Macros

#define SPEAKER_PORT_GATE   0x61
 Speaker port enable I/O register. More...
 
#define SPEAKER_GATE_ENABLE   0x03
 Speaker port enable bits. More...
 

Functions

void speaker_on (int frequency)
 Sets the PC speaker to emit a tone at the given FREQUENCY, in Hz. More...
 
void speaker_off (void)
 Turn off the PC speaker, by disconnecting the timer channel's output from the speaker. More...
 
void speaker_beep (void)
 Briefly beep the PC speaker. More...
 

Macro Definition Documentation

◆ SPEAKER_GATE_ENABLE

#define SPEAKER_GATE_ENABLE   0x03

Speaker port enable bits.

Definition at line 11 of file speaker.c.

◆ SPEAKER_PORT_GATE

#define SPEAKER_PORT_GATE   0x61

Speaker port enable I/O register.

Definition at line 8 of file speaker.c.

Function Documentation

◆ speaker_beep()

void speaker_beep ( void  )

Briefly beep the PC speaker.

devices/speaker.h

Definition at line 48 of file speaker.c.

References intr_get_level(), INTR_ON, speaker_off(), speaker_on(), and timer_msleep().

Referenced by vga_putc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ speaker_off()

void speaker_off ( void  )

Turn off the PC speaker, by disconnecting the timer channel's output from the speaker.

Definition at line 39 of file speaker.c.

References inb(), intr_disable(), intr_set_level(), outb(), SPEAKER_GATE_ENABLE, and SPEAKER_PORT_GATE.

Referenced by speaker_beep(), and speaker_on().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ speaker_on()

void speaker_on ( int  frequency)

Sets the PC speaker to emit a tone at the given FREQUENCY, in Hz.

Definition at line 16 of file speaker.c.

References inb(), intr_disable(), intr_set_level(), outb(), pit_configure_channel(), SPEAKER_GATE_ENABLE, speaker_off(), and SPEAKER_PORT_GATE.

Referenced by speaker_beep().

Here is the call graph for this function:
Here is the caller graph for this function: