From 19307baf27ba013e0803363ff1d60a95d0171cdc Mon Sep 17 00:00:00 2001 From: payton Date: Fri, 8 Sep 2023 16:12:56 +0800 Subject: [PATCH 1/7] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=90=8C=E6=AD=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c | 19 +++++++++++++++++-- .../lib/source/sifar/code/include/sf_common.h | 3 ++- .../sifar/code/source/common/sf_common.c | 12 ++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c index b5e0f2d63..b8b92dd8c 100755 --- a/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c +++ b/code/application/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM/UIInfo/UIInfo.c @@ -501,6 +501,16 @@ void Load_MenuInfo(void) if(Check_OTA() == TRUE){ DBG_DUMP("OTA success, reset system param\n"); + + #if HUNTING_CAMERA_MCU == ENABLE + if(sf_get_ui_para_flag()) + { + memcpy(&origInfo, ¤tInfo, sizeof(currentInfo)); + memcpy(&origInfo_check, ¤tInfo, sizeof(currentInfo)); + return; + } + #endif + SysResetFlag(); #if HUNTING_CAMERA_MCU == ENABLE @@ -515,7 +525,7 @@ void Load_MenuInfo(void) //origInfo_check = currentInfo; memcpy(&origInfo, ¤tInfo, sizeof(currentInfo)); memcpy(&origInfo_check, ¤tInfo, sizeof(currentInfo)); - sf_share_mem_customer_down(0); + //sf_share_mem_customer_down(0); #endif return; } @@ -698,14 +708,19 @@ EXIT: } if(((UIMenuStoreInfo*)tmpInfo)->uhInfoSize == sizeof(currentInfo)){ - memcpy(¤tInfo, tmpInfo, sizeof(currentInfo)); + #if HUNTING_CAMERA_MCU == ENABLE + if(!sf_get_ui_para_flag()) + { + memcpy(¤tInfo, tmpInfo, sizeof(currentInfo)); + } if(currentInfo.OtaFlag) { SysResetFlag(); currentInfo.uhInfoSize = sizeof(currentInfo); } #endif + } else{ DBG_WRN("menu info size loaded from flash seems incorrect(old:%lu new:%lu), reset menu info\n", diff --git a/code/lib/source/sifar/code/include/sf_common.h b/code/lib/source/sifar/code/include/sf_common.h index e260e189a..5fc9f50e4 100755 --- a/code/lib/source/sifar/code/include/sf_common.h +++ b/code/lib/source/sifar/code/include/sf_common.h @@ -123,5 +123,6 @@ UINT32 sf_cardv_hd_cap_start(void); void sf_cardv_set_wait_shared_condition(int in); int sf_cardv_para_signaling_start(void); UINT32 sf_cardv_wifi_send(void); - +void sf_set_ui_para_flag(UINT8 flag); +UINT8 sf_get_ui_para_flag(void); #endif diff --git a/code/lib/source/sifar/code/source/common/sf_common.c b/code/lib/source/sifar/code/source/common/sf_common.c index f74db15c2..b433bcb87 100755 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -89,6 +89,7 @@ static pthread_cond_t condition; static pthread_mutex_t Param_mutexLock; static int shared_condition = 1; static SINT32 WifiSocket = 0; +static UINT8 UiparaFlag = 0; static SF_THREAD_S UpgradeTskParam = { .IsRun = 0, @@ -1617,6 +1618,7 @@ static SINT32 sf_cardv_proccess_cmd_para_update(SF_MESSAGE_BUF_S *pMessageBuf) { case SF_PARA_CMD_UPDATE: //MLOGI("NeedTimeSyncStartUp = %d\n",puiPara->NeedTimeSyncStartUp); + sf_set_ui_para_flag(1); sf_share_mem_customer_update(); //MLOGI("NeedTimeSyncStartUp = %d\n",puiPara->NeedTimeSyncStartUp); break; @@ -2642,4 +2644,14 @@ UINT32 sf_cardv_wifi_send(void) } } return 0; +} + +UINT8 sf_get_ui_para_flag(void) +{ + return UiparaFlag; +} + +void sf_set_ui_para_flag(UINT8 flag) +{ + UiparaFlag = flag; } \ No newline at end of file From 72d31658a6655773c83bb6083ce681b5cb676fd9 Mon Sep 17 00:00:00 2001 From: payton Date: Mon, 11 Sep 2023 15:28:22 +0800 Subject: [PATCH 2/7] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8D=9F=E5=9D=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-mem-tbl.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-mem-tbl.dtsi b/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-mem-tbl.dtsi index 712391a53..de90ea350 100755 --- a/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-mem-tbl.dtsi +++ b/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-mem-tbl.dtsi @@ -39,7 +39,7 @@ hdal-memory { #address-cells = <1>; #size-cells = <1>; - media { reg = <0x03600000 0x04A00000>; }; + media { reg = <0x03700000 0x04900000>; }; }; hdal-maxpath-cfg { From b480dfb0e836947f205ea827836fa43b0200c0d9 Mon Sep 17 00:00:00 2001 From: payton Date: Mon, 11 Sep 2023 15:30:53 +0800 Subject: [PATCH 3/7] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8D=9F=E5=9D=8F=E6=97=B6=E7=9A=84=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UIApp/PhotoFast/PhotoFastSliceEncode.c | 440 ++++++++++++------ .../UIApp/PhotoFast/PhotoFastSliceEncode.h | 2 +- 2 files changed, 304 insertions(+), 138 deletions(-) diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.c b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.c index 25d7ba657..078be393d 100755 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.c +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.c @@ -16,7 +16,8 @@ #include "PhotoFast.h" #include #include "DxHunting.h" - +#include "UIAppPhoto_Param.h" +#include "DCF.h" #if HUNTING_CAMERA_MCU == ENABLE #include #endif @@ -104,28 +105,36 @@ static void PhotoFast_SliceEncode_Get_Src_Slice_Info( PhotoFast_SliceSize_Info *src_info, const HD_VIDEO_FRAME video_frame) { - src_info->slice_num = dst_info->slice_num; - src_info->width = video_frame.dim.w; - src_info->height = video_frame.dim.h; + src_info->slice_num = dst_info->slice_num; + src_info->width = video_frame.dim.w; + src_info->height = video_frame.dim.h; - if(src_info->slice_num > 1){ - src_info->slice_height = ALIGN_CEIL((src_info->width * dst_info->slice_height) / dst_info->width, 2); - src_info->last_slice_height = ALIGN_CEIL(src_info->height - src_info->slice_height * (src_info->slice_num - 1), 2); - } - else{ - src_info->slice_height = video_frame.dim.h; - src_info->last_slice_height = src_info->slice_height; - } + if(src_info->slice_num > 1){ + src_info->slice_height = ALIGN_CEIL((src_info->height) / src_info->slice_num, 2); + src_info->last_slice_height = ALIGN_CEIL(src_info->height - src_info->slice_height * (src_info->slice_num - 1), 2); + } + else{ + src_info->slice_height = video_frame.dim.h; + src_info->last_slice_height = src_info->slice_height; + } - PHOTOFAST_SLICE_ENC_DUMP("Src Slice Info: size = {%lu,%lu} slice num = {%lu} slice height = {%lu} last slice height = {%lu}\r\n", - src_info->width, src_info->height, src_info->slice_num, src_info->slice_height, src_info->last_slice_height); + if(src_info->slice_height * (src_info->slice_num - 1) >= src_info->height){ + DBG_ERR("aligned total slice height(%lu * %lu + %lu = %lu) exceed photo height(%lu)!\n", + src_info->slice_height, + src_info->slice_num - 1, + src_info->last_slice_height, + src_info->height); + } + + PHOTOFAST_SLICE_ENC_DUMP("Src Slice Info: size = {%lu,%lu} slice num = {%lu} slice height = {%lu} last slice height = {%lu}\r\n", + src_info->width, src_info->height, src_info->slice_num, src_info->slice_height, src_info->last_slice_height); } INT32 PhotoFast_SliceEncode_Get_Max_Dst_Slice_Buffer_Size(HD_VIDEO_PXLFMT pxl_fmt) { HD_DIM dim = PhotoFast_SliceEncode_Get_Encode_Max_Size(); UINT32 reserved_buffer = 0; - UINT32 max_buffer_size = VDO_YUV_BUFSIZE(dim.w, dim.h, pxl_fmt) + reserved_buffer; + UINT32 max_buffer_size = VDO_YUV_BUFSIZE(ALIGN_CEIL(dim.w, 16), ALIGN_CEIL(dim.h, 16), pxl_fmt) + reserved_buffer; return max_buffer_size; } @@ -135,11 +144,17 @@ static INT32 PhotoFast_SliceEncode_Get_Dst_Slice_Info(PhotoFast_SliceSize_Info * info->width = cap_size_w; info->height = cap_size_h; info->slice_num = slice_num; - info->slice_height = ALIGN_CEIL_16(info->height / info->slice_num); + + if(info->height == 1080 && slice_num == 1){ + info->slice_height = info->height; + } + else{ + info->slice_height = ALIGN_CEIL_16(info->height / info->slice_num); + } if(info->slice_height * (info->slice_num - 1) > info->height){ - DBG_ERR("calculate last slice height error!\n"); + DBG_ERR("calculate last slice height error!(slice_height = %lu, slice_num = %lu, photo height = %lu)\n", info->slice_height, info->slice_num, info->height); return E_SYS; } @@ -151,33 +166,136 @@ static INT32 PhotoFast_SliceEncode_Get_Dst_Slice_Info(PhotoFast_SliceSize_Info * return E_OK; } -INT32 PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(PhotoFast_SliceSize_Info *info) +INT32 PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(PhotoFast_SliceSize_Info *info, const HD_VIDEO_FRAME src_frame) { UINT32 cap_size_w = GetPhotoSizeWidth(SysGetFlag(FL_PHOTO_SIZE)); UINT32 cap_size_h = GetPhotoSizeHeight(SysGetFlag(FL_PHOTO_SIZE)); + UINT32 max_slice_num; UINT32 slice_num; unsigned int cap_size = cap_size_w * cap_size_h; unsigned int buf_size = CFG_PHOTOFAST_SLICE_ENC_PRIMARY_BUF_WIDTH * CFG_PHOTOFAST_SLICE_ENC_PRIMARY_BUF_HEIGHT; if(buf_size > cap_size){ + max_slice_num = 1; slice_num = 1; } else{ PHOTOFAST_SLICE_ENC_DUMP("cap_size = %lu buf_size = %lu\n", cap_size, buf_size); UINT32 lines = (buf_size / cap_size_w); - slice_num = cap_size_h / lines + (cap_size_h % lines ? 1 : 0); + max_slice_num = cap_size_h / lines + (cap_size_h % lines ? 1 : 0); + + UINT32 tmp_src_h = src_frame.dim.h / 2; + UINT32 tmp_dst_h = cap_size_h / 16; + UINT32 found_common_factor = 0; + UINT32 i; + + for (i = 1; i <= (tmp_src_h > tmp_dst_h ? tmp_dst_h : tmp_src_h) ; ++i) + { + if (tmp_src_h % i == 0 && tmp_dst_h % i == 0) + { + PHOTOFAST_SLICE_ENC_DUMP("common factor = %d\n", i); + + if(max_slice_num < i){ + found_common_factor = i; + break; + } + } + } + + if(found_common_factor){ + slice_num = found_common_factor; + PHOTOFAST_SLICE_ENC_DUMP("use common factor %d\n ", slice_num); + } + else{ + slice_num = max_slice_num; + PHOTOFAST_SLICE_ENC_DUMP("use max slice num %d\n ", slice_num); + } } return PhotoFast_SliceEncode_Get_Dst_Slice_Info(info, cap_size_w, cap_size_h, slice_num); } -static HD_DIM PhotoFast_SliceEncode_Get_Encode_Max_Size() +static UINT32 PhotoFast_SliceEncode_Get_Max_Dst_Slice_Info(PhotoFast_SliceSize_Info *info) +{ + static PhotoFast_SliceSize_Info max_slice_info = {0}; + UINT32 max_slice_num; + UINT32 slice_num; + INT32 ret = E_OK; + UIAPP_PHOTO_SENSOR_INFO *sensor_info = UIAppPhoto_get_SensorInfo(0); + unsigned int buf_size = CFG_PHOTOFAST_SLICE_ENC_PRIMARY_BUF_WIDTH * CFG_PHOTOFAST_SLICE_ENC_PRIMARY_BUF_HEIGHT; + + /* search max slice (slice height * slice width) */ + if(!max_slice_info.slice_height || !max_slice_info.width){ + + UINT8 cap_idx = 0; + + for(cap_idx = PHOTO_MAX_CAP_SIZE ; cap_idx <= PHOTO_SLICE_ENC_MIN_CAP_SIZE ; cap_idx++) + { + HD_DIM tmp_cap_size = {0}; + PhotoFast_SliceSize_Info tmp_slice_info = {0}; + + tmp_cap_size = (HD_DIM){GetPhotoSizeWidth(cap_idx), GetPhotoSizeHeight(cap_idx)}; + + if(buf_size > (tmp_cap_size.w * tmp_cap_size.h)){ + max_slice_num = 1; + slice_num = 1; + } + else{ + PHOTOFAST_SLICE_ENC_DUMP("cap_size = %lu buf_size = %lu\n", tmp_cap_size.w * tmp_cap_size.h, buf_size); + + UINT32 lines = (buf_size / tmp_cap_size.w); + max_slice_num = tmp_cap_size.h / lines + (tmp_cap_size.h % lines ? 1 : 0); + + UINT32 tmp_src_h = sensor_info->sSize.h / 2; + UINT32 tmp_dst_h = tmp_cap_size.h / 16; + UINT32 found_common_factor = 0; + UINT32 i; + + for (i = 1; i <= (tmp_src_h > tmp_dst_h ? tmp_dst_h : tmp_src_h) ; ++i) + { + if (tmp_src_h % i == 0 && tmp_dst_h % i == 0) + { + PHOTOFAST_SLICE_ENC_DUMP("common factor = %d\n", i); + + if(max_slice_num < i){ + found_common_factor = i; + break; + } + } + } + + if(found_common_factor){ + slice_num = found_common_factor; + PHOTOFAST_SLICE_ENC_DUMP("use common factor %d\n ", slice_num); + } + else{ + slice_num = max_slice_num; + PHOTOFAST_SLICE_ENC_DUMP("use max slice num %d\n ", slice_num); + } + } + + ret = PhotoFast_SliceEncode_Get_Dst_Slice_Info(&tmp_slice_info, tmp_cap_size.w, tmp_cap_size.h, slice_num); + + if((tmp_slice_info.slice_height * tmp_slice_info.width) > (max_slice_info.slice_height * max_slice_info.width)){ + max_slice_info = tmp_slice_info; + } + } + + PHOTOFAST_SLICE_ENC_DUMP("max dst slice = {%lu, %lu}, cap idx = %lu\n", max_slice_info.width, max_slice_info.slice_height, cap_idx); + } + + *info = max_slice_info; + + return ret; +} + +static HD_DIM PhotoFast_SliceEncode_Get_Encode_Max_Size(void) { PhotoFast_SliceSize_Info info; - if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&info) != E_OK) + if(PhotoFast_SliceEncode_Get_Max_Dst_Slice_Info(&info) != E_OK) return (HD_DIM){0, 0}; HD_DIM dim_max_slice = {info.width, info.slice_height}; @@ -187,7 +305,7 @@ static HD_DIM PhotoFast_SliceEncode_Get_Encode_Max_Size() static UINT32 PhotoFast_SliceEncode_Get_Encode_Max_Bitrate(HD_VIDEO_PXLFMT vproc_out_pxlfmt) { - const UINT32 ratio = 4; + const UINT32 ratio = CFG_PHOTOFAST_SLICE_ENC_BS_BUF_RATIO; UINT32 bitrate; HD_DIM dim = PhotoFast_SliceEncode_Get_Encode_Max_Size(); @@ -307,7 +425,7 @@ INT32 PhotoFast_SliceEncode_Open(const HD_PATH_ID vproc_path_id) HD_OUT_ID out = HD_VIDEOENC_OUT(0, first_out_port); /* calculate dst slice info */ - if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&dst_slice_info) != E_OK){ + if(PhotoFast_SliceEncode_Get_Max_Dst_Slice_Info(&dst_slice_info) != E_OK){ goto EXIT; } @@ -317,13 +435,15 @@ INT32 PhotoFast_SliceEncode_Open(const HD_PATH_ID vproc_path_id) ret = hd_videoproc_get(vproc_path_id, HD_VIDEOPROC_PARAM_OUT, (VOID*)&vproc_out); if(ret != HD_OK){ DBG_ERR("hd_videoproc_get HD_VIDEOPROC_PARAM_OUT failed(path_id=%lx, ret=%d)!", vproc_path_id, ret); - goto EXIT; + vproc_out_pxlfmt = HD_VIDEO_PXLFMT_YUV420; } - - vproc_out_pxlfmt = vproc_out.pxlfmt; + else{ + vproc_out_pxlfmt = vproc_out.pxlfmt; + } } - if ((ret = hd_videoenc_init()) != HD_OK){ + ret = hd_videoenc_init(); + if (ret != HD_OK && ret != HD_ERR_UNINIT){ DBG_ERR("hd_videoenc_init failed (%d)\r\n", ret); goto EXIT; } @@ -350,7 +470,7 @@ INT32 PhotoFast_SliceEncode_Open(const HD_PATH_ID vproc_path_id) /* calculate max buffer for slice */ info->yuv_buf_mem_info.blk_size = PhotoFast_SliceEncode_Get_Max_Dst_Slice_Buffer_Size(vproc_out_pxlfmt); - if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&max_info) != E_OK) + if(PhotoFast_SliceEncode_Get_Max_Dst_Slice_Info(&max_info) != E_OK) goto EXIT; bitrate = PhotoFast_SliceEncode_Get_Encode_Max_Bitrate(vproc_out_pxlfmt); @@ -570,99 +690,101 @@ static INT32 PhotoFast_SliceEncode_Get_Enc_Buffer_Info(const HD_PATH_ID enc_path } static INT32 PhotoFast_SliceEncode_Init_VF_GFX_Slice( - VF_GFX_SCALE* vf_gfx_scale_param, - const HD_VIDEO_FRAME* video_frame, - const PhotoFast_MEM_Info dst_buffer_info, - const PhotoFast_SliceSize_Info src_slice_info, - const PhotoFast_SliceSize_Info dst_slice_info, - const UINT8 slice_idx) + VF_GFX_SCALE* vf_gfx_scale_param, + const HD_VIDEO_FRAME* video_frame, + const PhotoFast_MEM_Info dst_buffer_info, + const PhotoFast_SliceSize_Info src_slice_info, + const PhotoFast_SliceSize_Info dst_slice_info, + const UINT8 slice_idx) { - HD_RESULT ret; - UINT32 addr_src[HD_VIDEO_MAX_PLANE] = {0}; - UINT32 addr_dst[HD_VIDEO_MAX_PLANE] = {0}; - UINT32 loff_src[HD_VIDEO_MAX_PLANE] = {0}; - UINT32 loff_dst[HD_VIDEO_MAX_PLANE] = {0}; - UINT32 offset; - UINT32 scr_slice_height = (slice_idx == (src_slice_info.slice_num - 1)) ? src_slice_info.last_slice_height : src_slice_info.slice_height; - UINT32 dst_slice_height = (slice_idx == (dst_slice_info.slice_num - 1)) ? dst_slice_info.last_slice_height : dst_slice_info.slice_height; - UINT32 dst_scale_slice_height = (slice_idx == (dst_slice_info.slice_num - 1)) ? (src_slice_info.last_slice_height * dst_slice_info.slice_height / src_slice_info.slice_height) : dst_slice_info.slice_height; + HD_RESULT ret; + UINT32 addr_src[HD_VIDEO_MAX_PLANE] = {0}; + UINT32 addr_dst[HD_VIDEO_MAX_PLANE] = {0}; + UINT32 loff_src[HD_VIDEO_MAX_PLANE] = {0}; + UINT32 loff_dst[HD_VIDEO_MAX_PLANE] = {0}; + UINT32 offset; + UINT32 scr_slice_height = (slice_idx == (src_slice_info.slice_num - 1)) ? src_slice_info.last_slice_height : src_slice_info.slice_height; + UINT32 dst_slice_height = (slice_idx == (dst_slice_info.slice_num - 1)) ? dst_slice_info.last_slice_height : dst_slice_info.slice_height; + UINT32 dst_scale_slice_height = (slice_idx == (dst_slice_info.slice_num - 1)) ? (src_slice_info.last_slice_height * dst_slice_info.slice_height / src_slice_info.slice_height) : dst_slice_info.slice_height; - /* dst img */ - addr_dst[0] = dst_buffer_info.pa; - loff_dst[0] = dst_slice_info.width; - addr_dst[1] = addr_dst[0] + loff_dst[0] * dst_slice_height; - loff_dst[1] = dst_slice_info.width; - ret = vf_init_ex(&vf_gfx_scale_param->dst_img, dst_slice_info.width, dst_slice_height, video_frame->pxlfmt, loff_dst, addr_dst); - if (ret != HD_OK) { - DBG_ERR("vf_init_ex dst failed(%d)\r\n", ret); - return E_SYS; - } + /* dst img */ + addr_dst[0] = dst_buffer_info.pa; + loff_dst[0] = dst_slice_info.width; + addr_dst[1] = addr_dst[0] + loff_dst[0] * dst_slice_height; + loff_dst[1] = dst_slice_info.width; + ret = vf_init_ex(&vf_gfx_scale_param->dst_img, dst_slice_info.width, dst_slice_height, video_frame->pxlfmt, loff_dst, addr_dst); + if (ret != HD_OK) { + DBG_ERR("vf_init_ex dst failed(%d)\r\n", ret); + return E_SYS; + } - vf_gfx_scale_param->engine = 0; - vf_gfx_scale_param->src_region.x = 0; - vf_gfx_scale_param->src_region.y = 0; - vf_gfx_scale_param->src_region.w = src_slice_info.width; - vf_gfx_scale_param->src_region.h = scr_slice_height; - vf_gfx_scale_param->dst_region.x = 0; - vf_gfx_scale_param->dst_region.y = 0; - vf_gfx_scale_param->dst_region.w = dst_slice_info.width; - vf_gfx_scale_param->dst_region.h = dst_scale_slice_height; - vf_gfx_scale_param->dst_img.blk = dst_buffer_info.blk; - vf_gfx_scale_param->quality = HD_GFX_SCALE_QUALITY_NULL; + vf_gfx_scale_param->engine = 0; + vf_gfx_scale_param->src_region.x = 0; + vf_gfx_scale_param->src_region.y = 0; + vf_gfx_scale_param->src_region.w = src_slice_info.width; + vf_gfx_scale_param->src_region.h = scr_slice_height; + vf_gfx_scale_param->dst_region.x = 0; + vf_gfx_scale_param->dst_region.y = 0; + vf_gfx_scale_param->dst_region.w = dst_slice_info.width; + vf_gfx_scale_param->dst_region.h = dst_scale_slice_height; + vf_gfx_scale_param->dst_img.blk = dst_buffer_info.blk; + vf_gfx_scale_param->quality = HD_GFX_SCALE_QUALITY_NULL; - offset = video_frame->loff[HD_VIDEO_PINDEX_Y] * slice_idx * src_slice_info.slice_height; + offset = video_frame->loff[HD_VIDEO_PINDEX_Y] * slice_idx * src_slice_info.slice_height; - addr_src[0] = video_frame->phy_addr[HD_VIDEO_PINDEX_Y] + offset; - addr_src[1] = video_frame->phy_addr[HD_VIDEO_PINDEX_UV] + offset/2; + addr_src[0] = video_frame->phy_addr[HD_VIDEO_PINDEX_Y] + offset; + addr_src[1] = video_frame->phy_addr[HD_VIDEO_PINDEX_UV] + offset/2; loff_src[0] = video_frame->loff[HD_VIDEO_PINDEX_Y]; loff_src[1] = video_frame->loff[HD_VIDEO_PINDEX_UV]; - if ((ret = vf_init_ex(&vf_gfx_scale_param->src_img, src_slice_info.width, scr_slice_height, video_frame->pxlfmt, loff_src, addr_src)) != HD_OK) { - DBG_ERR("vf_init_ex dst failed(%d)\r\n", ret); - return E_SYS; - } + if ((ret = vf_init_ex(&vf_gfx_scale_param->src_img, src_slice_info.width, scr_slice_height, video_frame->pxlfmt, loff_src, addr_src)) != HD_OK) { + DBG_ERR("vf_init_ex dst failed(%d)\r\n", ret); + return E_SYS; + } - PHOTOFAST_SLICE_ENC_DUMP("[Slice %lu] src dim{%lu, %lu} src region{%lu, %lu, %lu, %lu} addr{y:%lx uv:%lx}\r\n", - slice_idx, - vf_gfx_scale_param->src_img.dim.w, - vf_gfx_scale_param->src_img.dim.h, - vf_gfx_scale_param->src_region.x, - vf_gfx_scale_param->src_region.y, - vf_gfx_scale_param->src_region.w, - vf_gfx_scale_param->src_region.h, - addr_src[0], addr_src[1] - ); + PHOTOFAST_SLICE_ENC_DUMP("[Slice %lu] src dim{%lu, %lu} src region{%lu, %lu, %lu, %lu} addr{y:%lx uv:%lx}\r\n", + slice_idx, + vf_gfx_scale_param->src_img.dim.w, + vf_gfx_scale_param->src_img.dim.h, + vf_gfx_scale_param->src_region.x, + vf_gfx_scale_param->src_region.y, + vf_gfx_scale_param->src_region.w, + vf_gfx_scale_param->src_region.h, + addr_src[0], addr_src[1] + ); - PHOTOFAST_SLICE_ENC_DUMP("[Slice %lu] dst dim{%lu, %lu} dst region{%lu, %lu, %lu, %lu} addr{y:%lx uv:%lx}\r\n", - slice_idx, - vf_gfx_scale_param->dst_img.dim.w, - vf_gfx_scale_param->dst_img.dim.h, - vf_gfx_scale_param->dst_region.x, - vf_gfx_scale_param->dst_region.y, - vf_gfx_scale_param->dst_region.w, - vf_gfx_scale_param->dst_region.h, - addr_dst[0], addr_dst[1] - ); + PHOTOFAST_SLICE_ENC_DUMP("[Slice %lu] dst dim{%lu, %lu} dst region{%lu, %lu, %lu, %lu} addr{y:%lx uv:%lx}\r\n", + slice_idx, + vf_gfx_scale_param->dst_img.dim.w, + vf_gfx_scale_param->dst_img.dim.h, + vf_gfx_scale_param->dst_region.x, + vf_gfx_scale_param->dst_region.y, + vf_gfx_scale_param->dst_region.w, + vf_gfx_scale_param->dst_region.h, + addr_dst[0], addr_dst[1] + ); - if(slice_idx == (dst_slice_info.slice_num - 1)){ + if(slice_idx == (dst_slice_info.slice_num - 1) && + dst_scale_slice_height < dst_slice_info.last_slice_height + ){ - HD_GFX_DRAW_RECT draw_rect = {0}; + HD_GFX_DRAW_RECT draw_rect = {0}; - draw_rect.dst_img.dim = vf_gfx_scale_param->dst_img.dim; - draw_rect.dst_img.ddr_id = vf_gfx_scale_param->dst_img.ddr_id; - draw_rect.dst_img.format = vf_gfx_scale_param->dst_img.pxlfmt; - draw_rect.dst_img.p_phy_addr[0] = vf_gfx_scale_param->dst_img.phy_addr[0]; - draw_rect.dst_img.p_phy_addr[1] = vf_gfx_scale_param->dst_img.phy_addr[1]; - draw_rect.dst_img.lineoffset[0] = vf_gfx_scale_param->dst_img.loff[0]; - draw_rect.dst_img.lineoffset[1] = vf_gfx_scale_param->dst_img.loff[1]; + draw_rect.dst_img.dim = vf_gfx_scale_param->dst_img.dim; + draw_rect.dst_img.ddr_id = vf_gfx_scale_param->dst_img.ddr_id; + draw_rect.dst_img.format = vf_gfx_scale_param->dst_img.pxlfmt; + draw_rect.dst_img.p_phy_addr[0] = vf_gfx_scale_param->dst_img.phy_addr[0]; + draw_rect.dst_img.p_phy_addr[1] = vf_gfx_scale_param->dst_img.phy_addr[1]; + draw_rect.dst_img.lineoffset[0] = vf_gfx_scale_param->dst_img.loff[0]; + draw_rect.dst_img.lineoffset[1] = vf_gfx_scale_param->dst_img.loff[1]; draw_rect.color = LV_USER_CFG_STAMP_COLOR_BACKGROUND; - draw_rect.thickness = 1; - draw_rect.type = HD_GFX_RECT_SOLID; - draw_rect.rect = (HD_IRECT){0, 0, vf_gfx_scale_param->dst_img.dim.w, vf_gfx_scale_param->dst_img.dim.h}; - hd_gfx_draw_rect(&draw_rect); - } + draw_rect.thickness = 1; + draw_rect.type = HD_GFX_RECT_SOLID; + draw_rect.rect = (HD_IRECT){0, 0, vf_gfx_scale_param->dst_img.dim.w, vf_gfx_scale_param->dst_img.dim.h}; + hd_gfx_draw_rect(&draw_rect); + } - return E_OK; + return E_OK; } #if 1//PHOTOFAST_SLICE_ENC_DBG_PRIMARY_YUV @@ -1116,7 +1238,7 @@ EXIT: DBG_ERR("hd_videoenc_stop failed(%d)\r\n", ret); } - return (ret == HD_OK) ? E_OK : E_SYS; + return (ret == HD_OK) ? E_OK : ret; } @@ -1196,7 +1318,6 @@ static INT32 PhotoFast_SliceEncode_Encode_Primary( dst_slice_info, slice_idx); - if(vf_gfx_scale(&vf_gfx_scale_param, 1) != HD_OK){ goto EXIT; } @@ -1427,15 +1548,18 @@ INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME ret = hd_videoproc_get(vproc_path_id, HD_VIDEOPROC_PARAM_OUT, (VOID*)&vproc_out); if(ret != HD_OK){ DBG_ERR("hd_videoproc_get HD_VIDEOPROC_PARAM_OUT failed(path_id=%lx, ret=%d)!", vproc_path_id, ret); - goto EXIT; + vproc_out_pxlfmt = HD_VIDEO_PXLFMT_YUV420; + } + else{ + vproc_out_pxlfmt = vproc_out.pxlfmt; } - vproc_out_pxlfmt = vproc_out.pxlfmt; + /******************************************************************* * Calculate dst slice info ******************************************************************/ - if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&dst_slice_info) != E_OK){ + if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&dst_slice_info, video_frame) != E_OK){ return NVTEVT_CONSUME; } @@ -1482,11 +1606,12 @@ INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME } // slice_encode_primary_info->bs_buf_mem_info.blk_size = (VDO_YUV_BUFSIZE(dst_slice_info.width, dst_slice_info.height, video_frame.pxlfmt) / (CFG_PHOTOFAST_SLICE_ENC_BS_BUF_RATIO)) + CFG_JPG_HEADER_SIZE + PhotoFast_GetScreenNailSize() ; - slice_encode_primary_info->bs_buf_mem_info.blk_size = ((PhotoFast_SliceEncode_Get_Encode_Max_Bitrate(HD_VIDEO_PXLFMT_YUV420)/ 8) * (dst_slice_info.slice_num + 2)) + CFG_JPG_HEADER_SIZE + PhotoFast_GetScreenNailSize() ; + slice_encode_primary_info->bs_buf_mem_info.blk_size = ((PhotoFast_SliceEncode_Get_Encode_Max_Bitrate(HD_VIDEO_PXLFMT_YUV420)/ 8) * (dst_slice_info.slice_num + 1)) + CFG_JPG_HEADER_SIZE + PhotoFast_GetScreenNailSize() ; if(PhotoFast_SliceEncode_Alloc_Buffer(&slice_encode_primary_info->bs_buf_mem_info, "slice_enc_primary") != E_OK){ goto EXIT; } - + + PhotoFastCapDateImprint_GenYuvData(&video_frame); /* check free mem */ #if POWERON_FAST_BOOT_MSG == ENABLE nvt_cmdsys_runcmd("nvtmpp info"); @@ -1617,7 +1742,7 @@ INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME DBG_DUMP("elapsed time of slice encode without write file = %lu us\n", tick_end - tick_start); - extern INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId); + extern INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId, char* path); if(fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ @@ -1632,6 +1757,7 @@ INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME dst_jpg_file.addr, dst_jpg_file.size, NAMERULE_FMT_JPG, + 0, 0); EXIT: @@ -1740,6 +1866,12 @@ typedef struct { PhotoFast_MEM_Info mem_info_combined; PhotoFast_MEM_Info mem_info_thumb; PhotoFast_SliceEncode_Queue_Comm_Param comm; + +#if PHOTOFAST_FAST_CLOSE + char file_path[NMC_TOTALFILEPATH_MAX_LEN]; + UINT32 nextFolderID; + UINT32 nextFileID; +#endif } PhotoFast_SliceEncode_Queue23_Param; typedef struct { @@ -1841,17 +1973,11 @@ INT32 PhotoFast_SliceEncode_CB2(void* user_data) hd_ret = hd_videoproc_get(vproc_path_id, HD_VIDEOPROC_PARAM_OUT, (VOID*)&vproc_out); if(hd_ret != HD_OK){ DBG_ERR("hd_videoproc_get HD_VIDEOPROC_PARAM_OUT failed(path_id=%lx, ret=%d)!", vproc_path_id, ret); - goto EXIT; - } - - vproc_out_pxlfmt = vproc_out.pxlfmt; - - /******************************************************************* - * Calculate dst slice info - ******************************************************************/ - if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&dst_slice_info) != E_OK){ - return NVTEVT_CONSUME; + vproc_out_pxlfmt = HD_VIDEO_PXLFMT_YUV420; } + else{ + vproc_out_pxlfmt = vproc_out.pxlfmt; + } /* pull out vprc frame is in the CB1 */ @@ -1894,7 +2020,21 @@ INT32 PhotoFast_SliceEncode_CB2(void* user_data) goto EXIT; } - DBG_IND("process frame %lu\n", param->cnt); + DBG_DUMP("process frame %lu\n", param->cnt); + + /******************************************************************* + * Fast Stamp (higher speed, lower quality) + ******************************************************************/ +#if PHOTOFAST_FAST_STAMP + PhotoFastCapDateImprint_GenYuvData(&queue_ele_in->frame); +#endif + + /******************************************************************* + * Calculate dst slice info + ******************************************************************/ + if(PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(&dst_slice_info, queue_ele_in->frame) != E_OK){ + goto EXIT; + } /******************************************************************* * Calculate src slice info @@ -1921,13 +2061,6 @@ INT32 PhotoFast_SliceEncode_CB2(void* user_data) goto EXIT; } - /******************************************************************* - * Fast Stamp (higher speed, lower quality) - ******************************************************************/ -#if PHOTOFAST_FAST_STAMP - PhotoFastCapDateImprint_GenYuvData(&queue_ele_in->frame); -#endif - /******************************************************************* * Screennail & Thumbnail Scale ******************************************************************/ @@ -2041,6 +2174,16 @@ INT32 PhotoFast_SliceEncode_CB2(void* user_data) queue_ele_out->mem_info_combined = slice_encode_primary_info->bs_buf_mem_info; queue_ele_out->mem_info_thumb = slice_encode_screennail_info->bs_buf_mem_info; +#if PHOTOFAST_FAST_CLOSE + UINT32 nextFolderID = 0, nextFileID = 0; + DCF_GetNextID(&nextFolderID,&nextFileID); + queue_ele_out->nextFolderID = nextFolderID; + queue_ele_out->nextFileID = nextFileID; + DCF_MakeObjPath(nextFolderID, nextFileID, DCF_FILE_TYPE_JPG, queue_ele_out->file_path); + DCF_AddDBfile(queue_ele_out->file_path); + DBG_DUMP("%s added to DCF\r\n", queue_ele_out->file_path); +#endif + while (lfqueue_enq(param->queue23, (void*) queue_ele_out) == -1) { DBG_ERR("ENQ Full ?\r\n"); @@ -2125,7 +2268,7 @@ INT32 PhotoFast_SliceEncode_CB3(void* user_data) /******************************************************************* * Output jpg file ******************************************************************/ - extern INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId); + extern INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId, char* Path); if(fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ goto EXIT; @@ -2135,17 +2278,40 @@ INT32 PhotoFast_SliceEncode_CB3(void* user_data) goto EXIT; } +#if !PHOTOFAST_FAST_CLOSE PhotoFast_WriteFile( (UINT32)queue_ele_in->jpg_combined_addr, queue_ele_in->jpg_combined_size, NAMERULE_FMT_JPG, + 0, 0); - +#else + PhotoFast_WriteFile( + (UINT32)queue_ele_in->jpg_combined_addr, + queue_ele_in->jpg_combined_size, + NAMERULE_FMT_JPG, + 0, + queue_ele_in->file_path); +#endif { - extern CHAR* PhotoFast_GetLastWriteFilePath(void); - char* file_path = PhotoFast_GetLastWriteFilePath(); - char tmp[256] = {'\0'}; + char tmp[NMC_TOTALFILEPATH_MAX_LEN] = {'\0'}; + + #if !PHOTOFAST_FAST_CLOSE + extern CHAR* PhotoFast_GetLastWriteFilePath(void); + char* file_path = PhotoFast_GetLastWriteFilePath(); + #else + char file_path[NMC_TOTALFILEPATH_MAX_LEN]; + + #if HUNTING_CAMERA_MCU == ENABLE + sprintf(tmp, "W%03ld%04ld.JPG", queue_ele_in->nextFolderID, queue_ele_in->nextFileID); + strncpy(file_path, tmp, strlen(queue_ele_in->file_path) - 1); + DBG_IND("last send file:%s\r\n", file_path); + #else + strncpy(file_path, FilePath, strlen(queue_ele_in->file_path) - 1); + #endif + #endif + #if HUNTING_CAMERA_MCU == ENABLE char tmp2[64] = {'\0'}; #endif diff --git a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.h b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.h index bb8ef619d..dbd85a1fa 100644 --- a/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.h +++ b/rtos/code/application/source/cardv/SrcCode/UIApp/PhotoFast/PhotoFastSliceEncode.h @@ -31,7 +31,7 @@ typedef struct INT32 PhotoFast_SliceEncode_Open(const HD_PATH_ID vproc_path_id); INT32 PhotoFast_SliceEncode_Close(void); INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME *p_video_frame); -INT32 PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(PhotoFast_SliceSize_Info *info); +INT32 PhotoFast_SliceEncode_Get_Curr_Dst_Slice_Info(PhotoFast_SliceSize_Info *info, const HD_VIDEO_FRAME src_frame); INT32 PhotoFast_SliceEncode_Get_Max_Dst_Slice_Buffer_Size(HD_VIDEO_PXLFMT pxl_fmt); #if POWERON_FAST_SLICE_ENC_VER2 == ENABLE From 716e19b4ca3185b83effeca060464fbef5d8c274 Mon Sep 17 00:00:00 2001 From: payton Date: Tue, 12 Sep 2023 11:23:05 +0800 Subject: [PATCH 4/7] =?UTF-8?q?1.=E4=BC=98=E5=8C=96linuxtmp=E8=A7=A3?= =?UTF-8?q?=E5=8E=8B=E5=90=8E=E5=88=A4=E6=96=AD=E5=A4=84=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E5=BD=93=E8=B6=85=E5=87=BA=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/source/cardv/SrcCode/System/sys_linuxboot.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rtos/code/application/source/cardv/SrcCode/System/sys_linuxboot.c b/rtos/code/application/source/cardv/SrcCode/System/sys_linuxboot.c index 4b5dd82de..be3feb732 100755 --- a/rtos/code/application/source/cardv/SrcCode/System/sys_linuxboot.c +++ b/rtos/code/application/source/cardv/SrcCode/System/sys_linuxboot.c @@ -882,6 +882,12 @@ static int load_linux_from_flash(LINUXTMP_PARTITION *p_linuxtmp, FDT_INFO *p_fdt LINUX_BOOT_MSG("*linuxtmp used size = %lx , linux compressed / uncompressed size = %lx / %lx ******\n", p_linuxtmp->tmp_curr - p_linuxtmp->tmp_begin, fastload.MemComp.size, fastload.MemUnComp.size); + if(p_linuxtmp->tmp_curr > p_fdt_info->hdal_addr){ + DBG_ERR("linux tmp buffer overflow(curr:%lx), hdal media buffer(%lx) may be corrupted!!\n", p_linuxtmp->tmp_curr, p_fdt_info->hdal_addr); + vos_util_delay_ms(100); // add delay to show dbg_fatal message in linux + vos_debug_halt(); + } + cmd.Idx = FWSRV_CMD_IDX_FASTLOAD; cmd.In.pData = &fastload; cmd.In.uiNumByte = sizeof(fastload); From abeb8975d7212b1bce3dd103a7bc8c1717d9b820 Mon Sep 17 00:00:00 2001 From: alisa Date: Tue, 12 Sep 2023 22:58:26 +0800 Subject: [PATCH 5/7] =?UTF-8?q?[=E4=B8=9A=E5=8A=A1]1.=E8=B0=83=E8=AF=95=20?= =?UTF-8?q?E-sim=E7=9A=84=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../source/sf_app/code/include/sf_eg91_gps.h | 1 - .../code/source/4gMng/sf_4G_auto_operation.c | 2 +- .../sf_app/code/source/4gMng/sf_eg91_gps.c | 3 ++- .../sf_app/code/source/4gMng/sf_eg91_sim.c | 17 ++++++++++++++--- .../sf_app/code/source/4gMng/sf_opera_adapt.c | 2 +- .../source/sf_app/code/source/app/sf_app.c | 2 +- 6 files changed, 19 insertions(+), 8 deletions(-) mode change 100644 => 100755 code/application/source/sf_app/code/include/sf_eg91_gps.h mode change 100644 => 100755 code/application/source/sf_app/code/source/4gMng/sf_4G_auto_operation.c mode change 100644 => 100755 code/application/source/sf_app/code/source/4gMng/sf_eg91_gps.c mode change 100644 => 100755 code/application/source/sf_app/code/source/4gMng/sf_opera_adapt.c diff --git a/code/application/source/sf_app/code/include/sf_eg91_gps.h b/code/application/source/sf_app/code/include/sf_eg91_gps.h old mode 100644 new mode 100755 index 179b02b1f..d0a1eb2e1 --- a/code/application/source/sf_app/code/include/sf_eg91_gps.h +++ b/code/application/source/sf_app/code/include/sf_eg91_gps.h @@ -62,7 +62,6 @@ SINT32 eg91_gps_search(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime,UINT8 au SINT32 eg91_gps_Isupdate(SF_FN_PARAM_S *pfnParam,UINT8 *pIsupdate,SF_PARA_TIME_S *pNowTime,UINT8 u8day); - #ifdef __cplusplus #if __cplusplus } diff --git a/code/application/source/sf_app/code/source/4gMng/sf_4G_auto_operation.c b/code/application/source/sf_app/code/source/4gMng/sf_4G_auto_operation.c old mode 100644 new mode 100755 index 21773354f..b95e4342d --- a/code/application/source/sf_app/code/source/4gMng/sf_4G_auto_operation.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_4G_auto_operation.c @@ -66,7 +66,7 @@ UINT32 sf_auto_operation_adjust(void) } else if((SF_STRNCMP(puiPara->OperatorCode, "46003", 5) == 0) || (SF_STRNCMP(puiPara->OperatorCode, "46005", 5) == 0) || (SF_STRNCMP(puiPara->OperatorCode, "46011", 5) == 0))//china Telecom { - SF_STRCPY(puiPara->Sim4gApn, "CTNET"); + SF_STRCPY(puiPara->Sim4gApn, "vzwinternet"); SF_STRCPY(puiPara->Sim4gUsr, "\0"); SF_STRCPY(puiPara->Sim4gPwd, "\0"); diff --git a/code/application/source/sf_app/code/source/4gMng/sf_eg91_gps.c b/code/application/source/sf_app/code/source/4gMng/sf_eg91_gps.c old mode 100644 new mode 100755 index 37e46d85c..87a8ad30c --- a/code/application/source/sf_app/code/source/4gMng/sf_eg91_gps.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_eg91_gps.c @@ -14,6 +14,7 @@ #include "sf_hal_ttyusb.h" #include "sf_eg91_server.h" #include "sf_eg91_gps.h" +#include "sf_eg91_sim.h" #include "sf_param_common.h" #include "sf_module.h" @@ -63,6 +64,7 @@ static void gps_infor_convert(SF_CHAR *str) memcpy(str, strTemp, 4); } + SINT32 eg91_gps_greendate_Get(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime) { SINT32 ttyRet = SF_SUCCESS; @@ -311,7 +313,6 @@ SINT32 eg91_gps_greendate_Get(SF_FN_PARAM_S *pfnParam,SF_PARA_TIME_S *pNowTime) } return ret; } - SINT32 eg91_gps_Isupdate(SF_FN_PARAM_S *pfnParam,UINT8 *pIsupdate,SF_PARA_TIME_S *pNowTime,UINT8 u8day) { diff --git a/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c b/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c index d1ac9e8df..bdd607a2c 100755 --- a/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_eg91_sim.c @@ -3417,7 +3417,13 @@ SINT32 sf_net_regist_manual(void) } else { - sprintf((char *)gsmPara, "AT+RSTSET\r"); + //sprintf((char *)gsmPara, "AT+RSTSET\r"); + //sprintf((char *)gsmPara, "AT+CGREG?\r"); + //eNetRegLocation = QUECTEL_NETREG_CGREG; + //callTime = SF_QUECTEL_NET_REG_CALLTIME_MAX; /*4 min*/ + sprintf((char *)gsmPara, "%s", "AT+CGDCONT=1,\"IPV4V6\",\"\"\r"); + eNetRegLocation = QUECTEL_NETREG_CGDCONT; + } } else @@ -3477,6 +3483,9 @@ SINT32 sf_net_regist_manual(void) if(ret == SF_SUCCESS) { eNetRegLocation = QUECTEL_NETREG_FRIST; + //sprintf((char *)gsmPara, "AT+CGREG?\r"); + //eNetRegLocation = QUECTEL_NETREG_CGREG; + //callTime = SF_QUECTEL_NET_REG_CALLTIME_MAX; } else { @@ -3513,7 +3522,7 @@ SINT32 sf_net_regist_manual(void) #if SF_TEST_ERROR_CODE sf_test_code_err(eNetRegLocation, "+CGREG: 0,2"); #endif - + SF_DEBUG("Sim4gApn=%s", puiPara->Sim4gApn); if((strstr((const char *)gsmPara, "+CGREG: 2,1") != NULL) || (strstr((const char *)gsmPara, "+CGREG: 0,1") != NULL) || (strstr((const char *)gsmPara, "+CGREG: 0,5") != NULL)) { if(PWR_ON_TIME_SYNC == sf_poweron_type_get()) @@ -4789,6 +4798,7 @@ SINT32 sf_get_ntp(SINT32 value, SF_PARA_TIME_S *current_time) UIMenuStoreInfo *pPara = sf_app_ui_para_get(); SF_TTY_DATA_TYPE_S ttyData = { .waitMs = 2000, .len = 3, .lenMax = (GPRS_INFO_LINE_MAX-1), .cmp = "OK", .cmperr = "ERROR", .data = gsmPara}; + SF_DEBUG("Sim4gApn=%s", pPara->Sim4gApn); sf_gsm_para_buff_clear(); pdpIndex = sf_get_pdp_index(); @@ -4996,7 +5006,8 @@ UINT8 sf_get_pdp_index(void) UINT8 pdpIndex = 0; UIMenuStoreInfo *pPara = sf_app_ui_para_get(); - + + SF_DEBUG("Sim4gApn=%s", pPara->Sim4gApn); if(strstr((const char *)pPara->Sim4gApn, APN_4G_VERIZON)) { pdpIndex = V_PDP_INDEX; diff --git a/code/application/source/sf_app/code/source/4gMng/sf_opera_adapt.c b/code/application/source/sf_app/code/source/4gMng/sf_opera_adapt.c old mode 100644 new mode 100755 index fbc72bfc9..fdf70f324 --- a/code/application/source/sf_app/code/source/4gMng/sf_opera_adapt.c +++ b/code/application/source/sf_app/code/source/4gMng/sf_opera_adapt.c @@ -75,7 +75,7 @@ SINT32 sf_auto_operation_adaptation(SF_CHAR *operatorName, UIMenuStoreInfo *sim_ } else if((strncmp(operatorName, "46003", 5) == 0) || (strncmp(operatorName, "46005", 5) == 0) || (strncmp(operatorName, "46011", 5) == 0))//china telcom { - strcpy(sim_info_t->Sim4gApn, "CTNET"); + strcpy(sim_info_t->Sim4gApn, "vzwinternet"); strcpy(sim_info_t->Sim4gUsr, "\0"); strcpy(sim_info_t->Sim4gPwd, "\0"); diff --git a/code/application/source/sf_app/code/source/app/sf_app.c b/code/application/source/sf_app/code/source/app/sf_app.c index 4f167fb5e..00248ee90 100755 --- a/code/application/source/sf_app/code/source/app/sf_app.c +++ b/code/application/source/sf_app/code/source/app/sf_app.c @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) { printf("*********************************************\n"); printf("* *\n"); - printf("* sf_app-v3 *\n"); + printf("* sf_app-v5-0912 *\n"); printf("* *\n"); printf("*********************************************\n"); //gpio_direction_input(C_GPIO(10)); From 5553611f59b2a266bf646ed4c3f9d6d98fcfc8e9 Mon Sep 17 00:00:00 2001 From: alisa Date: Tue, 12 Sep 2023 23:00:43 +0800 Subject: [PATCH 6/7] =?UTF-8?q?[sifar=20SDK].=E6=9B=B4=E6=96=B0sifar=20SDK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- code/application/sifarsdk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/application/sifarsdk b/code/application/sifarsdk index 16e808c3a..670d2f3fc 160000 --- a/code/application/sifarsdk +++ b/code/application/sifarsdk @@ -1 +1 @@ -Subproject commit 16e808c3a97ba4c47dd683f1daa79b4459b20202 +Subproject commit 670d2f3fc39f4803f5a72bf125c0aea7a146a100 From ad9a4b1687562dbbb78142212d3385000c3e2aa3 Mon Sep 17 00:00:00 2001 From: alisa Date: Tue, 12 Sep 2023 23:26:57 +0800 Subject: [PATCH 7/7] =?UTF-8?q?[warning]1.=E5=8E=BB=E9=99=A4=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E7=9A=84=E8=AD=A6=E5=91=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../lib/source/sifar/code/include/sf_common.h | 2 +- .../sifar/code/source/common/sf_common.c | 42 +------------------ 2 files changed, 2 insertions(+), 42 deletions(-) diff --git a/code/lib/source/sifar/code/include/sf_common.h b/code/lib/source/sifar/code/include/sf_common.h index e8e1c26d5..a0a74c4be 100755 --- a/code/lib/source/sifar/code/include/sf_common.h +++ b/code/lib/source/sifar/code/include/sf_common.h @@ -122,7 +122,7 @@ UINT32 sf_cardv_cap_start(void); UINT32 sf_cardv_hd_cap_start(void); void sf_cardv_set_wait_shared_condition(int in); int sf_cardv_para_signaling_start(void); -UINT32 sf_cardv_wifi_send(void); +void sf_cardv_wifi_send(void); void sf_set_ui_para_flag(UINT8 flag); UINT8 sf_get_ui_para_flag(void); BOOL sf_cmd_ftp_ota(unsigned char argc, char **argv); diff --git a/code/lib/source/sifar/code/source/common/sf_common.c b/code/lib/source/sifar/code/source/common/sf_common.c index d7d4c3bde..61f559fb4 100755 --- a/code/lib/source/sifar/code/source/common/sf_common.c +++ b/code/lib/source/sifar/code/source/common/sf_common.c @@ -1711,7 +1711,7 @@ void sf_cardv_wifi_send() if(SF_SUCCESS == sf_share_mem_hd_update()) { - SF_REPORT_WIFI_ATTR_S* wifiCfg = sf_wifi_cfg_get(); + //SF_REPORT_WIFI_ATTR_S* wifiCfg = sf_wifi_cfg_get(); fd = sf_get_wifi_socket(); SF_CHAR filePath[64] = { 0 }; @@ -2684,46 +2684,6 @@ UINT32 sf_cardv_hd_cap_start(void) return SF_SUCCESS; } -UINT32 sf_cardv_wifi_send(void) -{ - SINT32 fd = 0; - SINT32 sendBuffLen = 0; - SINT8 sendBuff[1024] = { 0 }; - SINT32 i = 0; - struct stat statBuf; - - if(SF_SUCCESS == sf_share_mem_hd_update()) - { - //SF_REPORT_WIFI_ATTR_S* wifiCfg = sf_wifi_cfg_get(); - fd = sf_get_wifi_socket(); - - SF_CHAR filePath[64] = { 0 }; - SINT32 fdWifi = -1; - sprintf(filePath, "/tmp/wifiData.txt"); - printf("filePath:%s\n", filePath); - - fdWifi = open(filePath, O_RDWR, 0777); - if(fdWifi >= 0) - { - fstat(fdWifi, &statBuf); - sendBuffLen = statBuf.st_size; - printf("fSize=%d\n", sendBuffLen); - read(fdWifi, sendBuff, sendBuffLen); - close(fdWifi); - - for(i = 0; i < sendBuffLen; i++) - { - printf("[%x]-", sendBuff[i]); - } - printf("\n[cardv-sendBuff-1] e\n"); - - send(fd, sendBuff, sendBuffLen, 0); - remove("/tmp/wifiData.txt"); - } - } - return 0; -} - UINT8 sf_get_ui_para_flag(void) { return UiparaFlag;