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

📄 osal_pwrmgr.lst

📁 CC2431无线定位程序非常有参考价值
💻 LST
📖 第 1 页 / 共 2 页
字号:
     87          /*********************************************************************
     88           * @fn      osal_pwrmgr_device
     89           *
     90           * @brief   Sets the device power characteristic.
     91           *
     92           * @param   pwrmgr_device - type of power devices. With PWRMGR_ALWAYS_ON
     93           *          selection, there is no power savings and the device is most
     94           *          likely on mains power. The PWRMGR_BATTERY selection allows the
     95           *          HAL sleep manager to enter sleep.
     96           *
     97           * @return  none
     98           */

   \                                 In segment BANKED_CODE, align 1, keep-with-next
     99          void osal_pwrmgr_device( uint8 pwrmgr_device )
   \                     osal_pwrmgr_device:
    100          {
   \   000000   C082         PUSH    DPL
   \   000002   C083         PUSH    DPH
   \   000004                ; Saved register size: 2
   \   000004                ; Auto size: 0
    101            pwrmgr_attribute.pwrmgr_device = pwrmgr_device;
   \   000004   E9           MOV     A,R1
   \   000005   90....       MOV     DPTR,#(pwrmgr_attribute + 6)
   \   000008   80..         SJMP    ?Subroutine0
    102          }
    103          
    104          /*********************************************************************
    105           * @fn      osal_pwrmgr_task_state
    106           *
    107           * @brief   This function is called by each task to state whether or
    108           *          not this task wants to conserve power.
    109           *
    110           * @param   task_id - calling task ID.
    111           *          state - whether the calling task wants to
    112           *          conserve power or not.
    113           *
    114           * @return  ZSUCCESS if task complete
    115           */

   \                                 In segment BANKED_CODE, align 1, keep-with-next
    116          uint8 osal_pwrmgr_task_state( uint8 task_id, uint8 state )
   \                     osal_pwrmgr_task_state:
    117          {
   \   000000   74F6         MOV     A,#-0xa
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 10
   \   000005                ; Auto size: 0
   \   000005   E9           MOV     A,R1
   \   000006   FE           MOV     R6,A
   \   000007   EA           MOV     A,R2
   \   000008   FF           MOV     R7,A
    118            if ( osalFindTask( task_id ) == NULL )
   \   000009                ; Setup parameters for call to function osalFindTask
   \   000009   90....       MOV     DPTR,#(osalFindTask & 0xffff)
   \   00000C   74..         MOV     A,#((osalFindTask >> 16) & 0xff)
   \   00000E   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
   \   000011   EA           MOV     A,R2
   \   000012   7001         JNZ     ??osal_pwrmgr_task_state_0
   \   000014   EB           MOV     A,R3
   \                     ??osal_pwrmgr_task_state_0:
   \   000015   7004         JNZ     ??osal_pwrmgr_task_state_1
    119              return ( INVALID_TASK );
   \   000017   7901         MOV     R1,#0x1
   \   000019   8036         SJMP    ??osal_pwrmgr_task_state_2
    120          
    121            if ( state == PWRMGR_CONSERVE )
   \                     ??osal_pwrmgr_task_state_1:
   \   00001B   EF           MOV     A,R7
   \   00001C   75..01       MOV     ?V0 + 0,#0x1
   \   00001F   75..00       MOV     ?V0 + 1,#0x0
   \   000022   7019         JNZ     ??osal_pwrmgr_task_state_3
    122            {
    123              // Clear the task state flag
    124              pwrmgr_attribute.pwrmgr_task_state &= ~(1 << task_id );
   \   000024   EE           MOV     A,R6
   \   000025   78..         MOV     R0,#?V0 + 0
   \   000027   12....       LCALL   ?S_SHL
   \   00002A   E5..         MOV     A,?V0 + 0
   \   00002C   F4           CPL     A
   \   00002D   F8           MOV     R0,A
   \   00002E   E5..         MOV     A,?V0 + 1
   \   000030   F4           CPL     A
   \   000031   F9           MOV     R1,A
   \   000032   90....       MOV     DPTR,#pwrmgr_attribute
   \   000035   E0           MOVX    A,@DPTR
   \   000036   58           ANL     A,R0
   \   000037   F0           MOVX    @DPTR,A
   \   000038   A3           INC     DPTR
   \   000039   E0           MOVX    A,@DPTR
   \   00003A   59           ANL     A,R1
   \   00003B   8011         SJMP    ??osal_pwrmgr_task_state_4
    125            }
    126            else
    127            {
    128              // Set the task state flag
    129              pwrmgr_attribute.pwrmgr_task_state |= (1 << task_id);
   \                     ??osal_pwrmgr_task_state_3:
   \   00003D   EE           MOV     A,R6
   \   00003E   78..         MOV     R0,#?V0 + 0
   \   000040   12....       LCALL   ?S_SHL
   \   000043   90....       MOV     DPTR,#pwrmgr_attribute
   \   000046   E0           MOVX    A,@DPTR
   \   000047   45..         ORL     A,?V0 + 0
   \   000049   F0           MOVX    @DPTR,A
   \   00004A   A3           INC     DPTR
   \   00004B   E0           MOVX    A,@DPTR
   \   00004C   45..         ORL     A,?V0 + 1
   \                     ??osal_pwrmgr_task_state_4:
   \   00004E   F0           MOVX    @DPTR,A
    130            }
    131          
    132            return ( ZSUCCESS );
   \   00004F   7900         MOV     R1,#0x0
   \                     ??osal_pwrmgr_task_state_2:
   \   000051                REQUIRE ?Subroutine1
   \   000051                ; // Fall through to label ?Subroutine1
    133          }

   \                                 In segment BANKED_CODE, align 1, keep-with-next
   \                     ?Subroutine1:
   \   000000   7F02         MOV     R7,#0x2
   \   000002   02....       LJMP    ?BANKED_LEAVE_XDATA
    134          
    135          #if defined( POWER_SAVING )
    136          /*********************************************************************
    137           * @fn      osal_pwrmgr_powerconserve
    138           *
    139           * @brief   This function is called from the main OSAL loop when there are
    140           *          no events scheduled and shouldn't be called from anywhere else.
    141           *
    142           * @param   none.
    143           *
    144           * @return  none.
    145           */

   \                                 In segment BANKED_CODE, align 1, keep-with-next
    146          void osal_pwrmgr_powerconserve( void )
   \                     osal_pwrmgr_powerconserve:
    147          {
   \   000000   74F6         MOV     A,#-0xa
   \   000002   12....       LCALL   ?BANKED_ENTER_XDATA
   \   000005                ; Saved register size: 10
   \   000005                ; Auto size: 0
    148            uint16        next;
    149            halIntState_t intState;
    150          
    151            // Should we even look into power conservation
    152            if ( pwrmgr_attribute.pwrmgr_device != PWRMGR_ALWAYS_ON )
   \   000005   90....       MOV     DPTR,#(pwrmgr_attribute + 6)
   \   000008   E0           MOVX    A,@DPTR
   \   000009   6027         JZ      ??osal_pwrmgr_powerconserve_0
    153            {
    154              // Are all tasks in agreement to conserve
    155              if ( pwrmgr_attribute.pwrmgr_task_state == 0 )
   \   00000B   90....       MOV     DPTR,#pwrmgr_attribute
   \   00000E   E0           MOVX    A,@DPTR
   \   00000F   7002         JNZ     ??osal_pwrmgr_powerconserve_1
   \   000011   A3           INC     DPTR
   \   000012   E0           MOVX    A,@DPTR
   \                     ??osal_pwrmgr_powerconserve_1:
   \   000013   701D         JNZ     ??osal_pwrmgr_powerconserve_0
    156              {
    157                // Hold off interrupts.
    158                HAL_ENTER_CRITICAL_SECTION( intState );
   \   000015   A2AF         MOV     C,0xa8.7
   \   000017   E4           CLR     A
   \   000018   92E0         MOV     0xE0 /* A   */.0,C
   \   00001A   FE           MOV     R6,A
   \   00001B   C2AF         CLR     0xa8.7
    159          
    160                // Get next time-out
    161                next = osal_next_timeout();
   \   00001D                ; Setup parameters for call to function osal_next_timeout
   \   00001D   90....       MOV     DPTR,#(osal_next_timeout & 0xffff)
   \   000020   74..         MOV     A,#((osal_next_timeout >> 16) & 0xff)
   \   000022   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    162          
    163                // Re-enable interrupts.
    164                HAL_EXIT_CRITICAL_SECTION( intState );
   \   000025   EE           MOV     A,R6
   \   000026   A2E0         MOV     C,0xE0 /* A   */.0
   \   000028   92AF         MOV     0xa8.7,C
    165          
    166                // Put the processor into sleep mode
    167                OSAL_SET_CPU_INTO_SLEEP( next );
   \   00002A                ; Setup parameters for call to function halSleep
   \   00002A   90....       MOV     DPTR,#(halSleep & 0xffff)
   \   00002D   74..         MOV     A,#((halSleep >> 16) & 0xff)
   \   00002F   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    168              }
    169            }
    170          }
   \                     ??osal_pwrmgr_powerconserve_0:
   \   000032   80..         SJMP    ?Subroutine1

   \                                 In segment SFR_AN, at 0xa8
   \   union <unnamed> volatile __sfr _A_IEN0
   \                     _A_IEN0:
   \   000000                DS 1
    171          #endif /* POWER_SAVING */
    172          
    173          /*********************************************************************
    174          *********************************************************************/

   Maximum stack usage in bytes:

     Function                  ISTACK PSTACK XSTACK
     --------                  ------ ------ ------
     osal_pwrmgr_device            2      0      0
     osal_pwrmgr_init              2      0      0
     osal_pwrmgr_powerconserve     0      0     10
       -> osal_next_timeout        0      0     20
       -> halSleep                 0      0     20
     osal_pwrmgr_task_state        0      0     10
       -> osalFindTask             0      0     20


   Segment part sizes:

     Function/Label            Bytes
     --------------            -----
     pwrmgr_attribute             7
     osal_pwrmgr_init            14
     ?Subroutine0                 8
     osal_pwrmgr_device          10
     osal_pwrmgr_task_state      81
     ?Subroutine1                 5
     osal_pwrmgr_powerconserve   52
     _A_IEN0                      1

 
 170 bytes in segment BANKED_CODE
   1 byte  in segment SFR_AN
   7 bytes in segment XDATA_Z
 
 170 bytes of CODE  memory
   0 bytes of DATA  memory (+ 1 byte shared)
   7 bytes of XDATA memory

Errors: none
Warnings: none

⌨️ 快捷键说明

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