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

📄 mac_low_level.s51

📁 用IAR开发的ZIGBEE网络路由例子
💻 S51
📖 第 1 页 / 共 2 页
字号:

// E:\解决\路由\Components\mac\low_level\srf03\mac_low_level.c
//    1 /**************************************************************************************************
//    2     Filename:
//    3     Revised:        $Date: 2007-01-10 11:56:57 -0800 (Wed, 10 Jan 2007) $
//    4     Revision:       $Revision: 13262 $
//    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  *                                          Includes
//   20  * ------------------------------------------------------------------------------------------------
//   21  */
//   22 
//   23 /* hal */
//   24 #include "hal_types.h"
//   25 #include "hal_mcu.h"
//   26 
//   27 /* exported low-level */
//   28 #include "mac_low_level.h"
//   29 
//   30 /* low-level specific */
//   31 #include "mac_radio.h"
//   32 #include "mac_rx.h"
//   33 #include "mac_tx.h"
//   34 #include "mac_rx_onoff.h"
//   35 #include "mac_backoff_timer.h"
//   36 #include "mac_sleep.h"
//   37 
//   38 /* target specific */
//   39 #include "mac_radio_defs.h"
//   40 
//   41 /* debug */
//   42 #include "mac_assert.h"
//   43 
//   44 
//   45 /**************************************************************************************************
//   46  * @fn          macLowLevelInit
//   47  *
//   48  * @brief       Initialize low-level MAC.  Called only once on system power-up.
//   49  *
//   50  * @param       none
//   51  *
//   52  * @return      none
//   53  **************************************************************************************************
//   54  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//   55 void macLowLevelInit(void)
macLowLevelInit:
        CFI Block cfiBlock0 Using cfiCommon0
        CFI Function macLowLevelInit
//   56 {
        FUNCALL macLowLevelInit, macMcuInit
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        FUNCALL macLowLevelInit, macRadioInit
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        FUNCALL macLowLevelInit, macRxOnOffInit
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        FUNCALL macLowLevelInit, macRxInit
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        FUNCALL macLowLevelInit, macTxInit
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        FUNCALL macLowLevelInit, macBackoffTimerInit
        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
//   57   /* initialize mcu before anything else */
//   58   MAC_RADIO_MCU_INIT();
        ; Setup parameters for call to function macMcuInit
        MOV	DPTR,#(macMcuInit & 0xffff)
        MOV	A,#((macMcuInit >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
//   59 
//   60   /* software initialziation */
//   61   macRadioInit();
        ; Setup parameters for call to function macRadioInit
        MOV	DPTR,#(macRadioInit & 0xffff)
        MOV	A,#((macRadioInit >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
//   62   macRxOnOffInit();
        ; Setup parameters for call to function macRxOnOffInit
        MOV	DPTR,#(macRxOnOffInit & 0xffff)
        MOV	A,#((macRxOnOffInit >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
//   63   macRxInit();
        ; Setup parameters for call to function macRxInit
        MOV	DPTR,#(macRxInit & 0xffff)
        MOV	A,#((macRxInit >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
//   64   macTxInit();
        ; Setup parameters for call to function macTxInit
        MOV	DPTR,#(macTxInit & 0xffff)
        MOV	A,#((macTxInit >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
//   65   macBackoffTimerInit();
        ; Setup parameters for call to function macBackoffTimerInit
        MOV	DPTR,#(macBackoffTimerInit & 0xffff)
        MOV	A,#((macBackoffTimerInit >> 16) & 0xff)
        CFI EndBlock cfiBlock0
        REQUIRE ?Subroutine0
        ; // Fall through to label ?Subroutine0
//   66 }

        RSEG BANKED_CODE:CODE:NOROOT(0)
?Subroutine0:
        CFI Block cfiBlock1 Using cfiCommon0
        CFI NoFunction
        CFI CFA_SP SP+-5
        CFI DPL0 Frame(CFA_SP, 4)
        CFI DPH0 Frame(CFA_SP, 5)
        LCALL	?BCALL               ; Banked call to: DPTR()
        POP	DPH
        CFI CFA_SP SP+-4
        CFI DPH0 SameValue
        POP	DPL
        CFI CFA_SP SP+-3
        CFI DPL0 SameValue
        LJMP	?BRET
        CFI EndBlock cfiBlock1
//   67 
//   68 
//   69 /**************************************************************************************************
//   70  * @fn          macLowLevelReset
//   71  *
//   72  * @brief       Reset low-level MAC.
//   73  *
//   74  * @param       none
//   75  *
//   76  * @return      none
//   77  **************************************************************************************************
//   78  */

        RSEG BANKED_CODE:CODE:NOROOT(0)
//   79 void macLowLevelReset(void)
macLowLevelReset:
        CFI Block cfiBlock2 Using cfiCommon0
        CFI Function macLowLevelReset
//   80 {
        FUNCALL macLowLevelReset, halAssertHandler
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        FUNCALL macLowLevelReset, macRxTxReset
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        FUNCALL macLowLevelReset, macRadioReset
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        FUNCALL macLowLevelReset, macBackoffTimerReset
        LOCFRAME ISTACK, 2, STACK
        ARGFRAME ISTACK, 2, STACK
        FUNCALL macLowLevelReset, macSleepWakeUp
        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
//   81   MAC_ASSERT(!HAL_INTERRUPTS_ARE_ENABLED());   /* interrupts must be disabled */
        MOV	C,0xa8.7
        JNC	??macLowLevelReset_0
        ; Setup parameters for call to function halAssertHandler
        MOV	DPTR,#(halAssertHandler & 0xffff)
        MOV	A,#((halAssertHandler >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
//   82 
//   83   /* reset radio modules;  if not awake, skip this */
//   84   if (macSleepState == MAC_SLEEP_STATE_AWAKE)
??macLowLevelReset_0:
        MOV	DPTR,#macSleepState
        MOVX	A,@DPTR
        JNZ	??macLowLevelReset_1
//   85   {
//   86     macRxTxReset();
        ; Setup parameters for call to function macRxTxReset
        MOV	DPTR,#(macRxTxReset & 0xffff)
        MOV	A,#((macRxTxReset >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
//   87     macRadioReset();
        ; Setup parameters for call to function macRadioReset
        MOV	DPTR,#(macRadioReset & 0xffff)
        MOV	A,#((macRadioReset >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
//   88   }
//   89 
//   90   /* reset timer */
//   91   macBackoffTimerReset();
??macLowLevelReset_1:
        ; Setup parameters for call to function macBackoffTimerReset
        MOV	DPTR,#(macBackoffTimerReset & 0xffff)
        MOV	A,#((macBackoffTimerReset >> 16) & 0xff)
        LCALL	?BCALL               ; Banked call to: DPTR()
//   92 
//   93   /* power up the radio */
//   94   macSleepWakeUp();
        ; Setup parameters for call to function macSleepWakeUp
        MOV	DPTR,#(macSleepWakeUp & 0xffff)
        MOV	A,#((macSleepWakeUp >> 16) & 0xff)
        SJMP	?Subroutine0
        CFI EndBlock cfiBlock2
//   95 }

        ASEGN SFR_AN:DATA:NOROOT,0a8H
// union <unnamed> volatile __sfr _A_IEN0
_A_IEN0:
        DS 1

        END
//   96 
//   97 
//   98 /**************************************************************************************************
//   99 */
// 
// 112 bytes in segment BANKED_CODE
//   1 byte  in segment SFR_AN
// 
// 112 bytes of CODE memory
//   0 bytes of DATA memory (+ 1 byte shared)
//
//Errors: none
//Warnings: none

⌨️ 快捷键说明

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