FreeCalypso > hg > freecalypso-tools
annotate target-utils/buzplayer/melplay.c @ 733:bed7981ac8ca
doc/Compal-FFS: update for IMEI found in OTP cells
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 28 Aug 2020 15:58:46 +0000 |
parents | 8a200d65c6a0 |
children | 158dd05fb9f9 |
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 } |