MS2 程序分析 Lldwsw 一:下载MS2.RAR 压缩包解压缩后可以看到如下界面: 第一项为MS2 软件包

源代码在线查看: message.lst

软件大小: 177 K
上传用户: zl357159
关键词: MS2 Lldwsw MS
下载地址: 免注册下载 普通下载 VIP

相关代码

				C51 COMPILER V7.10   MESSAGE                                                               03/04/2008 11:51:09 PAGE 1   
				
				
				C51 COMPILER V7.10, COMPILATION OF MODULE MESSAGE
				OBJECT MODULE PLACED IN .\message.obj
				COMPILER INVOKED BY: C:\Program Files\Keil\C51\BIN\C51.EXE ..\SourceFile\message.c BROWSE DEBUG OBJECTEXTEND PRINT(.\mes
				                    -sage.lst) OBJECT(.\message.obj)
				
				line level    source
				
				   1          
				   2          /***************************************************************************************
				   3          ****************************************************************************************
				   4          * FILE          : message.c
				   5          * Description   : FIFO message queue
				   6          *                         
				   7          * Copyright (c) 2003~2007 by WANG SHAOWEI. All Rights Reserved.
				   8          * 
				   9          * History:
				  10          * Version               Name                    Date                    Description
				  11             1.0          Wang Shaowei    2003/07/16      Initial Version (MCU System)
				  12             2.0          Wang Shaowei    2005/06/01      MS2
				  13             3.0          Wang Shaowei    2007/03/11      MS3
				  14             
				  15          ****************************************************************************************
				  16          ****************************************************************************************/
				  17          
				  18          
				  19          #include "common.h"
				  20          
				  21          
				  22          
				  23          
				  24          
				  25          static U8 data u8MsgHead;               /*position that msg will be put in*/
				  26          static U8 data u8MsgTail;               /*position that msg will be get out*/
				  27          static U8 data u8MsgNum;                /*msg number*/
				  28          static U16 data u16MsgArray[MSG_ARRAY_SIZE];    /*msg queue*/
				  29          
				  30          
				  31          /*==================================================================
				  32          * Function      : msg_init
				  33          * Description   : init message
				  34          * Input Para    : void
				  35          * Output Para   : void
				  36          * Return Value: void
				  37          ==================================================================*/
				  38          void msg_init(void)
				  39          {
				  40   1              u8MsgHead = 0;
				  41   1              u8MsgTail = 0;
				  42   1              u8MsgNum = 0;
				  43   1      }
				  44          
				  45          
				  46          /*==================================================================
				  47          * Function      : msg_put_in
				  48          * Description   : Put in a U16 data in msg queue.
				  49                                    Because there is no return value to indicate success or fail, 
				  50                                    make sure msg queue is large enough, that is MSG_ARRAY_SIZE is big enough!!!
				  51                                    You can get a suitable MSG_ARRAY_SIZE with the debug message.
				  52          * Input Para    : U16 u16Val    : data to be put in
				  53          * Output Para   : void
				  54          * Return Value: void
				C51 COMPILER V7.10   MESSAGE                                                               03/04/2008 11:51:09 PAGE 2   
				
				  55          ==================================================================*/
				  56          void msg_put_in(U16 u16)        
				  57          {
				  58   1              U1 EA_MAP;
				  59   1      
				  60   1              if (u8MsgNum >= MSG_ARRAY_SIZE)
				  61   1              {
				  62   2                      //ERRprintf("msg_put_in: msg queue already full\n");
				  63   2                      return;
				  64   2              }
				  65   1              
				  66   1              EA_MAP = INTERRUPT_GET();
				  67   1              INTERRUPT_DISABLE();
				  68   1      
				  69   1              //first put in data, then increase u8MsgHead
				  70   1              u16MsgArray[ u8MsgHead] = u16;  
				  71   1              u8MsgHead++;
				  72   1              if (u8MsgHead >= MSG_ARRAY_SIZE)
				  73   1              {
				  74   2                      u8MsgHead = 0;
				  75   2              }       
				  76   1              u8MsgNum++;
				  77   1      
				  78   1              INTERRUPT_SET(EA_MAP);
				  79   1              return;
				  80   1      }
				  81          
				  82          
				  83          /*==================================================================
				  84          * Function      : msg_get_out
				  85          * Description   : get a U16 data out of the msg queue.
				  86                                    If the msg queue is empty, get MSG_NULL
				  87          * Input Para    : void
				  88          * Output Para   : U16 * pu16Val : pointer to hold data
				  89          * Return Value: void
				  90          ==================================================================*/
				  91          void msg_get_out(U16 *pU16)
				  92          {
				  93   1              U1 EA_MAP;
				  94   1      
				  95   1              if (u8MsgNum == 0)
				  96   1              {
				  97   2                      * pU16 = 0x0000;//MSG_NULL 				  98   2                      return;
				  99   2              }
				 100   1              
				 101   1              EA_MAP = INTERRUPT_GET();
				 102   1              INTERRUPT_DISABLE();
				 103   1      
				 104   1              //first get out data, then increase u8MsgTail
				 105   1              *pU16 = u16MsgArray[u8MsgTail];
				 106   1              u8MsgTail++;
				 107   1              if (u8MsgTail >= MSG_ARRAY_SIZE)
				 108   1              {
				 109   2                      u8MsgTail = 0;
				 110   2              }
				 111   1              u8MsgNum--;
				 112   1      
				 113   1              INTERRUPT_SET(EA_MAP);
				 114   1              return;
				 115   1      }
				 116          
				C51 COMPILER V7.10   MESSAGE                                                               03/04/2008 11:51:09 PAGE 3   
				
				 117          void msg_send_msg(U8 MsgType, U8 Val)
				 118          {
				 119   1              U1 EA_MAP;
				 120   1      
				 121   1              if (u8MsgNum >= MSG_ARRAY_SIZE)
				 122   1              {
				 123   2                      //ERRprintf("msg_put_in: msg queue already full\n");
				 124   2                      return;
				 125   2              }
				 126   1              
				 127   1              EA_MAP = INTERRUPT_GET();
				 128   1              INTERRUPT_DISABLE();
				 129   1      
				 130   1              //first put in data, then increase u8MsgHead
				 131   1              ((U8 *)(&(u16MsgArray[ u8MsgHead])))[0] = MsgType;      
				 132   1              ((U8 *)(&(u16MsgArray[ u8MsgHead])))[1] = Val;  
				 133   1              
				 134   1              u8MsgHead++;
				 135   1              if (u8MsgHead >= MSG_ARRAY_SIZE)
				 136   1              {
				 137   2                      u8MsgHead = 0;
				 138   2              }       
				 139   1              u8MsgNum++;
				 140   1      
				 141   1              INTERRUPT_SET(EA_MAP);
				 142   1              return;
				 143   1      }
				
				
				MODULE INFORMATION:   STATIC OVERLAYABLE
				   CODE SIZE        =    153    ----
				   CONSTANT SIZE    =   ----    ----
				   XDATA SIZE       =   ----    ----
				   PDATA SIZE       =   ----    ----
				   DATA SIZE        =     11    ----
				   IDATA SIZE       =   ----    ----
				   BIT SIZE         =   ----       3
				END OF MODULE INFORMATION.
				
				
				C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)
							

相关资源