annotate target-utils/buzplayer/melplay.c @ 522:26bb2c069427

loadtools/scripts: added experimental support for gtm900 target
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 06 Jun 2019 06:56:32 +0000
parents 8a200d65c6a0
children 158dd05fb9f9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
81
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include "types.h"
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include "melody.h"
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 extern struct melentry *melody_buf_start, *melody_buf_tailptr;
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #define ARMIO_LOAD_TIM (*(volatile u16 *) 0xFFFE4808)
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #define BUZZ_LIGHT_REG (*(volatile u16 *) 0xFFFE480E)
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 void
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 melody_play()
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 {
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 struct melentry *p;
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 int count;
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 wait_for_tdma_frame();
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 for (p = melody_buf_start; p < melody_buf_tailptr; p++) {
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 if (p->tone) {
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 ARMIO_LOAD_TIM = p->tone;
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 BUZZ_LIGHT_REG = 1;
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 } else
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 BUZZ_LIGHT_REG = 0;
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 for (count = p->dur; count; count--)
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 wait_for_tdma_frame();
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 BUZZ_LIGHT_REG = 0;
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 }
8a200d65c6a0 buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 }