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

📄 ap_message2.lst

📁 5807收音机模块用于炬力平台
💻 LST
📖 第 1 页 / 共 4 页
字号:
##############################################################################
#                                                                            #
# IAR Z80/64180 C-Compiler V4.04B/WIN                                        #
# Front End V4.20N                                       23/Feb/109  09:16:20 #
# Global Optimizer V1.05D                                                    #
#                                                                            #
#       Target option =  Z80                                                 #
#       Memory model  =  banked                                              #
#       Source file   =  d:\case_i_d95f\ap\common\ap_message2.c              #
#       List file     =  d:\case_i_d95f\ap\ap_radio\list\ap_message2.lst     #
#       Object file   =  d:\case_i_d95f\ap\ap_radio\obj\ap_message2.r01      #
#       ASM file      =  d:\case_i_d95f\ap\ap_radio\list\ap_message2.s01     #
#       Command line  =  -v0 -mb -OD:\case_i_d95f\ap\ap_radio\Obj\ -e -K -w  #
#                        -gA -s9 -RCODE -r0 -DNAPDEBUG                       #
#                        -LD:\case_i_d95f\ap\ap_radio\List\ -q -t8           #
#                        -AD:\case_i_d95f\ap\ap_radio\List\                  #
#                        -Id:\sdk_i_95f\inc\ -Id:\case_i_d95f\inc\           #
#                        d:\case_i_d95f\ap\common\ap_message2.c              #
#                                                                            #
#                                             (c) Copyright IAR Systems 1996 #
##############################################################################

   \   0000                    NAME    ap_message2(17)
   \   0000                    RSEG    COM_MSG(0)
   \   0000                    RSEG    UDATA0(0)
   \   0000                    RSEG    IDATA0(0)
   \   0000                    RSEG    CDATA0(0)
   \   0000                    PUBLIC  EarProtectThreshold
   \   0000                    EXTERN  ap_get_message
   \   0000                    PUBLIC  ap_get_message_core
   \   0000                    EXTERN  ap_handle_hotkey
   \   0000                    PUBLIC  ap_handle_hotkey_core
   \   0000                    PUBLIC  ap_message_init
   \   0000                    PUBLIC  ap_sleep
   \   0000                    PUBLIC  g_EarProtect_flag
   \   0000                    PUBLIC  g_charge_counter
   \   0000                    EXTERN  g_comval
   \   0000                    PUBLIC  g_decrease_time
   \   0000                    PUBLIC  g_half_hour_counter
   \   0000                    PUBLIC  g_light_time
   \   0000                    PUBLIC  g_rtc_counter
   \   0000                    PUBLIC  g_sleep_time
   \   0000                    PUBLIC  g_standby_time
   \   0000                    EXTERN  sKY_Beep
   \   0000                    EXTERN  sKY_ChargeGetandSet
   \   0000                    EXTERN  sKY_CloseBacklight
   \   0000                    EXTERN  sKY_OpenBacklight
   \   0000                    EXTERN  ui_run_realtime
   \   0000                    EXTERN  ui_show_lock
   \   0000                    EXTERN  ?CLZ80B_4_04_L00
   \   0000                    EXTERN  ?S_MUL_L02
   \   0000                    EXTERN  ?C_V_SWITCH_L06
   \   0000                    EXTERN  ?BANK_CALL_DIRECT_L08
   \   0000                    EXTERN  ?BANK_FAST_LEAVE_L08
   \   0000                    RSEG    COM_MSG
   \   0000            ap_message_init:
      1          /*
      2          *******************************************************************************
      3          *                ACTOS AP
      4          *        ap common lib message file
      5          *
      6          *        (c) Copyright, Actions Co,Ld.
      7          *             All Right Reserved
      8          *
      9          *******************************************************************************
     10          */
     11          #pragma codeseg(COM_MSG)
     12          
     13          #include "ap_common.h"
     14          #define DEBUG
     15          
     16          #ifdef EAR_PROTECT
     17              #define     EarProctetTimeTick     60    //30 seconds
     18              byte g_decrease_time = 0;
     19              int g_half_hour_counter = 0;
     20              //int g_autoswitch_counter = 0;
     21              byte g_EarProtect_flag;
     22              byte EarProtectThreshold;
     23              //int g_autoswitch_time;
     24          #endif
     25          BYTE g_light_time=0;    //关背光时间,0.5秒为单位
     26          WORD g_sleep_time=0;    //睡眠时间,0.5秒为单位
     27          WORD g_standby_time=0;    //自动关机时间,0.5秒为单位
     28          WORD g_rtc_counter=0;    //rtc 消息计数
     29          BYTE g_charge_counter = 0; //检测充电状态的计数器,插上USB就开始检测第一次
     30          extern comval_t g_comval; 
     31          //WORD g_ap_event=0;    //事件标志
     32          /*
     33          char g_ap_message[4]={0, 0, 0, 0};    //ap 消息队列
     34          char g_ap_message_index=0;        //ap 消息队列的读写指针
     35          */
     36          
     37          /*
     38            * 对于普通按键的处理存在隐患,如果os把普通按键的值定义到0x20 以上,
     39            * ap_get_message() 将不能正确处理, 正确的做法是用9个case, 不用default
     40            */
     41          #if  Msg_KeyEQ > 0x20  || Msg_KeyMenu > 0x20 || \
     42              Msg_KeyNext > 0x20 || Msg_KeyLast > 0x20 || \
     43              Msg_KeyVolAdd > 0x20 || Msg_KeyVolSub > 0x20 || \
     44              Msg_KeyPlayPause > 0x20 || Msg_KeyREC > 0x20 || Msg_KeyLoop > 0x20
     45          
     46          #error os define key greater than 0x20
     47          #endif
     48          
     49          /*
     50          ********************************************************************************
     51          * Description : 初始化消息处理
     52          *
     53          * Arguments   : comval, 系统设定值, =null 表示只初始化内部计数器
     54          *
     55          * Returns     :
     56          *                           
     57          * Notes       :
     58          *
     59          ********************************************************************************
     60          */
     61          void ap_message_init(const comval_t *comval)
     62          {
   \   0000  C5                PUSH    BC
   \   0001  DDE5              PUSH    IX
   \   0003  D5                PUSH    DE
   \   0004  DDE1              POP     IX
     63          
     64              if(comval != NULL)
   \   0006  7B                LD      A,E
   \   0007  B2                OR      D
   \   0008  282B              JR      Z,?0005
   \   000A            ?0004:
     65              {
     66                  g_light_time = comval->LightTime * 2;
   \   000A  DD7E09            LD      A,(IX+9)
   \   000D  87                ADD     A,A
   \   000E  320300            LD      (g_light_time),A
     67          
     68                  g_sleep_time = comval->SleepTime * 60 * 2;
   \   0011  DD4E0B            LD      C,(IX+11)
   \   0014  0600              LD      B,0
   \   0016  113C00            LD      DE,60
   \   0019  CD0000            CALL    LWRD ?S_MUL_L02
   \   001C  EB                EX      DE,HL
   \   001D  29                ADD     HL,HL
   \   001E  220400            LD      (g_sleep_time),HL
     69          
     70                  g_standby_time = comval->StandbyTime * 2;
   \   0021  DD6E0A            LD      L,(IX+10)
   \   0024  60                LD      H,B
   \   0025  29                ADD     HL,HL
   \   0026  220600            LD      (g_standby_time),HL
     71                  #ifdef EAR_PROTECT
     72                  g_EarProtect_flag = comval->EarProtect_flag;
   \   0029  DD7E18            LD      A,(IX+24)
   \   002C  320000            LD      (g_EarProtect_flag),A
     73                  EarProtectThreshold = comval->EarProtectThreshold;
   \   002F  DD7E19            LD      A,(IX+25)
   \   0032  320100            LD      (EarProtectThreshold),A
   \   0035            ?0005:
     74                  //g_autoswitch_time = comval->auto_switchoff_time * 60 * 2;
     75                  #endif
     76              }
     77          
     78              g_rtc_counter = 0;
   \   0035  210000            LD      HL,0
   \   0038  220800            LD      (g_rtc_counter),HL
     79          }
   \   003B  DDE1              POP     IX
   \   003D  C1                POP     BC
   \   003E  C30000            JP      LWRD ?BANK_FAST_LEAVE_L08
   \   0041            ap_get_message_core:
     80          
     81          
     82          /*
     83          ********************************************************************************
     84          * Description : 处理系统消息, 返回按键消息, 同时负责开/关背光
     85          *
     86          * Arguments   : key, 系统消息
     87          *
     88          * Returns     : 返回ap能够识别的消息, 如果没有系统消息, 返回 AP_KEY_NULL
     89          *
     90          * Notes       :
     91          
     92          * 按键时序:
     93           *  0.....1.2....1.5........... (s)
     94           *  key    long   hold    up    (>1.2s)
     95           *  key  up            (<1.2s)
     96           *
     97           * key rate: 0.3s
     98          *
     99          ********************************************************************************
    100          */
    101          char ap_get_message_core(char key)
    102          {
   \   0041  C5                PUSH    BC
   \   0042  DDE5              PUSH    IX
   \   0044  DD210000          LD      IX,0
   \   0048  DD39              ADD     IX,SP
   \   004A  D5                PUSH    DE
   \   004B  F5                PUSH    AF
    103              static WORD key_count=0;        //当前按键消息发生的次数
    104              static char key_value=Msg_KeyNull;        //当前按键的值
    105              #ifdef EAR_PROTECT
    106                  char tempVolume;
    107                  bool counter_flag = FALSE;
    108                  
    109                  tempVolume = input8(0x99)&0x1f;
   \   004C  DB99              IN      A,(153)
   \   004E  E61F              AND     31
   \   0050  DD77FC            LD      (IX-4),A
    110                  if (tempVolume > EarProtectThreshold)
   \   0053  47                LD      B,A
   \   0054  3A0100            LD      A,(EarProtectThreshold)
   \   0057  B8                CP      B
   \   0058  3006              JR      NC,?0009
   \   005A            ?0008:
    111                  {              
    112                         counter_flag = TRUE;
   \   005A  DD36FD01          LD      (IX-3),1
    113                  }
    114                  else
   \   005E  1804              JR      ?0010
   \   0060            ?0009:
    115                  {
    116                      counter_flag = FALSE;
   \   0060  DD36FD00          LD      (IX-3),0
   \   0064            ?0010:
    117                  }
    118                      
    119                  if ( g_EarProtect_flag && (tempVolume > EarProtectThreshold) && (g_decrease_time == EarProctetTimeTick) )
   \   0064  3A0000            LD      A,(g_EarProtect_flag)
   \   0067  B7                OR      A
   \   0068  2824              JR      Z,?0012
   \   006A  3A0100            LD      A,(EarProtectThreshold)
   \   006D  B8                CP      B
   \   006E  301E              JR      NC,?0012
   \   0070  3A0000            LD      A,(g_decrease_time)
   \   0073  FE3C              CP      60
   \   0075  2017              JR      NZ,?0012
   \   0077            ?0014:
   \   0077            ?0013:
   \   0077            ?0011:
    120                  {
    121                      output8(0x99, input(0x99)&0xe0|(tempVolume-1));
   \   0077  019900            LD      BC,153
   \   007A  ED50              IN      D,(C)
   \   007C  7A                LD      A,D
   \   007D  E6E0              AND     224
   \   007F  F5                PUSH    AF
   \   0080  DD7EFC            LD      A,(IX-4)
   \   0083  C6FF              ADD     A,255
   \   0085  47                LD      B,A
   \   0086  F1                POP     AF
   \   0087  B0                OR      B
   \   0088  D399              OUT     (153),A
    122                      g_decrease_time = 0;
   \   008A  AF                XOR     A
   \   008B  320000            LD      (g_decrease_time),A
   \   008E            ?0012:
    123                  }
    124                  if ( g_EarProtect_flag && (g_half_hour_counter == 7200) )
   \   008E  3A0000            LD      A,(g_EarProtect_flag)
   \   0091  B7                OR      A
   \   0092  2828              JR      Z,?0016
   \   0094  21201C            LD      HL,7200
   \   0097  ED4B0100          LD      BC,(g_half_hour_counter)
   \   009B  ED42              SBC     HL,BC
   \   009D  201D              JR      NZ,?0016

⌨️ 快捷键说明

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