FreeCalypso > hg > freecalypso-tools
annotate target-utils/buzplayer/melplay.c @ 1014:961efadd530a default tip
fc-shell TCH DL handler: add support for CSD modes
TCH DL capture mechanism in FC Tourmaline firmware has been extended
to support CSD modes in addition to speech - add the necessary support
on the host tools side.
It needs to be noted that this mechanism in its present state does NOT
provide the debug utility value that was sought: as we learned only
after the code was implemented, TI's DSP has a misfeature in that the
buffer we are reading (a_dd_0[]) is zeroed out when the IDS block
is enabled, i.e., we are reading all zeros and not the real DL bits
we were after. But since the code has already been written, we are
keeping it - perhaps we can do some tests with IDS disabled.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 26 Nov 2024 06:27:43 +0000 |
parents | 158dd05fb9f9 |
children |
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; |
824
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
5 extern int melody_mode; |
81
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #define ARMIO_LOAD_TIM (*(volatile u16 *) 0xFFFE4808) |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #define BUZZ_LIGHT_REG (*(volatile u16 *) 0xFFFE480E) |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 |
824
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
10 #define PWT_FRC_REG (*(volatile u8 *) 0xFFFE8800) |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
11 #define PWT_VCR_REG (*(volatile u8 *) 0xFFFE8801) |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
12 |
81
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 void |
824
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
14 melody_play_bu() |
81
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 { |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 struct melentry *p; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 int count; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 wait_for_tdma_frame(); |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 for (p = melody_buf_start; p < melody_buf_tailptr; p++) { |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 if (p->tone) { |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 ARMIO_LOAD_TIM = p->tone; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 BUZZ_LIGHT_REG = 1; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 } else |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 BUZZ_LIGHT_REG = 0; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 for (count = p->dur; count; count--) |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 wait_for_tdma_frame(); |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 BUZZ_LIGHT_REG = 0; |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 } |
8a200d65c6a0
buzplayer: play implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 } |
824
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
31 |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
32 void |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
33 melody_play_pwt() |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
34 { |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
35 struct melentry *p; |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
36 int count; |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
37 |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
38 wait_for_tdma_frame(); |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
39 for (p = melody_buf_start; p < melody_buf_tailptr; p++) { |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
40 PWT_FRC_REG = p->tone; |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
41 PWT_VCR_REG = p->vol; |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
42 for (count = p->dur; count; count--) |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
43 wait_for_tdma_frame(); |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
44 PWT_VCR_REG = 0; |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
45 } |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
46 } |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
47 |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
48 void |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
49 melody_play() |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
50 { |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
51 switch (melody_mode) { |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
52 case 1: |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
53 melody_play_bu(); |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
54 return; |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
55 case 2: |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
56 melody_play_pwt(); |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
57 return; |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
58 default: |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
59 printf("ERROR: no melody entered\n"); |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
60 } |
158dd05fb9f9
buzplayer: implement PWT mode melody play
Mychaela Falconia <falcon@freecalypso.org>
parents:
81
diff
changeset
|
61 } |