2009-02-24 10:14:45 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2002
|
2011-08-04 16:45:45 +00:00
|
|
|
* Daniel Engström, Omicron Ceti AB, <daniel@omicron.se>
|
2009-02-24 10:14:45 +00:00
|
|
|
*
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2009-02-24 10:14:45 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/i8254.h>
|
|
|
|
|
|
|
|
#define TIMER2_VALUE 0x0a8e /* 440Hz */
|
|
|
|
|
2013-04-17 16:13:39 +00:00
|
|
|
int pcat_timer_init(void)
|
2009-02-24 10:14:45 +00:00
|
|
|
{
|
2013-04-17 16:13:39 +00:00
|
|
|
/*
|
|
|
|
* initialize 2, used to drive the speaker
|
2012-10-20 12:33:14 +00:00
|
|
|
* (to start a beep: write 3 to port 0x61,
|
2009-02-24 10:14:45 +00:00
|
|
|
* to stop it again: write 0)
|
|
|
|
*/
|
2011-11-08 02:33:15 +00:00
|
|
|
outb(PIT_CMD_CTR2 | PIT_CMD_BOTH | PIT_CMD_MODE3,
|
|
|
|
PIT_BASE + PIT_COMMAND);
|
|
|
|
outb(TIMER2_VALUE & 0xff, PIT_BASE + PIT_T2);
|
|
|
|
outb(TIMER2_VALUE >> 8, PIT_BASE + PIT_T2);
|
2009-02-24 10:14:45 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|