📄 voice_drv.lst
字号:
C51 COMPILER V6.20c VOICE_DRV 07/10/2002 15:17:38 PAGE 1
C51 COMPILER V6.20c, COMPILATION OF MODULE VOICE_DRV
OBJECT MODULE PLACED IN ..\obj\voice_drv.obj
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE ..\src\voice\voice_drv.c BROWSE INCDIR(..\src\system;..\..\..\lib) DEFINE(K
-EIL) DEBUG OBJECTEXTEND PRINT(.\voice_drv.lst) OBJECT(..\obj\voice_drv.obj)
stmt level source
1 /*C**************************************************************************
2 * $RCSfile: voice_drv.c,v $
3 *----------------------------------------------------------------------------
4 * Copyright (c) 2002 Atmel.
5 *----------------------------------------------------------------------------
6 * RELEASE: $Name: DEMO_FAT_1_2_5 $
7 * REVISION: $Revision: 1.3 $
8 * FILE_CVSID: $Id: voice_drv.c,v 1.3 2002/06/06 15:31:24 ffosse Exp $
9 *----------------------------------------------------------------------------
10 * PURPOSE:
11 * This file contains the voice driver routines Timer 1 is used as conversion
12 * time base, its frequency is defined in config.h
13 *
14 * NOTES:
15 * Global Variables:
16 * - gl_buffer: array of bytes in pdata space
17 * - gl_pointer: byte in data space
18 *****************************************************************************/
19
20 /*_____ I N C L U D E S ____________________________________________________*/
21
22 #include "config.h" /* system configuration */
23 #include "..\..\..\..\lib_demob\board.h" /* board definition */
24 #include "..\..\..\..\lib_demob\dac\dac_drv.h"/* dac driver definition */
25 #include "..\clock\clock.h" /* clock definition */
26 #include "voice_drv.h" /* voice driver definition */
27
28
29 /*_____ M A C R O S ________________________________________________________*/
30
31
32 /*_____ D E F I N I T I O N ________________________________________________*/
33
34 extern pdata Byte gl_buffer[];
35 extern data Byte gl_pointer;
36
37 Byte voc_volume; /* volume value */
38
39
40 /*_____ D E C L A R A T I O N ______________________________________________*/
41
42 static void voc_audio_init (void);
43
44
45 /*F**************************************************************************
46 * NAME: voc_rec_init
47 *----------------------------------------------------------------------------
48 * PARAMS:
49 *
50 * return:
51 *----------------------------------------------------------------------------
52 * PURPOSE:
53 * Initialize the timer and ADC
54 *----------------------------------------------------------------------------
C51 COMPILER V6.20c VOICE_DRV 07/10/2002 15:17:38 PAGE 2
55 * EXAMPLE:
56 *----------------------------------------------------------------------------
57 * NOTE:
58 * T1_PRIO defined in config.h
59 *----------------------------------------------------------------------------
60 * REQUIREMENTS:
61 *****************************************************************************/
62 void voc_rec_init (void)
63 {
64 1 gl_pointer = 0x00;
65 1 Adc_set_clock(AD_CLOCK);
66 1 Adc_enable();
67 1 T1_init(T1_NOT_GATED, T1_TIMER, T1_MODE_2); /* 8-bit auto-reload */
68 1 TH1 = T1_BASE; /* load timer */
69 1 t1_set_prio(T1_PRIO); /* set-up priority */
70 1 T1_enable_int(); /* enable interrupt */
71 1 T1_start();
72 1 }
73
74
75 /*F**************************************************************************
76 * NAME: voc_play_init
77 *----------------------------------------------------------------------------
78 * PARAMS:
79 *
80 * return:
81 *----------------------------------------------------------------------------
82 * PURPOSE:
83 * Audio interface initialization
84 *----------------------------------------------------------------------------
85 * EXAMPLE:
86 *----------------------------------------------------------------------------
87 * NOTE:
88 *----------------------------------------------------------------------------
89 * REQUIREMENTS:
90 *****************************************************************************/
91 void voc_play_init (void)
92 {
93 1 gl_pointer = 0x00;
94 1 voc_audio_init(); /* init audio interface */
95 1 clock_voice_init(); /* program the voice clocks */
96 1 }
97
98
99 /*L**************************************************************************
100 * NAME: voc_audio_init
101 *----------------------------------------------------------------------------
102 * PARAMS:
103 *
104 * return:
105 *----------------------------------------------------------------------------
106 * PURPOSE:
107 * Audio interface initialization in voice mode
108 *----------------------------------------------------------------------------
109 * EXAMPLE:
110 *----------------------------------------------------------------------------
111 * NOTE:
112 * DAC_NB_BIT and AUD_PRIO defined in config.h
113 *----------------------------------------------------------------------------
114 * REQUIREMENTS:
115 *****************************************************************************/
116 void voc_audio_init (void)
C51 COMPILER V6.20c VOICE_DRV 07/10/2002 15:17:38 PAGE 3
117 {
118 1 Aud_set_pcm_32(DAC_NB_BIT);
119 1 Aud_set_voice(MSK_DUP0);
120 1 aud_set_prio(AUD_PRIO);
121 1 Aud_enable();
122 1 Dac_unmute();
123 1 }
124
125
126 /*F**************************************************************************
127 * NAME: voc_play_start
128 *----------------------------------------------------------------------------
129 * PARAMS:
130 *
131 * return:
132 *----------------------------------------------------------------------------
133 * PURPOSE:
134 * Fill audio buffer and start sample request
135 *----------------------------------------------------------------------------
136 * EXAMPLE:
137 *----------------------------------------------------------------------------
138 * NOTE:
139 * 0x80 offset is added for unsigned to signed samples conversion
140 *----------------------------------------------------------------------------
141 * REQUIREMENTS:
142 *****************************************************************************/
143 void voc_play_start (void)
144 {
145 1 Byte i;
146 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -