?? voice_drv.lst
字號:
C51 COMPILER V7.00 VOICE_DRV 04/28/2004 09:31:56 PAGE 1
C51 COMPILER V7.00, COMPILATION OF MODULE VOICE_DRV
OBJECT MODULE PLACED IN C:\Documents and Settings\lvxc\桌面\AA\voice_drv.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE modules\voice\voice_drv.c OPTIMIZE(7,SPEED) BROWSE INCDIR(.\modules\system;
-.\;.\;.\lib_refd) DEFINE(KEIL) DEBUG OBJECTEXTEND PRINT(.\voice_drv.lst) OBJECT(C:\Documents and Settings\lvxc\桌面\AA\v
-oice_drv.obj)
stmt level source
1 /*C**************************************************************************
2 * NAME: voice_drv.c
3 *----------------------------------------------------------------------------
4 * Copyright (c) 2003 Atmel.
5 *----------------------------------------------------------------------------
6 * RELEASE: snd1c-refd-nf-4_0_3
7 * REVISION: 1.9
8 *----------------------------------------------------------------------------
9 * PURPOSE:
10 * This file contains the voice driver routines Timer 1 is used as conversion
11 * time base, its frequency is defined in config.h
12 *
13 * NOTES:
14 * Global Variables:
15 * - voice_buffer: array of bytes in xdata space
16 * - gl_pointer: byte in data space
17 *****************************************************************************/
18
19 /*_____ I N C L U D E S ____________________________________________________*/
20
21 #include "config.h" /* system configuration */
22 #include "board.h" /* board definition */
23 #include "dac\dac_drv.h" /* dac driver definition */
24 #include "lib_mcu\clock\clock.h" /* clock definition */
25 #include "voice_drv.h" /* voice driver definition */
26
27
28 /*_____ M A C R O S ________________________________________________________*/
29
30
31 /*_____ D E F I N I T I O N ________________________________________________*/
32
33 extern xdata Byte voice_buffer[];
34 extern data Byte gl_pointer;
35
36 Byte voc_volume; /* volume value */
37
38
39 /*_____ D E C L A R A T I O N ______________________________________________*/
40
41 static void voc_audio_init (void);
42
43
44 /*F**************************************************************************
45 * NAME: voc_rec_init
46 *----------------------------------------------------------------------------
47 * PARAMS:
48 *
49 * return:
50 *----------------------------------------------------------------------------
51 * PURPOSE:
52 * Initialize the timer and ADC
53 *----------------------------------------------------------------------------
C51 COMPILER V7.00 VOICE_DRV 04/28/2004 09:31:56 PAGE 2
54 * EXAMPLE:
55 *----------------------------------------------------------------------------
56 * NOTE:
57 * T1_PRIO defined in config.h
58 *----------------------------------------------------------------------------
59 * REQUIREMENTS:
60 *****************************************************************************/
61 void voc_rec_init (void)
62 {
63 1 gl_pointer = 0x00;
64 1 Adc_set_clock(AD_CLOCK);
65 1 Adc_enable();
66 1 Adc_select_channel(VOICE_CHANNEL); /* select voice channel */
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 *****************************************************************************/
C51 COMPILER V7.00 VOICE_DRV 04/28/2004 09:31:56 PAGE 3
116 void voc_audio_init (void)
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
147 1 for (i = 8; i != 0; i--)
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -