coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
spkmodem.c File Reference
#include <arch/io.h>
#include <console/spkmodem.h>
Include dependency graph for spkmodem.c:

Go to the source code of this file.

Macros

#define SPEAKER_PIT_FREQUENCY   0x1234dd
 

Enumerations

enum  {
  PIT_COUNTER_0 = 0x40 , PIT_COUNTER_1 = 0x41 , PIT_COUNTER_2 = 0x42 , PIT_CTRL = 0x43 ,
  PIT_SPEAKER_PORT = 0x61
}
 
enum  { PIT_SPK_TMR2 = 0x01 , PIT_SPK_DATA = 0x02 , PIT_SPK_TMR2_LATCH = 0x20 }
 
enum  {
  PIT_CTRL_SELECT_MASK = 0xc0 , PIT_CTRL_SELECT_0 = 0x00 , PIT_CTRL_SELECT_1 = 0x40 , PIT_CTRL_SELECT_2 = 0x80 ,
  PIT_CTRL_READLOAD_MASK = 0x30 , PIT_CTRL_COUNTER_LATCH = 0x00 , PIT_CTRL_READLOAD_LSB = 0x10 , PIT_CTRL_READLOAD_MSB = 0x20 ,
  PIT_CTRL_READLOAD_WORD = 0x30 , PIT_CTRL_MODE_MASK = 0x0e , PIT_CTRL_INTR_ON_TERM = 0x00 , PIT_CTRL_PROGR_ONE_SHOT = 0x02 ,
  PIT_CTRL_RATE_GEN = 0x04 , PIT_CTRL_SQUAREWAVE_GEN = 0x06 , PIT_CTRL_SOFTSTROBE = 0x08 , PIT_CTRL_HARDSTROBE = 0x0a ,
  PIT_CTRL_COUNT_MASK = 0x01 , PIT_CTRL_COUNT_BINARY = 0x00 , PIT_CTRL_COUNT_BCD = 0x01
}
 

Functions

static void make_tone (uint16_t freq_count, unsigned int duration)
 
void spkmodem_tx_byte (unsigned char c)
 
void spkmodem_init (void)
 

Macro Definition Documentation

◆ SPEAKER_PIT_FREQUENCY

#define SPEAKER_PIT_FREQUENCY   0x1234dd

Definition at line 6 of file spkmodem.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PIT_COUNTER_0 
PIT_COUNTER_1 
PIT_COUNTER_2 
PIT_CTRL 
PIT_SPEAKER_PORT 

Definition at line 8 of file spkmodem.c.

◆ anonymous enum

anonymous enum
Enumerator
PIT_SPK_TMR2 
PIT_SPK_DATA 
PIT_SPK_TMR2_LATCH 

Definition at line 16 of file spkmodem.c.

◆ anonymous enum

anonymous enum
Enumerator
PIT_CTRL_SELECT_MASK 
PIT_CTRL_SELECT_0 
PIT_CTRL_SELECT_1 
PIT_CTRL_SELECT_2 
PIT_CTRL_READLOAD_MASK 
PIT_CTRL_COUNTER_LATCH 
PIT_CTRL_READLOAD_LSB 
PIT_CTRL_READLOAD_MSB 
PIT_CTRL_READLOAD_WORD 
PIT_CTRL_MODE_MASK 
PIT_CTRL_INTR_ON_TERM 
PIT_CTRL_PROGR_ONE_SHOT 
PIT_CTRL_RATE_GEN 
PIT_CTRL_SQUAREWAVE_GEN 
PIT_CTRL_SOFTSTROBE 
PIT_CTRL_HARDSTROBE 
PIT_CTRL_COUNT_MASK 
PIT_CTRL_COUNT_BINARY 
PIT_CTRL_COUNT_BCD 

Definition at line 22 of file spkmodem.c.

Function Documentation

◆ make_tone()

static void make_tone ( uint16_t  freq_count,
unsigned int  duration 
)
static

Definition at line 51 of file spkmodem.c.

References inb(), outb(), PIT_COUNTER_2, PIT_CTRL, PIT_CTRL_COUNT_BINARY, PIT_CTRL_READLOAD_WORD, PIT_CTRL_SELECT_2, PIT_CTRL_SQUAREWAVE_GEN, PIT_SPEAKER_PORT, PIT_SPK_DATA, and PIT_SPK_TMR2.

Referenced by spkmodem_tx_byte().

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

◆ spkmodem_init()

void spkmodem_init ( void  )

Definition at line 96 of file spkmodem.c.

References spkmodem_tx_byte().

Here is the call graph for this function:

◆ spkmodem_tx_byte()

void spkmodem_tx_byte ( unsigned char  c)

Definition at line 81 of file spkmodem.c.

References c, make_tone(), and SPEAKER_PIT_FREQUENCY.

Referenced by spkmodem_init().

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