/*********************************************************************
* @fn main * @brief First function called after startup. //启动后第一个调用的函数 * @return don't care */ int main( void ) { // Turn off interrupts //禁用所有中断 osal_int_disable( INTS_ALL ); // Initialization for board related stuff such as LEDs //初始化板载相关设备:时钟振荡器、缓存预取控制、LED和Joystick HAL_BOARD_INIT(); // Make sure supply voltage is high enough to run //电压检测,确保芯片正常运行的电压 zmain_vdd_check(); // Initialize board I/O //初始化板上的IO,LED关闭和检测重启原因 InitBoard( OB_COLD ); // Initialze HAL drivers //初始化硬件驱动 HalDriverInit(); // Initialize NV System //初始化NV系统,也就是非易失性存储系统,相当与对FLASH的初始化 osal_nv_init( NULL ); // Initialize the MAC //初始化MAC层 ZMacInit(); // Determine the extended address //判断物理扩展地址是否合法 zmain_ext_addr(); // Initialize basic NV items //初始化Z-Stack全局变量,用NV中的值初始化终端 zgInit(); //如果禁止了NWK,APS,ZDO函数功能,则需要单独初始化AF层 #ifndef NONWK // Since the AF isn't a task, call it's initialization routine //初始化AF层 afInit(); #endif // Initialize the operating system //初始化操作系统 osal_init_system(); // Allow interrupts //开启中断 osal_int_enable( INTS_ALL ); // Final board initialization //最终板载初始化(按键初始化和配置) InitBoard( OB_READY ); // Display information about this device //显示设备信息 zmain_dev_info(); /* Display the device info on the LCD */ //如果有LCD #ifdef LCD_SUPPORTED //液晶显示初始化 zmain_lcd_init(); #endif #ifdef WDT_IN_PM1 /* If WDT is used, this is a good place to enable it. */ //使能看门狗 WatchDogEnable( WDTIMX ); #endif //进入操作系统 osal_start_system(); // No Return from here return 0; // Shouldn't get here. } // main() |
|
来自: xingwangjy > 《CC2530》