⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 voice_task.lst

📁 这是atmel公司的89C51SND1C的mp3源程序
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V6.20c  VOICE_TASK                                                            07/10/2002 15:17:43 PAGE 1   


C51 COMPILER V6.20c, COMPILATION OF MODULE VOICE_TASK
OBJECT MODULE PLACED IN ..\obj\voice_task.obj
COMPILER INVOKED BY: C:\KEIL\C51\BIN\C51.EXE ..\src\voice\voice_task.c BROWSE INCDIR(..\src\system;..\..\..\lib) DEFINE(
                    -KEIL) DEBUG OBJECTEXTEND PRINT(.\voice_task.lst) OBJECT(..\obj\voice_task.obj) 

stmt level    source

   1          /*C**************************************************************************
   2          * $RCSfile: voice_task.c,v $
   3          *----------------------------------------------------------------------------
   4          * Copyright (c) 2002 Atmel.
   5          *----------------------------------------------------------------------------
   6          * RELEASE:      $Name: DEMO_FAT_1_2_5 $      
   7          * REVISION:     $Revision: 1.7 $     
   8          * FILE_CVSID:   $Id: voice_task.c,v 1.7 2002/06/06 15:29:21 ffosse Exp $       
   9          *----------------------------------------------------------------------------
  10          * PURPOSE:
  11          * This file contains the voice task and attached routines
  12          *
  13          * NOTES:
  14          * Global Variables:
  15          *   - gl_key_press:   bit in bdata space
  16          *   - gl_key:         byte in idata space
  17          *   - gl_buffer:      array of bytes in pdata space
  18          *   - gl_pointer:     byte in data space
  19          *   - gl_wav_header:  wave structure in code
  20          *****************************************************************************/
  21          
  22          /*_____ I N C L U D E S ____________________________________________________*/
  23          
  24          #include "config.h"                         /* system configuration */
  25          #include "..\..\..\..\lib_demob\board.h"    /* board definition */
  26          #include "..\display\disp.h"                /* display definition */
  27          #include "..\file\file.h"                   /* file definition */
  28          #include "..\clock\clock.h"                 /* clock definition */
  29          #include "..\mode\mode_task.h"              /* mode task definition */
  30          #include "..\display\disp_task.h"           /* display definition */
  31          #include "..\mem\mem_task.h"                /* memory task definition */
  32          #include "voice_drv.h"                      /* voice definition */
  33          #include "voice_task.h"                     /* voice task definition */
  34          #include "..\file\wav.h"                    /* wav file definition */
  35          
  36          
  37          /*_____ M A C R O S ________________________________________________________*/
  38          
  39          
  40          /*_____ D E F I N I T I O N ________________________________________________*/
  41          
  42          extern  bdata   bit     gl_key_press;       /* TRUE when a key is decoded */
  43          extern  idata   Byte    gl_key;             /* value of the key pressed */
  44          extern  bdata   bit     gl_mem_failure;     /* memory hardware failure */
  45          extern  pdata   Byte    gl_buffer[];
  46          extern  data    Byte    gl_pointer;
  47          extern  code    wav_struct  gl_wav_header;
  48          
  49          static  idata   Byte    voice_state;        /* task state */
  50          
  51          
  52          
  53          /*_____ D E C L A R A T I O N ______________________________________________*/
  54          
C51 COMPILER V6.20c  VOICE_TASK                                                            07/10/2002 15:17:43 PAGE 2   

  55          
  56          /*F**************************************************************************
  57          * NAME: voice_task_init
  58          *----------------------------------------------------------------------------
  59          * PARAMS:
  60          *
  61          * return:
  62          *----------------------------------------------------------------------------
  63          * PURPOSE: 
  64          *   Voice task initialization
  65          *----------------------------------------------------------------------------
  66          * EXAMPLE:
  67          *----------------------------------------------------------------------------
  68          * NOTE:
  69          *----------------------------------------------------------------------------
  70          * REQUIREMENTS:
  71          *****************************************************************************/
  72          void voice_task_init (void)
  73          {
  74   1        voice_state = VOICE_START;
  75   1        Voc_init_volume();                            /* mid-range volume */
  76   1      }
  77          
  78          
  79          /*F**************************************************************************
  80          * NAME: voice_task
  81          *----------------------------------------------------------------------------
  82          * PARAMS:
  83          *
  84          * return:
  85          *----------------------------------------------------------------------------
  86          * PURPOSE: 
  87          *   Voice playing / recording task
  88          *----------------------------------------------------------------------------
  89          * EXAMPLE:
  90          *----------------------------------------------------------------------------
  91          * NOTE:
  92          *   STATES:
  93          *   VOICE_START      start task
  94          *   VOICE_INSTALL     voice installation
  95          *   VOICE_IDLE        idle state of this task
  96          *   VOICE_PLAY_INIT   initialisation of audio interface
  97          *   VOICE_PLAY        voice under playing
  98          *   VOICE_PLAY_PAUSE  voice playing halted
  99          *   VOICE_NEW         previous or next song handler
 100          *   VOICE_PLAY_STOP   stop playing
 101          *   VOICE_NO_MESSAGE  file system empty
 102          *   VOICE_REC_INIT    initialisation of A to D converter
 103          *   VOICE_RECORD      voice under recording
 104          *   VOICE_REC_PAUSE   voice recording halted
 105          *   VOICE_REC_STOP    stop recording
 106          *   VOICE_ERROR       error in playing or recording
 107          *----------------------------------------------------------------------------
 108          * REQUIREMENTS:
 109          *****************************************************************************/
 110          void voice_task (void)
 111          {
 112   1      Byte    i;
 113   1      static  Uint32  voc_cpt, voc_length;
 114   1      
 115   1        switch (voice_state)
 116   1        {
C51 COMPILER V6.20c  VOICE_TASK                                                            07/10/2002 15:17:43 PAGE 3   

 117   2          case VOICE_START:
 118   2          {
 119   3            print_mode_voice();                   /* select voice icon */
 120   3            print_state_blank();                  /* select blank icon */
 121   3            print_screen(VOICE_SCREEN);           /* display voice screen */
 122   3            print_voice_vol(Voc_get_volume());    /* display volume level */
 123   3            voice_state = VOICE_INSTALL;
 124   3            break;
 125   3          }
 126   2      
 127   2          case VOICE_INSTALL:
 128   2          {
 129   3            if (mem_status() != MEM_BUSY)         /* wait end of memory install */
 130   3            {
 131   4              if (mem_status() == MEM_READY)
 132   4              {
 133   5                if (File_entry_root(FILE_WAV) == OK)/* WAV file in root dir? */
 134   5                {
 135   6                  print_file_name();              /* display file name */
 136   6                  voice_state = VOICE_IDLE;
 137   6                }
 138   5                else
 139   5                { /* no *.voc file in root */
 140   6                  voice_state = VOICE_NO_MSG;
 141   6                }
 142   5              }
 143   4              else
 144   4              { /* disk not formated */
 145   5                print_state_error();              /* error icon when not formated */
 146   5                if (gl_key_press)                 /* a key is pressed? */
 147   5                {
 148   6                  switch (gl_key)
 149   6                  {
 150   7                    case KEY_MEM:
 151   7                      mem_select_next();          /* select next memory */
 152   7                      voice_state = VOICE_START;
 153   7                      break;
 154   7      
 155   7                    case KEY_MODE:
 156   7                      mode_set_init();            /* exit from song task */
 157   7                      voice_state = VOICE_START;
 158   7                      break;
 159   7        
 160   7                    case KEY_LOCK:
 161   7                      print_kbd_lock();           /* print keyboard status */
 162   7                      break;
 163   7                  }
 164   6                  gl_key_press = FALSE;           /* ack key usage */
 165   6                }
 166   5                else
 167   5                { /* check card presence */
 168   6                  if (mem_check_card() == KO)
 169   6                  {
 170   7                    mem_select_next();
 171   7                    voice_state = VOICE_START;    /* card has been unplugged */
 172   7                  }
 173   6                }
 174   5              }
 175   4            }
 176   3            break;
 177   3          }
 178   2      
C51 COMPILER V6.20c  VOICE_TASK                                                            07/10/2002 15:17:43 PAGE 4   

 179   2      
 180   2          case VOICE_IDLE:                        /* no file openned */
 181   2          {
 182   3            if (gl_key_press)                     /* a key is pressed? */
 183   3            {
 184   4              switch (gl_key)
 185   4              {
 186   5                case KEY_PLAY:
 187   5                  voice_state = VOICE_PLAY_INIT;
 188   5                  break;
 189   5      
 190   5                case KEY_NEXT:
 191   5                  file_seek_next(FILE_WAV, TRUE); /* select next message with loop */
 192   5                  print_file_name();              /* display file name */
 193   5                  break;
 194   5      
 195   5                case KEY_PREV:
 196   5                  file_seek_prev(FILE_WAV);       /* select previous message */
 197   5                  print_file_name();              /* display file name */
 198   5                  break;
 199   5      
 200   5                case KEY_REC:
 201   5                  voice_state = VOICE_REC_INIT;
 202   5                  break;
 203   5      
 204   5                case KEY_INC:
 205   5                  voc_inc_volume();               /* increment volume */
 206   5                  print_voice_vol(Voc_get_volume());  /* display new level */
 207   5                  break;
 208   5      
 209   5                case KEY_DEC:
 210   5                  voc_dec_volume();               /* decrement volume */
 211   5                  print_voice_vol(Voc_get_volume());  /* display new level */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -