2 * This file is part of the coreboot project.
4 * Copyright (C) 2009 Libra Li <libra.li@technexion.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #include "southbridge/amd/sb600/sb600.h"
30 #include <device/pci.h>
31 #include <device/pci_ids.h>
32 #include <../southbridge/amd/sb600/sb600.h>
35 #endif /* __PRE_RAM__ */
39 void speaker_init(uint8_t time) {
41 * Options_0 - RW - 8 bits - [PM_Reg: 60h].
42 * SpkrEn, bit[5]=1b, Setting this bit will configure GPIO2 to be speaker output.
45 pmio_write(0x60, (pmio_read(0x60) | (1<<5)));
47 pm_iowrite(0x60, (pm_ioread(0x60) | (1<<5)));
48 #endif /* __PRE_RAM__ */
51 * Tmr1CntrlWord - RW - 8 bits - [IO_Reg: 43h].
52 * ModeSelect, bit[3:1]=011b, Square wave output.
53 * CmmandSelect, bit[5:4]=11b, Read/write least, and then most significant byte.
54 * CounterSelect, bit[7:6]=10b, Select counter 2.
60 * TimerCh2- RW - 8 bits - [IO_Reg: 42h].
65 void speaker_on_nodelay(void) {
67 * Nmi_Status - RW - 8 bits - [IO_Reg: 61h].
68 * SpkrEnable, bit[0]=1b, Enable counter 2
69 * SpkrTmrEnable, bit[1]=1b, Speaker timer on
71 outb(inb(0x61) | 0x03, 0x61);
74 void speaker_on_delay(void) {
79 void speaker_off_nodelay(void) {
81 * Nmi_Status - RW - 8 bits - [IO_Reg: 61h].
82 * SpkrEnable, bit[0]=0b, Disable counter 2
83 * SpkrTmrEnable, bit[1]=0b, Speaker timer off
85 outb(inb(0x61) & ~0x03, 0x61);
88 void speaker_off_delay(void) {
89 speaker_off_nodelay();