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

📄 song_drv.lst

📁 基于uCOS/II制作的MP3
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   SONG_DRV                                                              06/03/2006 10:32:53 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE SONG_DRV
OBJECT MODULE PLACED IN song_drv.obj
COMPILER INVOKED BY: C:\Program Files\keil\C51\BIN\C51.EXE modules\song\song_drv.c LARGE BROWSE DEBUG OBJECTEXTEND PRINT
                    -(.\song_drv.lst) OBJECT(song_drv.obj)

line level    source

   1          /*C**************************************************************************
   2          * NAME:         song_drv.c
   3          *----------------------------------------------------------------------------
   4          * Copyright (c) 2003 Atmel.
   5          *----------------------------------------------------------------------------
   6          * RELEASE:      snd1c-refd-nf-4_0_3      
   7          * REVISION:     1.20     
   8          *----------------------------------------------------------------------------
   9          * PURPOSE:
  10          * This file contains the song driver routines
  11          *****************************************************************************/
  12          
  13          /*_____ I N C L U D E S ____________________________________________________*/
  14          
  15          #include "config.h"                         /* system configuration */
  16          #include "lib_mcu\aud\aud_drv.h"                    /* dac driver definition */
  17          #include "lib_mcu\mp3\mp3_drv.h"            /* mp3 driver definition */
  18          #include "modules\file\file.h"              /* file definition */
  19          #include "lib_mcu\clock\clock.h"            /* clock definition */
  20          #include "song_drv.h"                       /* song driver definition */
  21          
  22          
  23          /*_____ M A C R O S ________________________________________________________*/
  24          
  25          
  26          /*_____ D E F I N I T I O N ________________________________________________*/
  27          
  28                  Byte    song_sound;                 /* save the selected sound */
  29                  Byte    mp3_volume;
  30          xdata   Uint16  song_frame_size;            /* Frame size value for one second  */
  31          idata   Byte    sound_volume;               /* save actual sound level          */
  32          
  33          /*_____ D E C L A R A T I O N ______________________________________________*/
  34          
  35          static  void    song_audio_init (void);
  36          
  37          code Uint16 song_tab_frame_size_00 [2][16] =
  38              {/* 44.1 KHz MPEG1 */
  39                {0, 104, 130, 156, 182, 208, 261, 313, 365, 417, 522, 626, 731, 835, 1044, 0},
  40               /* 22.05 KHz MPEG2 */
  41                {0,  26, 52, 78, 104, 130, 156, 182, 208,  261,  313, 365, 417, 470, 522, 0}
  42              };
  43          
  44          code Uint16 song_tab_frame_size_01 [2][16] =
  45              {
  46              /* 48 Khz MPEG1 */
  47                {0, 96, 120, 144, 168, 192, 240, 288, 336, 384, 480, 576, 672, 768, 960, 0},
  48              /* 24 Khz MPEG2 */
  49                {0,  24, 48, 72, 96, 120, 144, 168, 192, 240, 288, 336, 384, 432, 480, 0}
  50              };
  51          
  52          code Uint16 song_tab_frame_size_10 [2][16] =
  53          
  54              {/* 32 Khz MPEG1  */
C51 COMPILER V7.50   SONG_DRV                                                              06/03/2006 10:32:53 PAGE 2   

  55                {0, 144, 180, 216, 252, 288, 360, 432, 504, 576, 720, 864, 1008, 1152, 1440, 0},
  56               /* 16 Khz MPEG2  */
  57                {0,  36, 72, 108, 144, 180, 216, 252, 288, 360, 432, 504, 576, 648, 720, 0}
  58              };
  59              
  60          
  61          code Uint16 song_tab_seek [2][16]=
  62          {
  63            {0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 0},
  64            {0,  8, 16, 24, 32, 40, 48, 56,  64,  80,  96, 112, 128, 144, 160, 0}
  65            
  66          };
  67          
  68          
  69          /*F**************************************************************************
  70          * NAME: song_snd_init
  71          *----------------------------------------------------------------------------
  72          * PARAMS:
  73          *
  74          * return:
  75          *----------------------------------------------------------------------------
  76          * PURPOSE: 
  77          *   Sound control initialization
  78          *----------------------------------------------------------------------------
  79          * EXAMPLE:
  80          *----------------------------------------------------------------------------
  81          * NOTE:
  82          *   Initializes the sound controls to their medium value
  83          *----------------------------------------------------------------------------
  84          * REQUIREMENTS:
  85          *****************************************************************************/
  86          void song_snd_init (void)
  87          {
  88   1        MP3BAS = BASS_MED;
  89   1        MP3MED = MEDIUM_MED;
  90   1        MP3TRE = TREBLE_MED;
  91   1        MP3VOL = VOLUME_MED;
  92   1        MP3VOR = VOLUME_MED;
  93   1        mp3_volume = VOLUME_MED;
  94   1        song_sound = SND_VOLUME;          /* volume control selected by default */
  95   1      }
  96          
  97          
  98          
  99          /*F**************************************************************************
 100          * NAME: song_snd_inc
 101          *----------------------------------------------------------------------------
 102          * PARAMS:
 103          *
 104          * return:
 105          *----------------------------------------------------------------------------
 106          * PURPOSE:
 107          *   Increment the selected sound control
 108          *----------------------------------------------------------------------------
 109          * EXAMPLE:
 110          *----------------------------------------------------------------------------
 111          * NOTE:
 112          *   The number of the current selected sound control is stored in the
 113          *   variable snd_select (0.Volume; 1.Bass; 2.Medium; 3. Trebble)
 114          *----------------------------------------------------------------------------
 115          * REQUIREMENTS:
 116          *****************************************************************************/
C51 COMPILER V7.50   SONG_DRV                                                              06/03/2006 10:32:53 PAGE 3   

 117          void song_snd_inc (void)
 118          {
 119   1        switch (song_sound)
 120   1        {
 121   2          case SND_VOLUME:
 122   2          if (mp3_volume != VOLUME_MAX)
 123   2          { 
 124   3              mp3_volume++;
 125   3              MP3VOL++;
 126   3              MP3VOR++;
 127   3             /* if ((MP3CON&MSK_MPBBST) && (MP3VOL > VOLUME_MED || MP3VOR > VOLUME_MED)) 
 128   3                            Mp3_clr_bass_boost(); /* should be less than -15dB */
 129   3      
 130   3            }
 131   2            break;
 132   2      
 133   2          case SND_BASS:
 134   2          {
 135   3            if (MP3BAS != BASS_MAX)
 136   3              MP3BAS++;
 137   3            break;
 138   3          }
 139   2      
 140   2          case SND_MEDIUM:
 141   2          {
 142   3            if (MP3MED != MEDIUM_MAX)
 143   3              MP3MED++;
 144   3            break;
 145   3          }
 146   2      
 147   2          case SND_TREBLE:
 148   2          {
 149   3            if (MP3TRE != TREBLE_MAX)
 150   3              MP3TRE++;
 151   3            break;
 152   3          }
 153   2      
 154   2          case SND_BBOOST:
 155   2          if(MP3VOL > VOLUME_MED || MP3VOR > VOLUME_MED) /* should be less than -15dB */
 156   2      //      dac_set_vol(VOLUME_MED);
 157   2          Mp3_set_bass_boost();
 158   2          break;
 159   2        }
 160   1      }
 161          
 162          
 163          /*F**************************************************************************
 164          * NAME: song_snd_dec
 165          *----------------------------------------------------------------------------
 166          * PARAMS:
 167          *
 168          * return:
 169          *----------------------------------------------------------------------------
 170          * PURPOSE:
 171          *   Decrement the selected sound control
 172          *----------------------------------------------------------------------------
 173          * EXAMPLE:
 174          *----------------------------------------------------------------------------
 175          * NOTE:
 176          *   The number of the current selected sound control is stored in the
 177          *   variable snd_select (0.Volume; 1.Bass; 2.Medium; 3. Trebble)
 178          *----------------------------------------------------------------------------
C51 COMPILER V7.50   SONG_DRV                                                              06/03/2006 10:32:53 PAGE 4   

 179          * REQUIREMENTS:
 180          *****************************************************************************/
 181          void song_snd_dec (void)
 182          {
 183   1        switch (song_sound)
 184   1        {
 185   2          case SND_VOLUME:
 186   2          if (mp3_volume != VOLUME_MIN) //dac_set_vol(--mp3_volume);
 187   2            mp3_volume--;
 188   2            MP3VOL--;
 189   2            MP3VOR--;  
 190   2            break;
 191   2      
 192   2          case SND_BASS:
 193   2          {
 194   3            if (MP3BAS != BASS_MIN)
 195   3              MP3BAS--;
 196   3            break;
 197   3          }
 198   2      
 199   2          case SND_MEDIUM:
 200   2          {
 201   3            if (MP3MED != MEDIUM_MIN)
 202   3              MP3MED--;
 203   3            break;
 204   3          }
 205   2      
 206   2          case SND_TREBLE:
 207   2          {
 208   3            if (MP3TRE != TREBLE_MIN)
 209   3              MP3TRE--;
 210   3            break;
 211   3          }
 212   2      
 213   2          case SND_BBOOST:
 214   2          Mp3_clr_bass_boost();
 215   2          break;
 216   2        }
 217   1      }
 218          
 219          
 220          /*F**************************************************************************
 221          * NAME: song_snd_select
 222          *----------------------------------------------------------------------------
 223          * PARAMS:
 224          *
 225          * return:
 226          *----------------------------------------------------------------------------
 227          * PURPOSE:
 228          *   Select next sound control
 229          *----------------------------------------------------------------------------
 230          * EXAMPLE:
 231          *----------------------------------------------------------------------------
 232          * NOTE:
 233          *----------------------------------------------------------------------------
 234          * REQUIREMENTS:
 235          *****************************************************************************/
 236          void song_snd_select (void)
 237          {
 238   1        song_sound = (song_sound + 1) % NB_SOUND;
 239   1      }
 240          
C51 COMPILER V7.50   SONG_DRV                                                              06/03/2006 10:32:53 PAGE 5   

 241          
 242          /*F**************************************************************************
 243          * NAME: song_get_sound
 244          *----------------------------------------------------------------------------
 245          * PARAMS:
 246          *
 247          * return:
 248          *   sound selected: SND_VOLUME, SND_BASS, SND_MEDIUM, SND_TREBLE
 249          *----------------------------------------------------------------------------
 250          * PURPOSE: 
 251          *   Returns selected sound control
 252          *----------------------------------------------------------------------------
 253          * EXAMPLE:
 254          *----------------------------------------------------------------------------
 255          * NOTE:
 256          *----------------------------------------------------------------------------
 257          * REQUIREMENTS:
 258          *****************************************************************************/
 259          Byte song_get_sound (void)
 260          {
 261   1        return (song_sound);
 262   1      }
 263          
 264          
 265          /*F**************************************************************************
 266          * NAME: song_get_level
 267          *----------------------------------------------------------------------------
 268          * PARAMS:
 269          *
 270          * return:
 271          *   level of sound selected
 272          *----------------------------------------------------------------------------
 273          * PURPOSE:
 274          *   Returns selected sound level
 275          *----------------------------------------------------------------------------
 276          * EXAMPLE:
 277          *----------------------------------------------------------------------------
 278          * NOTE:
 279          *----------------------------------------------------------------------------
 280          * REQUIREMENTS:
 281          *****************************************************************************/
 282          Byte song_get_level (void)
 283          {
 284   1        switch (song_sound)
 285   1        {
 286   2          case SND_VOLUME: return mp3_volume;
 287   2          case SND_BASS:   return MP3BAS;
 288   2          case SND_MEDIUM: return MP3MED;
 289   2          case SND_TREBLE: return MP3TRE;
 290   2          case SND_BBOOST: return (MP3CON&MSK_MPBBST)?1:0;
 291   2        }
 292   1      return 0;
 293   1      }
 294          
 295          

⌨️ 快捷键说明

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