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

📄 libchain.lst

📁 威望公司MP3 + USB MCU 的参考软件
💻 LST
📖 第 1 页 / 共 4 页
字号:
C51 COMPILER V8.01   LIBCHAIN                                                              04/17/2008 09:45:56 PAGE 1   


C51 COMPILER V8.01, COMPILATION OF MODULE LIBCHAIN
OBJECT MODULE PLACED IN .\Debug\libchain.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE file\libchain.c LARGE OPTIMIZE(9,SIZE) NOINTPROMOTE INCDIR(.\common;.\e2pro
                    -m;.\file;.\fmtx;.\ir;.\keyboard;.\lcm;.\led;.\main;.\matrixkey;.\mp3ctrl;.\sd;.\usbhost;.\include;.\lib) DEBUG OBJECTEXT
                    -END PRINT(.\Debug\libchain.lst) OBJECT(.\Debug\libchain.obj)

line level    source

   1          /****************************************************************
   2          *                      Viaon Technology (Suzhou) Co.,Ltd
   3          *
   4          *    Copyright 2007, Viaon Technology (Suzhou) Co.,Ltd,Suzhou,China
   5          *                    All rights reserved.
   6          *
   7          *
   8          * Filename:             libchain.c
   9          *
  10          * Programmer:           Greg 
  11          *
  12          * Created:              1/2/2008
  13          *
  14          * Description:          public functions 
  15          *              
  16          *        
  17          * Change History (most recent first):   2008.1.2
  18          ****************************************************************/
  19          /*
  20          *******************************************************************************
  21          *        #include
  22          *******************************************************************************
  23          */
  24          //#include <string.h>
  25          
  26          #include "utiltypedef.h"
  27          #include "common.h"
  28          
  29          #include "libfat.h"
  30          #include "libdrive.h"
  31          #include "libchain.h"
  32          
  33          extern BYTE DBUF[512];
  34          
  35          /*
  36          *******************************************************************************
  37          *        #define CONSTANT
  38          *******************************************************************************
  39          */
  40          
  41          /*
  42          *******************************************************************************
  43          *        #define MACROS
  44          *******************************************************************************
  45          */
  46          
  47          /* none */
  48          
  49          /*
  50          *******************************************************************************
  51          *        LOCAL DATA TYPES
  52          *******************************************************************************
  53          */
C51 COMPILER V8.01   LIBCHAIN                                                              04/17/2008 09:45:56 PAGE 2   

  54          
  55          /* none */
  56          
  57          /*
  58          *******************************************************************************
  59          *        LOCAL VARIABLE
  60          *******************************************************************************
  61          */
  62          
  63          
  64          /*
  65          *******************************************************************************
  66          *        LOCAL FUNCTION PROTOTYPES
  67          *******************************************************************************
  68          */
  69          
  70          
  71          /*
  72          *******************************************************************************
  73          *        GLOBAL FUNCTIONS
  74          *******************************************************************************
  75          */
  76          // initialize a chain structure
  77          // if start = 0 mean in the root area of FAT12/FAT16
  78          void ChainInit(DRIVE *drv, CHAIN *chain, DWORD start, DWORD Size)
  79                  {
  80   1              drv =drv;
  81   1      
  82   1          chain->Start = start;
  83   1          chain->Current = start;
  84   1          chain->Point = 0;
  85   1          chain->Size = Size;
  86   1              }
  87          
  88          /////////////////utility/////////////////////////////////
  89          /*void *memcpy(void* a, const void* b, DWORD c)
  90          {
  91              while(c)
  92              {
  93                  *(BYTE*)a = *(BYTE*)b;
  94                  c--;
  95                  a++;
  96                  b++;
  97              }
  98              return a+=c;
  99          }*/
 100          
 101          #if 0
              WORD LoadUnalign16(void *in)
                      {
                      BYTE_STRC out;
                      
                      out.Byte0 = ((BYTE *)in)[0];
                      out.Byte1 = ((BYTE *)in)[1];
                      
                      return *((WORD *)(&out));
                      }
                      
              
              
              DWORD LoadUnalign32(void *in)
                      {
C51 COMPILER V8.01   LIBCHAIN                                                              04/17/2008 09:45:56 PAGE 3   

                      BYTE_STRC out;
                      
                      out.Byte0 = ((BYTE *)in)[0];
                      out.Byte1 = ((BYTE *)in)[1];
                      out.Byte2 = ((BYTE *)in)[2];
                      out.Byte3 = ((BYTE *)in)[3];
                      
                      return *((DWORD *)(&out));
                      }
              #endif  
 126          
 127          
 128          WORD LoadAlien16(void *in)              // the alien mean big-endian and maybe un-alignned
 129                  {
 130   1              WORD out;
 131   1      #if 1
 132   1              out = ((BYTE_STRC *)in)->Byte1;
 133   1              out = out << 8;
 134   1              out += ((BYTE_STRC *)in)->Byte0;
 135   1      #else
                      BYTE * data bPtr_in = (BYTE *)in;
                      BYTE data * data bPtr_out = (BYTE data *)(&out);        
              
                      #if BIG_ENDIAN
                              bPtr_out[0] = bPtr_in[1];
                              bPtr_out[1] = bPtr_in[0];       
                      #else //LITTLE_ENDIAN
                              bPtr_out[0] = bPtr_in[0];
                              bPtr_out[1] = bPtr_in[1];       
                      #endif
              #endif
 147   1      
 148   1              return out;
 149   1              }
 150          
 151          
 152          
 153          //DWORD LoadAlien32(void *in)           // the alien mean big-endian and maybe un-alignned
 154          void LoadAlien32(void *in, void *out)   // the alien mean big-endian and maybe un-alignned
 155                  {
 156   1              //DWORD data out;
 157   1      #if 0
                      out = ((BYTE_STRC *)in)->Byte3;
                      out = out << 8;
                      out += ((BYTE_STRC *)in)->Byte2;
                      out = out << 8;
                      out += ((BYTE_STRC *)in)->Byte1;
                      out = out << 8;
                      out += ((BYTE_STRC *)in)->Byte0;
              #else
 166   1              BYTE * data bPtr_in = (BYTE *)in;
 167   1              BYTE * data bPtr_out = (BYTE *)out;     
 168   1      
 169   1      #if BIG_ENDIAN
 170   1              bPtr_out[0] = bPtr_in[3];
 171   1              bPtr_out[1] = bPtr_in[2]; 
 172   1              bPtr_out[2] = bPtr_in[1];
 173   1              bPtr_out[3] = bPtr_in[0]; 
 174   1      #else //LITTLE_ENDIAN
                      bPtr_out[0] = bPtr_in[0];
                      bPtr_out[1] = bPtr_in[1]; 
                      bPtr_out[2] = bPtr_in[2];
C51 COMPILER V8.01   LIBCHAIN                                                              04/17/2008 09:45:56 PAGE 4   

                      bPtr_out[3] = bPtr_in[3]; 
              #endif
 180   1      #endif
 181   1              return;
 182   1              }
 183          
 184          
 185          #if 0
              void SaveAlien16(void *addr, WORD data1)
                      {
                      ((BYTE_STRC *)addr)->Byte0 = data1;
                      data1 = data1 >> 8;
                      ((BYTE_STRC *)addr)->Byte1 = data1;
                      }
              
              
              
              void SaveAlien32(void *addr, DWORD data1)
                      {
                      ((BYTE_STRC *)addr)->Byte0 = data1;
                      data1 = data1 >> 8;
                      ((BYTE_STRC *)addr)->Byte1 = data1;
                      data1 = data1 >> 8;
                      ((BYTE_STRC *)addr)->Byte2 = data1;
                      data1 = data1 >> 8;
                      ((BYTE_STRC *)addr)->Byte3 = data1;
                      }
              #endif
 206                          
 207          #ifdef LONG_NAME_MODE           
              // input the address of the little-endian 16-bits value array for source
              // input the address of the WORD array address for target and a length in bytes
              // return the rear address the target address after copying
              #if 0
              WORD *LoadAlienArray16(WORD *target, void *source, BYTE length)
                      {
                      register BYTE *point;
                      register WORD unicode;
              
                      point = (BYTE *)source;
                      point ++;                               // point to the MSB of the first value of source
              
                      while(length)
                              {
                              unicode = *point;       // load the MSB
                              point --;                       // move the LSB
                              unicode <<= 8;          // shift target temp to high byte
                              unicode += *point;      // load the LSB to low byte of target temp
                              point += 3;                     // move the the MSB of next half word
                              *target = unicode;      // save the target
                              target ++;                      
                              length -= 2;
                              }
              
                      return target;                  // return the rear address of array
                      }
              #else
              BYTE *LoadAlienArray16(BYTE *target, void *source, BYTE length)
              {
                      register BYTE *point;
                      register BYTE unicode;
              //      WORD wTmp;
C51 COMPILER V8.01   LIBCHAIN                                                              04/17/2008 09:45:56 PAGE 5   

              
                      point = (BYTE *)source;
                      point ++;                               // point to the MSB of the first value of source
              
                      while(length){
                              unicode = *point;       // load the MSB
                              point --;                       // move the LSB
              
                              if((*((WORD *)point) == 0XFFFF) || (*((WORD *)point) == 0X0000)){
                                      break;
                              }else if(unicode == 0){
                                      unicode = *point;       // load the LSB to low byte of target temp      
                              }else{
                                      unicode = '-'; //This unicode is not ASCII CODE
                              }
                              

⌨️ 快捷键说明

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