MT2503D开机初始化操作

1、定义的初始化函数

比如在mcu\plutommi\mmi\SmartTerminal\SmartTerminalScr\smartterminalhandler.c中定义;

2、注册初始化函数

mcu\plutommi\mmi\Bootup\BootupInc\BootupInitConfig.h文件的前部,有这么一段注释:

MT2503D开机初始化操作_第1张图片
文件注释

从注释可以看到,初始化函数声明为mmi_ret mmi_myapp_init(mmi_event_struct *evt)形式,应使用MMI_BOOTUP_INIT_REG进行注册,而声明为void mmi_myapp_init(void)形式,应使用MMI_BOOTUP_INIT_ADP。

注意:不需要在该文件中声明初始化函数,因为MMI_BOOTUP_INIT_ADP 和 MMI_BOOTUP_INIT_REG中使用了extern进行外部声明!!!

初始化分了几个阶段,声明在mcu\plutommi\Service\Inc\BootupSrvGprot.hsrv_bootup_event_enum中,分别是:

初始化阶段 描述
EVT_ID_SRV_BOOTUP_EARLY_INIT The applications which need to be initialized as earlier as possible will require this event, for example, interrupt applications, services needed during booting.If no such requirement, please subscribe EVT_ID_SRV_BOOTUP_NORMAL_INIT.
EVT_ID_SRV_BOOTUP_NORMAL_INIT The normal init event of booting. Applications usually subscribe to do their initializations. If your application has NVRAM or file accessing, it is recommended to trigger the initialization here. If your application does not need to be initialized on booting or large amount of initialization is required, you may try lazy initialization. That is, initialize only when the application is really launched,to accelerate bootup speed.
EVT_ID_SRV_BOOTUP_BEFORE_IDLE Before entering idle screen, this event will be emitted. At this step, almost all initializations are completed, including SIM.
EVT_ID_SRV_BOOTUP_COMPLETED The bootup flow has completed and entered idle screen. All application is possible to be launched.

根据需要在相应的阶段注册初始化函数,注册的函数名不能重复,否则会报错。如下所示

MMI_BOOTUP_INIT_REG_BEGIN(EVT_ID_SRV_BOOTUP_BEFORE_IDLE)
#ifdef __MMI_MYAPP__
    MMI_BOOTUP_INIT_REG(mmi_myapp_init)
#endif
MMI_BOOTUP_INIT_REG_END(EVT_ID_SRV_BOOTUP_BEFORE_IDLE)

注册的位置位于MMI_BOOTUP_INIT_REG_BEGINMMI_BOOTUP_INIT_REG_END之间,且应该靠近MMI_BOOTUP_INIT_REG_END

你可能感兴趣的:(MT2503D开机初始化操作)