1.修改usb检测逻辑;2.增加sifar app;3.更新0412 IQ;4.增加exif信息

This commit is contained in:
payton 2023-04-12 16:26:42 +08:00
parent 302629f168
commit d28e78b4a6
62 changed files with 3876 additions and 229 deletions

View File

@ -134,10 +134,10 @@ insmod ${PREFIX}/lib/modules/$KERVER/kernel/drivers/iio/adc/nvt_adc.ko
fi
#usb
if [[ -f ${PREFIX}/lib/modules/$KERVER/hdal/comm/uvcp/nvt_uvcp.ko ]]; then
insmod ${PREFIX}/lib/modules/$KERVER/hdal/comm/uvcp/nvt_uvcp.ko
insmod ${PREFIX}/lib/modules/$KERVER/hdal/comm/usb2dev/nvt_usb2dev.ko
fi
#if [[ -f ${PREFIX}/lib/modules/$KERVER/hdal/comm/uvcp/nvt_uvcp.ko ]]; then
#insmod ${PREFIX}/lib/modules/$KERVER/hdal/comm/uvcp/nvt_uvcp.ko
#insmod ${PREFIX}/lib/modules/$KERVER/hdal/comm/usb2dev/nvt_usb2dev.ko
#fi
#insmod ${PREFIX}/lib/modules/$KERVER/kernel/drivers/usb/ehci-hcd.ko

View File

@ -68,7 +68,7 @@ C_LDFLAGS = \
LDSCRIPT = $(MODULE_NAME).lds
LDS_EXTERN = extern.lds
OUTPUT_NAME = $(OUTPUT_DIR)/cardv
OUTPUT2_NAME = $(OUTPUT_DIR)/sifar_app
#OUTPUT2_NAME = $(OUTPUT_DIR)/sf_app
IMG_NAME = $(OUTPUT_DIR)/$(MODULE_NAME).img
MAP_NAME = $(OUTPUT_DIR)/$(MODULE_NAME).map
SYM_NAME = $(OUTPUT_DIR)/$(MODULE_NAME).sym
@ -256,7 +256,7 @@ endif
#######################################################################################
OBJ = $(SRC:.c=.o) $(ASM:.S=.o) $(CPP_SRC:.cpp=.o) $(DTS_SENSOR:.dts=.o)
all: $(OUTPUT_NAME) $(DTS_SENSOR:.dts=.dtb) $(OUTPUT_APPFS) $(OUTPUT2_NAME)
all: $(OUTPUT_NAME) $(DTS_SENSOR:.dts=.dtb) $(OUTPUT_APPFS)
$(APPFS_DIR): $(DTS_APP:.dts=.dtb)
@echo creating $@
@ -320,17 +320,17 @@ $(OUTPUT_NAME): $(IMG_NAME)
$(STRIP) $< && \
$(OBJCOPY) -R .comment -R .note.ABI-tag -R .gnu.version $< $@
$(OUTPUT2_NAME) : sifar_app
@echo Creating executable $@ ... && \
$(STRIP) $< && \
$(OBJCOPY) -R .comment -R .note.ABI-tag -R .gnu.version $< $@
#$(OUTPUT2_NAME) : sifar_app
# @echo Creating executable $@ ... && \
# $(STRIP) $< && \
# $(OBJCOPY) -R .comment -R .note.ABI-tag -R .gnu.version $< $@
APP2_SRC = ./SrcCode/Startup/sifar_app.c
#APP2_SRC = ./SrcCode/Startup/sifar_app.c
sifar_app: $(APP2_SRC)
@echo Compiling "sifar_app" && \
$(CC) $(C_CFLAGS) -c $(APP2_SRC) -o $(APP2_SRC:.c=.o) && \
$(COLLECT2) -o $@ $(APP2_SRC:.c=.o) $(C_LDFLAGS)
#sifar_app: $(APP2_SRC)
# @echo Compiling "sifar_app" && \
# $(CC) $(C_CFLAGS) -c $(APP2_SRC) -o $(APP2_SRC:.c=.o) && \
# $(COLLECT2) -o $@ $(APP2_SRC:.c=.o) $(C_LDFLAGS)
# inline warning should be ignored with some LVGL static inline functions(e.g. lv_color_mix_with_alpha)
%/fbdev.o: %/fbdev.c
@ -368,13 +368,13 @@ cim: $(DTB) $(OBJ)
clean:
@rm -rf $(OBJ) $(MAIN_C:.c=.o) $(LDS_EXTERN) $(DTB) $(OUTPUT_DIR)
install: $(OUTPUT_NAME) $(OUTPUT_APPFS) $(OUTPUT2_NAME)
install: $(OUTPUT_NAME) $(OUTPUT_APPFS)
@mkdir -p $(INSTALL_DIR)
@cp -avf $(OUTPUT_NAME) $(INSTALL_DIR)
@cp -avf $(OUTPUT_NAME) $(ROOTFS_DIR)/rootfs/usr/bin
@cp -avf $(OUTPUT_APPFS) $(LINUX_BUILD_TOP)/output
@cp -avf $(OUTPUT2_NAME) $(INSTALL_DIR)
@cp -avf $(OUTPUT2_NAME) $(ROOTFS_DIR)/rootfs/usr/bin
# @cp -avf $(OUTPUT2_NAME) $(INSTALL_DIR)
# @cp -avf $(OUTPUT2_NAME) $(ROOTFS_DIR)/rootfs/usr/bin
dasm: $(IMG_NAME)
@echo Disassembly $< to $(DASM_NAME)... \

View File

@ -14,6 +14,7 @@
#include "DxUSB.h"
#include "DxCommon.h"
#include "DxApi.h"
#include "io/gpio.h"
///////////////////////////////////////////////////////////////////////////////
#define __MODULE__ DxUSB
@ -31,6 +32,8 @@ UINT32 DetUSBState(UINT32 StateID, UINT32 Value); // General Properties
UINT32 DetUSBControl(UINT32 CtrlID, UINT32 Param1, UINT32 Param2); // General Methods
UINT32 DetUSBCommand(CHAR *pcCmdStr); //General Command Console
#define GPIO_VBUS D_GPIO_7
//dx object
DX_OBJECT gDevUSB = {
DXFLAG_SIGN,
@ -49,9 +52,21 @@ DX_OBJECT gDevUSB = {
0,
};
static BOOL _DxUSB_get_vbus(void)
{
gpio_setDir(GPIO_VBUS, GPIO_DIR_INPUT);
return (BOOL)gpio_getPin(GPIO_VBUS);
}
static BOOL DxUSB_GetIsUSBPlug(void)
{
#if 0
return (usb2dev_state_change());
#else
return _DxUSB_get_vbus();
#endif
}
static UINT32 DxUSB_UpdateConnectType(void)

View File

@ -1,9 +1,9 @@
/ {
isp {
sensor@0 {
ae_path = "/isp/ae/gc5603_ae_0";
awb_path = "/isp/awb/gc5603_awb_0";
iq_path = "/isp/iq/gc5603_iq_0";
ae_path = "/isp/ae/os05b10_ae_0";
awb_path = "/isp/awb/os05b10_awb_0";
iq_path = "/isp/iq/os05b10_iq_0";
#iq_cap_path = "/isp/iq/gc5603_iq_0_cap";
#iq_shading_path = "/isp/iq/gc5603_iq_shading_0";
};
@ -24,7 +24,7 @@
};
/* Note: put include files in the tail since label should be declared first. */
#include "gc5603_ae_0.dtsi"
#include "gc5603_awb_0.dtsi"
#include "gc5603_iq_0.dtsi"
#include "os05b10_ae_0.dtsi"
#include "os05b10_awb_0.dtsi"
#include "os05b10_iq_0.dtsi"

View File

@ -14,7 +14,7 @@
#include "PrjInc.h"
#include "GxUSB.h"
#include "UsbDevDef.h"
#include "usb2dev.h"
#define THIS_DBGLVL 2 // 0=FATAL, 1=ERR, 2=WRN, 3=UNIT, 4=FUNC, 5=IND, 6=MSG, 7=VALUE, 8=USER
///////////////////////////////////////////////////////////////////////////////
#define __MODULE__ SysUsbExe
@ -23,6 +23,158 @@
#include <kwrap/debug.h>
///////////////////////////////////////////////////////////////////////////////
static char driver_path_prefix[] = "/lib/modules/4.19.91";
static char* usb_host_drivers[] = {
"kernel/drivers/usb/common/usb-common.ko",
"kernel/drivers/usb/core/usbcore.ko",
"kernel/drivers/usb/host/ehci-hcd.ko",
"kernel/drivers/net/mii.ko",
"kernel/drivers/net/usb/usbnet.ko",
"kernel/drivers/usb/serial/usbserial.ko",
"kernel/drivers/usb/serial/usb_wwan.ko",
"kernel/drivers/usb/serial/option.ko",
"kernel/drivers/net/usb/cdc_ether.ko",
"kernel/drivers/usb/class/cdc-wdm.ko",
"kernel/drivers/net/usb/qmi_wwan.ko",
"extra/net/GobiNet/drv_gobi_net.ko",
NULL
};
static char* usb_dev_drivers[] = {
"hdal/comm/uvcp/nvt_uvcp.ko",
"hdal/comm/usb2dev/nvt_usb2dev.ko",
NULL
};
static BOOL is_usb_host_driver_inserted = FALSE;
static BOOL is_usb_dev_driver_inserted = FALSE;
static BOOL System_WaitUsbDev(void)
{
int exit_code = -1;
BOOL ret;
UINT8 cnt = 0;
UINT8 timeout = 100;
do{
exit_code = system("ls /dev/nvt_usb2dev0");
if(exit_code == 0)
break;
vos_util_delay_ms(10);
} while(cnt < timeout);
if(exit_code == 0)
ret = TRUE;
else
ret = FALSE;
usb2dev_state_change();
return ret;
}
static BOOL System_InsmodUsb(BOOL isHost)
{
char** usb_drivers = NULL;
char* driver_path = NULL;
UINT8 cnt = 0;
char cmd[256] = {'\0'};
if(isHost){
if(is_usb_host_driver_inserted == TRUE)
return TRUE;
usb_drivers = usb_host_drivers;
}
else{
if(is_usb_dev_driver_inserted == TRUE)
return TRUE;
usb_drivers = usb_dev_drivers;
}
while(usb_drivers[cnt++])
{
}
DBG_DUMP("cnt = %lu\n", cnt);
for(int i = 0 ; i < cnt ; i++)
{
driver_path = usb_drivers[i];
if(driver_path){
memset(cmd, '\0', sizeof(cmd));
snprintf(cmd, sizeof(cmd), "insmod %s/%s", driver_path_prefix, driver_path);
//DBG_DUMP("%s\n", cmd);
printf("[%s:%d] %s\n", __FUNCTION__, __LINE__, cmd);
system(cmd);
}
}
if(isHost == FALSE){
is_usb_dev_driver_inserted = TRUE;
return System_WaitUsbDev();
}
else{
is_usb_host_driver_inserted = TRUE;
return TRUE;
}
}
static BOOL System_RmmodUsb(BOOL isHost)
{
char** usb_drivers = NULL;
char* driver_path = NULL;
UINT8 cnt = 0;
char cmd[256] = {'\0'};
if(isHost){
if(is_usb_host_driver_inserted == FALSE)
return TRUE;
usb_drivers = usb_host_drivers;
}
else{
if(is_usb_dev_driver_inserted == FALSE)
return TRUE;
usb_drivers = usb_dev_drivers;
}
while(usb_drivers[cnt++])
{
}
DBG_DUMP("cnt = %lu\n", cnt);
for(int i = cnt - 1 ; i >= 0 ; i--)
{
driver_path = usb_drivers[i];
if(driver_path){
snprintf(cmd, sizeof(cmd), "rmmod %s/%s", driver_path_prefix, driver_path);
DBG_DUMP("%s\n", cmd);
system(cmd);
}
}
if(isHost == FALSE){
is_usb_dev_driver_inserted = FALSE;
}
else{
is_usb_host_driver_inserted = FALSE;
}
return TRUE;
}
#if (USB_MODE == ENABLE)
//Using USB Plug-In + DOWN Key to enter to Msdc Vendor Spy Mode
@ -58,7 +210,7 @@ void System_OnUsbPreInit(void)
#endif
//Charger type setting should be invoked once prior to GxUSB_GetIsUSBPlug() which
//has been called in System_OnPowerPreInit() at the earliest time.
GxUSB_SetChargerType(FALSE);
// GxUSB_SetChargerType(FALSE);
}
void System_OnUsbInit(void)
@ -81,7 +233,12 @@ void System_OnUsbInit(void)
//force check USB connect type
if (GxUSB_GetIsUSBPlug()) {
System_InsmodUsb(FALSE); /* insmod usb dev ko */
GxUSB_UpdateConnectType();
GxUSB_SetChargerType(FALSE);
}
else{
System_InsmodUsb(TRUE); /* insmod usb host ko */
}
TM_BOOT_END("usb", "init");
}
@ -148,6 +305,11 @@ INT32 System_OnUsbInsert(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray)
{
//usb plug in
DBG_IND("USB plug - begin\r\n");
System_RmmodUsb(TRUE); /* rmmod usb host ko */
System_InsmodUsb(FALSE); /* insmod usb dev ko */
GxUSB_SetChargerType(FALSE);
USB_UpdateSource();
Ux_PostEvent(NVTEVT_BATTERY, 0, 0);
#if (USB_MODE == ENABLE)
@ -227,6 +389,10 @@ INT32 System_OnUsbRemove(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray)
#endif
USB_UpdateSource();
Ux_PostEvent(NVTEVT_BATTERY, 0, 0);
System_RmmodUsb(FALSE); /* rmmod usb device ko */
System_InsmodUsb(TRUE); /* insmod usb host ko */
DBG_IND("USB unplug - end\r\n");
return NVTEVT_CONSUME;
}

View File

@ -318,14 +318,15 @@ void System_WaitForPowerOffStart(void)
int NvtMain(void)
{
struct tm ctv = {0};
System_InstallID();
#if (USB_MODE==ENABLE)
System_OnUsbPreInit();
#endif
System_OnPowerPreInit();
#if HUNTING_CAMERA_MCU != ENABLE// The time is controlled by the MCU. sf_get_mcu_rtc_set_sys
//System_OnPowerPreInit() should be prior to rtc checking
struct tm ctv = {0};
ctv = hwclock_get_time(TIME_ID_CURRENT);
if(ctv.tm_year < DEFAULT_YEAR) {
ctv.tm_year = DEFAULT_YEAR;
@ -336,6 +337,7 @@ int NvtMain(void)
ctv.tm_sec = DEFAULT_SEC;
hwclock_set_time(TIME_ID_CURRENT, ctv, 0);
}
#endif
#if (POWERON_TRACE == ENABLE)
System_WaitForPowerOnFinish(); // Wait for boot cmd

View File

@ -233,7 +233,7 @@ INT32 Set_Cur_Day_Night_Status(BOOL OnOff, UINT8 isSnapVideo)
vendor_isp_set_iq(IQT_ITEM_NIGHT_MODE, &night_mode);
if (OnOff){
vos_util_delay_ms(500);
vos_util_delay_ms(1500);
}
if ((hd_ret = vendor_isp_uninit()) != HD_OK) {
DBG_ERR("vendor_isp_uninit() fail(%d)\r\n", hd_ret);

View File

@ -1402,10 +1402,15 @@ void PhotoStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen)
AET_STATUS_INFO ae_status = {0};
AWBT_STATUS awb_status = {0};
//IQT_WDR_PARAM wdr = {0};
HD_RESULT hd_ret;
ae_status.id = AE_ID_1;
if ((hd_ret = vendor_isp_init()) != HD_OK) {
DBG_ERR("vendor_isp_init() failed(%d)\r\n", hd_ret);
}
ae_status.id = 0;
vendor_isp_get_ae(AET_ITEM_STATUS, &ae_status);
awb_status.id = AWB_ID_1;
awb_status.id = 0;
vendor_isp_get_awb(AWBT_ITEM_STATUS, &awb_status);
/*wdr.id = id;
vendor_isp_get_iq(IQT_ITEM_WDR_PARAM, &wdr);
@ -1423,7 +1428,10 @@ void PhotoStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen)
awb_status.status.cur_b_gain,
awb_status.status.cur_ct
);
//DBG_DUMP("isp Buf=%s\r\n",Buf);
// DBG_ERR("isp Buf=%s\r\n",Buf);
if ((hd_ret = vendor_isp_uninit()) != HD_OK) {
DBG_ERR("vendor_isp_uninit() failed(%d)\r\n", hd_ret);
}
return;
}

View File

@ -410,12 +410,19 @@ typedef struct _UIMenuUIMenuStoreInfo {
CHAR Sim4gUsr[40];
CHAR Sim4gPwd[20];/* */
CHAR SimPinStr[8];/* */
CHAR MmsMmsc[50];
CHAR MmsApn[40];
CHAR MmsProxy[40];
CHAR MmsPort[6];
CHAR MmsUsr[40];
CHAR MmsPwd[20];
CHAR ModuleImei[20];
CHAR ModuleVer[50];
CHAR ModuleSubver[50];
CHAR AcmIp[60];
CHAR AcmPort[5];
CHAR WebIp[70];
CHAR OperatorCode[8];
//============Sifar==============///Payton
} UIMenuStoreInfo;

View File

@ -0,0 +1,79 @@
# get model name from $(NVT_PRJCFG_MODEL_CFG)
# e.g: ./configs/rtos/cfg_CARDV_EVB/ModelConfig.mk -> CARDV_EVB
MODEL = $(shell echo $(NVT_PRJCFG_MODEL_CFG) | sed 's/.*\/configs\/Linux\/cfg_\([^\/]*\)\/ModelConfig.mk/\1/g')
#######################################################################################
#--------- DO NOT EDIT ---------------------------------------------------------------#
#######################################################################################
# rtos-main.c always be compilied at last to update build date
MAIN_C = ./code/source/app/sifar-main.c
# compiler options
WARNING = -Wall -Wundef -Wsign-compare -Wno-missing-braces -Wstrict-prototypes -Werror -Wformat
COMPILE_OPTS = -I. -O2 -fPIC -ffunction-sections -fdata-sections -ftree-vectorize
# use COLLECT2 instead of ld (https://gcc.gnu.org/onlinedocs/gccint/Collect2.html)
COLLECT2 = $(shell $(CC) $(PLATFORM_CFLAGS) -print-prog-name=collect2)
# necessary objects for user application
CRTBEGIN_OBJ = $(shell $(CC) $(PLATFORM_CFLAGS) -print-file-name=crtbegin.o)
CRTEND_OBJ = $(shell $(CC) $(PLATFORM_CFLAGS) -print-file-name=crtend.o)
CRTN_OBJ = $(shell $(CC) $(PLATFORM_CFLAGS) -print-file-name=crtn.o)
CRT1_OBJ = $(shell $(CC) $(PLATFORM_CFLAGS) -print-file-name=crt1.o)
CRTI_OBJ = $(shell $(CC) $(PLATFORM_CFLAGS) -print-file-name=crti.o)
# do not adjust the order in CRT_OBJ_BEGIN and CRT_OBJ_END
CRT_OBJ_BEGIN = $(CRT1_OBJ) $(CRTI_OBJ) $(CRTBEGIN_OBJ)
CRT_OBJ_END = --no-as-needed $(CRTEND_OBJ) $(CRTN_OBJ)
# DYNAMIC LINKER
uclibc=$(shell echo $(CROSS_COMPILE)|grep uclib)
ifneq ($(uclibc),)
DYNAMIC_LINKER = /lib/ld-uClibc.so.0
else
DYNAMIC_LINKER = /lib/ld-linux-armhf.so.3
endif
# replace string on lds
LDS_REPLACE_DEFAULT = \
-e's/$$START_UP/$(BOARD_RTOS_ADDR)/g' \
-e's/$$CODE_INFO/$(CODE_INFO)/g' \
-e's/$$BIN_INFO/$(BIN_INFO)/g' \
-e's/$$LDS_EXTERN/$(LDS_EXTERN)/g' \
-e's/$$MODEL/$(MODEL)/g' \
-e's/$$SENSOR1/libnvt_$(SENSOR1)/g' \
-e's/$$SENSOR2/libnvt_$(SENSOR2)/g' \
-e's/$$SENSOR3/libnvt_$(SENSOR3)/g' \
-e's/$$LCD1/lib$(LCD1)/g' \
-e's/$$LCD2/lib$(LCD2)/g' \
#--------- END OF DO NOT EDIT ---------------------------------------------------------
#######################################################################################
#--------- ENVIRONMENT SETTING -------------------------------------------------------#
#######################################################################################
# FLAGs for Compiler, Assembler
C_PREDEFINED = \
-D_NVT_CONSOLE_ \
-D_MODEL_$(MODEL)_ \
-D_BIN_NAME_='"$(BIN_NAME)"' \
-D_BIN_NAME_T_='"$(BIN_NAME_T)"' \
-D_BOARD_DRAM_SIZE_=$(BOARD_DRAM_SIZE) \
-D_BOARD_FDT_ADDR_=$(BOARD_FDT_ADDR) \
-D_BOARD_SHMEM_ADDR_=$(BOARD_SHMEM_ADDR) \
-D_BOARD_RTOS_ADDR_=$(BOARD_RTOS_ADDR) \
-D_$(EMBMEM)_ \
-D_EMBMEM_BLK_SIZE_=$(EMBMEM_BLK_SIZE) \
-D_$(FW_TYPE)_ \
-D_$(UI_STYLE)_ \
-D_$(LCD1)_ \
-D_$(SENSOR1)_ \
-D_SENSOR1_$(SENSOR1)_ \
-D_$(SENSOR2)_ \
-D_SENSOR2_$(SENSOR2)_ \
-D_$(SENSOR3)_ \
-D_SENSOR3_$(SENSOR3)_ \
-D_SEN1_="$(subst sen_,,$(SENSOR1))" \
-D_SEN2_="$(subst sen_,,$(SENSOR2))" \
-D_SEN3_="$(subst sen_,,$(SENSOR3))" \
-D_$(NVT_ROOTFS_TYPE)_ \
-D_$(TOUCH)_ \
-D_$(NVT_ETHREARCAM)_\
-D_$(NVT_ETHREARCAM_CAPS_COUNT)_\

View File

@ -0,0 +1,151 @@
include $(NVT_PRJCFG_MODEL_CFG)
include ./MakeConfig.mk
#######################################################################################
#--------- INCs FOR C_CFLAGS ---------------------------------------------------------#
#######################################################################################
# DIRs
SYSROOT_DIR = $(shell $(CC) $(PLATFORM_CFLAGS) -print-sysroot)
GCC_LIB_DIR = $(dir $(shell $(CC) $(PLATFORM_CFLAGS) -print-libgcc-file-name))
SYSROOT_LIB_DIR = $(SYSROOT_DIR)/usr/lib
STDC_LIB_DIR = $(dir $(shell $(CC) $(PLATFORM_CFLAGS) -print-file-name=libstdc++.a))
LIBC_LIB_DIR = $(dir $(shell $(CC) $(PLATFORM_CFLAGS) -print-file-name=libc.a))
HDAL_SAMPLE_DIR = $(NVT_HDAL_DIR)/samples
NVT_TOOLS_DIR = $(BUILD_DIR)/nvt-tools
VOS_DRIVER_DIR = $(NVT_VOS_DIR)/drivers
KDRV_DIR = $(NVT_HDAL_DIR)/drivers/k_driver
EXT_DIR = $(NVT_HDAL_DIR)/ext_devices
KFLOW_DIR = $(NVT_HDAL_DIR)/drivers/k_flow
OUTPUT_DIR = ./output
INSTALL_DIR = ../../output
SIFAR_OPEN_SOURCE = yes
AI_LIB_DIR = $(NVT_HDAL_DIR)/vendor/ai2/source
uclibc=$(shell echo $(CROSS_COMPILE)|grep uclib)
ifeq ($(uclibc),)
AI_PREBUILD_LIB=$(NVT_HDAL_DIR)/vendor/ai/source/prebuilt/lib/glibc
else
AI_PREBUILD_LIB=$(NVT_HDAL_DIR)/vendor/ai/source/prebuilt/lib/uclibc
endif
SIFAR_DIR = $(LIBRARY_DIR)/source/sifar/code
SIFAR_APP_DIR = ./code/include
# public includes
EXTRA_INCLUDE += \
-I$(NVT_VOS_DIR)/include \
-I$(NVT_HDAL_DIR)/include \
-I$(NVT_HDAL_DIR)/vendor/isp/include \
-I$(NVT_HDAL_DIR)/vendor/isp/drivers/include \
-I$(LIBRARY_DIR)/include \
-I$(KDRV_DIR)/include/plat \
-I$(KDRV_DIR)/include/comm \
-I$(KDRV_DIR)/include \
-I$(EXT_DIR)/panel/display_panel/include \
-I$(EXT_DIR)/sensor/sen_common \
-I$(EXT_DIR)/audio/aud_common/include \
-I$(KFLOW_DIR)/include \
-I$(NVT_DRIVER_DIR)/include \
-I$(LIBRARY_DIR)/include \
-I$(APP_DIR)/include \
-I$(KDRV_DIR)/source/kdrv_gfx2d/kdrv_affine/include \
-I$(NVT_HDAL_DIR)/vendor/media/include \
-I$(NVT_HDAL_DIR)/vendor/common/include \
-I$(SIFAR_DIR)/include \
-I$(SIFAR_APP_DIR) \
# application local includes
EXTRA_INCLUDE += \
-I$(APP_DIR)/source/cardv/SrcCode \
-I$(APP_DIR)/source/cardv/SrcCode/Startup \
-I$(APP_DIR)/source/cardv/SrcCode/System \
-I$(APP_DIR)/source/cardv/SrcCode/Dx/include \
-I$(APP_DIR)/source/cardv/SrcCode/Gx/include \
-I$(APP_DIR)/source/cardv/SrcCode/Compatible \
-I$(APP_DIR)/source/cardv/SrcCode/Dx/$(MODEL)
ifeq "$(UI_STYLE)" "UI_STYLE_LVGL"
EXTRA_INCLUDE += \
-I$(APP_DIR)/source/cardv/SrcCode/UIWnd/LVGL_SPORTCAM \
endif
EXTRA_INCLUDE += \
-I$(NVT_HDAL_DIR)/vendor/ai2/include \
-I$(NVT_HDAL_DIR)/vendor/ai2/source_pub/include \
-I$(NVT_HDAL_DIR)/vendor/ai2/source_pub/vendor_ai_cpu \
-I$(NVT_HDAL_DIR)/vendor/ai2/source_pub/vendor_ai_dsp \
-I$(NVT_HDAL_DIR)/vendor/ai/drivers/k_driver/include \
-I$(NVT_HDAL_DIR)/vendor/ai2/drivers/k_flow/include \
-I$(NVT_HDAL_DIR)/vendor/ai2/drivers/k_flow/source/kflow_ai_net \
-I$(APP_DIR)/source/cardv/SrcCode/UIApp/Alg \
#--------- END OF INCs FOR C_CFLAGS ---------------------------------------------------
# code/lib
EXTRA_LIB += \
-l:libsifar.a \
#######################################################################################
#--------- SOURCEs FOR APPLICATION ---------------------------------------------------#
#######################################################################################
# system
SRC = \
./code/source/app/sf_test.c \
./code/source/app/sf_app.c
#--------- END OF SOURCEs FOR APPLICATION ---------------------------------------------
include $(NVT_PRJCFG_MODEL_CFG)
#--------- ENVIRONMENT SETTING --------------------
INCLUDES = -I$(NVT_HDAL_DIR)/include -I$(LIBRARY_DIR)/include
WARNING = -Wall -Wundef -Wsign-compare -Wno-missing-braces -Wstrict-prototypes
COMPILE_OPTS = $(INCLUDES) -I. -O2 -fPIC -ffunction-sections -fdata-sections
CPPFLAGS =
CFLAGS = $(PLATFORM_CFLAGS) $(PRJCFG_CFLAGS)
C_FLAGS = $(COMPILE_OPTS) $(EXTRA_INCLUDE) $(EXTRA_LIB) $(CPPFLAGS) $(CFLAGS) $(WARNING) $(C_PREDEFINED)
LD_FLAGS = -L$(LIBRARY_DIR)/output/lib -Wl,-rpath-link=$(LIBRARY_DIR)/output/lib -lrt
#--------- END OF ENVIRONMENT SETTING -------------
#--------- Compiling -------------------
BIN = sf_app
HEADER = $(shell find . -name "*.h")
OBJ = $(SRC:.c=.o)
.PHONY: all clean install
ifeq ($(SIFAR_OPEN_SOURCE),no)
all:
@echo ">>> Skip"
clean:
@echo ">>> Skip"
else
all: $(BIN)
$(BIN): $(OBJ)
$(CC) -o $@ $(OBJ) $(LD_FLAGS)
$(NM) -n $@ > $@.sym
$(STRIP) $@
$(OBJCOPY) -R .comment -R .note.ABI-tag -R .gnu.version $@
%.o: %.c $(HEADER)
$(CC) $(C_FLAGS) -c $< -o $@
clean:
rm -vf $(BIN) $(OBJ) $(BIN).sym *.o *.a *.so*
endif
install:
@echo ">>>>>>>>>>>>>>>>>>> $@ >>>>>>>>>>>>>>>>>>>"
@mkdir -p $(APP_DIR)/output
@cp -avf $(BIN) $(APP_DIR)/output
@cp -avf ${BIN} $(ROOTFS_DIR)/rootfs/usr/bin

View File

@ -0,0 +1,33 @@
/*
* app2.c
*
* Created on: 202347
* Author: NVT02970
*/
#include <io/gpio.h>
#include <UIWnd/UIFlow.h>
#include <sf_inc.h>
int main(int argc, char *argv[])
{
//gpio_direction_input(C_GPIO(10));
sf_mcu_init();
sf_get_power_on_mode();
sf_mcu_wdg_set(30);
sf_usb_mux_s(1);
//sf_mcu_reg_set(SF_MCU_CTRL_MODULE_PIR, 1);
//sf_sd_exist_reg_cb(DrvCARD_DetStrgCard);
/*led init*/
sf_led_init();
sf_sys_status_led_set(SF_LED_SYS_STATE_PIR_NOT_DETECT);
//sf_battery_thread_init();
}

View File

@ -0,0 +1,23 @@
/*
* app2.c
*
* Created on: 202347
* Author: NVT02970
*/
#include <io/gpio.h>
#include <UIWnd/UIFlow.h>
int sfmain(int argc, char *argv[])
{
//gpio_direction_input(C_GPIO(10));
}

Binary file not shown.

View File

@ -0,0 +1,32 @@
U abort
w __deregister_frame_info
w __register_frame_info
U __uClibc_main
00010234 T _init
00010288 T main
00010290 T _start
000102cc t deregister_tm_clones
000102f8 t register_tm_clones
00010330 t __do_global_dtors_aux
00010378 t frame_dummy
000103a8 T sfmain
000103ac T _fini
000103bc r
000103bc r __FRAME_END__
00020f38 d __frame_dummy_init_array_entry
00020f3c d __do_global_dtors_aux_fini_array_entry
00020f40 d _DYNAMIC
00021000 d _GLOBAL_OFFSET_TABLE_
0002101c D __data_start
0002101c W data_start
00021020 D __dso_handle
00021024 B __bss_start
00021024 B __bss_start__
00021024 b completed.10337
00021024 D _edata
00021024 D __TMC_END__
00021028 b object.10342
00021040 B __bss_end__
00021040 B _bss_end__
00021040 B _end
00021040 B __end__

View File

@ -7,7 +7,7 @@
version-info = [00 01 00 01];
ae_expect_lum {
size = [b0 00 00 00];
data = [32 00 00 00 40 00 00 00 41 00 00 00 41 00 00 00 41 00 00 00 41 00 00 00 41 00 00 00 41 00 00 00 41 00 00 00 41 00 00 00 49 00 00 00 53 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00];
data = [2f 00 00 00 32 00 00 00 3a 00 00 00 3a 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 43 00 00 00 46 00 00 00 50 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 46 00 00 00 50 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00];
};
ae_la_clamp {
size = [50 01 00 00];
@ -27,7 +27,7 @@
};
ae_meter_window {
size = [00 01 00 00];
data = [01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 04 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 04 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00];
data = [01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 04 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 04 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00];
};
ae_lum_gamma {
size = [82 00 00 00];

View File

@ -15,11 +15,11 @@
};
awb_ct_weight {
size = [78 00 00 00];
data = [fc 08 00 00 f0 0a 00 00 74 0e 00 00 5c 12 00 00 64 19 00 00 f8 2a 00 00 48 03 00 00 60 03 00 00 bc 03 00 00 f7 03 00 00 23 04 00 00 c3 04 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00];
data = [fc 08 00 00 f0 0a 00 00 74 0e 00 00 5c 12 00 00 64 19 00 00 f8 2a 00 00 48 03 00 00 60 03 00 00 bc 03 00 00 f7 03 00 00 23 04 00 00 c3 04 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 08 00 00 00 08 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00];
};
awb_target {
size = [24 00 00 00];
data = [60 03 00 00 f7 03 00 00 23 04 00 00 00 04 00 00 00 04 00 00 00 04 00 00 00 04 00 00 00 04 00 00 00 04 00 00];
data = [60 03 00 00 f7 03 00 00 23 04 00 00 00 04 00 00 24 04 00 00 38 04 00 00 00 04 00 00 f2 03 00 00 e8 03 00 00];
};
awb_ct_info {
size = [60 00 00 00];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -69,6 +69,8 @@ SRC = \
code/source/common/sf_common.c \
code/source/common/sf_led.c \
code/source/common/sf_battery.c \
code/source/common/sf_message_queue.c \
code/source/common/sf_share_mem.c \
code/source/common/sf_base64.c \
code/source/module/sf_tcp.c \
code/source/module/sf_http.c \

View File

@ -2,8 +2,9 @@
#define _SF_BATTERY_
#include <kwrap/task.h>
#include <sf_type.h>
typedef signed int SINT32;
//typedef signed int SINT32;
UINT32 sf_battery_voltage_convert(UINT32 resistanceGnd, UINT32 resistanceVin, UINT32 adcVal);
UINT32 sf_battery_convert_to_adc(UINT32 resistanceGnd, UINT32 resistanceVin, UINT32 volt);

View File

@ -15,5 +15,8 @@
#include <sf_type.h>
#include <sf_hal_ttyusb.h>
#include <sf_log.h>
#include <sf_message_queue.h>
#include <sf_share_mem.h>
#endif

View File

@ -416,6 +416,8 @@ void sf_set_power_off_flag(UINT8 flag);
UINT8 sf_get_power_off_flag(void);
int sf_while_flag(void);
UINT8 sf_mcu_power_on_para_get(MCUParam_t attrId);
void sf_set_sim_insert(UINT8 sim);
UINT8 sf_get_mcu_rtc_set_sys(void);
#endif

View File

@ -0,0 +1,38 @@
#ifndef __SF_MESSAGE_QUEUE_H__
#define __SF_MESSAGE_QUEUE_H__
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#include <sf_type.h>
#include "UIInfo/UIInfo.h"
typedef struct sf_MESSAGE_Buf_S
{
long mtype;
SINT32 cmdId;
SINT32 s32Wait;
SINT32 arg1;
SINT32 arg2;
SINT32 arg3;
}SF_MESSAGE_BUF_S;
SINT32 sf_com_message_app_init(void);
SINT32 sf_com_message_send_to_app(SF_MESSAGE_BUF_S *pMessageBuf);
SINT32 sf_com_message_recv_from_app(SF_MESSAGE_BUF_S *pMessageBuf);
SINT32 sf_com_message_cardv_init(void);
SINT32 sf_com_message_send_to_cardv(SF_MESSAGE_BUF_S *pMessageBuf);
SINT32 sf_com_message_recv_from_cardv(SF_MESSAGE_BUF_S *pMessageBuf);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif

View File

@ -0,0 +1,88 @@
#ifndef __SF_SHARE_MEM_H__
#define __SF_SHARE_MEM_H__
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#include "sf_type.h"
#define SF_MAX_PATH_LEN 128
#define SF_MAX_PIC_LEN 64
#define SF_SRCFILE_MAX 4
#define SF_THUMB_FILE_MAX_LEN 20
typedef enum sf_FILE_TYPE_E
{
SF_FILE_TYPE_PIC_THUM_3M = 0x00,
SF_FILE_TYPE_PIC_3M = 0x01,
SF_FILE_TYPE_VIDEO_THUM_WVGA = 0X02,
SF_FILE_TYPE_VIDEO_WVGA = 0X03,
SF_FILE_TYPE_VIDEO_THUM_720P = 0X04,
SF_FILE_TYPE_VIDEO_720P = 0X05,
SF_FILE_TYPE_VIDEO_THUM_1080P = 0X06,
SF_FILE_TYPE_VIDEO_1080P = 0X07,
SF_FILE_TYPE_PIC_THUM_5M = 0x08,
SF_FILE_TYPE_PIC_5M = 0x09,
SF_FILE_TYPE_LOG_ERROR = 0x0A,
SF_FILE_TYPE_CFG = 0x0B,
SF_FILE_TYPE_TRIGGER = 0x0C,
SF_FILE_TYPE_PIC_BIG,
SF_FILE_TYPE_PIC_SMALL,
SF_FILE_TYPE_PIC_VIDEO,
SF_FILE_TYPE_VIDEO,
SF_FILE_TYPE_LOG_DP, /*dailyreport file*/
SF_FILE_TYPE_GPS,
SF_FILE_TYPE_TXT,
SF_FILE_TYPE_UPDATE,
SF_FILE_TYPE_FOTA,
SF_FILE_TYPE_BT_ALARM, /*Bettery Alarm*/
SF_FILE_TYPE_OTHER,
SF_FILE_TYPE_BUTT,
}SF_FILE_TYPE_E;
typedef struct sf_FILE_ATTR_S {
SF_FILE_TYPE_E enFileTye;
SF_CHAR thumbfileName[SF_MAX_PIC_LEN];
SF_CHAR thumbfilePath[SF_MAX_PATH_LEN];
SF_CHAR txtfilePath[SF_MAX_PATH_LEN];
SF_CHAR txtfileName[SF_MAX_PIC_LEN];
UINT32 thumbfileSize;
}SF_FILE_ATTR_S;
typedef struct sf_SRCFILE_ATTR_S {
UINT8 filecnt;
SF_FILE_ATTR_S stfileattr[SF_SRCFILE_MAX];
}SF_SRCFILE_ATTR_S;
SINT32 sf_sem_init(SF_CHAR *pathname,SINT32 *psemid);
SINT32 sf_sem_down(SINT32 semid, SINT32 who);
SINT32 sf_sem_up(SINT32 semid, SINT32 who);
SINT32 sf_sem_deinit(SINT32 semid);
SINT32 sf_share_mem_file_init(void);
SINT32 sf_share_mem_file_deinit(void);
SINT32 sf_share_mem_customer_init(void);
SINT32 sf_share_mem_customer_deinit(void);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif

View File

@ -1,6 +1,297 @@
#ifndef _SF_SIM_
#define _SF_SIM_
#include <sf_hal_ttyusb.h>
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#define sf_4g_send_data sf_hal_ttyusb2_write
#define sf_4g_get_data sf_hal_ttyusb2_read
#define SF_NTP_SITE1 "time.windows.com"
#define SF_NTP_SITE2 "time.nist.gov"
#define APNGPRS_WUYUAN1 "America.bics"
#define APNGPRS_WUYUAN2 "bicsapn"
#define APN_4G_USCC "uscc"
#define APN_4G_ATT "nxtgenphone"
#define APN_4G_VERIZON "VZWINTERNET"
#define APN_4G_TMOBBILE "fast.t-mobile.com"
#define EG91 "EG91"
#define EG95 "EG95"
/** Return Result Check */
#define SF_CHECK_RETURN(ret, errcode) \
do { \
if (0 > ret) { \
printf("Error Code: [0x%08X]\n\n", errcode); \
return errcode; \
} \
} while (0)
/** Sifar Error Code Rule [--module[16bit]--|--error[16bit]--]
* module : module enum value [SF_MOD_E]
* error_code : error code in specified module, unique in module
**/
#define SF_ERR_ID(module, err) ((SINT32)(((module) << 16) | (err)))
typedef enum SF_SIM
{
SMS_SIM_INIT_READY= (unsigned char)0x01,
SMS_SIM_INIT_ATI,
SMS_SIM_INIT_IPREX,
SMS_SIM_INIT_ATCSUB,
SMS_SIM_INIT_ATCPIN,
SMS_SIM_INIT_ATCPIN1,
SMS_SIM_INIT_ATCPIN2,
SMS_SIM_INIT_CNVW,
SMS_SIM_INIT_ATW,
SMS_SIM_INIT_CICCID,
SMS_SIM_INIT_ATCIMI,
SMS_SIM_INIT_QICSGP,
SMS_SIM_INIT_QICSGP1,
SMS_SIM_INIT_CGREG,
SMS_SIM_INIT_COPS,
SMS_SIM_INIT_CNSMOD,
SMS_SIM_INIT_CPSI,
SMS_SIM_INIT_CSQ,
SMS_SIM_INIT_CCLK,
SMS_SIM_INIT_CNTP,
SMS_SIM_INIT_CNTPTO,
SMS_SIM_INIT_ATCNTP,
SMS_SIM_INIT_ATCNTP1,
SMS_SIM_INIT_NTP_CCLK,
SMS_SIM_INIT_QIDEACT,
SMS_SIM_INIT_CSCLK,
SMS_SIM_INIT_DTRUP,
SMS_SIM_INIT_EXIT,
SMS_SIM_INIT_CFUN,
SMS_SIM_INIT_CIMI,
}SF_SIM_E;
/** SF Module ID */
typedef enum SF_MOD_E {
SF_MOD_SIM = 1,
SF_MOD_GPS,
SF_MOD_FTP,
SF_MOD_SMS,
SF_MOD_4G,
SF_MOD_4G_SEND,
SF_MOD_OTA,
SF_MOD_MMS,
SF_MOD_SMTP,
SF_MOD_UPLOAD,
SF_MOD_HTTP,
SF_MOD_TCP,
SF_MOD_BUTT,
} SF_MOD_e;
typedef enum _SIM_ERR_CODE_E{
SIM_COM_SUCCEED = 0,
SIM_ERROR_NO_SIGNAL = 1,
SIM_ERROR_NO_SIMCARD = 2,
SIM_ERROR_AT_TIMEOUT = 3,
SIM_ERROR_UTC = 4,
SIM_ERROR_REG_NET = 5,
SIM_ERROR_APN = 6,
SIM_ERROR_IMEI = 7,
SIM_ERROR_PIN = 8,
SIM_ERROR_PIN_PUK = 9,
SIM_ERROR_NTP = 10,
SIM_ERROR_FAILURE = 11,
SIM_ERROR_MEGA = 12,
SIM_ERROR_BUTT,
}SIM_ERR_CODE_e;
#define SF_SIM_ERROR_NO_SIGNAL SF_ERR_ID(SF_MOD_SIM, SIM_ERROR_NO_SIGNAL)
#define SF_SIM_ERROR_NO_SIMCARD SF_ERR_ID(SF_MOD_SIM, SIM_ERROR_NO_SIMCARD)
#define SF_SIM_ERROR_AT_TIMEOUT SF_ERR_ID(SF_MOD_SIM, SIM_ERROR_AT_TIMEOUT)
#define SF_SIM_ERROR_UTC SF_ERR_ID(SF_MOD_SIM, SIM_ERROR_UTC)
#define SF_SIM_ERROR_REG_NET SF_ERR_ID(SF_MOD_SIM, SIM_ERROR_REG_NET)
#define SF_SIM_ERROR_APN SF_ERR_ID(SF_MOD_SIM, SIM_ERROR_APN)
#define SF_SIM_ERROR_IMEI SF_ERR_ID(SF_MOD_SIM, SIM_ERROR_IMEI)
#define SF_SIM_ERROR_PIN SF_ERR_ID(SF_MOD_SIM, SIM_ERROR_PIN)
#define SF_SIM_ERROR_PIN_PUK SF_ERR_ID(SF_MOD_SIM, SIM_ERROR_PIN_PUK)
#define SF_SIM_ERROR_NTP SF_ERR_ID(SF_MOD_SIM, SIM_ERROR_NTP)
#define SF_SIM_ERROR_FAILURE SF_ERR_ID(SF_MOD_SIM, SIM_ERROR_FAILURE)
#define SF_SIM_ERROR_MEGA SF_ERR_ID(SF_MOD_SIM, SIM_ERROR_MEGA)
typedef enum _GPS_ERR_CODE_E{
GPS_ERROR_QIACT = 1,
GPS_ERROR_LOC_TIMEOUT,
GPS_ERROR_NTP,
GPS_ERROR_XD, /* AT+CGPSXD=0, recv fail*/
GPS_ERROR_SETTIME, /* AT+QGPSXTRATIME, recv fail*/
GPS_ERROR_AT_TIMEOUT,
GPS_ERROR_AT_ERROR,
GPS_ERROR_BUTT,
}GPS_ERR_CODE_e;
#define SF_GPS_ERROR_QIACT SF_ERR_ID(SF_MOD_GPS, GPS_ERROR_QIACT)
#define SF_GPS_ERROR_LOC_TIMEOUT SF_ERR_ID(SF_MOD_GPS, GPS_ERROR_LOC_TIMEOUT)
#define SF_GPS_ERROR_NTP SF_ERR_ID(SF_MOD_GPS, GPS_ERROR_NTP)
#define SF_GPS_ERROR_XD SF_ERR_ID(SF_MOD_GPS, GPS_ERROR_XD)
#define SF_GPS_ERROR_SETTIME SF_ERR_ID(SF_MOD_GPS, GPS_ERROR_SETTIME)
#define SF_GPS_ERROR_AT_TIMEOUT SF_ERR_ID(SF_MOD_GPS, GPS_ERROR_AT_TIMEOUT)
#define SF_GPS_ERROR_AT_ERROR SF_ERR_ID(SF_MOD_GPS, GPS_ERROR_AT_ERROR)
typedef enum _GPRS_MODULE_ERR_CODE_E{
GPRS_MODULE_ERROR_OPEN = 1,
GPRS_MODULE_ERROR_WRITE = 2,
GPRS_MODULE_ERROR_READ = 3,
GPRS_MODULE_ERROR_BUTT,
}GPRS_MODULE_ERR_CODE_e;
#define SF_GPRS_MODULE_ERROR_OPEN SF_ERR_ID(SF_MOD_4G, GPRS_MODULE_ERROR_OPEN)
#define SF_GPRS_MODULE_ERROR_WRITE SF_ERR_ID(SF_MOD_4G, GPRS_MODULE_ERROR_WRITE)
#define SF_GPRS_MODULE_ERROR_READ SF_ERR_ID(SF_MOD_4G, GPRS_MODULE_ERROR_READ)
typedef enum _SEND_ERR_CODE_E{
SEND_ERROR_SIGNAL = 1,
SEND_ERROR_CREAT_DP_FILE = 2,
SEND_ERROR_CREAT_GPS_FILE= 3,
SEND_ERROR_LOG_NOT_EXIST = 4,
SEND_ERROR_BATCH_PIC_NULL= 5,
SEND_ERROR_BATCH_PIC = 6,
SEND_ERROR_APN_NULL = 7,
SEND_ERROR_FTP_NULL = 8,
SEND_ERROR_REACH_MAX_NUM = 9,
SEND_ERROR_BUTT,
}SEND_ERR_CODE_e;
#define SF_SEND_ERROR_SIGNAL SF_ERR_ID(SF_MOD_4G_SEND, SEND_ERROR_SIGNAL)
#define SF_SEND_ERROR_CREAT_DP_FILE SF_ERR_ID(SF_MOD_4G_SEND, SEND_ERROR_CREAT_DP_FILE)
#define SF_SEND_ERROR_CREAT_GPS_FILE SF_ERR_ID(SF_MOD_4G_SEND, SEND_ERROR_CREAT_GPS_FILE)
#define SF_SEND_ERROR_LOG_NOT_EXIST SF_ERR_ID(SF_MOD_4G_SEND, SEND_ERROR_LOG_NOT_EXIST)
#define SF_SEND_ERROR_BATCH_PIC_NULL SF_ERR_ID(SF_MOD_4G_SEND, SEND_ERROR_BATCH_PIC_NULL)
#define SF_SEND_ERROR_BATCH_PIC SF_ERR_ID(SF_MOD_4G_SEND, SEND_ERROR_BATCH_PIC)
#define SF_SEND_ERROR_APN_NULL SF_ERR_ID(SF_MOD_4G_SEND, SEND_ERROR_APN_NULL)
#define SF_SEND_ERROR_FTP_NULL SF_ERR_ID(SF_MOD_4G_SEND, SEND_ERROR_FTP_NULL)
#define SF_SEND_ERROR_REACH_MAX_NUM SF_ERR_ID(SF_MOD_4G_SEND, SEND_ERROR_REACH_MAX_NUM)
typedef enum _OTA_ERR_CODE_E{
OTA_ERROR_QIACT = 1,
OTA_ERROR_VERTION = 2,
OTA_ERROR_VERSION_INVALID= 3,
OTA_ERROR_TIME_OUT = 4,
OTA_ERROR_BAT_LOW = 5,
OTA_ERROR_FTP_OPEN = 6,
OTA_ERROR_FTP_NLST = 7,
OTA_ERROR_FTP_GET = 8,
OTA_ERROR_FTP_QIDEACT = 9,
OTA_ERROR_FTP_QFSEEK = 10,
OTA_ERROR_FTP_CFGFORMAT = 11,
OTA_ERROR_FTP_QFREAD = 12,
OTA_ERROR_FTP_QFOTADL = 13,
OTA_ERROR_FTP_DOWNLOAD = 14,
OTA_ERROR_FTP_UPDATE = 15,
OTA_ERROR_QIDEACT = 16,
OTA_ERROR_BUTT,
}OTA_ERR_CODE_e;
#define SF_OTA_ERROR_QIACT SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_QIACT)
#define SF_OTA_ERROR_VERTION SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_VERTION)
#define SF_OTA_ERROR_VERTION_INVAlID SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_VERSION_INVALID)
#define SF_OTA_ERROR_TIME_OUT SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_TIME_OUT)
#define SF_OTA_ERROR_BAT_LOW SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_BAT_LOW)
#define SF_OTA_ERROR_FTP_OPEN SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_FTP_OPEN)
#define SF_OTA_ERROR_FTP_NLST SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_FTP_NLST)
#define SF_OTA_ERROR_FTP_GET SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_FTP_GET)
#define SF_OTA_ERROR_FTP_QIDEACT SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_FTP_QIDEACT)
#define SF_OTA_ERROR_FTP_QFSEEK SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_FTP_QFSEEK)
#define SF_OTA_ERROR_FTP_CFGFORMAT SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_FTP_CFGFORMAT)
#define SF_OTA_ERROR_FTP_QFREAD SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_FTP_QFREAD)
#define SF_OTA_ERROR_FTP_QFOTADL SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_FTP_QFOTADL)
#define SF_OTA_ERROR_FTP_DOWNLOAD SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_FTP_DOWNLOAD)
#define SF_OTA_ERROR_FTP_UPDATE SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_FTP_UPDATE)
#define SF_OTA_ERROR_QIDEACT SF_ERR_ID(SF_MOD_OTA, OTA_ERROR_QIDEACT)
typedef enum _MMS_ERR_CODE_E{
MMS_ERROR_AT_TIMEOUT = 1,
MMS_ERROR_AT_ERROR = 2,
MMS_ERROR_CREAT_PIC_FAIL = 3,
MMS_ERROR_PIC_TOO_LARGE = 4,
MMS_ERROR_SEND_FAIL = 5,
MMS_ERROR_EDIT_CLOSE_FAIL = 6,
MMS_ERROR_GET_FSIZE_FAIL = 7,
MMS_ERROR_QIDEACT,
MMS_ERROR_771,
MMS_ERROR_PDP,
}MMS_ERR_CODE_e;
#define SF_MMS_ERROR_AT_TIMEOUT SF_ERR_ID(SF_MOD_MMS, MMS_ERROR_AT_TIMEOUT)
#define SF_MMS_ERROR_AT_ERROR SF_ERR_ID(SF_MOD_MMS, MMS_ERROR_AT_ERROR)
#define SF_MMS_ERROR_CREAT_PIC_FAIL SF_ERR_ID(SF_MOD_MMS, MMS_ERROR_CREAT_PIC_FAIL)
#define SF_MMS_ERROR_PIC_TOO_LARGE SF_ERR_ID(SF_MOD_MMS, MMS_ERROR_PIC_TOO_LARGE)
#define SF_MMS_ERROR_SEND_FAIL SF_ERR_ID(SF_MOD_MMS, MMS_ERROR_SEND_FAIL)
#define SF_MMS_ERROR_EDIT_CLOSE_FAIL SF_ERR_ID(SF_MOD_MMS, MMS_ERROR_EDIT_CLOSE_FAIL)
#define SF_MMS_ERROR_GET_FSIZE_FAIL SF_ERR_ID(SF_MOD_MMS, MMS_ERROR_GET_FSIZE_FAIL)
#define SF_MMS_ERROR_QIDEACT SF_ERR_ID(SF_MOD_MMS, MMS_ERROR_QIDEACT)
#define SF_MMS_ERROR_771 SF_ERR_ID(SF_MOD_MMS, MMS_ERROR_771)
#define SF_MMS_ERROR_PDP SF_ERR_ID(SF_MOD_MMS, MMS_ERROR_PDP)
typedef enum _SMTP_ERR_CODE_E{
SMTP_ERROR_AT_TIMEOUT = 1,
SMTP_ERROR_AT_ERROR = 2,
SMTP_ERROR_SSL_START = 3,
SMTP_ERROR_SEND_TIMEOUT = 4,
SMTP_ERROR_SEND_CLOSE = 5,
SMTP_ERROR_TRY_READ_3_TIMES = 6,
SMTP_ERROR_SD_POWER_RECYCLE = 7,
SMTP_ERROR_SEND = 8,
SMTP_ERROR_SEND_FAIL = 9,
SMTP_ERROR_SSL_STOP = 10,
SMTP_ERROR_CREAT_DR_FAIL = 11,
SMTP_ERROR_ACTIVE,
}SMTP_ERR_CODE_e;
#define SF_SMTP_ERROR_AT_TIMEOUT SF_ERR_ID(SF_MOD_SMTP, SMTP_ERROR_AT_TIMEOUT)
#define SF_SMTP_ERROR_AT_ERROR SF_ERR_ID(SF_MOD_SMTP, SMTP_ERROR_AT_ERROR)
#define SF_SMTP_ERROR_SSL_START SF_ERR_ID(SF_MOD_SMTP, SMTP_ERROR_SSL_START)
#define SF_SMTP_ERROR_SEND_TIMEOUT SF_ERR_ID(SF_MOD_SMTP, SMTP_ERROR_SEND_TIMEOUT)
#define SF_SMTP_ERROR_SEND_CLOSE SF_ERR_ID(SF_MOD_SMTP, SMTP_ERROR_SEND_CLOSE)
#define SF_SMTP_ERROR_TRY_READ_3_TIMES SF_ERR_ID(SF_MOD_SMTP, SMTP_ERROR_TRY_READ_3_TIMES)
#define SF_SMTP_ERROR_SD_POWER_RECYCLE SF_ERR_ID(SF_MOD_SMTP, SMTP_ERROR_SD_POWER_RECYCLE)
#define SF_SMTP_ERROR_SEND SF_ERR_ID(SF_MOD_SMTP, SMTP_ERROR_SEND)
#define SF_SMTP_ERROR_SEND_FAIL SF_ERR_ID(SF_MOD_SMTP, SMTP_ERROR_SEND_FAIL)
#define SF_SMTP_ERROR_SSL_STOP SF_ERR_ID(SF_MOD_SMTP, SMTP_ERROR_SSL_STOP)
#define SF_SMTP_ERROR_CREAT_DR_FAIL SF_ERR_ID(SF_MOD_SMTP, SMTP_ERROR_CREAT_DR_FAIL)
#define SF_SMTP_ERROR_ACTIVE SF_ERR_ID(SF_MOD_SMTP, SMTP_ERROR_ACTIVE)
typedef enum _UPLOAD_ERR_CODE_E{
UPLOAD_ERROR_AT_TIMEOUT = 1,
UPLOAD_ERROR_AT_ERROR = 2,
UPLOAD_ERROR_OPEN_FAIL = 3,
UPLOAD_ERROR_GET_FSIZE_FAIL = 4,
UPLOAD_ERROR_DATA = 5,
UPLOAD_ERROR_RETRY = 6,
}UPLOAD_ERR_CODE_e;
#define SF_UPLOAD_ERROR_AT_TIMEOUT SF_ERR_ID(SF_MOD_UPLOAD, UPLOAD_ERROR_AT_TIMEOUT)
#define SF_UPLOAD_ERROR_AT_ERROR SF_ERR_ID(SF_MOD_UPLOAD, UPLOAD_ERROR_AT_ERROR)
#define SF_UPLOAD_ERROR_OPEN_FAIL SF_ERR_ID(SF_MOD_UPLOAD, UPLOAD_ERROR_OPEN_FAIL)
#define SF_UPLOAD_ERROR_GET_FSIZE_FAIL SF_ERR_ID(SF_MOD_UPLOAD, UPLOAD_ERROR_GET_FSIZE_FAIL)
#define SF_UPLOAD_ERROR_DATA SF_ERR_ID(SF_MOD_UPLOAD, UPLOAD_ERROR_DATA)
#define SF_UPLOAD_ERROR_RETRY SF_ERR_ID(SF_MOD_UPLOAD, UPLOAD_ERROR_RETRY)
UINT32 sf_auto_operation_adjust(void);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif

View File

@ -472,7 +472,7 @@ BOOL sf_cmd_work_time_switch(unsigned char argc, char **argv)
puiPara->WorkTime[0].StartTime.Min = value;
sscanf_s(argv[4],"%d", &value);
puiPara->WorkTime[0].StopTime.Hour = value;
sscanf_s(argv[4],"%d", &value);
sscanf_s(argv[5],"%d", &value);
puiPara->WorkTime[0].StopTime.Min = value;
}
printf("[%s:%d] argc:%d WorkTime1Switch:%d %d:%d-%d:%d\n", __FUNCTION__, __LINE__, argc, SysGetFlag(WorkTime1Switch),puiPara->WorkTime[0].StartTime.Hour,puiPara->WorkTime[0].StartTime.Min,puiPara->WorkTime[0].StopTime.Hour,puiPara->WorkTime[0].StopTime.Min);
@ -489,7 +489,7 @@ BOOL sf_cmd_work_time_switch(unsigned char argc, char **argv)
puiPara->WorkTime[1].StartTime.Min = value;
sscanf_s(argv[4],"%d", &value);
puiPara->WorkTime[1].StopTime.Hour = value;
sscanf_s(argv[4],"%d", &value);
sscanf_s(argv[5],"%d", &value);
puiPara->WorkTime[1].StopTime.Min = value;
}
printf("[%s:%d] argc:%d WorkTime1Switch:%d %d:%d-%d:%d\n", __FUNCTION__, __LINE__, argc, SysGetFlag(WorkTime2Switch),puiPara->WorkTime[1].StartTime.Hour,puiPara->WorkTime[1].StartTime.Min,puiPara->WorkTime[1].StopTime.Hour,puiPara->WorkTime[1].StopTime.Min);

View File

@ -0,0 +1,112 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <dirent.h>
#include <printf.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
#include <sys/msg.h>
#include <sf_inc.h>
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
int sf_msgQueueId = -1;
int cardv_msgQueueId = -1;
static SINT32 message_queue_send(SINT32 MsgQueueId,SF_MESSAGE_BUF_S *pMessageBuf)
{
size_t msgsz = sizeof(pMessageBuf->cmdId) + sizeof(pMessageBuf->s32Wait) + sizeof(pMessageBuf->arg1) + sizeof(pMessageBuf->arg2)+ sizeof(pMessageBuf->arg3);
if(msgsnd(MsgQueueId, pMessageBuf, msgsz, 0) == -1)
{
return SF_FAILURE;
}
return SF_SUCCESS;
}
static SINT32 message_queue_recv(SINT32 MsgQueueId,SF_MESSAGE_BUF_S *pMessageBuf)
{
size_t msgsz = sizeof(pMessageBuf->cmdId) + sizeof(pMessageBuf->s32Wait) + sizeof(pMessageBuf->arg1) + sizeof(pMessageBuf->arg2)+ sizeof(pMessageBuf->arg3);
if(msgrcv(MsgQueueId, pMessageBuf, msgsz,0,IPC_NOWAIT) == -1)
{
return SF_FAILURE;
}
return SF_SUCCESS;
}
static SINT32 message_queue_create(SF_CHAR *pathname,SINT32 *pMsgQueueId)
{
key_t key;
SF_CHAR touchPath[128] = {0};
if(access(pathname, F_OK) != 0)
{
sprintf(touchPath, "%s %s","touch",pathname);
system(touchPath);
}
if((key = ftok(pathname,'z')) < 0)
{
MLOGI("ftok error");
return SF_FAILURE;
}
if ((*pMsgQueueId = msgget(key, IPC_CREAT | 0660)) == -1)
{
MLOGI("MsgQueueId = %#x\n",*pMsgQueueId);
MLOGI("msgget failed errno.%02d is: %s\n", errno, strerror(errno));
return SF_FAILURE;
}
MLOGI("MsgQueueId = %#x\n",*pMsgQueueId);
return SF_SUCCESS;
}
SINT32 sf_com_message_app_init(void)
{
return message_queue_create((char*)"/tmp/sf_message",&sf_msgQueueId);
}
SINT32 sf_com_message_recv_from_app(SF_MESSAGE_BUF_S *pMessageBuf)
{
return message_queue_recv(sf_msgQueueId,pMessageBuf);
}
SINT32 sf_com_message_send_to_app(SF_MESSAGE_BUF_S *pMessageBuf)
{
pMessageBuf->mtype = 1;
return message_queue_send(sf_msgQueueId,pMessageBuf);
}
SINT32 sf_com_message_cardv_init()
{
return message_queue_create((char*)"/tmp/cardv_message",&cardv_msgQueueId);
}
SINT32 sf_com_message_recv_from_cardv(SF_MESSAGE_BUF_S *pMessageBuf)
{
return message_queue_recv(cardv_msgQueueId,pMessageBuf);
}
SINT32 sf_com_message_send_to_cardv(SF_MESSAGE_BUF_S *pMessageBuf)
{
pMessageBuf->mtype = 1;
return message_queue_send(cardv_msgQueueId,pMessageBuf);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,216 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <dirent.h>
#include <printf.h>
#include <fcntl.h>
#include <termios.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#include <sf_inc.h>
int sf_semId = -1;
int sf_sharMemId = -1;
int sf_sharMemfileId = -1;
union semun {
int val;
struct semid_ds *buf;
unsigned short *array;
struct seminfo *__buf;
};
SINT32 sem_creat(SF_CHAR *pathname,SINT32 *psemid)
{
SF_CHAR touchPath[128] = {0};
if(access(pathname, F_OK) != 0)
{
sprintf(touchPath, "%s %s","touch",pathname);
system(touchPath);
}
key_t key = ftok(pathname, 111);
if(key < 0)
{
perror("ftok");
return SF_FAILURE;
}
*psemid = semget(key, 1, IPC_CREAT|IPC_EXCL|0666);
if(*psemid < 0)
{
perror("semget");
return SF_FAILURE;
}
union semun un;
un.val = 1;
if(semctl(*psemid, 0, SETVAL, un)<0)
{
perror("semctl");
return SF_FAILURE;
}
return SF_SUCCESS;
}
SINT32 sem_check(SINT32 semid, SINT32 who, SINT32 op)
{
struct sembuf sf;
sf.sem_num = who;
sf.sem_op = op;
sf.sem_flg = 0;
if(semop(semid, &sf, 1) < 0)
{
perror("semop");
return SF_FAILURE;
}
return SF_SUCCESS;
}
SINT32 sf_sem_init(SF_CHAR *pathname,SINT32 *psemid)
{
return sem_creat(pathname,psemid);
}
SINT32 sf_sem_down(SINT32 semid, SINT32 who)
{
return sem_check(semid, who, -1);
}
SINT32 sf_sem_up(SINT32 semid, SINT32 who)
{
return sem_check(semid, who, 1);
}
SINT32 sf_sem_deinit(SINT32 semid)
{
if(semctl(semid, 0, IPC_RMID) < 0)
{
perror("semctl");
return SF_FAILURE;
}
return SF_SUCCESS;
}
int share_mem_create(SF_CHAR *pathname,int size,SINT32 *pshmID)
{
SF_CHAR touchPath[128] = {0};
if(access(pathname, F_OK) != 0)
{
sprintf(touchPath, "%s %s","touch",pathname);
system(touchPath);
}
key_t key = ftok(pathname, 111);
if(key < 0)
{
perror("ftok");
return SF_FAILURE;
}
*pshmID = shmget(key, size, IPC_CREAT|0666);
if(*pshmID == -1)
{
perror("shmget");
return SF_FAILURE;
}
return SF_SUCCESS;
}
int share_mem_destory(int shmID)
{
if(shmctl(shmID, IPC_RMID, NULL) < 0 )
{
perror("shmctl");
return SF_FAILURE;
}
return SF_SUCCESS;
}
void* share_mem_get(int shmID)
{
return shmat(shmID, NULL, 0);
}
SINT32 sf_share_mem_init(SF_CHAR *pathname,int size,SINT32 *pshmID)
{
return share_mem_create(pathname,size,pshmID);
}
SINT32 sf_share_mem_deinit(SINT32 shmID)
{
return share_mem_destory(shmID);
}
void* sf_share_mem_get(int shmID)
{
return share_mem_get(shmID);
}
SINT32 sf_share_mem_file_init(void)
{
SF_SRCFILE_ATTR_S *pThumbFileCfg = 0;
if(SF_SUCCESS == sf_share_mem_init((char*)"/tmp/sf_file",sizeof(SF_SRCFILE_ATTR_S),&sf_sharMemfileId))
{
pThumbFileCfg = (SF_SRCFILE_ATTR_S *)sf_share_mem_get(sf_sharMemfileId);
if(pThumbFileCfg <= 0)
{
MLOGI("creat share mem failed!!!\n");
return SF_FAILURE;
}
else
{
//sf_file_thumb_cfg_set(pThumbFileCfg);
MLOGI("creat share mem succeed!!!\n");
return SF_SUCCESS;
}
}
return SF_FAILURE;
}
SINT32 sf_share_mem_customer_init(void)
{
UIMenuStoreInfo *pSfCustomerPara = 0;
if(SF_SUCCESS == sf_share_mem_init((char*)"/tmp/sf_share",sizeof(UIMenuStoreInfo),&sf_sharMemId))
{
pSfCustomerPara = (UIMenuStoreInfo *)sf_share_mem_get(sf_sharMemId);
if(pSfCustomerPara <= 0)
{
MLOGI("creat share mem failed!!!\n");
return SF_FAILURE;
}
else
{
//sf_customer_param_set(pSfCustomerPara);
MLOGI("creat share mem succeed!!!\n");
return SF_SUCCESS;
}
}
return SF_FAILURE;
}
SINT32 sf_share_mem_file_deinit(void)
{
return sf_share_mem_deinit(sf_sharMemfileId);
}
SINT32 sf_share_mem_customer_deinit(void)
{
return sf_share_mem_deinit(sf_sharMemId);
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

View File

@ -473,10 +473,87 @@ UINT8 sf_mcu_power_on_para_get(MCUParam_t attrId)
}
printf(" start mode = %d IRSHTTER = %d\n", startMode, IRSHTTER);
sf_get_mcu_rtc_set_sys();
return startMode;
}
/*************************************************
Function: sf_get_mcu_rtc_set_sys
Description: get mcu rtc,set to sys
Input: N/A
Output: N/A
Return: N/A
Others: N/A
*************************************************/
UINT8 sf_get_mcu_rtc_set_sys(void)
{
UINT8 mcuReg[REG_SIZE] = { 0 };
UINT8 mcuData[REG_SIZE] = { 0 };
UINT8 i = 0;
UINT16 year;
UINT16 mon;
UINT16 day;
UINT16 hour;
UINT16 min;
UINT16 sec;
struct tm Curr_DateTime = {0};
mcuReg[i++] = SF_RTC_YEAR;
mcuReg[i++] = SF_RTC_MONTH;
mcuReg[i++] = SF_RTC_DAY;
mcuReg[i++] = SF_RTC_HOUR;
mcuReg[i++] = SF_RTC_MINUTE;
mcuReg[i++] = SF_RTC_SEC;
sf_mcu_read_multi(mcuReg, mcuData, i);
i = 0;
year = mcuData[i++] + 2000;
mon = mcuData[i++];
day = mcuData[i++];
hour = mcuData[i++];
min = mcuData[i++];
sec = mcuData[i++];
if(sec == 0)
{
i = 0;
mcuReg[i++] = SF_RTC_YEAR;
mcuReg[i++] = SF_RTC_MONTH;
mcuReg[i++] = SF_RTC_DAY;
mcuReg[i++] = SF_RTC_HOUR;
mcuReg[i++] = SF_RTC_MINUTE;
mcuReg[i++] = SF_RTC_SEC;
sf_mcu_read_multi(mcuReg, mcuData, i);
i = 0;
year = mcuData[i++] + 2000;
mon = mcuData[i++];
day = mcuData[i++];
hour = mcuData[i++];
min = mcuData[i++];
sec = mcuData[i++];
}
printf("%s:%d %d : %d : %d : %d : %d : %d\n", __FUNCTION__, __LINE__,year, mon,day,hour,min,sec);
if((year >= SF_DATE_TIME_YEAR_MIN) && (year <= SF_DATE_TIME_YEAR_MAX) && (mon <= 12) && (day <= 31) && (hour < 24) && (min < 60) && (sec < 60))
{
Curr_DateTime.tm_year = year;
Curr_DateTime.tm_mon = mon;
Curr_DateTime.tm_mday = day;
Curr_DateTime.tm_hour = hour;
Curr_DateTime.tm_min = min;
Curr_DateTime.tm_sec = sec;
hwclock_set_time(TIME_ID_CURRENT, *(struct tm*)&Curr_DateTime, 0);
return SUCCESS;
}
return FAIL;
}
#endif
/*************************************************
@ -1327,6 +1404,7 @@ UINT8 sf_mcu_reg_set(MCUParam_t attrId, UINT8 val)
{
struct tm ctv = {0};
ctv = hwclock_get_time(TIME_ID_CURRENT);
printf("%s:%d %d : %d : %d : %d : %d : %d\n", __FUNCTION__, __LINE__,ctv.tm_year, ctv.tm_mon,ctv.tm_mday,ctv.tm_hour,ctv.tm_min,ctv.tm_sec);
mcuReg[i] = SF_RTC_YEAR;
mcuData[i++] = ctv.tm_year - 2000;
@ -1887,4 +1965,9 @@ int sf_while_flag(void)
}
}
void sf_set_sim_insert(UINT8 sim)
{
simCardInsert = sim;
}

File diff suppressed because it is too large Load Diff

View File

@ -19,28 +19,690 @@
*
**************************************************************************/
#include <linux/module.h>
#include <sf_mcu.h>
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/input.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#include <kwrap/util.h>
#include <sys/wait.h>
#include <errno.h>
#include <kwrap/debug.h>
#include <time.h>
#include <io/gpio.h>
#include <sf_inc.h>
//#include "sf_opera_adapt.h"
#include "UIInfo/UIInfo.h"
#define SF_4G_UART_BUFF_SIZE 512
static char UartBuff[SF_4G_UART_BUFF_SIZE] = { 0 };
char gsmPara[SF_4G_UART_BUFF_SIZE] = { 0 };
char logStr[128] = {0};
UINT16 UartlnIdx = 0;
UINT16 GprslnIdx = 0;
UINT32 UartLastRecvTime = 0;
UINT8 needRecordLogFlag = 0; /*1:need record log to sd card.*/
UINT8 SIMPIN1 = 1;
UINT8 SIMPIN11 = 1;
UINT8 SIMPINPUK = 1;
static UINT8 SimICCID[33] = { 0 };
UINT8 SimImei[8] = { 0 };
UINT8 AddCimiTimes = 0;
typedef struct sf_cimi_id
{
int id;
char cimi[6];
struct sf_cimi_id *next;
}sf_cimi_id_t;
sf_cimi_id_t cimi_head = { .id = 1, .cimi = "0", .next = NULL };
void sf_4g_data_buff_clear(void)
{
memset(UartBuff, '\0', sizeof(UartBuff));
UartlnIdx = 0;
UartLastRecvTime = 0;
GprslnIdx = 0;
}
void sf_gsm_para_buff_clear(void)
{
memset(gsmPara, '\0', sizeof(gsmPara));
}
void sf_set_sim_pin_flag(UINT8 simPin, UINT8 simPins, UINT8 simPinPuk)
{
SIMPIN1 = simPin;
SIMPIN11 = simPins;
SIMPINPUK = simPinPuk;
printf("[%s:%d]SIMPIN1=%d,SIMPIN11=%d,SIMPINPUK=%d\n", __FUNCTION__, __LINE__, SIMPIN1, SIMPIN11, SIMPINPUK);
}
SINT32 sf_add_cimi_id(char *cimi)
{
int ret = SUCCESS;
sf_cimi_id_t *n;
sf_cimi_id_t *nck;
for(nck = cimi_head.next; nck != NULL; nck = nck->next)
{
printf("[%s:%d]old:nck->id:%d,nck->cimi:%s\n\n", __FUNCTION__, __LINE__, nck->id, nck->cimi);
if(strstr((const char *)nck->cimi, cimi) || ((nck->id) >= 5))
{
return nck->id;
}
}
n = malloc(sizeof(sf_cimi_id_t));
memset(n->cimi, '\0', sizeof(n->cimi));
strncpy((char *)n->cimi, cimi, 5);
n->id = cimi_head.id++;
printf("[%s:%d]new:n->id:%d,n->cimi:%s\n", __FUNCTION__, __LINE__, n->id, n->cimi);
n->next = cimi_head.next;
cimi_head.next = n;
return ret;
}
/*************************************************
Function: sf_module_init
Description: module init
Input: N/A
Output: N/A
Return: 0 SUCCESS, 1 error
Others: N/A
*************************************************/
SINT32 sf_module_init(VOID)
{
SINT32 ret = SF_SUCCESS;
SF_SIM_E eSmsLocation = SMS_SIM_INIT_READY;
SINT32 ttyRet = 0;
UINT8 calltime = 0;
UINT16 time = 0;
SINT32 simCnt = 0;
char *temp = NULL;
char *delim = NULL;
int mm = 0;
int StrNumber = 0;
char strtmp[12][70] = { { 0 } };
printf("[%s:%d] s\n", __FUNCTION__, __LINE__);
UIMenuStoreInfo *pPara = sf_ui_para_get();
needRecordLogFlag = 1;
SysSetFlag(NetGeneration, SF_NET_NO);
sf_4g_data_buff_clear();
sf_gsm_para_buff_clear();
while(sf_while_flag())
{
switch(eSmsLocation)
{
case SMS_SIM_INIT_READY:
if(strstr((const char *)gsmPara, "OK"))
{
eSmsLocation = SMS_SIM_INIT_ATI;
strcpy((char *)gsmPara, "ATI\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
else if(strstr((const char *)gsmPara, "CME ERROR: SIM not inserted"))
{
ret = SF_SIM_ERROR_NO_SIMCARD;
SLOG_DM(gsmPara);
sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X", __FUNCTION__, __LINE__, ret);
SLOG_DM(logStr);
goto SF_MODULE_END;
}
else
{
//sleep(800);
strcpy((char *)gsmPara, "AT\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
//printf("ttyRet:%d\n", ttyRet);
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
break;
case SMS_SIM_INIT_ATI:
if(strstr((const char *)gsmPara, "Revision"))
{
SLOG_DM(gsmPara);
delim = " \r\n";
temp = strtok(strstr((const char *)gsmPara, "Revision"), delim);
mm = 0;
memset(strtmp, '\0', sizeof(strtmp));
while((temp != NULL) && (mm < 12))
{
strcpy(strtmp[mm], temp);
printf("---temp[%d]:%s\n", mm, temp);
mm++;
temp = strtok(0, delim);
}
strcpy((char *)pPara->ModuleVer, (const char *)strtmp[1]);
strcpy((char *)pPara->ModuleImei, (const char *)strtmp[3]);
printf("[%s:%d]ModuleImei:%s,ModuleVer:%s\n", __FUNCTION__, __LINE__, pPara->ModuleImei, pPara->ModuleVer);
strcpy((char *)gsmPara, "AT+CSUB\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
eSmsLocation = SMS_SIM_INIT_ATCSUB;
}
else
{
strcpy((char *)gsmPara, "ATI\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
break;
case SMS_SIM_INIT_ATCSUB:
if(strstr((const char *)gsmPara, "+CSUB:"))
{
delim = " \r\n";
temp = strtok(strstr((const char *)gsmPara, "+CSUB:"), delim);
mm = 0;
calltime = 0;
memset(strtmp, '\0', sizeof(strtmp));
while((temp != NULL) && (mm < 12))
{
strcpy(strtmp[mm], temp);
printf("---temp[%d]:%s\n", mm, temp);
mm++;
temp = strtok(0, delim);
}
strcpy((char *)pPara->ModuleSubver, (const char *)strtmp[1]);
printf("[%s:%d]ModuleQGver:%s\n", __FUNCTION__, __LINE__, pPara->ModuleSubver);
strcpy((char *)gsmPara, "AT+CPIN?\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
eSmsLocation = SMS_SIM_INIT_ATCPIN;
}
else
{
strcpy((char *)gsmPara, "AT+CSUB\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
break;
case SMS_SIM_INIT_ATCPIN:
if(strstr((const char *)gsmPara, "READY"))
{
sf_set_sim_pin_flag(1, 1, 1);
eSmsLocation = SMS_SIM_INIT_CNVW;
strcpy((char *)gsmPara, "AT+CNVW=3006,0,\"FF\"\r");
calltime = 0;
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
else if(strstr((const char *)gsmPara, "CME ERROR: SIM not inserted"))
{
calltime++;
if(calltime > 10)
{
ret = SF_SIM_ERROR_NO_SIMCARD;
sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X", __FUNCTION__, __LINE__, ret);
goto SF_MODULE_END;
}
else
{
//sleep(1000);
sprintf((char *)gsmPara, "%s", "AT+CPIN?\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
}
else if(strstr((const char *)gsmPara, "CME ERROR: SIM busy"))
{
if(simCnt > 50)
{
ret = SF_SIM_ERROR_NO_SIMCARD;
SLOG_DM(gsmPara);
sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X", __FUNCTION__, __LINE__, ret);
SLOG_DM(logStr);
goto SF_MODULE_END;
}
else
{
//sleep(1000);
sprintf((char *)gsmPara, "%s", "AT+CPIN?\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
simCnt++;
}
else if(strstr((const char *)gsmPara, "SIM")) /*+CPIN: SIM PIN*/
{
if(strstr((const char *)gsmPara, "PUK") == 0)
{
printf("[%s:%d]pPara->SimPinFlag=%d\n", __FUNCTION__, __LINE__, SysGetFlag(SimPinFlag));
if(SysGetFlag(SimPinFlag)) /*set pin code and save already*/
{
eSmsLocation = SMS_SIM_INIT_ATCPIN1;
SysSetFlag(SimPinFlag, 0);
//printf("[%s:%d]pPara->SimPinStr:%s\n",__FUNCTION__,__LINE__,pPara->SimPinStr);
sprintf((char *)gsmPara, "AT+CPIN=%s\r", pPara->SimPinStr);
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
else /*first time*/
{
sf_set_sim_pin_flag(0, 1, 1);
printf("[%s:%d]SIMPIN1=%d,SIMPIN11=%d,SIMPINPUK=%d\n", __FUNCTION__, __LINE__, SIMPIN1, SIMPIN11, SIMPINPUK);
SLOG_DM(gsmPara);
ret = SF_SIM_ERROR_PIN;
sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X", __FUNCTION__, __LINE__, ret);
SLOG_DM(logStr);
goto SF_MODULE_END;
}
}
else
{
sf_set_sim_pin_flag(1, 1, 0);
printf("--------PUK Error.--------\n");
ret = SF_SIM_ERROR_PIN_PUK;
SLOG_DM(gsmPara);
sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X", __FUNCTION__, __LINE__, ret);
SLOG_DM(logStr);
goto SF_MODULE_END;
}
}
else if(strstr((const char *)gsmPara, "NOT"))
{
sf_set_sim_insert(0);
sf_set_sim_pin_flag(1, 1, 1);
ret = SF_SIM_ERROR_PIN;
SLOG_DM(gsmPara);
sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X", __FUNCTION__, __LINE__, ret);
SLOG_DM(logStr);
goto SF_MODULE_END;
}
else
{
if(time % 10 == 0)
{
printf("--------tempi:%d.--------\n", time);
sprintf((char *)gsmPara, "AT+CPIN?\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
}
break;
case SMS_SIM_INIT_ATCPIN1:
printf("[SMS_SIM_INIT_ATCPIN1]gsmPara:%s\n", gsmPara);
if(strstr((const char *)gsmPara, "ERROR"))
{
if(strstr((const char *)gsmPara, "PUK"))
{
sf_set_sim_pin_flag(1, 1, 0);
printf("--------PUK Error.---2-----\n");
ret = SF_SIM_ERROR_PIN_PUK;
SLOG_DM(gsmPara);
sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X", __FUNCTION__, __LINE__, ret);
SLOG_DM(logStr);
goto SF_MODULE_END;
}
else
{
printf("[%s:%d]Pin Code Entered Error.\n", __FUNCTION__, __LINE__);
sf_set_sim_pin_flag(1, 0, 1);
ret = SF_SIM_ERROR_PIN;
SLOG_DM(gsmPara);
sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X", __FUNCTION__, __LINE__, ret);
SLOG_DM(logStr);
goto SF_MODULE_END;
}
}
else if(strstr((const char *)gsmPara, "OK"))
{
sf_set_sim_pin_flag(1, 1, 1);
eSmsLocation = SMS_SIM_INIT_ATCPIN2;
sprintf((char *)gsmPara, "AT+CLCK=\"SC\",0,\"%s\"\r", pPara->SimPinStr);
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
calltime = 0;
}
break;
case SMS_SIM_INIT_ATCPIN2:
printf("[SMS_SIM_INIT_ATCPIN2]gsmPara:%s\n", gsmPara);
if(strstr((const char *)gsmPara, "READY"))
{
sf_set_sim_pin_flag(1, 1, 1);
//eSmsLocation = SMS_SIM_INIT_ATCIMI;
//strcpy((char *)gsmPara, "AT+CIMI\r");
eSmsLocation = SMS_SIM_INIT_CNVW;
strcpy((char *)gsmPara, "AT+CNVW=3006,0,\"FF\"\r");
calltime = 0;
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
else
{
calltime++;
if(calltime > 30)
{
sf_set_sim_pin_flag(0, 1, 1);
ret = SF_SIM_ERROR_PIN;
SLOG_DM(gsmPara);
sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X", __FUNCTION__, __LINE__, ret);
SLOG_DM(logStr);
goto SF_MODULE_END;
}
}
break;
case SMS_SIM_INIT_CNVW:
if(strstr((const char *)gsmPara, "OK"))
{
strcpy((char *)gsmPara, "AT&W\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
eSmsLocation = SMS_SIM_INIT_ATW;
}
else
{
//appTimeDelayMs(800);
strcpy((char *)gsmPara, "AT+CNVW=3006,0,\"FF\"\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
break;
case SMS_SIM_INIT_ATW:
if(strstr((const char *)gsmPara, "OK"))
{
strcpy((char *)gsmPara, "AT+CICCID\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
eSmsLocation = SMS_SIM_INIT_CICCID;
}
else
{
//appTimeDelayMs(800);
strcpy((char *)gsmPara, "AT&W\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
break;
case SMS_SIM_INIT_CICCID:
if(strstr((const char *)gsmPara, "+ICCID:"))
{
delim = " \r\n";
temp = strtok(strstr((const char *)gsmPara, "+ICCID:"), delim);
mm = 0;
calltime = 0;
memset(strtmp, '\0', sizeof(strtmp));
while((temp != NULL) && (mm < 12))
{
strcpy(strtmp[mm], temp);
printf("---temp[%d]:%s\n", mm, temp);
mm++;
temp = strtok(0, delim);
}
strcpy((char *)SimICCID, (const char *)strtmp[1]);
printf("%s:%d SimICCID:%s\n", __FUNCTION__, __LINE__, SimICCID);
eSmsLocation = SMS_SIM_INIT_ATCIMI;
strcpy((char *)gsmPara, "AT+CIMI\r");
calltime = 0;
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
else
{
strcpy((char *)gsmPara, "AT+CICCID\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
break;
case SMS_SIM_INIT_ATCIMI:
printf("[SMS_SIM_INIT_ATCIMI]gsmPara:%s\n", gsmPara);
if(strstr((const char *)gsmPara, "OK"))
{
SLOG_DM(gsmPara);
delim = " \r\n";
if(strstr((const char *)gsmPara, "AT+CIMI"))
{
temp = strtok(strstr((const char *)gsmPara, "AT+CIMI"), delim);
StrNumber = 1;
}
else
{
temp = strtok((char *)gsmPara, delim);
StrNumber = 0;
}
mm = 0;
memset(strtmp, '\0', sizeof(strtmp));
while((temp != NULL) && (mm < 12))
{
strcpy(strtmp[mm], temp);
printf("---temp[%d]:%s\n", mm, temp);
mm++;
temp = strtok(0, delim);
}
if(((strtmp[StrNumber][0] - '0') >= 0) && ((strtmp[StrNumber][0] - '0') <= 9) && ((strtmp[StrNumber][5] - '0') >= 0) && ((strtmp[StrNumber][5] - '0') <= 9))
{
memset(pPara->OperatorCode, '\0', sizeof(pPara->OperatorCode));
strncpy((char *)pPara->OperatorCode, (const char *)strtmp[StrNumber], 5);
strncpy((char *)SimImei, (const char *)strtmp[1], 5);
printf("[%s:%d]OperatorCode:%s,SimImei:%s\n", __FUNCTION__, __LINE__, pPara->OperatorCode, SimImei);
if(SysGetFlag(SimAutoSwitch) == 0)
{
if(sf_auto_operation_adjust() == FAIL)
{
SLOG_DM(gsmPara);
sprintf((char *)logStr, "Auto Operation Fail,MCCMNC:%s", pPara->OperatorCode);
SLOG_DM(logStr);
ret = SF_SIM_ERROR_APN;
sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X", __FUNCTION__, __LINE__, ret);
SLOG_DM(logStr);
//sf_guide_operator_match_status_set();
goto SF_MODULE_END;
}
else
{
sprintf((char *)logStr, "Auto Operation Success,MCCMNC:%s", pPara->OperatorCode);
SLOG_DM(logStr);
}
printf("pPara->Sim4gApn=%s\n", pPara->Sim4gApn);
}
else
{
//searchState = SEARCH_OPERATOR_SUCCESS;
printf("[%s:%d]operation info manual set,default success.\n", __FUNCTION__, __LINE__);
}
if((strstr((const char *)pPara->Sim4gApn, APNGPRS_WUYUAN1)) || (strstr((const char *)pPara->Sim4gApn, APNGPRS_WUYUAN2)))
{
sf_add_cimi_id((char *)SimImei);
AddCimiTimes++;
}
//sf_guide_operator_match_status_set();
if(strstr((const char *)pPara->Sim4gApn, APN_4G_VERIZON))
{
sprintf((char *)gsmPara, "AT+CGDCONT=3,\"IPV4V6\",\"%s\"\r", pPara->Sim4gApn);
}
else if(strstr((const char *)pPara->Sim4gApn, APN_4G_ATT))
{
sprintf((char *)gsmPara, "AT+CGDCONT=1,\"IPV4V6\",\"%s\"\r", pPara->Sim4gApn);
}
else
{
sprintf((char *)gsmPara, "AT+CGDCONT=1,\"IPV4V6\",\"%s\"\r", pPara->Sim4gApn);
}
eSmsLocation = SMS_SIM_INIT_EXIT;
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
else
{
ret = SF_SIM_ERROR_APN;
SLOG_DM(gsmPara);
sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X", __FUNCTION__, __LINE__, ret);
SLOG_DM(logStr);
goto SF_MODULE_END;
}
}
else
{
calltime++;
if(calltime > 10)
{
ret = SF_SIM_ERROR_APN;
SLOG_DM(gsmPara);
sprintf((char *)logStr, "[%s:%d]Error Code:0x%08X", __FUNCTION__, __LINE__, ret);
SLOG_DM(logStr);
goto SF_MODULE_END;
}
strcpy((char *)gsmPara, "AT+CIMI\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
break;
case SMS_SIM_INIT_QICSGP:
if(strstr((const char *)gsmPara, "OK"))
{
if(strstr((const char *)gsmPara, "\"ims\"") == NULL)
{
eSmsLocation = SMS_SIM_INIT_QICSGP1;
sprintf((char *)gsmPara, "AT+QPRTPARA=3\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
else
{
goto SF_MODULE_END;
}
}
break;
case SMS_SIM_INIT_QICSGP1:
if(strstr((const char *)gsmPara, "OK"))
{
/*sf_4g_uart_exit();
sf_mcu_reg_set(SF_MCU_RESET_MODULE, 0);
appTimeDelayMs(5000);
if(SUCCESS != sf_4g_uart_init(1))
{
printf("[%s:%d] tty usb err\n", __FUNCTION__, __LINE__);
goto SF_MODULE_END;
}*/
time = 0;
calltime = 0;
eSmsLocation = SMS_SIM_INIT_READY;
}
break;
case SMS_SIM_INIT_EXIT:
if(strstr((const char *)gsmPara, "OK"))
{
goto SF_MODULE_END;
}
else
{
strcpy((char *)gsmPara, "AT\r");
ttyRet = sf_4g_send_data(gsmPara, strlen((const char *)gsmPara));
SF_CHECK_RETURN(ttyRet, SF_GPRS_MODULE_ERROR_WRITE);
}
break;
default:
break;
}
sf_4g_get_data(gsmPara, 200);
if(gsmPara[0] != '\0')
{
printf("[%s:%d]eSmsLocation:%d\ngsmPara:%s\n", __FUNCTION__, __LINE__, eSmsLocation, gsmPara);
}
time++;
if(time > 800)
{
SLOG_DM(gsmPara);
sprintf((char *)logStr, "[%s:%d]Wait Init Timeout.", __FUNCTION__, __LINE__);
printf("%s,GprsMode=%d\n", logStr, SysGetFlag(GprsMode));
SLOG_DM(logStr);
time = 0;
ret = SF_SIM_ERROR_AT_TIMEOUT;
goto SF_MODULE_END;
}
}
SF_MODULE_END:
printf("[%s:%d]ret:[0x%08X]\n\n", __FUNCTION__, __LINE__, ret);
return ret;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif

View File

@ -1,6 +1,6 @@
; Source Insight Project File List
; Project Name: na51089_linux_sdk
; Generated by Source Insight 4.00.0107 at 2023/4/7 16:06:09
; Generated by Source Insight 4.00.0107 at 2023/4/10 14:55:33
; Version=4.00.0107
;
; Each line should contain either a file name, a wildcard, or a sub-directory name.
@ -5015,8 +5015,10 @@ lib\source\sifar\code\include\sf_inc.h
lib\source\sifar\code\include\sf_led.h
lib\source\sifar\code\include\sf_log.h
lib\source\sifar\code\include\sf_mcu.h
lib\source\sifar\code\include\sf_message_queue.h
lib\source\sifar\code\include\sf_pc_tool.h
lib\source\sifar\code\include\sf_sd_common.h
lib\source\sifar\code\include\sf_share_mem.h
lib\source\sifar\code\include\sf_sim.h
lib\source\sifar\code\include\sf_tcp.h
lib\source\sifar\code\include\sf_type.h
@ -5024,8 +5026,10 @@ lib\source\sifar\code\source\common\sf_base64.c
lib\source\sifar\code\source\common\sf_battery.c
lib\source\sifar\code\source\common\sf_common.c
lib\source\sifar\code\source\common\sf_led.c
lib\source\sifar\code\source\common\sf_message_queue.c
lib\source\sifar\code\source\common\sf_pc_tool.c
lib\source\sifar\code\source\common\sf_sd_common.c
lib\source\sifar\code\source\common\sf_share_mem.c
lib\source\sifar\code\source\debug\sf_dbg.c
lib\source\sifar\code\source\debug\sf_log.c
lib\source\sifar\code\source\mcu\sf_commu_mcu.c

View File

@ -48,7 +48,6 @@ echo sen1=${SENSOR1}
MV_KO_LIST=(\
/lib/modules/$KERVER/extra/mcu/drv_sf_i2c_mcu.ko \
/lib/modules/$KERVER/extra/net/GobiNet/drv_gobi_net.ko \
/lib/modules/$KERVER/extra/crypto/cryptodev-linux/cryptodev.ko \
/lib/modules/$KERVER/vos/kwrap/kwrap.ko \
/lib/modules/$KERVER/hdal/comm/nvtmem/nvtmem.ko \
@ -92,18 +91,9 @@ MV_KO_LIST=(\
/lib/modules/$KERVER/hdal/kdrv_videoout/fbdev/nvt_fb.ko \
/lib/modules/$KERVER/kernel/drivers/iio/industrialio.ko \
/lib/modules/$KERVER/kernel/drivers/iio/adc/nvt_adc.ko \
/lib/modules/$KERVER/hdal/comm/uvcp/nvt_uvcp.ko \
/lib/modules/$KERVER/hdal/comm/usb2dev/nvt_usb2dev.ko \
/lib/modules/$KERVER/kernel/drivers/usb/serial/option.ko \
/lib/modules/$KERVER/kernel/drivers/usb/serial/usb_wwan.ko \
/lib/modules/$KERVER/kernel/drivers/usb/serial/usbserial.ko \
/lib/modules/$KERVER/kernel/drivers/net/usb/usbnet.ko \
/lib/modules/$KERVER/kernel/drivers/net/usb/cdc_ether.ko \
/lib/modules/$KERVER/kernel/drivers/net/usb/qmi_wwan.ko \
/lib/modules/$KERVER/kernel/drivers/usb/ehci-hcd.ko \
/lib/modules/$KERVER/kernel/drivers/net/mii.ko \
)
if [ -d ${ROOTFS_DIR}/rootfs/etc/lib ]; then
echo "remove old rootfs etc/lib"
rm -r ${ROOTFS_DIR}/rootfs/etc/lib

View File

@ -676,18 +676,21 @@ static UINT32 DrvPowerControl(UINT32 CtrlID, UINT32 Param1, UINT32 Param2)
{
switch(CtrlID) {
case DRVPWR_CTRL_CURRENT_TIME:
printf("[%s:%d] s DRVPWR_CTRL_CURRENT_TIME\n",__FUNCTION__,__LINE__);
if (Param1 == 0)
hwclock_set_time(TIME_ID_CURRENT, *(struct tm*)Param2, 0);
if (Param1 == 1)
*((struct tm*)Param2) = hwclock_get_time(TIME_ID_CURRENT);
break;
case DRVPWR_CTRL_HWRT_TIME:
printf("[%s:%d] s DRVPWR_CTRL_HWRT_TIME\n",__FUNCTION__,__LINE__);
if (Param1 == 0)
hwclock_set_time(TIME_ID_HWRT, *(struct tm*)Param2, 0);
if (Param1 == 1)
*((struct tm*)Param2) = hwclock_get_time(TIME_ID_HWRT);
break;
case DRVPWR_CTRL_SWRT_TIME:
printf("[%s:%d] s DRVPWR_CTRL_SWRT_TIME\n",__FUNCTION__,__LINE__);
if (Param1 == 0)
hwclock_set_time(TIME_ID_SWRT, *(struct tm*)Param2, 0);
if (Param1 == 1)

View File

@ -190,6 +190,7 @@ static UINT32 DrvPowerInit(void *pInitParam)
static UINT32 DrvPowerOpen(void)
{
DBG_IND("open\r\n");
//DBG_WRN("[%s:%d] s HWCLOCK_MODE_RTC\n",__FUNCTION__,__LINE__);
hwclock_open(HWCLOCK_MODE_RTC);
return DX_OK;
}
@ -216,6 +217,7 @@ static UINT32 DrvPowerControl(UINT32 CtrlID, UINT32 Param1, UINT32 Param2)
{
switch(CtrlID) {
case DRVPWR_CTRL_CURRENT_TIME:
//DBG_WRN("[%s:%d] s DRVPWR_CTRL_CURRENT_TIME\n",__FUNCTION__,__LINE__);
if (Param1 == 0) {
hwclock_set_time(TIME_ID_CURRENT, *(struct tm*)Param2, 0);
}
@ -224,6 +226,7 @@ static UINT32 DrvPowerControl(UINT32 CtrlID, UINT32 Param1, UINT32 Param2)
}
break;
case DRVPWR_CTRL_HWRT_TIME:
//DBG_WRN("[%s:%d] s DRVPWR_CTRL_HWRT_TIME\n",__FUNCTION__,__LINE__);
if (Param1 == 0) {
hwclock_set_time(TIME_ID_HWRT, *(struct tm*)Param2, 0);
}
@ -232,6 +235,7 @@ static UINT32 DrvPowerControl(UINT32 CtrlID, UINT32 Param1, UINT32 Param2)
}
break;
case DRVPWR_CTRL_SWRT_TIME:
//DBG_WRN("[%s:%d] s DRVPWR_CTRL_SWRT_TIME\n",__FUNCTION__,__LINE__);
if (Param1 == 0) {
hwclock_set_time(TIME_ID_SWRT, *(struct tm*)Param2, 0);
}

View File

@ -1084,46 +1084,46 @@ static UINT32 ae_adc_tbl[57][3] = {
{0, 33333, 6000},//128000},
#else // 1K RSS
{980, 120, 1000},
{970, 250, 1000},
{960, 250, 1000},
{945, 250, 1000},
{930, 250, 1000},
{910, 250, 1000},
{900, 250, 1000},
{885, 250, 1000},
{870, 300, 1000},
{850, 300, 1000},
{840, 300, 1000},
{832, 300, 1000},
{820, 300, 1000},
{816, 300, 1000},
{810, 300, 1000},
{805, 400, 1000},
{800, 400, 1000},
{787, 400, 1000},
{750, 400, 1000},
{723, 400, 1000},
{671, 400, 1000},
{641, 500, 1000},
{600, 500, 1000},
{538, 500, 1000},
{503, 500, 1000},
{484, 500, 1000},
{466, 600, 1000},
{414, 600, 1000},
{347, 600, 1000},
{353, 800, 1000},
{330, 800, 1000},
{324, 800, 1000},
{314, 800, 1000},
{306, 900, 1000},
{277, 1000, 1000},
{257, 1200, 1000},
{109, 2700, 1000},
{84, 4201, 1000},
{76, 4201, 1000},// night
{60, 5801, 1000},
{49, 5801, 1000},
{970, 120, 1000},
{960, 120, 1000},
{945, 120, 1000},
{930, 120, 1000},
{910, 120, 1000},
{900, 120, 1000},
{885, 120, 1000},
{870, 200, 1000},
{850, 200, 1000},
{840, 200, 1000},
{832, 200, 1000},
{820, 200, 1000},
{816, 200, 1000},
{810, 200, 1000},
{805, 200, 1000},
{800, 200, 1000},
{787, 200, 1000},
{750, 200, 1000},
{723, 200, 1000},
{671, 200, 1000},
{641, 200, 1000},
{600, 200, 1000},
{538, 300, 1000},
{503, 300, 1000},
{484, 300, 1000},
{466, 300, 1000},
{414, 400, 1000},
{347, 400, 1000},
{353, 400, 1000},
{330, 500, 1000},
{324, 500, 1000},
{314, 500, 1000},
{306, 600, 1000},
{277, 600, 1000},
{257, 800, 1000},
{109, 900, 1000},
{84, 1000, 1000},
{76, 1200, 1000},// night
{60, 2700, 1000},
{49, 4201, 1000},
{36, 5801, 1000},
{31, 7332, 1000},
{26, 7332, 1000},
@ -1139,7 +1139,7 @@ static UINT32 ae_adc_tbl[57][3] = {
{6, 16666, 2000},
{5, 16666, 2000},
{2, 33333, 2000},
{0, 33333, 6000},
{0, 33333, 4000},
#endif
};

View File

@ -487,11 +487,11 @@
// EXIF Config
#define USE_EXIF DISABLE
// End string must be '\0', total char must be 31
#define EXIF_MAKER_NAME "DvCam"
#define EXIF_MAKER_NAME "SY"
// End string must be '\0', total char must be 31
#define EXIF_MODEL_NAME "96675"
#define EXIF_MODEL_NAME "S530-R"
// End string must be '\0', total char must be 31
#define EXIF_IMAGE_DESCROPTOIN "NOVATEK CAMERA"
#define EXIF_IMAGE_DESCROPTOIN "S530 CAMERA"
#define EXIF_SOFTWARE_VERSION FW_VERSION_NUM // <= 20 char (TagSoftVerLen)
@ -947,6 +947,7 @@
#define HUNTING_MCU_I2C DISABLE
#define HUNTING_MCU_UART ENABLE
#define HUNTING_IR_LED_940 DISABLE
#define SF_EXIF_MN_BUF_SIZE 256
#define SF_BASE_VERSION "7MD4RCwD3T2"
/*******************************************************************************************

View File

@ -366,12 +366,13 @@ extern void rtcTest_poweroffPWR(void);
int NvtMain(void)
{
struct tm ctv = {0};
System_InstallID();
#if (USB_MODE==ENABLE)
System_OnUsbPreInit();
#endif
System_OnPowerPreInit();
#if HUNTING_CAMERA_MCU != ENABLE// The time is controlled by the MCU. sf_get_mcu_rtc_set_sys
struct tm ctv = {0};
//System_OnPowerPreInit() should be prior to rtc checking
ctv = hwclock_get_time(TIME_ID_CURRENT);
@ -384,6 +385,7 @@ int NvtMain(void)
ctv.tm_sec = DEFAULT_SEC;
hwclock_set_time(TIME_ID_CURRENT, ctv, 0);
}
#endif
#if (POWERON_TRACE == ENABLE)
System_WaitForPowerOnFinish(); // Wait for boot cmd

View File

@ -172,6 +172,7 @@ static void insmod_system(void)
DBG_ERR("open hwclock failed!\n");
}
else{
#if HUNTING_CAMERA_MCU != ENABLE// The time is controlled by the MCU. sf_get_mcu_rtc_set_sys
struct tm current_time = {0};
struct tm current_time2 = {0};
@ -188,10 +189,10 @@ static void insmod_system(void)
current_time2 = hwclock_get_time(TIME_ID_CURRENT);
DBG_DUMP("hwclock_get_time TIME_ID_CURRENT y%lu m%lu\n", current_time2.tm_year, current_time2.tm_mon);
#endif
}
vos_perf_list_mark("b_sys", __LINE__, 1);
}

View File

@ -49,11 +49,14 @@ typedef struct {
UINT32 MakerNoteCheckID;
UINT16 TestData1;
UINT16 TestData2;
char ExifBuf[SF_EXIF_MN_BUF_SIZE];
//Please reserve two word space to let capture flow save the screennail info.
UINT32 ScreennailOffset;
UINT32 ScreennailSize;
} SAMPLE_CODE_MAKER_NOTE, *PSAMPLE_CODE_MAKER_NOTE;
extern void PhotoStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen);
ER ExifCB(EXIF_EVENT event, PMEM_RANGE pBuffer, UINT32 uiRetParamNum, UINT32 *pParamArray)
{
//UINT32 i;
@ -67,6 +70,10 @@ ER ExifCB(EXIF_EVENT event, PMEM_RANGE pBuffer, UINT32 uiRetParamNum, UINT32 *pP
MakerNoteSample.TestData1 = (UINT16)QUALITY_FINE;
#endif
MakerNoteSample.TestData2 = 0xA5A5;
PhotoStamp_get_isp_status(0,&MakerNoteSample.ExifBuf[0],SF_EXIF_MN_BUF_SIZE);
//printf("%s:%d Buf=%s\r\n",__FUNCTION__,__LINE__,MakerNoteSample.SfExifBuf);
memcpy((void *)pBuffer->addr, (void *) &MakerNoteSample, sizeof(MakerNoteSample));
pBuffer->size = sizeof(MakerNoteSample);
} else if (PARSE_MAKERNOTE == event) {

View File

@ -3587,7 +3587,7 @@ INT32 MovieExe_OnRecStart(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray)
UINT32 i, mask;
UINT32 movie_rec_mask, clone_rec_mask;
USIZE thmub_size;
UINT32 uifile_buffer_reserved_sec = 10;
UINT32 uifile_buffer_reserved_sec = 5;
#if (_BOARD_DRAM_SIZE_ == 0x04000000)
uifile_buffer_reserved_sec =5;
#elif ((SENSOR_CAPS_COUNT >= 2) && (_BOARD_DRAM_SIZE_ == 0x08000000))

View File

@ -817,9 +817,9 @@ THREAD_RETTYPE MovieFast_InitMovieModeThread(void *arg)
#endif
MovieFast_InstallID();
vos_util_delay_ms(300);
vos_util_delay_ms(500);
Set_AEMODE(1);
vos_util_delay_ms(300);
vos_util_delay_ms(500);
if ((g_moviefast_tsk_id = vos_task_create(MovieFast_CmdTsk, 0, "MovieFastTsk", PRI_MOVIEFAST_CMDTSK, STKSIZE_MOVIEFAST_CMDTSK)) == 0) {
DBG_ERR("MovieFastTsk create failed.\r\n");

View File

@ -282,17 +282,17 @@ static void MovieStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen)
AET_STATUS_INFO ae_status = {0};
AWBT_STATUS awb_status = {0};
IQT_WDR_PARAM wdr = {0};
IQT_DEFOG_PARAM defog = {0};
//IQT_DEFOG_PARAM defog = {0};
id = 0;
ae_status.id = id;
vendor_isp_get_ae(AET_ITEM_STATUS, &ae_status);
awb_status.id = id;
vendor_isp_get_awb(AWBT_ITEM_STATUS, &awb_status);
wdr.id = id;
vendor_isp_get_iq(IQT_ITEM_WDR_PARAM, &wdr);
defog.id = id;
vendor_isp_get_iq(IQT_ITEM_DEFOG_PARAM, &defog);
snprintf(Buf, BufLen, "%3d %4d %4d %6d %6d %4d %4d %d %d %4d %4d %4d\0",
//defog.id = id;
//vendor_isp_get_iq(IQT_ITEM_DEFOG_PARAM, &defog);
snprintf(Buf, BufLen, "%3d %4d %4d %6d %6d %4d %4d %d %4d %4d %4d\0",
ae_status.status_info.lv/100000,
ae_status.status_info.lum,
ae_status.status_info.expect_lum,
@ -301,7 +301,7 @@ static void MovieStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen)
ae_status.status_info.overexp_adj,
ae_status.status_info.overexp_cnt,
wdr.wdr.enable,
defog.defog.enable,
//defog.defog.enable,
awb_status.status.cur_r_gain,
awb_status.status.cur_b_gain,
awb_status.status.cur_ct
@ -543,6 +543,11 @@ void MovieStamp_Setup(UINT32 uiVEncOutPortId, UINT32 uiFlag, UINT32 uiImageWidth
}
g_VsFontIn[uiVEncOutPortId].pFont=(FONT *) lv_plugin_get_font(red_id)->font;
#if MOVIE_ISP_LOG
red_id = LV_USER_CFG_STAMP_FONT_ID_SMALL;
g_VsFontIn[uiVEncOutPortId].pFont=(FONT *) lv_plugin_get_font(red_id)->font;
#endif
#else
@ -582,11 +587,13 @@ void MovieStamp_Setup(UINT32 uiVEncOutPortId, UINT32 uiFlag, UINT32 uiImageWidth
break;
}
#endif
#if MOVIE_ISP_LOG
g_VsFontIn[uiVEncOutPortId].pFont=(FONT *)gDateStampFontTbl12x20;
#endif
#endif
/* do water logo scaling*/
#if defined (WATERLOGO_FUNCTION) && (WATERLOGO_FUNCTION == ENABLE)
{

View File

@ -12,6 +12,8 @@
#include "KeyDef.h"
#include "UIApp/ExifVendor.h"
#include "exif/Exif.h"
#include "exif/ExifDef.h"
//#include "iq_api.h"
//#include "ImageUnit_VdoEnc.h"
@ -55,6 +57,7 @@ void Photo_WriteExifCB(UINT32 *SensorID)
ExifVendor_Write0thIFD(HandleID);
ExifVendor_WriteExifIFD(HandleID);
ExifVendor_Write0thIntIFD(HandleID);
#endif
}

View File

@ -966,7 +966,6 @@ static void _PhotoFast_Unused(void)
static ER PhotoFast_CaptureInit(void)
{
struct tm Curr_DateTime = {0};
PhotoFast_InstallID();
if ((g_photofast_tsk_id = vos_task_create(PhotoFast_CmdTsk, 0, "PhotoFastTsk", PRI_PHOTOFAST_CMDTSK, STKSIZE_PHOTOFAST_CMDTSK)) == 0) {
@ -975,6 +974,10 @@ static ER PhotoFast_CaptureInit(void)
vos_task_resume(g_photofast_tsk_id);
}
#if HUNTING_CAMERA_MCU != ENABLE// The time is controlled by the MCU. sf_get_mcu_rtc_set_sys
printf("[%s:%d] s \n",__FUNCTION__,__LINE__);
struct tm Curr_DateTime = {0};
//temp test
Curr_DateTime.tm_year = 2021;
Curr_DateTime.tm_mon = 12;
@ -984,7 +987,7 @@ static ER PhotoFast_CaptureInit(void)
Curr_DateTime.tm_sec = 12;
hwclock_set_time(TIME_ID_CURRENT, *(struct tm*)&Curr_DateTime, 0);
#endif
_PhotoFast_Unused();
return E_OK;
@ -992,7 +995,6 @@ static ER PhotoFast_CaptureInit(void)
#else
static ER PhotoFast_CaptureInit(void)
{
struct tm Curr_DateTime = {0};
UINT32 u32W, u32H;
HD_RESULT hd_ret;
PHOTOFAST_ENC_INFO EncInfo = {0};
@ -1027,6 +1029,9 @@ static ER PhotoFast_CaptureInit(void)
} else {
vos_task_resume(g_photofast_tsk_id);
}
#if HUNTING_CAMERA_MCU != ENABLE// The time is controlled by the MCU. sf_get_mcu_rtc_set_sys
struct tm Curr_DateTime = {0};
printf("[%s:%d] s \n",__FUNCTION__,__LINE__);
//temp test
Curr_DateTime.tm_year = 2021;
@ -1037,7 +1042,7 @@ static ER PhotoFast_CaptureInit(void)
Curr_DateTime.tm_sec = 12;
hwclock_set_time(TIME_ID_CURRENT, *(struct tm*)&Curr_DateTime, 0);
#endif
// allocate primary captured resolution
u32W = GetPhotoSizeWidth(SysGetFlag(FL_PHOTO_SIZE));
u32H = GetPhotoSizeHeight(SysGetFlag(FL_PHOTO_SIZE));
@ -1344,13 +1349,13 @@ THREAD_RETTYPE PhotoFast_FlowPreviewThread(void *arg)
// nvt_cmdsys_runcmd("ctl_ipp dump_hdl_all");
nvt_cmdsys_runcmd("ae dbg 0 256 1 ");
isp_dbg_set_dbg_mode(0, 0x0003000 );
nvt_cmdsys_runcmd("ae set_speed 0 128 600 700 100 ");
nvt_cmdsys_runcmd("ae set_speed 0 128 600 600 100 ");
}
#endif
while(g_bPreViewPullFlag) {
if (g_bFrmCnt == 4){;
if (g_bFrmCnt == 7){;
Set_AEMODE(1);
//setet_preset_param();
setet_preset_param();
}
#if POWERON_FAST_SLICE_ENC_VER2 == ENABLE
@ -1376,7 +1381,7 @@ THREAD_RETTYPE PhotoFast_FlowPreviewThread(void *arg)
// vos_perf_list_mark("yuv", __LINE__, 0);
//}
if(++g_bFrmCnt >= 7){//PHOTOFAST_CAP_FRAME_CNT){
if(++g_bFrmCnt >= 12){//PHOTOFAST_CAP_FRAME_CNT){
start_cap = TRUE;
//Set_AEMODE(1);
}
@ -1628,8 +1633,9 @@ void Set_AEMODE(UINT32 id)
{
AET_MANUAL ae_manual = {0};
AET_STATUS_INFO ae_status_info = {0};
//AWBT_STATUS awb_status = {0};
//AWBT_MANUAL awb_manual = {0};
AWBT_STATUS status = {0};
ISPT_C_GAIN c_gain = {0};
HD_RESULT hd_ret;
if ((hd_ret = vendor_isp_init()) != HD_OK) {
@ -1651,19 +1657,18 @@ else
vendor_isp_set_ae(AET_ITEM_MANUAL, &ae_manual);
/*if(sf_is_night_mode(0) ==FALSE)
if(sf_is_night_mode(0) ==FALSE)
{
awb_status.id = 0;
vendor_isp_get_awb(AWBT_ITEM_STATUS, &awb_status);
awb_manual.id = 0;
status.id = 0;
vendor_isp_get_awb(AWBT_ITEM_STATUS, &status);
awb_manual.manual.en = 1;
awb_manual.manual.r_gain= awb_status.status.cur_r_gain;
awb_manual.manual.g_gain= awb_status.status.cur_g_gain;
awb_manual.manual.b_gain= awb_status.status.cur_b_gain;
c_gain.id = 0;
vendor_isp_set_awb(AWBT_ITEM_MANUAL, &awb_manual);
}*/
c_gain.gain[0] = status.status.cur_r_gain;
c_gain.gain[1] = status.status.cur_g_gain;
c_gain.gain[2] = status.status.cur_b_gain;
vendor_isp_set_common(ISPT_ITEM_C_GAIN, &c_gain);
}
}
if ((hd_ret = vendor_isp_uninit()) != HD_OK) {
DBG_ERR("vendor_isp_uninit() fail(%d)\r\n", hd_ret);

View File

@ -67,13 +67,14 @@ void PhotoStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen)
//vendor_isp_get_iq(IQT_ITEM_3DNR_PARAM, &nr_3d);
//defog.id = id;
//vendor_isp_get_iq(IQT_ITEM_DEFOG_PARAM, &defog);
// struct tm Curr_gsDateTime ={0};
//Curr_gsDateTime = hwclock_get_time(TIME_ID_CURRENT);
struct tm Curr_gsDateTime ={0};
Curr_gsDateTime = hwclock_get_time(TIME_ID_CURRENT);
//sprintf(strStampDateTime, "%04d/%02d/%02d %02d:%02d:%02d", Curr_gsDateTime.tm_year, Curr_gsDateTime.tm_mon, Curr_gsDateTime.tm_mday, Curr_gsDateTime.tm_hour, Curr_gsDateTime.tm_min, Curr_gsDateTime.tm_sec);
#if 1
//snprintf(Buf, BufLen, "%d %d %3d %4d %4d %4d %4d %d %4d %4d %4d %4d %04d/%02d/%02d %02d:%02d:%02d %d%c",
snprintf(Buf, BufLen, "6 %d %d %3d %4d %4d %d %d %d %4d %4d %4d %4d %4d%c",// %d%c",
//snprintf(Buf, BufLen, "6 %d %d %3d %4d %4d %d %d %d %4d %4d %4d %4d %4d%c",// %d%c",
/*snprintf(Buf, BufLen, "%d %d %3d %4d %4d %d %d %d %4d %4d %4d %4d %4d%c %04d/%02d/%02d %02d:%02d:%02d",
(INT)(ae_status.status_info.iso_gain[0]),
(INT)(ae_status.status_info.expotime[0]),
@ -88,17 +89,30 @@ void PhotoStamp_get_isp_status(UINT32 id, char* Buf, UINT32 BufLen)
(INT)(awb_status.status.cur_b_gain),
(INT)(awb_status.status.cur_ct),
(INT)(IRSHTTER),
//Curr_gsDateTime.tm_year,
//Curr_gsDateTime.tm_mon,
//Curr_gsDateTime.tm_mday,
//Curr_gsDateTime.tm_hour,
//Curr_gsDateTime.tm_min,
//Curr_gsDateTime.tm_sec,
Curr_gsDateTime.tm_year,
Curr_gsDateTime.tm_mon,
Curr_gsDateTime.tm_mday,
Curr_gsDateTime.tm_hour,
Curr_gsDateTime.tm_min,
Curr_gsDateTime.tm_sec,
//(INT)(Init_Adc),
//(INT)(nr_3d._3dnr.enable),
'\0'
);
);*/
//DBG_DUMP("isp Buf=%s\r\n",Buf);
snprintf(Buf, BufLen, "%d %d %3d %d %04d/%02d/%02d %02d:%02d:%02d",
(INT)(ae_status.status_info.iso_gain[0]),
(INT)(ae_status.status_info.expotime[0]),
(INT)(ae_status.status_info.lv/100000),
IRSHTTER,
Curr_gsDateTime.tm_year,
Curr_gsDateTime.tm_mon,
Curr_gsDateTime.tm_mday,
Curr_gsDateTime.tm_hour,
Curr_gsDateTime.tm_min,
Curr_gsDateTime.tm_sec);
printf("%s:%d Buf=%s\r\n",__FUNCTION__,__LINE__,Buf);
#endif
vendor_isp_uninit();
return;
@ -146,8 +160,10 @@ void PhotoFastCapDateImprint_InitBuff(void)
/******************************************************************************
* Stamp text
******************************************************************************/
printf("[%s:%d] s\n",__FUNCTION__,__LINE__);
#if PHOTO_STAMP_ISP_STATUS == ENABLE
memset(photo_aesteam, '\0', sizeof(photo_aesteam));
PhotoStamp_get_isp_status(0,&photo_aesteam[0],64);
#endif
@ -262,6 +278,7 @@ INT32 PhotoFastCapDateImprint_GenYuvData(HD_VIDEO_FRAME *pDstImg)
// param_img.engine = 0;
// vf_gfx_copy(&param_img);
printf("[%s:%d] s\n",__FUNCTION__,__LINE__);
lv_user_font_conv(&stamp_text.draw_cfg, &stamp_text.mem_cfg);
@ -291,6 +308,7 @@ INT32 PhotoFastCapDateImprint_GenYuvData(HD_VIDEO_FRAME *pDstImg)
param_text.colorkey = CKEY;
param_text.engine = 0;
vf_gfx_copy(&param_text);
printf("[%s:%d] e\n",__FUNCTION__,__LINE__);
return E_OK;
}
@ -390,6 +408,7 @@ INT32 PhotoFastCapDateImprint_GenYuvData(HD_VIDEO_FRAME *pDstImg)
IPOINT DstLocation;
VF_GFX_COPY param = {0};
HD_RESULT hd_ret;
printf("[%s:%d] s\n",__FUNCTION__,__LINE__);
if ((!g_custom_stamp_va_addr) || (!pDstImg)) {
DBG_ERR("No stamped buffer or pDstImg is NULL\r\n");
@ -530,6 +549,7 @@ INT32 PhotoFastCapDateImprint_GenYuvData(HD_VIDEO_FRAME *pDstImg)
param.colorkey = 0;
param.engine = GXIMG_CP_ENG1;
hd_ret = vf_gfx_copy(&param);
printf("[%s:%d] e\n",__FUNCTION__,__LINE__);
if (hd_ret != HD_OK) {
return E_SYS;

View File

@ -1752,11 +1752,13 @@ INT32 PhotoFast_SliceEncode_CB2(void* user_data)
MEM_RANGE pri_jpg = {.addr = slice_encode_primary_info->bs_buf_mem_info.va + CFG_JPG_HEADER_SIZE, .size = slice_encode_primary_info->bs_buf_mem_info.used_size};
MEM_RANGE scr_jpg = {.addr = slice_encode_screennail_info->bs_buf_mem_info.va, .size = slice_encode_screennail_info->bs_buf_mem_info.used_size};
MEM_RANGE dst_jpg_file = { 0 };
DBG_WRN(" EXIF\r\n");
/* exif */
ExifVendor_Write0thIFD(EXIF_HDL_ID_1);
ExifVendor_WriteExifIFD(EXIF_HDL_ID_1);
ExifVendor_Write0thIntIFD(EXIF_HDL_ID_1);
if (EXIF_CreateExif(EXIF_HDL_ID_1, &exif_data, &thumb_jpg) != EXIF_ER_OK) {
DBG_ERR("Create Exif fail\r\n");
exif_data.size = 0;

View File

@ -102,6 +102,7 @@ void DateTime_Save(void)
cUIDateTime.tm_min = gUITimeMinute;
cUIDateTime.tm_sec = gUITimeSecond;
hwclock_set_time(TIME_ID_CURRENT, cUIDateTime, 0);
printf("[%s:%d] s TIME_ID_CURRENT\n",__FUNCTION__,__LINE__);
DbgMsg_UISetDate(("Save DateFmt:%d\r\n", gUIDateSetFmt));
DbgMsg_UISetDate(("Save TimeFmt:%d\r\n", gUITimeSetFmt));
@ -459,6 +460,7 @@ void _TimeRecord_Load(INT32 iTid)
void _TimeRecord_Save(INT32 iTid)
{
TIME_RECORD *ti = &(gTimeRecord[iTid]);
printf("[%s:%d] s TIME_ID_CURRENT\n",__FUNCTION__,__LINE__);
//save date-time
hwclock_set_time(TIME_ID_CURRENT, ti->Curr_DateTime, 0);
}

View File

@ -410,12 +410,19 @@ typedef struct _UIMenuUIMenuStoreInfo {
CHAR Sim4gUsr[40];
CHAR Sim4gPwd[20];/* */
CHAR SimPinStr[8];/* */
CHAR MmsMmsc[50];
CHAR MmsApn[40];
CHAR MmsProxy[40];
CHAR MmsPort[6];
CHAR MmsUsr[40];
CHAR MmsPwd[20];
CHAR ModuleImei[20];
CHAR ModuleVer[50];
CHAR ModuleSubver[50];
CHAR AcmIp[60];
CHAR AcmPort[5];
CHAR WebIp[70];
CHAR OperatorCode[8];
//============Sifar==============///Payton
} UIMenuStoreInfo;

View File

@ -49,6 +49,9 @@
#define SF_OTHER_BATT_RECOVERY 99
#define SF_BATT_RECOVERY 72 //S530
#define SF_DATE_TIME_YEAR_MAX 2050
#define SF_DATE_TIME_YEAR_MIN 2021
/*REG START MODE*/
#define MCU_MODE_AUTO 0x00
#define MCU_MODE_OFF 0x40
@ -449,6 +452,9 @@ BOOL sf_is_usb_flag(void);
void sf_calculate_daily_report(UINT8*dailyHour, UINT8*dailyMin);
int sf_while_flag(void);
int sf_init_mcu(void);
UINT8 sf_get_mcu_rtc_set_sys(void);
UINT8 sf_get_power_off_flag(void);
void sf_set_power_off_flag(UINT8 flag);
#endif

View File

@ -449,10 +449,87 @@ UINT8 sf_mcu_power_on_para_get(MCUParam_t attrId)
}
printf(" start mode = %d IRSHTTER = %d\n", startMode, IRSHTTER);
sf_get_mcu_rtc_set_sys();
return startMode;
}
/*************************************************
Function: sf_get_mcu_rtc_set_sys
Description: get mcu rtc,set to sys
Input: N/A
Output: N/A
Return: N/A
Others: N/A
*************************************************/
UINT8 sf_get_mcu_rtc_set_sys(void)
{
UINT8 mcuReg[REG_SIZE] = { 0 };
UINT8 mcuData[REG_SIZE] = { 0 };
UINT8 i = 0;
UINT16 year;
UINT16 mon;
UINT16 day;
UINT16 hour;
UINT16 min;
UINT16 sec;
struct tm Curr_DateTime = {0};
mcuReg[i++] = SF_RTC_YEAR;
mcuReg[i++] = SF_RTC_MONTH;
mcuReg[i++] = SF_RTC_DAY;
mcuReg[i++] = SF_RTC_HOUR;
mcuReg[i++] = SF_RTC_MINUTE;
mcuReg[i++] = SF_RTC_SEC;
sf_mcu_read_multi(mcuReg, mcuData, i);
i = 0;
year = mcuData[i++] + 2000;
mon = mcuData[i++];
day = mcuData[i++];
hour = mcuData[i++];
min = mcuData[i++];
sec = mcuData[i++];
if(sec == 0)
{
i = 0;
mcuReg[i++] = SF_RTC_YEAR;
mcuReg[i++] = SF_RTC_MONTH;
mcuReg[i++] = SF_RTC_DAY;
mcuReg[i++] = SF_RTC_HOUR;
mcuReg[i++] = SF_RTC_MINUTE;
mcuReg[i++] = SF_RTC_SEC;
sf_mcu_read_multi(mcuReg, mcuData, i);
i = 0;
year = mcuData[i++] + 2000;
mon = mcuData[i++];
day = mcuData[i++];
hour = mcuData[i++];
min = mcuData[i++];
sec = mcuData[i++];
}
printf("%s:%d %d : %d : %d : %d : %d : %d\n", __FUNCTION__, __LINE__,year, mon,day,hour,min,sec);
if((year >= SF_DATE_TIME_YEAR_MIN) && (year <= SF_DATE_TIME_YEAR_MAX) && (mon <= 12) && (day <= 31) && (hour < 24) && (min < 60) && (sec < 60))
{
Curr_DateTime.tm_year = year;
Curr_DateTime.tm_mon = mon;
Curr_DateTime.tm_mday = day;
Curr_DateTime.tm_hour = hour;
Curr_DateTime.tm_min = min;
Curr_DateTime.tm_sec = sec;
hwclock_set_time(TIME_ID_CURRENT, *(struct tm*)&Curr_DateTime, 0);
return SUCCESS;
}
return FAIL;
}
#endif
int sf_off_mcu(void)
@ -1265,6 +1342,7 @@ UINT8 sf_mcu_reg_set(MCUParam_t attrId, UINT8 val)
{
struct tm ctv = {0};
ctv = hwclock_get_time(TIME_ID_CURRENT);
printf("%s:%d %d : %d : %d : %d : %d : %d\n", __FUNCTION__, __LINE__,ctv.tm_year, ctv.tm_mon,ctv.tm_mday,ctv.tm_hour,ctv.tm_min,ctv.tm_sec);
mcuReg[i] = SF_RTC_YEAR;
mcuData[i++] = ctv.tm_year - 2000;
@ -1686,7 +1764,7 @@ BOOL sf_get_mode_flag(void)
BOOL sf_is_usb_flag(void)
{
return GxUSB_GetIsUSBPlug();
return gpio_getIntStatus(GPIO_INT_USBPLUGIN);
}
void sf_cmd_camera_restart(UINT8 cameraRestart)

View File

@ -7,7 +7,7 @@
version-info = [00 01 00 01];
ae_expect_lum {
size = [b0 00 00 00];
data = [32 00 00 00 40 00 00 00 41 00 00 00 41 00 00 00 41 00 00 00 41 00 00 00 41 00 00 00 41 00 00 00 41 00 00 00 41 00 00 00 49 00 00 00 53 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00 64 00 00 00];
data = [2f 00 00 00 32 00 00 00 3a 00 00 00 3a 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 43 00 00 00 46 00 00 00 50 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 3c 00 00 00 46 00 00 00 50 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00 5a 00 00 00];
};
ae_la_clamp {
size = [50 01 00 00];
@ -27,7 +27,7 @@
};
ae_meter_window {
size = [00 01 00 00];
data = [01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 04 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 04 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00];
data = [01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 04 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 00 00 00 04 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 03 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 02 00 00 00 01 00 00 00 01 00 00 00];
};
ae_lum_gamma {
size = [82 00 00 00];

View File

@ -15,11 +15,11 @@
};
awb_ct_weight {
size = [78 00 00 00];
data = [fc 08 00 00 f0 0a 00 00 74 0e 00 00 5c 12 00 00 64 19 00 00 f8 2a 00 00 48 03 00 00 60 03 00 00 bc 03 00 00 f7 03 00 00 23 04 00 00 c3 04 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00];
data = [fc 08 00 00 f0 0a 00 00 74 0e 00 00 5c 12 00 00 64 19 00 00 f8 2a 00 00 48 03 00 00 60 03 00 00 bc 03 00 00 f7 03 00 00 23 04 00 00 c3 04 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 08 00 00 00 08 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00 01 00 00 00];
};
awb_target {
size = [24 00 00 00];
data = [60 03 00 00 f7 03 00 00 23 04 00 00 00 04 00 00 00 04 00 00 00 04 00 00 00 04 00 00 00 04 00 00 00 04 00 00];
data = [60 03 00 00 f7 03 00 00 23 04 00 00 00 04 00 00 24 04 00 00 38 04 00 00 00 04 00 00 f2 03 00 00 e8 03 00 00];
};
awb_ct_info {
size = [60 00 00 00];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long