SayoriOS  0.3.3
beeper.c
См. документацию.
1 
10 #include <io/ports.h>
11 #include <drv/beeper.h>
12 #include <sys/timer.h>
13 
14 uint32_t config = 0;
15 
21 void beeperPlay(uint32_t frequency) {
22  uint32_t Div;
23  uint8_t tmp;
24 
25  Div = getFrequency() * 1000;
26  Div /= frequency;
27 
28  outb(0x43, 0xb6);
29  outb(0x42, (uint8_t) (Div) );
30  outb(0x42, (uint8_t) (Div >> 8));
31 
32  tmp = inb(0x61);
33 
34  if (tmp != (tmp | 3)) {
35  outb(0x61, tmp | 3);
36  }
37 }
38 
42 void beeperSilent() {
43  uint8_t tmp = inb(0x61) & 0xFC;
44  outb(0x61, tmp);
45 }
void beeperSilent()
[Beeper] Выключить звук
Definition: beeper.c:42
uint32_t config
Корректировка
Definition: beeper.c:14
void beeperPlay(uint32_t frequency)
Вопроизвести звук (квадратной формы волны)
Definition: beeper.c:21
size_t getFrequency()
Получить частоту таймера
Definition: timer.c:43