mac_sleep.s51
来自「TI的基于ZIGBEE2006的协议栈」· S51 代码 · 共 680 行 · 第 1/3 页
S51
680 行
CFI CFA_PSP16 PSP16+0
CFI CFA_XSP16 XSP16+0
CFI `PSW.CY` SameValue
CFI `B.BR0` SameValue
CFI `B.BR1` SameValue
CFI `B.BR2` SameValue
CFI `B.BR3` SameValue
CFI `B.BR4` SameValue
CFI `B.BR5` SameValue
CFI `B.BR6` SameValue
CFI `B.BR7` SameValue
CFI `VB.BR8` SameValue
CFI `VB.BR9` SameValue
CFI `VB.BR10` SameValue
CFI `VB.BR11` SameValue
CFI `VB.BR12` SameValue
CFI `VB.BR13` SameValue
CFI `VB.BR14` SameValue
CFI `VB.BR15` SameValue
CFI VB SameValue
CFI B Undefined
CFI A Undefined
CFI PSW SameValue
CFI DPL0 SameValue
CFI DPH0 SameValue
CFI R0 Undefined
CFI R1 Undefined
CFI R2 Undefined
CFI R3 Undefined
CFI R4 Undefined
CFI R5 Undefined
CFI R6 SameValue
CFI R7 SameValue
CFI V0 SameValue
CFI V1 SameValue
CFI V2 SameValue
CFI V3 SameValue
CFI V4 SameValue
CFI V5 SameValue
CFI V6 SameValue
CFI V7 SameValue
CFI PSPH Undefined
CFI PSPL Undefined
CFI XSPH Undefined
CFI XSPL Undefined
CFI ?RET Concat
CFI ?BRET_EXT Frame(CFA_SP, 3)
CFI ?RET_HIGH Frame(CFA_SP, 2)
CFI ?RET_LOW Frame(CFA_SP, 1)
CFI EndCommon cfiCommon0
EXTERN macRxRadioPowerUpInit
FUNCTION macRxRadioPowerUpInit,0202H
ARGFRAME ISTACK, 2, STACK
EXTERN halAssertHandler
FUNCTION halAssertHandler,0202H
ARGFRAME ISTACK, 2, STACK
ARGFRAME XSTACK, 9, STACK
EXTERN macRxOnRequest
FUNCTION macRxOnRequest,0202H
ARGFRAME ISTACK, 2, STACK
EXTERN macRxOff
FUNCTION macRxOff,0202H
ARGFRAME XSTACK, 9, STACK
EXTERN macRxActive
EXTERN macRxEnableFlags
EXTERN macRxFilter
EXTERN macRxOutgoingAckFlag
EXTERN macTxActive
// C:\Texas Instruments\ZStack-1.4.2\Components\mac\low_level\srf03\mac_sleep.c
// 1 /**************************************************************************************************
// 2 Filename:
// 3 Revised: $Date: 2007-02-01 11:24:21 -0800 (Thu, 01 Feb 2007) $
// 4 Revision: $Revision: 13416 $
// 5
// 6 Description:
// 7
// 8 Describe the purpose and contents of the file.
// 9
// 10 Copyright (c) 2006 by Texas Instruments, Inc.
// 11 All Rights Reserved. Permission to use, reproduce, copy, prepare
// 12 derivative works, modify, distribute, perform, display or sell this
// 13 software and/or its documentation for any purpose is prohibited
// 14 without the express written consent of Texas Instruments, Inc.
// 15 **************************************************************************************************/
// 16
// 17
// 18
// 19 /* ------------------------------------------------------------------------------------------------
// 20 * Includes
// 21 * ------------------------------------------------------------------------------------------------
// 22 */
// 23
// 24 /* hal */
// 25 #include "hal_types.h"
// 26
// 27 /* exported low-level */
// 28 #include "mac_low_level.h"
// 29
// 30 /* low-level specific */
// 31 #include "mac_sleep.h"
// 32 #include "mac_radio.h"
// 33 #include "mac_tx.h"
// 34 #include "mac_rx.h"
// 35 #include "mac_rx_onoff.h"
// 36
// 37 /* target specific */
// 38 #include "mac_radio_defs.h"
ASEGN SFR_AN:DATA:NOROOT,0beH
// unsigned char volatile __sfr SLEEP
SLEEP:
DS 1
ASEGN SFR_AN:DATA:NOROOT,0c3H
// unsigned char volatile __sfr T2CNF
T2CNF:
DS 1
// 39
// 40 /* debug */
// 41 #include "mac_assert.h"
// 42
// 43
// 44 /* ------------------------------------------------------------------------------------------------
// 45 * Global Variables
// 46 * ------------------------------------------------------------------------------------------------
// 47 */
RSEG XDATA_I:XDATA:NOROOT(0)
// 48 uint8 macSleepState = MAC_SLEEP_STATE_RADIO_OFF;
macSleepState:
DS 1
REQUIRE `?<Initializer for macSleepState>`
REQUIRE __INIT_XDATA_I
// 49
// 50
// 51 /**************************************************************************************************
// 52 * @fn macSleepWakeUp
// 53 *
// 54 * @brief Wake up the radio from sleep mode.
// 55 *
// 56 * @param none
// 57 *
// 58 * @return none
// 59 **************************************************************************************************
// 60 */
RSEG BANKED_CODE:CODE:NOROOT(0)
// 61 void macSleepWakeUp(void)
macSleepWakeUp:
CFI Block cfiBlock0 Using cfiCommon0
CFI Function macSleepWakeUp
// 62 {
FUNCALL macSleepWakeUp, macRxRadioPowerUpInit
LOCFRAME ISTACK, 2, STACK
ARGFRAME ISTACK, 2, STACK
FUNCALL macSleepWakeUp, halAssertHandler
LOCFRAME ISTACK, 2, STACK
ARGFRAME ISTACK, 2, STACK
FUNCALL macSleepWakeUp, macRxOnRequest
LOCFRAME ISTACK, 2, STACK
ARGFRAME ISTACK, 2, STACK
PUSH DPL
CFI DPL0 Frame(CFA_SP, 4)
CFI CFA_SP SP+-4
PUSH DPH
CFI DPH0 Frame(CFA_SP, 5)
CFI CFA_SP SP+-5
; Saved register size: 2
; Auto size: 0
// 63 /* don't wake up radio if it's already awake */
// 64 if (macSleepState == MAC_SLEEP_STATE_AWAKE)
MOV DPTR,#macSleepState
MOVX A,@DPTR
JZ ??macSleepWakeUp_0
// 65 {
// 66 return;
// 67 }
// 68
// 69 /* wake up MAC timer */
// 70 MAC_RADIO_TIMER_WAKE_UP();
ORL 0xc3,#0x1
??macSleepWakeUp_1:
MOV A,0xc3
MOV C,0xE0 /* A */.0
JNC ??macSleepWakeUp_1
// 71
// 72 /* if radio was completely off, restore from that state first */
// 73 if (macSleepState == MAC_SLEEP_STATE_RADIO_OFF)
MOVX A,@DPTR
XRL A,#0x2
JNZ ??macSleepWakeUp_2
// 74 {
// 75 /* turn on radio power */
// 76 MAC_RADIO_TURN_ON_POWER();
MOV DPTR,#-0x20e9
MOVX A,@DPTR
CLR 0xE0 /* A */.3
MOVX @DPTR,A
??macSleepWakeUp_3:
MOVX A,@DPTR
MOV C,0xE0 /* A */.4
JC ??macSleepWakeUp_3
// 77
// 78 /* power-up initialization of receive logic */
// 79 macRxRadioPowerUpInit();
; Setup parameters for call to function macRxRadioPowerUpInit
MOV DPTR,#(macRxRadioPowerUpInit & 0xffff)
MOV A,#((macRxRadioPowerUpInit >> 16) & 0xff)
LCALL ?BCALL ; Banked call to: DPTR()
// 80 }
// 81
// 82 /* turn on the oscillator */
// 83 MAC_RADIO_TURN_ON_OSC();
??macSleepWakeUp_2:
MOV A,0xbe
MOV C,0xE0 /* A */.6
JC ??macSleepWakeUp_4
; Setup parameters for call to function halAssertHandler
MOV DPTR,#(halAssertHandler & 0xffff)
MOV A,#((halAssertHandler >> 16) & 0xff)
LCALL ?BCALL ; Banked call to: DPTR()
// 84
// 85 /* update sleep state here before requesting to turn on receiver */
// 86 macSleepState = MAC_SLEEP_STATE_AWAKE;
??macSleepWakeUp_4:
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?