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

📄 zmain.lst

📁 cc2430应用实例
💻 LST
📖 第 1 页 / 共 4 页
字号:
     79          
     80          /*********************************************************************
     81           * LOCAL VARIABLES
     82           */
     83          
     84          /*********************************************************************
     85           * ZMAIN API JUMP FUNCTIONS
     86           *
     87           * If the MINIMIZE_ROOT compile flag is defined, ZMAIN API functions
     88           * are implemented as "jump functions" located in the ROOT segment,
     89           * as expected by the NWK object libraries. This allows the actual
     90           * ZMAIN function bodies to locate outside ROOT memory, increasing
     91           * space for user defined constants, strings, etc in ROOT memory.
     92           *
     93           * If the MINIMIZE_ROOT compile flag in not defined, the ZMAIN API
     94           * functions are aliased to the similarly-named function bodies and
     95           * located in the ROOT segment with no "jump function" overhead.
     96           * This is the default behavior which produces smaller overall code
     97           * size and maximizes available code space in BANK1...BANK3.
     98           *
     99           */
    100          
    101          #ifdef MINIMIZE_ROOT
    102            // ZMAIN functions are not forced into ROOT segment
    103            #define ZSEG
    104          #else
    105            // ZMAIN functions are forced into ROOT segment
    106            #define ZSEG ROOT
    107          #endif
    108          
    109          /*********************************************************************
    110           * LOCAL FUNCTIONS
    111           */
    112          
    113          static ZSEG void zmain_dev_info( void );
    114          static ZSEG void zmain_ext_addr( void );
    115          static ZSEG void zmain_ram_init( void );
    116          static ZSEG void zmain_vdd_check( void );
    117          
    118          #ifdef LCD_SUPPORTED
    119          static ZSEG void zmain_lcd_init( void );
    120          #endif
    121          
    122          /*********************************************************************
    123           * @fn      main
    124           * @brief   First function called after startup.
    125           * @return  don't care
    126           *********************************************************************/

   \                                 In segment NEAR_CODE, align 1, keep-with-next
    127          ZSEG int main( void )
   \                     main:
    128          {
   \   000000                ; Auto size: 0
    129            
    130            // Turn off interrupts
    131            osal_int_disable( INTS_ALL );
   \   000000                ; Setup parameters for call to function osal_int_disable
   \   000000   79FF         MOV     R1,#-0x1
   \   000002   90....       MOV     DPTR,#(osal_int_disable & 0xffff)
   \   000005   74..         MOV     A,#((osal_int_disable >> 16) & 0xff)
   \   000007   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    132            
    133            // Make sure supply voltage is high enough to run
    134            zmain_vdd_check();
   \   00000A                ; Setup parameters for call to function zmain_vdd_check
   \   00000A   12....       LCALL   ??zmain_vdd_check
    135          
    136            // Initialize stack memory
    137            zmain_ram_init();
   \   00000D   78..         MOV     R0,#(SFB(XSP) & 0xff)
   \   00000F   8682         MOV     DPL,@R0
   \   000011   08           INC     R0
   \   000012   8683         MOV     DPH,@R0
   \   000014   8003         SJMP    ??main_0
   \                     ??main_1:
   \   000016   74A5         MOV     A,#-0x5b
   \   000018   F0           MOVX    @DPTR,A
   \                     ??main_0:
   \   000019   12....       LCALL   ?Subroutine0
   \                     ??CrossCallReturnLabel_0:
   \   00001C   C3           CLR     C
   \   00001D   74..         MOV     A,#(SFB(XSTACK) & 0xff)
   \   00001F   9582         SUBB    A,DPL
   \   000021   74..         MOV     A,#((SFB(XSTACK) >> 8) & 0xff)
   \   000023   9583         SUBB    A,DPH
   \   000025   40EF         JC      ??main_1
   \   000027   7582..       MOV     DPL,#((SFE(ISTACK) + 255) & 0xff)
   \   00002A   7583..       MOV     DPH,#(((SFE(ISTACK) - 1) >> 8) & 0xff)
   \   00002D   8004         SJMP    ??main_2
   \                     ??main_3:
   \   00002F   A882         MOV     R0,DPL
   \   000031   76A5         MOV     @R0,#-0x5b
   \                     ??main_2:
   \   000033   E581         MOV     A,0x81
   \   000035   F5..         MOV     ?V0 + 0,A
   \   000037   12....       LCALL   ?Subroutine0
   \                     ??CrossCallReturnLabel_1:
   \   00003A   75..00       MOV     ?V0 + 1,#0x0
   \   00003D   C3           CLR     C
   \   00003E   E5..         MOV     A,?V0 + 0
   \   000040   9582         SUBB    A,DPL
   \   000042   E4           CLR     A
   \   000043   9583         SUBB    A,DPH
   \   000045   40E8         JC      ??main_3
    138          
    139            // Initialize board I/O
    140            InitBoard( OB_COLD );
   \   000047                ; Setup parameters for call to function InitBoard
   \   000047   7900         MOV     R1,#0x0
   \   000049   90....       MOV     DPTR,#(InitBoard & 0xffff)
   \   00004C   74..         MOV     A,#((InitBoard >> 16) & 0xff)
   \   00004E   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    141          
    142            // Initialze HAL drivers
    143            HalDriverInit();
   \   000051                ; Setup parameters for call to function HalDriverInit
   \   000051   90....       MOV     DPTR,#(HalDriverInit & 0xffff)
   \   000054   74..         MOV     A,#((HalDriverInit >> 16) & 0xff)
   \   000056   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    144          
    145            // Initialize NV System
    146            osal_nv_init( NULL );
   \   000059                ; Setup parameters for call to function osal_nv_init
   \   000059   7A00         MOV     R2,#0x0
   \   00005B   7B00         MOV     R3,#0x0
   \   00005D   90....       MOV     DPTR,#(osal_nv_init & 0xffff)
   \   000060   74..         MOV     A,#((osal_nv_init >> 16) & 0xff)
   \   000062   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    147          
    148            // Determine the extended address
    149            zmain_ext_addr();
   \   000065                ; Setup parameters for call to function zmain_ext_addr
   \   000065   12....       LCALL   ??zmain_ext_addr
    150          
    151            // Initialize basic NV items
    152            zgInit();
   \   000068                ; Setup parameters for call to function zgInit
   \   000068   90....       MOV     DPTR,#(zgInit & 0xffff)
   \   00006B   74..         MOV     A,#((zgInit >> 16) & 0xff)
   \   00006D   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    153          
    154            // Initialize the MAC
    155            ZMacInit();
   \   000070                ; Setup parameters for call to function ZMacInit
   \   000070   12....       LCALL   ZMacInit
    156          
    157          #ifndef NONWK
    158            // Since the AF isn't a task, call it's initialization routine
    159            afInit();
   \   000073                ; Setup parameters for call to function afInit
   \   000073   90....       MOV     DPTR,#(afInit & 0xffff)
   \   000076   74..         MOV     A,#((afInit >> 16) & 0xff)
   \   000078   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    160          #endif
    161          
    162            // Initialize the operating system
    163            osal_init_system();
   \   00007B                ; Setup parameters for call to function osal_init_system
   \   00007B   90....       MOV     DPTR,#(osal_init_system & 0xffff)
   \   00007E   74..         MOV     A,#((osal_init_system >> 16) & 0xff)
   \   000080   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    164          
    165            // Allow interrupts
    166            osal_int_enable( INTS_ALL );
   \   000083                ; Setup parameters for call to function osal_int_enable
   \   000083   79FF         MOV     R1,#-0x1
   \   000085   90....       MOV     DPTR,#(osal_int_enable & 0xffff)
   \   000088   74..         MOV     A,#((osal_int_enable >> 16) & 0xff)
   \   00008A   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    167          
    168            // Final board initialization
    169            InitBoard( OB_READY );
   \   00008D                ; Setup parameters for call to function InitBoard
   \   00008D   7902         MOV     R1,#0x2
   \   00008F   90....       MOV     DPTR,#(InitBoard & 0xffff)
   \   000092   74..         MOV     A,#((InitBoard >> 16) & 0xff)
   \   000094   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    170          
    171            // Display information about this device
    172            zmain_dev_info();
    173          
    174            /* Display the device info on the LCD */
    175          #ifdef LCD_SUPPORTED
    176            zmain_lcd_init();
    177          #endif
    178          
    179            osal_start_system(); // No Return from here
   \   000097                ; Setup parameters for call to function osal_start_system
   \   000097   90....       MOV     DPTR,#(osal_start_system & 0xffff)
   \   00009A   74..         MOV     A,#((osal_start_system >> 16) & 0xff)
   \   00009C   12....       LCALL   ?BCALL               ; Banked call to: DPTR()
    180          } // main()
   \   00009F   7A00         MOV     R2,#0x0
   \   0000A1   7B00         MOV     R3,#0x0
   \   0000A3   22           RET
    181          
    182          /*********************************************************************
    183           * @fn      zmain_vdd_check
    184           * @brief   Check if the Vdd is OK to run the processor.
    185           * @return  Return if Vdd is ok; otherwise, flash LED, then reset
    186           *********************************************************************/

   \                                 In segment NEAR_CODE, align 1, keep-with-next
    187          static ZSEG void zmain_vdd_check( void )
   \                     ??zmain_vdd_check:
    188          {
   \   000000   74F8         MOV     A,#-0x8
   \   000002   12....       LCALL   ?FUNC_ENTER_XDATA
   \   000005                ; Saved register size: 8
   \   000005                ; Auto size: 0
    189            uint8 vdd_passed_count = 0;
   \   000005   7E00         MOV     R6,#0x0
    190            bool toggle = 0;
   \   000007   7F00         MOV     R7,#0x0
    191          
    192            // Initialization for board related stuff such as LEDs
    193            HAL_BOARD_INIT();
   \   000009   43FE01       ORL     0xfe,#0x1
   \   00000C   43FE02       ORL     0xfe,#0x2
   \   00000F   43F701       ORL     0xf7,#0x1
   \   000012   43FE04       ORL     0xfe,#0x4
   \   000015   C292         CLR     0x90.2
   \   000017   8015         SJMP    ??zmain_vdd_check_1
    194          
    195            // Repeat getting the sample until number of failures or successes hits MAX

⌨️ 快捷键说明

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