1.性能优化,减少工作时间
This commit is contained in:
parent
14c29b24bf
commit
4b49d2551d
|
@ -49,6 +49,14 @@ typedef enum MCU_FLAG_INIT {
|
||||||
MCU_FLAG_INIT_MAX_CNT = 32, //flag max bit cnt is 32
|
MCU_FLAG_INIT_MAX_CNT = 32, //flag max bit cnt is 32
|
||||||
} MCU_FLAG_INIT;
|
} MCU_FLAG_INIT;
|
||||||
|
|
||||||
|
typedef enum NET_FLAG_INIT {
|
||||||
|
NET_FLAG_INITT = 0x00,
|
||||||
|
NET_FLAG_INITT_OK,
|
||||||
|
NET_FLAG_NET_OK,
|
||||||
|
NET_FLAG_SEND_END,
|
||||||
|
|
||||||
|
} NET_FLAG_INIT;
|
||||||
|
|
||||||
void mcubuf_reset(void);
|
void mcubuf_reset(void);
|
||||||
int sf_commu_mcu_interface_init(int speed, char flow_ctrl, int databits, int stopbits, char parity);
|
int sf_commu_mcu_interface_init(int speed, char flow_ctrl, int databits, int stopbits, char parity);
|
||||||
int sf_commu_mcu_open(void);
|
int sf_commu_mcu_open(void);
|
||||||
|
@ -79,7 +87,9 @@ void sf_mcu_flag_set_done(MCU_FLAG_INIT boot_init);
|
||||||
void sf_mcu_flag_wait_done(MCU_FLAG_INIT boot_init);
|
void sf_mcu_flag_wait_done(MCU_FLAG_INIT boot_init);
|
||||||
int sf_mcu_flag_wait_done_timeout(MCU_FLAG_INIT boot_init, int timeout_ms);
|
int sf_mcu_flag_wait_done_timeout(MCU_FLAG_INIT boot_init, int timeout_ms);
|
||||||
void sf_mcu_flag_clear_done(MCU_FLAG_INIT boot_init);
|
void sf_mcu_flag_clear_done(MCU_FLAG_INIT boot_init);
|
||||||
|
void sf_net_flag_init(void);
|
||||||
|
void sf_net_flag_set_done(NET_FLAG_INIT boot_init);
|
||||||
|
int sf_net_flag_wait_done_timeout(NET_FLAG_INIT boot_init, int timeout_ms);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif //__cplusplus
|
#endif //__cplusplus
|
||||||
|
|
|
@ -106,6 +106,9 @@ void sf_save_camera_gps_info(void);
|
||||||
void set_at_parament(void);
|
void set_at_parament(void);
|
||||||
int sf_net_dns_ck(void);
|
int sf_net_dns_ck(void);
|
||||||
void sf_register_net_para_ck(void);
|
void sf_register_net_para_ck(void);
|
||||||
|
SINT32 sf_app_auto_send_start(void);
|
||||||
|
SINT32 sf_file_send_auto(void);
|
||||||
|
SINT32 sf_app_auto_net_start(void);
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
||||||
#include "sf_ftp.h"
|
#include "sf_ftp.h"
|
||||||
#include "sf_module.h"
|
#include "sf_module.h"
|
||||||
#include "at_manager.h"
|
#include "at_manager.h"
|
||||||
|
#include "sf_commu_mcu.h"
|
||||||
#define APNGPRS_WUYUAN1 "America.bics"
|
#define APNGPRS_WUYUAN1 "America.bics"
|
||||||
#define APNGPRS_WUYUAN2 "bicsapn"
|
#define APNGPRS_WUYUAN2 "bicsapn"
|
||||||
#define MEGA_TEST 0
|
#define MEGA_TEST 0
|
||||||
|
@ -4281,12 +4281,13 @@ SINT32 sf_auto_net_reg(void)
|
||||||
ret = SF_SIM_ERROR_APN;
|
ret = SF_SIM_ERROR_APN;
|
||||||
sprintf((char *)logStr, "Error Code:0x%08X\n", ret);
|
sprintf((char *)logStr, "Error Code:0x%08X\n", ret);
|
||||||
SLOGE(logStr);
|
SLOGE(logStr);
|
||||||
|
sf_net_flag_set_done(NET_FLAG_NET_OK);
|
||||||
//sf_guide_operator_match_status_set();
|
//sf_guide_operator_match_status_set();
|
||||||
goto SF_MODULE_END;
|
goto SF_MODULE_END;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
sf_net_flag_set_done(NET_FLAG_NET_OK);
|
||||||
sprintf((char *)logStr, "Auto Operation Success,MCCMNC:%s\n", puiPara->OperatorCode);
|
sprintf((char *)logStr, "Auto Operation Success,MCCMNC:%s\n", puiPara->OperatorCode);
|
||||||
SLOGI(logStr);
|
SLOGI(logStr);
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,8 @@ extern "C" {
|
||||||
#include "sf_system.h"
|
#include "sf_system.h"
|
||||||
#include "curl/curl.h"
|
#include "curl/curl.h"
|
||||||
#include "sf_4G_sms_lpa_cmd.h"
|
#include "sf_4G_sms_lpa_cmd.h"
|
||||||
|
#include "sf_commu_mcu.h"
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* C O N S T A N T S *
|
* C O N S T A N T S *
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
@ -888,7 +890,7 @@ SINT32 sf_pic_send_ftp(void)
|
||||||
UINT8 piccount = 0;
|
UINT8 piccount = 0;
|
||||||
UINT8 pic = 0;
|
UINT8 pic = 0;
|
||||||
UINT8 csqlevel = 0;
|
UINT8 csqlevel = 0;
|
||||||
int timeout = 120000;
|
int timeout = 60000;
|
||||||
//SINT64 sendStartTime = 0;
|
//SINT64 sendStartTime = 0;
|
||||||
UINT8 sendAlreadyFlag = 0;
|
UINT8 sendAlreadyFlag = 0;
|
||||||
UINT8 timeoutCnt = 0;
|
UINT8 timeoutCnt = 0;
|
||||||
|
@ -918,7 +920,7 @@ SINT32 sf_pic_send_ftp(void)
|
||||||
|
|
||||||
if(tempPicSize == 0)
|
if(tempPicSize == 0)
|
||||||
{
|
{
|
||||||
timeout = 120000;
|
timeout = 60000;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -950,6 +952,11 @@ SINT32 sf_pic_send_ftp(void)
|
||||||
printf("%s:%d pic:%d ftpFileName:%s filePath:%s fileStr:%s\n", __FUNCTION__, __LINE__, pic, ftpFileName[pic], filePath[pic], fileStr[pic]);
|
printf("%s:%d pic:%d ftpFileName:%s filePath:%s fileStr:%s\n", __FUNCTION__, __LINE__, pic, ftpFileName[pic], filePath[pic], fileStr[pic]);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
SF_STARTUP_TYPE_E StartMode = sf_poweron_type_get();
|
||||||
|
if((SF_MCU_STARTUP_TIMELAPSE == StartMode) || (SF_MCU_STARTUP_PIR == StartMode))
|
||||||
|
{
|
||||||
|
sf_net_flag_wait_done_timeout(NET_FLAG_INITT_OK, 120000);
|
||||||
|
}
|
||||||
for(pic = 0; pic < piccount; pic++)
|
for(pic = 0; pic < piccount; pic++)
|
||||||
{
|
{
|
||||||
if(SF_FILE_TYPE_PIC_VIDEO == pThumbFileCfg->stfileattr[pic].enFileTye){
|
if(SF_FILE_TYPE_PIC_VIDEO == pThumbFileCfg->stfileattr[pic].enFileTye){
|
||||||
|
|
|
@ -2704,8 +2704,8 @@ SINT32 sf_power_off_check_sd(void)
|
||||||
//sf_FlowLogCopyToCard();
|
//sf_FlowLogCopyToCard();
|
||||||
//if(sf_in_card_exist())
|
//if(sf_in_card_exist())
|
||||||
{
|
{
|
||||||
if(sf_get_mode_flag() || ((0 == puiPara->SendType)) || (startup == SF_MCU_STARTUP_RESET))
|
// if(sf_get_mode_flag() || ((0 == puiPara->SendType)) || (startup == SF_MCU_STARTUP_RESET))
|
||||||
sf_delete_send_flie_list();
|
// sf_delete_send_flie_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*check disk free size*/
|
/*check disk free size*/
|
||||||
|
|
|
@ -60,6 +60,7 @@
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
#include "sf_4g_lpa.h"
|
#include "sf_4g_lpa.h"
|
||||||
#include "sf_eg91_gps.h"
|
#include "sf_eg91_gps.h"
|
||||||
|
#include "sf_commu_mcu.h"
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#if __cplusplus
|
#if __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -84,6 +85,14 @@ SF_THREAD_S QlogTsk = {
|
||||||
.TskId = -1,
|
.TskId = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void sf_set_flag_wait(signed int ret)
|
||||||
|
{
|
||||||
|
if(ret != SF_SUCCESS)
|
||||||
|
{
|
||||||
|
sf_net_flag_set_done(NET_FLAG_SEND_END);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SINT32 app_ttyusb_IsOpen(void) {
|
SINT32 app_ttyusb_IsOpen(void) {
|
||||||
int retryTime = 0;
|
int retryTime = 0;
|
||||||
int retryFlag = 0;
|
int retryFlag = 0;
|
||||||
|
@ -272,10 +281,10 @@ SINT32 sf_USB_net_init(void)
|
||||||
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||||
|
|
||||||
if (!sf_app_while_flag())
|
if (!sf_app_while_flag())
|
||||||
{
|
{
|
||||||
printf("[%s:%d]is update ... \n", __FUNCTION__, __LINE__);
|
printf("[%s:%d]is update ... \n", __FUNCTION__, __LINE__);
|
||||||
return;
|
return ret;
|
||||||
}
|
}
|
||||||
if (flag == 0)
|
if (flag == 0)
|
||||||
{
|
{
|
||||||
flag = 1;
|
flag = 1;
|
||||||
|
@ -292,25 +301,25 @@ SINT32 sf_USB_net_init(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < 20; i++)
|
for (i = 0; i < 100; i++)
|
||||||
{
|
{
|
||||||
if(strncmp(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0)
|
if(strncmp(puiPara->ModuleVer, GPRS_MODULE_TYPE_EG915Q, 6) == 0)
|
||||||
{
|
{
|
||||||
ret = sf_check_usb0();
|
ret = sf_check_usb0();
|
||||||
|
|
||||||
if(ret != SUCCESS)
|
// if(ret != SUCCESS)
|
||||||
{
|
// {
|
||||||
ret = sf_check_eth0();
|
// ret = sf_check_eth0();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
||||||
ret = sf_check_eth0();
|
ret = sf_check_eth0();
|
||||||
if(ret != SUCCESS)
|
// if(ret != SUCCESS)
|
||||||
{
|
// {
|
||||||
ret = sf_check_usb0();
|
// ret = sf_check_usb0();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
if (SUCCESS == ret)
|
if (SUCCESS == ret)
|
||||||
{
|
{
|
||||||
|
@ -320,7 +329,7 @@ SINT32 sf_USB_net_init(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sf_sleep_ms(500);
|
sf_sleep_ms(100);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//sf_net_dns_ck();
|
//sf_net_dns_ck();
|
||||||
|
@ -1262,6 +1271,9 @@ static SINT32 app_file_transfer(SF_FN_PARAM_S *pfnParam) {
|
||||||
//pCustomerParam->GpsSendFlag = 0;
|
//pCustomerParam->GpsSendFlag = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//to do : send lpa direct
|
||||||
|
sf_ftp_lpa_log_send();
|
||||||
|
|
||||||
if (sf_get_pic()) {
|
if (sf_get_pic()) {
|
||||||
s32ret = sf_send_file_to_ftp(1);
|
s32ret = sf_send_file_to_ftp(1);
|
||||||
sf_sms_set_pic(0);
|
sf_sms_set_pic(0);
|
||||||
|
@ -1692,7 +1704,43 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam)
|
||||||
if (pCustomerParam->SendType != 0) {
|
if (pCustomerParam->SendType != 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef SF_HARDWARE_TEST
|
||||||
|
app_system_poweroff(SF_POWEROFF_NOT);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
s32ret = sf_4G_sim_IsInsert();
|
||||||
|
if (!s32ret) {
|
||||||
|
SF_APPCOMM_CHECK_RETURN(SF_FAILURE, SF_APP_ERROR_REQUEST);
|
||||||
|
}
|
||||||
|
|
||||||
|
s32ret = app_ttyusb_IsOpen();
|
||||||
|
SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST);
|
||||||
|
|
||||||
|
#if SF_QLOG_ENABLE
|
||||||
|
if (pCustomerParam->QLogSwitch == 1)
|
||||||
|
{
|
||||||
|
sf_app_qlog_start();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
if (pCustomerParam->GprsMode != 1)
|
||||||
|
{
|
||||||
|
s32ret = sf_4G_sim_init(pfnParam);
|
||||||
|
SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST);
|
||||||
|
}
|
||||||
|
sf_app_auto_net_start();
|
||||||
|
s32ret = sf_4G_register_net_auto(pfnParam);
|
||||||
|
if (s32ret != SF_SUCCESS) {
|
||||||
|
sf_set_flag_wait(s32ret);
|
||||||
|
sf_set_signal_ready_flag(TRUE);
|
||||||
|
}
|
||||||
|
sf_app_auto_send_start();
|
||||||
|
// sf_share_mem_customer_down(1);
|
||||||
|
// SF_APPCOMM_CHECK_RETURN(s32ret, SF_APP_ERROR_REQUEST);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
case SF_MCU_STARTUP_BATCH_SEND:
|
case SF_MCU_STARTUP_BATCH_SEND:
|
||||||
|
|
||||||
#ifdef SF_HARDWARE_TEST
|
#ifdef SF_HARDWARE_TEST
|
||||||
|
@ -1949,8 +1997,6 @@ static SINT32 app_Register_Net_startup_mode(SF_FN_PARAM_S *pfnParam)
|
||||||
set_at_parament();
|
set_at_parament();
|
||||||
sf_USB_net_init();
|
sf_USB_net_init();
|
||||||
|
|
||||||
//to do : send lpa direct
|
|
||||||
sf_ftp_lpa_log_send();
|
|
||||||
|
|
||||||
if ((SF_ON == pCustomerParam->GpsSwitch) || (pCustomerParam->FristSendDailyAndGps))
|
if ((SF_ON == pCustomerParam->GpsSwitch) || (pCustomerParam->FristSendDailyAndGps))
|
||||||
{
|
{
|
||||||
|
|
|
@ -156,6 +156,16 @@ SF_THREAD_S LpaTskCfg =
|
||||||
.TskId = -1,
|
.TskId = -1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
SF_THREAD_S AtuoSendTskCfg =
|
||||||
|
{
|
||||||
|
.IsRun = 0,
|
||||||
|
.TskId = -1,
|
||||||
|
};
|
||||||
|
SF_THREAD_S AtuoNetTskCfg =
|
||||||
|
{
|
||||||
|
.IsRun = 0,
|
||||||
|
.TskId = -1,
|
||||||
|
};
|
||||||
SINT8 debugFlag = 0;
|
SINT8 debugFlag = 0;
|
||||||
|
|
||||||
UINT8 McuInitFlag = 0;
|
UINT8 McuInitFlag = 0;
|
||||||
|
@ -913,6 +923,28 @@ UINT8 *sf_versionGet(UINT8 ver[],UINT8 fea[])
|
||||||
return ver;
|
return ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*************************************************
|
||||||
|
Function: sf_power_off_net_flag_wait
|
||||||
|
Description: sf power off .
|
||||||
|
Input: N/A
|
||||||
|
Output: N/A
|
||||||
|
Return: 0:SUCCESS, errcode:FAIL
|
||||||
|
Others: N/A
|
||||||
|
*************************************************/
|
||||||
|
SINT32 sf_power_off_net_flag_wait(void)
|
||||||
|
{
|
||||||
|
UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
|
||||||
|
SF_STARTUP_TYPE_E StartMode = sf_poweron_type_get();
|
||||||
|
if((SF_MCU_STARTUP_TIMELAPSE == StartMode) || (SF_MCU_STARTUP_PIR == StartMode))
|
||||||
|
{
|
||||||
|
sf_net_flag_wait_done_timeout(NET_FLAG_SEND_END, 120000);
|
||||||
|
}
|
||||||
|
if(sf_get_mode_flag() || ((0 == puiPara->SendType)) || (StartMode == SF_MCU_STARTUP_RESET))
|
||||||
|
{
|
||||||
|
sf_delete_send_flie_list();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
Function: sf_power_off
|
Function: sf_power_off
|
||||||
|
@ -936,11 +968,13 @@ void sf_power_off(void)
|
||||||
sf_power_off_check_sd();
|
sf_power_off_check_sd();
|
||||||
sf_power_off_check_sd_fail();
|
sf_power_off_check_sd_fail();
|
||||||
|
|
||||||
|
sf_power_off_net_flag_wait();
|
||||||
|
|
||||||
|
sf_power_off_check_sms();
|
||||||
|
|
||||||
sf_poweroff_check_lpa_excute_cmd();
|
sf_poweroff_check_lpa_excute_cmd();
|
||||||
|
|
||||||
sf_poweroff_check_lpa_enable_profile();
|
sf_poweroff_check_lpa_enable_profile();
|
||||||
|
|
||||||
sf_power_off_check_sms();
|
|
||||||
|
|
||||||
sf_power_off_module_ota();
|
sf_power_off_module_ota();
|
||||||
|
|
||||||
|
@ -1763,3 +1797,61 @@ SINT32 sf_app_lpa_start(void)
|
||||||
}
|
}
|
||||||
return SF_SUCCESS;
|
return SF_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void* sf_auto_send_thread(void *arg)
|
||||||
|
{
|
||||||
|
SLOGI("thread run\n");
|
||||||
|
sf_file_send_auto();
|
||||||
|
sf_net_flag_set_done(NET_FLAG_SEND_END);
|
||||||
|
AtuoSendTskCfg.IsRun = 0;
|
||||||
|
SLOGI("thread end\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
SINT32 sf_app_auto_send_start(void)
|
||||||
|
{
|
||||||
|
SINT32 ret = SF_FAILURE;
|
||||||
|
if(AtuoSendTskCfg.IsRun)
|
||||||
|
{
|
||||||
|
SLOGE("thread has already run !!!\n");
|
||||||
|
return SF_FAILURE;
|
||||||
|
}
|
||||||
|
AtuoSendTskCfg.IsRun = 1;
|
||||||
|
SLOGI("thread run\n");
|
||||||
|
ret = pthread_create(&AtuoSendTskCfg.TskId, NULL, sf_auto_send_thread, NULL);
|
||||||
|
if(ret != SF_SUCCESS)
|
||||||
|
{
|
||||||
|
MLOGD("thread creat fail!\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return SF_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
void* sf_auto_net_thread(void *arg)
|
||||||
|
{
|
||||||
|
SLOGI("thread run\n");
|
||||||
|
sf_net_flag_wait_done_timeout(NET_FLAG_NET_OK, 120000);
|
||||||
|
set_at_parament();
|
||||||
|
sf_USB_net_init();
|
||||||
|
sf_net_flag_set_done(NET_FLAG_INITT_OK);
|
||||||
|
AtuoNetTskCfg.IsRun = 0;
|
||||||
|
SLOGI("thread end\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
SINT32 sf_app_auto_net_start(void)
|
||||||
|
{
|
||||||
|
SINT32 ret = SF_FAILURE;
|
||||||
|
if(AtuoNetTskCfg.IsRun)
|
||||||
|
{
|
||||||
|
SLOGE("thread has already run !!!\n");
|
||||||
|
return SF_FAILURE;
|
||||||
|
}
|
||||||
|
AtuoNetTskCfg.IsRun = 1;
|
||||||
|
SLOGI("thread run\n");
|
||||||
|
ret = pthread_create(&AtuoNetTskCfg.TskId, NULL, sf_auto_net_thread, NULL);
|
||||||
|
if(ret != SF_SUCCESS)
|
||||||
|
{
|
||||||
|
MLOGD("thread creat fail!\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return SF_SUCCESS;
|
||||||
|
}
|
|
@ -133,6 +133,50 @@ static pthread_t sfCommuMcuThread = 0;
|
||||||
|
|
||||||
int gsfd = -1;
|
int gsfd = -1;
|
||||||
|
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
static ID sf_net_flag_id = 0;
|
||||||
|
|
||||||
|
void sf_net_flag_init(void)
|
||||||
|
{
|
||||||
|
ER ret = E_OK;
|
||||||
|
T_CFLG cflg;
|
||||||
|
if ((ret |= vos_flag_create(&sf_net_flag_id, &cflg, "sf_mcu_flag_id")) != E_OK)
|
||||||
|
{
|
||||||
|
SYS_SLOGE("sf_net_flag_id fail\r\n");
|
||||||
|
}
|
||||||
|
vos_flag_clr(sf_net_flag_id, (FLGPTN)-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sf_net_flag_set_done(NET_FLAG_INIT boot_init)
|
||||||
|
{
|
||||||
|
static int initflag = 0;
|
||||||
|
if(!initflag)
|
||||||
|
{
|
||||||
|
sf_net_flag_init();
|
||||||
|
initflag = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
vos_flag_set(sf_net_flag_id, (FLGPTN)(1 << boot_init));
|
||||||
|
}
|
||||||
|
|
||||||
|
int sf_net_flag_wait_done_timeout(NET_FLAG_INIT boot_init, int timeout_ms)
|
||||||
|
{
|
||||||
|
ER ret = E_OK;
|
||||||
|
FLGPTN flgptn;
|
||||||
|
if(sf_net_flag_id)
|
||||||
|
{
|
||||||
|
ret = vos_flag_wait_timeout(&flgptn, sf_net_flag_id, (FLGPTN)(1 << boot_init), TWF_ANDW, vos_util_msec_to_tick(timeout_ms));
|
||||||
|
if(unlikely(ret != E_OK)){
|
||||||
|
printf("[%s:%d]wait(%lu) init timeout(%ld ms)!\n", __FUNCTION__, __LINE__, boot_init, timeout_ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
static ID sf_mcu_flag_id = 0;
|
static ID sf_mcu_flag_id = 0;
|
||||||
|
|
||||||
void sf_mcu_flag_init(void)
|
void sf_mcu_flag_init(void)
|
||||||
|
@ -164,7 +208,7 @@ int sf_mcu_flag_wait_done_timeout(MCU_FLAG_INIT boot_init, int timeout_ms)
|
||||||
|
|
||||||
ret = vos_flag_wait_timeout(&flgptn, sf_mcu_flag_id, (FLGPTN)(1 << boot_init), TWF_ANDW, vos_util_msec_to_tick(timeout_ms));
|
ret = vos_flag_wait_timeout(&flgptn, sf_mcu_flag_id, (FLGPTN)(1 << boot_init), TWF_ANDW, vos_util_msec_to_tick(timeout_ms));
|
||||||
if(unlikely(ret != E_OK)){
|
if(unlikely(ret != E_OK)){
|
||||||
printf("wait(%lu) init timeout(%ld ms)!\n", boot_init, timeout_ms);
|
printf("[%s:%d]wait(%lu) init timeout(%ld ms)!\n", __FUNCTION__, __LINE__, boot_init, timeout_ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user