diff --git a/BSP/linux-kernel/arch/arm/plat-novatek/include/plat b/BSP/linux-kernel/arch/arm/plat-novatek/include/plat index 1435eac62..d29f8ad06 120000 --- a/BSP/linux-kernel/arch/arm/plat-novatek/include/plat +++ b/BSP/linux-kernel/arch/arm/plat-novatek/include/plat @@ -1 +1 @@ -/home/payton/na51089_linux_sdk/BSP/linux-kernel/arch/arm/plat-novatek/include/plat-na51089 \ No newline at end of file +/home/payton/S530/BSP/linux-kernel/arch/arm/plat-novatek/include/plat-na51089 \ No newline at end of file diff --git a/BSP/linux-kernel/arch/arm/plat-novatek/plat b/BSP/linux-kernel/arch/arm/plat-novatek/plat index 7e5ee300d..be865272d 120000 --- a/BSP/linux-kernel/arch/arm/plat-novatek/plat +++ b/BSP/linux-kernel/arch/arm/plat-novatek/plat @@ -1 +1 @@ -/home/payton/na51089_linux_sdk/BSP/linux-kernel/arch/arm/plat-novatek/plat-na51089 \ No newline at end of file +/home/payton/S530/BSP/linux-kernel/arch/arm/plat-novatek/plat-na51089 \ No newline at end of file diff --git a/BSP/linux-kernel/drivers/soc/nvt/nvt_hdal/hdal b/BSP/linux-kernel/drivers/soc/nvt/nvt_hdal/hdal index 7bd00e46c..82b63d2d4 120000 --- a/BSP/linux-kernel/drivers/soc/nvt/nvt_hdal/hdal +++ b/BSP/linux-kernel/drivers/soc/nvt/nvt_hdal/hdal @@ -1 +1 @@ -/home/payton/na51089_linux_sdk/code/hdal \ No newline at end of file +/home/payton/S530/code/hdal \ No newline at end of file diff --git a/BSP/linux-kernel/drivers/soc/nvt/nvt_hdal/vos b/BSP/linux-kernel/drivers/soc/nvt/nvt_hdal/vos index c95eed914..bfe54dbe3 120000 --- a/BSP/linux-kernel/drivers/soc/nvt/nvt_hdal/vos +++ b/BSP/linux-kernel/drivers/soc/nvt/nvt_hdal/vos @@ -1 +1 @@ -/home/payton/na51089_linux_sdk/code/vos \ No newline at end of file +/home/payton/S530/code/vos \ No newline at end of file diff --git a/build/nvt-tools/__pycache__/pyfdt.cpython-36.pyc b/build/nvt-tools/__pycache__/pyfdt.cpython-36.pyc index 0650e265b..532d6c186 100644 Binary files a/build/nvt-tools/__pycache__/pyfdt.cpython-36.pyc and b/build/nvt-tools/__pycache__/pyfdt.cpython-36.pyc differ diff --git a/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h b/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h index 3bc707975..6d292aaa2 100755 --- a/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h +++ b/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h @@ -914,8 +914,8 @@ #define PHOTO_PREVIEW_SLICE_ENC_FUNC ENABLE #define PHOTO_PREVIEW_SLICE_ENC_VER2_FUNC ENABLE #define DZOOM_FUNC ENABLE -#define HUNTING_MCU_I2C ENABLE -#define HUNTING_MCU_UART DISABLE +#define HUNTING_MCU_I2C DISABLE +#define HUNTING_MCU_UART ENABLE #define HUNTING_IR_LED_940 ENABLE//DISABLE #define SF_BASE_VERSION "7MD4RCwD3T1" diff --git a/code/hdal/vendor/output/libvendor_ai2_pub.a b/code/hdal/vendor/output/libvendor_ai2_pub.a index 6b1f24bbf..573785a3a 100644 Binary files a/code/hdal/vendor/output/libvendor_ai2_pub.a and b/code/hdal/vendor/output/libvendor_ai2_pub.a differ diff --git a/code/hdal/vendor/output/libvendor_ai2_pub2.a b/code/hdal/vendor/output/libvendor_ai2_pub2.a index a44f2aaf5..60d30b371 100644 Binary files a/code/hdal/vendor/output/libvendor_ai2_pub2.a and b/code/hdal/vendor/output/libvendor_ai2_pub2.a differ diff --git a/code/lib/include/openssl/opensslconf.h b/code/lib/include/openssl/opensslconf.h index 98adec057..accab6ac6 100644 --- a/code/lib/include/openssl/opensslconf.h +++ b/code/lib/include/openssl/opensslconf.h @@ -104,8 +104,8 @@ extern "C" { #if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */ #if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) -#define ENGINESDIR "/home/payton/na51089_linux_sdk/code/lib/external/__install/lib/engines" -#define OPENSSLDIR "/home/payton/na51089_linux_sdk/code/lib/external/__install/ssl" +#define ENGINESDIR "/home/payton/S530/code/lib/external/__install/lib/engines" +#define OPENSSLDIR "/home/payton/S530/code/lib/external/__install/ssl" #endif #endif diff --git a/code/lib/source/sifar/code/include/sf_commu_mcu.h b/code/lib/source/sifar/code/include/sf_commu_mcu.h index ed109dc2b..35cd36f68 100755 --- a/code/lib/source/sifar/code/include/sf_commu_mcu.h +++ b/code/lib/source/sifar/code/include/sf_commu_mcu.h @@ -25,11 +25,13 @@ extern "C"{ #endif // __cplusplus +#include #define SERIAL_DEVICE_PATH "/dev/ttyS2" +#define BUF_REG_SIZE (REG_SIZE*2+8) typedef struct { - unsigned char buf[32]; + unsigned char buf[BUF_REG_SIZE]; unsigned int index; }SMAPBUF_t; /* @@ -63,6 +65,11 @@ unsigned char sf_commu_parse_mcu_data(unsigned char * src, unsigned int len); void sf_commu_mcu_task_start(void); void sf_commu_mcu_task_stop(void); unsigned char sf_commu_mcu_task_running(void); +unsigned int sf_get_mcu_reg_ack_depack_many(unsigned char reg[], unsigned char val[], unsigned int * num); +int sf_set_mcu_reg_many(unsigned char reg[], unsigned char val[], unsigned int num); +int sf_get_mcu_reg_many(unsigned char reg[], unsigned int num); +int sf_commu_set_mcu_many(unsigned char reg[], unsigned char val[], unsigned int *num); +int sf_commu_get_mcu_many(unsigned char reg[], unsigned char val[], unsigned int *num); #ifdef __cplusplus } diff --git a/code/lib/source/sifar/code/include/sf_mcu.h b/code/lib/source/sifar/code/include/sf_mcu.h index dbcf1bfb7..5f4268630 100755 --- a/code/lib/source/sifar/code/include/sf_mcu.h +++ b/code/lib/source/sifar/code/include/sf_mcu.h @@ -113,7 +113,7 @@ #define WDT_OFF 0x01 #define DEBUG_MODE_ON 0x02 -#if defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) +#if 0//defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) #define REG_SIZE 82 typedef enum @@ -210,7 +210,7 @@ typedef enum RESERVER13, RESERVER14, }PARA_REG; -//#endif +#endif typedef enum { POWEROFF_COUNTDOWN = 1, @@ -239,7 +239,8 @@ typedef enum { WORKING_TIME_ALL = 0xff, }WORKING_TIME_TYPE; -#elif defined(_MODEL_565_HUNTING_EVB_LINUX_4G_68CS_) +//#elif defined(_MODEL_565_HUNTING_EVB_LINUX_4G_68CS_) +#if 1 #define REG_SIZE 91 @@ -349,7 +350,6 @@ typedef enum RESERVER12 = 89, RESERVER13 = 90, }PARA_REG; -#else #endif @@ -398,7 +398,7 @@ typedef struct sfCAMERA_CMD_S UINT8 cameraRestart; UINT8 GotoServerGetPara; } SF_CAMERA_CMD_S; - +void sf_mcu_dataready_ck(UINT8 startMode); void sf_mcu_dataready_get(void); UINT8 sf_mcu_reg_set(MCUParam_t attrId, UINT8 val); UINT32 sf_gpio_get_status(UINT32 ipin); diff --git a/code/lib/source/sifar/code/source/mcu/sf_commu_mcu.c b/code/lib/source/sifar/code/source/mcu/sf_commu_mcu.c index 94ea5fa1a..61def471f 100755 --- a/code/lib/source/sifar/code/source/mcu/sf_commu_mcu.c +++ b/code/lib/source/sifar/code/source/mcu/sf_commu_mcu.c @@ -125,7 +125,7 @@ static unsigned short sf_crc16_check(unsigned char * dataIn, int length) return result; } -static unsigned char sndBuf[32] = +static unsigned char sndBuf[BUF_REG_SIZE] = { 0 }; @@ -137,8 +137,10 @@ SMAPBUF_t smap_buf = int SMAP_waitAck = 0; -unsigned char mcu_buf[32] = {0}; +unsigned char mcu_buf[BUF_REG_SIZE] = {0}; unsigned int mcu_buf_len = 0; +unsigned char cmpRegBuf[BUF_REG_SIZE] = {0}; +unsigned char cmpValBuf[BUF_REG_SIZE] = {0}; static unsigned char sf_commu_mcu_exit = 1; static VK_TASK_HANDLE sfCommuMcuThread = 0; @@ -149,7 +151,7 @@ int gsfd = -1; void mcubuf_reset(void) { mcu_buf_len = 0; - memset(mcu_buf, 0x00, sizeof(mcu_buf)); + memset(mcu_buf, 0x00, sizeof(mcu_buf)); } int sf_commu_mcu_open(void) { @@ -351,9 +353,9 @@ int sf_commu_write(unsigned char * buf, int len) int ret = FAIL; ret = write(gsfd, buf, len); - printf("%s:%d ret %d\n", __FUNCTION__, __LINE__, ret); if(ret < 0) { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); return FAIL; } return ret; @@ -364,9 +366,12 @@ int sf_commu_read(unsigned char * buf, int len) { int ret = SUCCESS; ret = read(gsfd, buf, len); - printf("%s:%d ret %d\n", __FUNCTION__, __LINE__, ret); - if(ret < 0) - return FAIL; + if(ret < 0) + { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); + return FAIL; + } + return ret; } @@ -416,7 +421,6 @@ int sf_get_mcu_reg(unsigned char reg) unsigned short crc_end = 0; int ret = FAIL; //uint8_t i = 0; - CHKPNT; memset(sndBuf, 0x00, sizeof(sndBuf)); sndBuf[index] = 0x55; index++; @@ -446,6 +450,97 @@ int sf_get_mcu_reg(unsigned char reg) return 0x01; } +int sf_set_mcu_reg_many(unsigned char reg[], unsigned char val[], unsigned int num) +{ + unsigned short index = 0; + unsigned short crc = 0; + unsigned short crc_start = 0; + unsigned short crc_end = 0; + unsigned int i = 0; + int ret = FAIL; + memset(sndBuf, 0x00, sizeof(sndBuf)); + // uint8_t i = 0; + sndBuf[index] = 0x55; + index++; + sndBuf[index] = 0xAA; + index++; + crc_start = index; + sndBuf[index] = 0x04; + index++; + sndBuf[index] = num; + + for(i = 0; i < num; i++) + { + index++; + sndBuf[index] = reg[i]; + index++; + sndBuf[index] = val[i]; + + } + index++; + crc_end = index; + crc = sf_crc16_check(&sndBuf[crc_start], crc_end - crc_start); + sndBuf[index] = (crc & 0xff00) >> 8; + index++; + sndBuf[index] = crc & 0x00ff; + index++; + sndBuf[index] = 0xFF; + index++; + sndBuf[index] = 0xEE; + ret = sf_commu_write(sndBuf, index + 1); + if(ret == FAIL) + { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); + } + return 0x03; +} + +int sf_get_mcu_reg_many(unsigned char reg[], unsigned int num) +{ + unsigned short index = 0; + unsigned short crc = 0; + unsigned short crc_start = 0; + unsigned short crc_end = 0; + unsigned int i = 0; + int ret = FAIL; + //uint8_t i = 0; + memset(sndBuf, 0x00, sizeof(sndBuf)); + sndBuf[index] = 0x55; + index++; + sndBuf[index] = 0xAA; + index++; + crc_start = index; + sndBuf[index] = 0x02; + index++; + sndBuf[index] = num; + + + for(i = 0; i < num; i++) + { + index++; + sndBuf[index] = reg[i]; + } + + index++; + crc_end = index; + crc = sf_crc16_check(&sndBuf[crc_start], crc_end - crc_start); + sndBuf[index] = (crc & 0xff00) >> 8; + index++; + sndBuf[index] = crc & 0x00ff; + index++; + sndBuf[index] = 0xFF; + index++; + sndBuf[index] = 0xEE; + + ret = sf_commu_write(sndBuf, index + 1); + if(ret == FAIL) + { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); + } + + return 0x01; +} + unsigned int sf_set_mcu_reg_ack_depack(unsigned int * address, unsigned int * value) { unsigned short crc1 = (((unsigned short) smap_buf.buf[smap_buf.index - 4]) << 8) | smap_buf.buf[smap_buf.index - 3]; @@ -497,6 +592,42 @@ unsigned int sf_get_mcu_reg_ack_depack(unsigned int * address, unsigned int * va return (unsigned int)smap_buf.buf[2]; } + + +unsigned int sf_get_mcu_reg_ack_depack_many(unsigned char reg[], unsigned char val[], unsigned int * num) +{ + unsigned short crc1 = (((unsigned short) smap_buf.buf[smap_buf.index - 4] << 8) & 0xff00) | smap_buf.buf[smap_buf.index - 3]; + unsigned short crc2 = 0; + unsigned int i = 0; + unsigned int j = 4; + + crc2 = sf_crc16_check(&smap_buf.buf[2], smap_buf.index - 6); + + if (crc2 != crc1) + { + printf("crc error crc1 %d, crc2 %d, function %s, file %s, line %d\r\n", crc1, crc2, __FUNCTION__, + __FILE__, __LINE__); + return - 1; + } + *num = smap_buf.buf[3]; + + for(i = 0; i < *num; i++) + { + reg[i]= smap_buf.buf[j]; + j++; + val[i]= smap_buf.buf[j]; + j++; + } + + if (smap_buf.buf[2] == 0xFF) /* error command 0xff */ + { + printf("%s:%d command error\r\n", __FUNCTION__, __LINE__); + return - 1; + } + + return (unsigned int)smap_buf.buf[2]; +} + int sf_commu_wait(unsigned char cmd) { volatile char trytimes = 0; @@ -517,7 +648,9 @@ void sf_commu_reset(void) { smap_buf.index = 0; SMAP_waitAck = 0; - memset(smap_buf.buf, 0x00, 32); + memset(smap_buf.buf, 0x00, sizeof(smap_buf.buf)); + memset(cmpRegBuf, 0x00, sizeof(cmpRegBuf)); + memset(cmpValBuf, 0x00, sizeof(cmpValBuf)); } int sf_commu_set_mcu(unsigned char reg, unsigned char val) @@ -525,7 +658,7 @@ int sf_commu_set_mcu(unsigned char reg, unsigned char val) int ret = -1; unsigned int address = 0; unsigned int value = 0; - printf("Reg_Data[%02d,0x%02x]\n", reg,val); + //printf("W_addr[%02d,0x%02x]\n", reg,val); sf_commu_reset(); sf_set_mcu_reg(reg, val); ret = sf_commu_wait(0x03); @@ -554,17 +687,17 @@ int sf_commu_get_mcu(unsigned char reg) int ret = 0; unsigned int address = 0; unsigned int value = 0; - CHKPNT; sf_commu_reset(); sf_get_mcu_reg(reg); - ret = sf_commu_wait(0x01); - if(ret < 0) - { - printf("%s:%d time out\r\n", __FUNCTION__, __LINE__); - sf_commu_reset(); - return - 1; - } + ret = sf_commu_wait(0x01); + if(ret < 0) + { + printf("%s:%d time out\r\n", __FUNCTION__, __LINE__); + sf_commu_reset(); + return - 1; + } + ret = sf_get_mcu_reg_ack_depack(&address, &value); if (ret < 0 || address != reg) { @@ -578,6 +711,79 @@ int sf_commu_get_mcu(unsigned char reg) return ret; } +int sf_commu_set_mcu_many(unsigned char reg[], unsigned char val[], unsigned int *num) +{ + int ret = -1; + //unsigned int address = 0; + //unsigned int value = 0; + unsigned int i = 0; + //printf("W_addr[%02d,0x%02x]\n", reg,val); + sf_commu_reset(); + sf_set_mcu_reg_many(reg, val, *num); + ret = sf_commu_wait(0x04); + if(ret < 0) + { + printf("%s:%d time out\r\n", __FUNCTION__, __LINE__); + sf_commu_reset(); + return - 1; + } + + ret = sf_get_mcu_reg_ack_depack_many(cmpRegBuf, cmpValBuf, num); + if (ret < 0) + { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); + ret = -1; + } + else + { + for(i = 0; i < *num; i++) + { + if((reg[i] != cmpRegBuf[i]) || (val[i] != cmpValBuf[i])) + { + printf("%s:%d error address %d, value %d get address %d, value %d\r\n", __FUNCTION__, __LINE__, reg[i], val[i], cmpRegBuf[i], cmpValBuf[i]); + ret = -1; + } + } + } + + return ret; +} + +int sf_commu_get_mcu_many(unsigned char reg[], unsigned char val[], unsigned int *num) +{ + int ret = 0; + unsigned int i = 0; + + sf_commu_reset(); + sf_get_mcu_reg_many(reg,*num); + ret = sf_commu_wait(0x02); + if(ret < 0) + { + printf("%s:%d time out\r\n", __FUNCTION__, __LINE__); + sf_commu_reset(); + return - 1; + } + + ret = sf_get_mcu_reg_ack_depack_many(cmpRegBuf, val, num); + if (ret < 0) + { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); + ret = -1; + } + else + { + for(i = 0; i < *num; i++) + { + if(reg[i] != cmpRegBuf[i]) + { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); + ret = -1; + } + } + } + + return ret; +} int sf_getRegFromMcu_depack(unsigned char * dataToParse, unsigned int datalen, unsigned char * regAddr, unsigned char * regVal) { @@ -660,6 +866,7 @@ unsigned char sf_commu_parse_mcu_data(unsigned char * src, unsigned int len) //stMessageBuf.arg2 = SF_KEY_PIN_DATAREADY; //sf_com_message_send_to_app(&stMessageBuf); ret = 0x05; + sf_mcu_dataready_ck((val[0] & 0x1F)); } else { @@ -691,7 +898,7 @@ unsigned char sf_commu_parse_mcu_data(unsigned char * src, unsigned int len) THREAD_RETTYPE sf_commu_mcu_task(void *arg) { THREAD_ENTRY(); - static unsigned char buffer[32] = {0}; + static unsigned char buffer[BUF_REG_SIZE] = {0}; int i = 0; int readLen = 0; int len = 0; @@ -704,17 +911,18 @@ THREAD_RETTYPE sf_commu_mcu_task(void *arg) unsigned char copy_size = 0; //sf_commu_mcu_interface_init(115200, 'N', 8, 1, 'N'); //sf_commu_mcu_open(); - - printf("%s:%d\r\n", __FUNCTION__, __LINE__); + //FLGPTN FlgPtn; + mcubuf_reset(); CHKPNT; while(sf_commu_mcu_exit == 0) { - readLen = sf_commu_read(buffer + len, 32); + readLen = sf_commu_read(buffer + len, BUF_REG_SIZE); if(readLen > 0) { len += readLen; + //printf("%s:%d len = %d readLen = %d\n",__FUNCTION__,__LINE__, len, readLen); } while(i < len) diff --git a/code/lib/source/sifar/code/source/mcu/sf_mcu_client.c b/code/lib/source/sifar/code/source/mcu/sf_mcu_client.c index a1a2242b3..789c0f24d 100755 --- a/code/lib/source/sifar/code/source/mcu/sf_mcu_client.c +++ b/code/lib/source/sifar/code/source/mcu/sf_mcu_client.c @@ -62,10 +62,10 @@ static UINT32 simCardInsert=0; static UINT8 gModuleSleep = 1; static UINT32 SmsCheck = 0; static SF_CAMERA_CMD_S CameraCmd = {0}; +static UINT8 McuProductInfo = 0; #if defined(_MODEL_565_HUNTING_EVB_LINUX_4G_68CS_) static UINT8 drNoResetTimeSync = FALSE; //0:reset; 1:no reset; -static UINT8 McuProductInfo = 0; #elif defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) static UINT8 isSignalReady = 0; @@ -251,64 +251,6 @@ UINT8 sf_mcu_write(UINT32 reg, UINT32 data) return 0; } -#else - -UINT8 sf_mcu_read(UINT32 reg, UINT8 *data) -{ - UINT8 data2 = 0; - - CHKPNT; - *data = sf_commu_get_mcu(reg); - //vos_util_delay_us(30); - - data2 = sf_commu_get_mcu(reg); - printf("R_addr[%d]=0x%02x\n", reg, data2); - - if(*data != data2) - { - printf("%s:%d ERROR\n", __FUNCTION__, __LINE__); - printf("[ERROR]reg:%d,data:%d,data2:%d\n", reg, *data, data2); - vos_util_delay_us(300); - *data = sf_commu_get_mcu(reg); - printf("[ERROR]reg:%d,data:%d,data2:%d\n", reg, *data, data2); - } - - //vos_util_delay_us(200); - CHKPNT; - - return 0; -} - -UINT8 sf_mcu_write(UINT32 reg, UINT32 data) -{ - UINT8 data2 = 0; - - sf_commu_set_mcu(reg, data); - //vos_util_delay_us(20); - - data2 = sf_commu_get_mcu(reg); - printf("W_addr[%d]=0x%02x\n", reg, data2); - - if(data != data2) - { - printf("%s:%d ERROR reg:%d,data:%d,data2:%d\n", __FUNCTION__, __LINE__, reg, data, data2); - vos_util_delay_us(300); - sf_commu_set_mcu(reg, data); - } - - //vos_util_delay_us(200); - - return 0; -} -int sf_mcu_init(void) -{ - CHKPNT; - sf_commu_mcu_task_start(); - return 0; -} - -#endif - UINT8 sf_mcu_write_multi(UINT8 reg[], UINT8 data[], UINT32 num) { UINT32 i; @@ -320,19 +262,6 @@ UINT8 sf_mcu_write_multi(UINT8 reg[], UINT8 data[], UINT32 num) return SUCCESS; } -/************************************************* - Function: sf_get_daily_report_start_mode - Description: get dailyreport start mode - Input: N/A - Output: N/A - Return: 0:ON mode 1:OFF mode - Others: N/A -*************************************************/ -UINT8 sf_get_daily_report_start_mode(void) -{ - return DailyReportStartMode; -} - /************************************************* Function: sf_mcu_power_on_para_get Description: read MCU register data to update uipara and variable. @@ -356,7 +285,7 @@ UINT8 sf_mcu_power_on_para_get(MCUParam_t attrId) } sf_mcu_read(MCU_SUB_VER, &McuSubVersion); - #if defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) + #if 0//defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) sf_mcu_read(MCU_VER, &mcuVer); McuVersion = mcuVer; #else @@ -399,6 +328,170 @@ UINT8 sf_mcu_power_on_para_get(MCUParam_t attrId) return startMode; } +#else + +UINT8 sf_mcu_read(UINT32 reg, UINT8 *data) +{ + //UINT8 data2 = 0; + + //CHKPNT; + *data = sf_commu_get_mcu(reg); + //vos_util_delay_us(30); + + //data2 = sf_commu_get_mcu(reg); + printf("R_addr[%d]=0x%02x\n", reg, *data); + + /*if(*data != data2) + { + printf("%s:%d ERROR\n", __FUNCTION__, __LINE__); + printf("[ERROR]reg:%d,data:%d,data2:%d\n", reg, *data, data2); + vos_util_delay_us(300); + *data = sf_commu_get_mcu(reg); + printf("[ERROR]reg:%d,data:%d,data2:%d\n", reg, *data, data2); + }*/ + + //vos_util_delay_us(200); + //CHKPNT; + + return 0; +} + +UINT8 sf_mcu_write(UINT32 reg, UINT32 data) +{ + //UINT8 data2 = 0; + + sf_commu_set_mcu(reg, data); + //vos_util_delay_us(20); + + //data2 = sf_commu_get_mcu(reg); + printf("W_addr[%d]=0x%02x\n", reg, data); + + /*if(data != data2) + { + printf("%s:%d ERROR reg:%d,data:%d,data2:%d\n", __FUNCTION__, __LINE__, reg, data, data2); + vos_util_delay_us(300); + sf_commu_set_mcu(reg, data); + }*/ + + //vos_util_delay_us(200); + + return 0; +} +int sf_mcu_init(void) +{ + //CHKPNT; + sf_commu_mcu_task_start(); + return 0; +} +UINT8 sf_mcu_write_multi(UINT8 reg[], UINT8 data[], UINT32 num) +{ + UINT32 i; + unsigned int pnum = num; + if(0 <= sf_commu_set_mcu_many(reg, data, &pnum)) + { + for(i = 0; i < num; i++) + { + printf("W_addr[%d]=0x%02x\n", reg[i], data[i]); + } + return SUCCESS; + } + return FAIL; +} + +UINT8 sf_mcu_read_multi(UINT8 reg[], UINT8 data[], UINT32 num) +{ + UINT32 i; + unsigned int pnum = num; + if(0 <= sf_commu_get_mcu_many(reg, data, &pnum)) + { + for(i = 0; i < num; i++) + { + printf("R_addr[%d]=0x%02x\n", reg[i], data[i]); + } + return SUCCESS; + } + return FAIL; +} + +/************************************************* + Function: sf_mcu_power_on_para_get + Description: read MCU register data to update uipara and variable. + Input: attrId:which kind of para want to get + Output: N/A + Return: start mode + Others: N/A +*************************************************/ +UINT8 sf_mcu_power_on_para_get(MCUParam_t attrId) +{ + UINT8 dataTemp1 = 0, dataTemp2 = 0; + UINT8 startMode = 0; + //UINT8 mcuVer = 0; + UINT8 mcuReg[REG_SIZE] = { 0 }; + UINT8 mcuData[REG_SIZE] = { 0 }; + UINT8 i = 0; + + if(attrId != SF_MCU_POWERON) + { + sf_mcu_read(START_MODE, &dataTemp1); + startMode = dataTemp1 & 0x1F; + + return startMode; + } + mcuReg[i] = MCU_SUB_VER; + mcuReg[i++] = MCU_VER_L; + mcuReg[i++] = MCU_VER_H; + mcuReg[i++] = MCU_PRODUCT_INFO; + mcuReg[i++] = START_MODE; + mcuReg[i++] = LUMINANCE_L; + mcuReg[i++] = LUMINANCE_H; + sf_mcu_read_multi(mcuReg, mcuData, i); + i = 0; + McuSubVersion = mcuData[i]; + + McuVersion = mcuData[i++]; + McuVersion = (UINT16)mcuData[i++] << 8 | McuVersion; + McuProductInfo = mcuData[i++]; + dataTemp1 = mcuData[i++]; + startMode = dataTemp1 & 0x1F; + DailyReportStartMode = (dataTemp1 & 0xc0) >> 6; + dataTemp1= mcuData[i++]; + dataTemp2 = mcuData[i++]; + IRSHTTER = (dataTemp2 << 8) | dataTemp1; + + #if defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) + if(startMode == PWR_ON_TIME_SYNC) + { + startMode = PWR_ON_DAILY_REPORT; + } + else + #endif + { + if(startMode > PWR_ON_TIME_SEND) //if start mode err, USB IN default power on SETUP + { + startMode = PWR_ON_SETUP; + } + } + + printf(" start mode = %d IRSHTTER = %d\n", startMode, IRSHTTER); + + return startMode; +} + +#endif + +/************************************************* + Function: sf_get_daily_report_start_mode + Description: get dailyreport start mode + Input: N/A + Output: N/A + Return: 0:ON mode 1:OFF mode + Others: N/A +*************************************************/ +UINT8 sf_get_daily_report_start_mode(void) +{ + return DailyReportStartMode; +} + UINT8 sf_mcu_wdg_set(UINT8 value) { UINT8 i = 0; @@ -554,6 +647,60 @@ UINT32 sf_gpio_get_status(UINT32 ipin) return (UINT32) ((gpio_get_value(ipin) == 1) ? 1 : 0 ); } +/************************************************* + Function: sf_mcu_dataready_get + Description: + Input: attrId:which kind of para want to get + Output: N/A + Return: N/A + Others: N/A +*************************************************/ +void sf_mcu_dataready_ck(UINT8 startMode) +{ + printf("startMode=%d\n", startMode); +#if 1 + if(GxUSB_GetIsUSBPlug())//sf_gpio_get_status(GPIO_INT_USBPLUGIN)) + { + return; + } + + if(sf_get_mode_flag()) + { + if(startMode == 0) //OFF + { + sf_set_power_off_flag(1); + gModuleSleep = 0; + //LCD_BACKLIGHT_OFF; + //profLogPrintf(0,"[sf_mcu_dataready_get],APP_POWER_OFF_NORMAL"); + printf("[power off] %s(%d)\n", __FUNCTION__, __LINE__); + Ux_PostEvent(NVTEVT_SYSTEM_SHUTDOWN, 1, 0); //shutdown start + } + else if(startMode == 1) //SETUP + { + /*exit pir mode*/ + } + else if(startMode == 3) //ON + { + sf_set_auto_off_time(0); + sf_set_pir_statu_flag(1); + printf("%s:%d-------PIR Key Pressed.------\n", __FUNCTION__, __LINE__); + //Ux_PostEvent(NVTEVT_SYSTEM_SHUTDOWN, 1, 0); //shutdown start + } + } + else + { + if((startMode == 0) || (startMode == 1)) //PIR MODE: ON->OFF/ ON->SETUP + { + gModuleSleep = 0; //power off 4G module + sf_set_power_off_flag(1); + printf("[power off] %s(%d)\n", __FUNCTION__, __LINE__); + Ux_PostEvent(NVTEVT_SYSTEM_SHUTDOWN, 1, 0); //shutdown start + } + } + +#endif +} + /************************************************* Function: sf_mcu_dataready_get Description: @@ -1249,7 +1396,7 @@ UINT8 sf_mcu_reg_set(MCUParam_t attrId, UINT8 val) if(gpsAlwaysFlag && simCardInsert) temp |= 0x80; - mcuReg[i] = FUNCTION_SWTICH; + mcuReg[i] = FUNCTION_SWTICH0; mcuData[i++] = temp; if(SysGetFlag(TimelapseSwitch)) diff --git a/code/na51089_linux_sdk_app_filelist.txt b/code/na51089_linux_sdk_app_filelist.txt index 525d9e49c..fdf02ad8a 100755 --- a/code/na51089_linux_sdk_app_filelist.txt +++ b/code/na51089_linux_sdk_app_filelist.txt @@ -1,6 +1,6 @@ ; Source Insight Project File List -; Project Name: 6.8CS_NTK -; Generated by Source Insight 4.00.0107 at 2023/3/13 17:03:41 +; Project Name: na51089_linux_sdk +; Generated by Source Insight 4.00.0107 at 2023/3/28 16:08:21 ; Version=4.00.0107 ; ; Each line should contain either a file name, a wildcard, or a sub-directory name. @@ -9,17 +9,17 @@ application\external\Makefile application\Makefile application\source\cardv\Makefile -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxCfg.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxCfg.h -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxDisplay_LCD.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxInput_Key.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxPower_Battery.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxPower_DC.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxStorage_Card.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxStorage_EmbMem.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxUsb.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\IOCfg.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\IOCfg.h +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxCfg.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxCfg.h +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxDisplay_LCD.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxInput_Key.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxPower_Battery.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxPower_DC.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxStorage_Card.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxStorage_EmbMem.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxUsb.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\IOCfg.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\IOCfg.h application\source\cardv\SrcCode\Dx\DxCommon.c application\source\cardv\SrcCode\Dx\DxVer.c application\source\cardv\SrcCode\Dx\include\DrvExt.h @@ -191,6 +191,8 @@ application\source\cardv\SrcCode\NVTUserCommand.h application\source\cardv\SrcCode\PrjCfg.h application\source\cardv\SrcCode\PrjCfg_Default.h application\source\cardv\SrcCode\PrjCfg_HUNTING.h +application\source\cardv\SrcCode\PrjCfg_HUNTING_68CS.h +application\source\cardv\SrcCode\PrjCfg_HUNTING_S530.h application\source\cardv\SrcCode\PrjInc.h application\source\cardv\SrcCode\ProjectInfo.h application\source\cardv\SrcCode\Startup\bin_info.c @@ -4631,7 +4633,6 @@ lib\include\PStore.h lib\include\QRCode\QR_Encode.h lib\include\rtosfdt.h lib\include\sdio.h -lib\include\sf_mcu.h lib\include\SizeConvert.h lib\include\strg_def.h lib\include\sw_md.h @@ -5003,6 +5004,7 @@ lib\source\PStore\Makefile lib\source\QRCode\Makefile lib\source\sifar\code\include\sf_battery.h lib\source\sifar\code\include\sf_common.h +lib\source\sifar\code\include\sf_commu_mcu.h lib\source\sifar\code\include\sf_dbg.h lib\source\sifar\code\include\sf_gps.h lib\source\sifar\code\include\sf_http.h @@ -5019,6 +5021,7 @@ lib\source\sifar\code\source\common\sf_led.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\debug\sf_dbg.c +lib\source\sifar\code\source\mcu\sf_commu_mcu.c lib\source\sifar\code\source\mcu\sf_mcu_client.c lib\source\sifar\code\source\module\sf_4G_auto_operation.c lib\source\sifar\code\source\module\sf_4G_usb_uart.c diff --git a/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.dtb b/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.dtb new file mode 100644 index 000000000..76751d44c Binary files /dev/null and b/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.dtb differ diff --git a/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.tmp.dts b/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.tmp.dts new file mode 100644 index 000000000..01fee3436 --- /dev/null +++ b/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-evb.tmp.dts @@ -0,0 +1,1181 @@ +# 1 "nvt-evb.dts" +# 1 "" +# 1 "" +# 1 "nvt-evb.dts" + + + + + + + +/dts-v1/; +# 1 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/gpio/nvt-gpio.h" 1 +# 13 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/gpio/nvt-gpio.h" +# 1 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/gpio/gpio.h" 1 +# 14 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/gpio/nvt-gpio.h" 2 +# 10 "nvt-evb.dts" 2 +# 1 "nvt-peri.dtsi" 1 +# 10 "nvt-peri.dtsi" +# 1 "nvt-basic.dtsi" 1 +# 9 "nvt-basic.dtsi" +# 1 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/interrupt-controller/arm-gic.h" 1 +# 9 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/interrupt-controller/arm-gic.h" +# 1 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/interrupt-controller/irq.h" 1 +# 10 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/interrupt-controller/arm-gic.h" 2 +# 10 "nvt-basic.dtsi" 2 + +/ { + model = "Novatek NA51089"; + compatible = "novatek,na51089", "nvt,ca9"; + interrupt-parent = <&gic>; + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0x0>; + next-level-cache = <&L2>; + clock-frequency = <960000000>; + }; + }; + + cg@f0020000 { + compatible = "nvt,core_clk"; + reg = <0xf0020000 0x1000>; + }; + + + periph_clk: periph_clk { + compatible = "nvt,periph_clk"; + #clock-cells = <0>; + clock-output-names = "periph_clk"; + }; + + global_timer@ffd00200 { + compatible = "arm,cortex-a9-global-timer"; + reg = <0xffd00200 0x20>; + interrupts = <1 11 0xf01>; + clocks = <&periph_clk>; + }; + + private_timer@ffd00600 { + compatible = "arm,cortex-a9-twd-timer"; + reg = <0xffd00600 0x20>; + interrupts = <1 13 0xf01>; + clocks = <&periph_clk>; + }; + + pmu { + compatible = "arm,cortex-a9-pmu"; + interrupts = <0 112 4>; + interrupt-affinity = <&cpu0>; + }; + + L2: cache-controller@ffe00000 { + compatible = "arm,pl310-cache"; + reg = <0xffe00000 0x1000>; + interrupts = <0 96 4>; + cache-unified; + arm,shared-override; + cache-level = <2>; + arm,data-latency = <2 2 2>; + arm,tag-latency = <2 2 2>; + }; + + gic: interrupt-controller@0xffd00000 { + compatible = "arm,cortex-a9-gic"; + #interrupt-cells = <3>; + interrupt-controller; + reg = <0xffd01000 0x1000>, + <0xffd00100 0x1000>; + }; + + scu: snoop-control-unit@0xffd00000 { + compatible = "arm,cortex-a9-scu"; + reg = <0xffd00000 0x100>; + }; +}; +# 11 "nvt-peri.dtsi" 2 + +/ { + chosen { + bootargs = " "; + }; + + aliases { + mmc0 = &mmc0; + mmc1 = &mmc1; + }; + + uart@f0290000 { + compatible = "ns16550a"; + reg = <0xf0290000 0x1000>; + interrupts = <0 43 4>; + baud = <115200>; + reg-shift = <2>; + reg-io-width = <4>; + no-loopback-test = <1>; + clock-frequency = <24000000>; + fifo-size = <64>; + uart_id = <0>; + }; + + uart@f0300000 { + compatible = "ns16550a"; + reg = <0xf0300000 0x1000>; + interrupts = <0 44 4>; + baud = <115200>; + reg-shift = <2>; + reg-io-width = <4>; + no-loopback-test = <1>; + clock-frequency = <48000000>; + fifo-size = <64>; + hw_flowctrl = <0>; + rx_trig_level = <3>; + uart_id = <1>; + }; + + uart@f0310000 { + compatible = "ns16550a"; + reg = <0xf0310000 0x1000>; + interrupts = <0 45 4>; + baud = <115200>; + reg-shift = <2>; + reg-io-width = <4>; + no-loopback-test = <1>; + clock-frequency = <48000000>; + fifo-size = <64>; + hw_flowctrl = <0>; + rx_trig_level = <3>; + uart_id = <2>; + }; + + kdrv_rpc: cc@f0090000 { + compatible = "kdrv_rpc"; + reg = <0xf0090000 0x300>; + interrupts = <0 59 4>; + }; + + mmc0: mmc@f0420000 { + compatible = "nvt,nvt_mmc"; + reg = <0xf0420000 0x1000>; + interrupts = <0 30 4>; + max-frequency = <48000000>; + voltage-switch = <0>; + max-voltage = <3300>; + bus-width = <4>; + neg-sample-edge = <0>; + driving = <15 15 15 20 15 15 25 25 25 25 25 25>; + cd_gpio = <(9) 0x0 0x0>; + card_power_gpio = <(7 + 0x20) 0x0>; + + + }; + + mmc1: mmc@f0500000 { + compatible = "nvt,nvt_mmc2"; + reg = <0xf0500000 0x1000>; + interrupts = <0 31 4>; + max-frequency = <48000000>; + voltage-switch = <0>; + max-voltage = <3300>; + bus-width = <4>; + neg-sample-edge = <0>; + driving = <15 8 8 20 8 8 20 8 8 20 8 8>; + cd_gpio = <0 0x0 0x1>; + + + + }; + + nand: nand@f0400000 { + #address-cells = <2>; + #size-cells = <2>; + compatible = "nvt,nvt_spinand"; + reg = <0xf0400000 0x1000>; + interrupts = <0 29 4>; + clock-frequency = <96000000>; + nvt-devname = "spi_nand.0"; + }; + + nor: nor@f0400000 { + #address-cells = <2>; + #size-cells = <2>; + compatible = "nvt,nvt_spinor"; + reg = <0xf0400000 0x1000>; + interrupts = <0 29 4>; + clock-frequency = <120000000>; + nvt-devname = "spi_nor.0"; + trace-stdtable = <1>; + }; + + gpio: gpio@f0070000 { + compatible = "nvt,nvt_gpio"; + reg = <0xf0070000 0x10000>; + interrupts = <0 24 4>; + #gpio-cells = <2>; + }; + + eth@f02b0000 { + compatible = "nvt,synopsys_eth"; + reg = <0xf02b0000 0x3800>; + interrupts = <0 34 4>; + sp-clk = <0>; + ref-clk-out = <0>; + }; + + phy@f02b3800 { + compatible = "nvt,eth_phy"; + reg = <0xf02b3800 0x400>; + }; + + wdt@f0050000 { + compatible = "nvt,nvt_wdt"; + reg = <0xf0050000 0x10000>; + interrupts = <0 57 4>; + }; + + pwm: pwm@f0210000 { + compatible = "nvt,nvt_kdrv_pwm"; + reg = <0xf0210000 0x2000>; + interrupts = <0 26 4>; + }; + + adc@f0260000 { + compatible = "nvt,nvt_adc"; + reg = <0xf0260000 0x1000>; + interrupts = <0 47 4>; + #io-channel-cells = <1>; + }; + + rtc@f0060000 { + compatible = "nvt,nvt_rtc"; + reg = <0xf0060000 0x100>; + interrupts = <0 56 4>; + }; + + drtc@f00b0000 { + compatible = "nvt,nvt_drtc"; + reg = <0xf00b0000 0x100>; + }; + + crypto: crypto@f0620000 { + compatible = "nvt,nvt_crypto"; + reg = <0xf0620000 0x100>; + interrupts = <0 38 4>; + mclk = <1>; + }; + + hash: hash@f0670000 { + compatible = "nvt,nvt_hash"; + reg = <0xf0670000 0x100>; + interrupts = <0 28 4>; + mclk = <1>; + }; + + rsa: rsa@f06a0000 { + compatible = "nvt,nvt_rsa"; + reg = <0xf06a0000 0x100>; + interrupts = <0 20 4>; + mclk = <1>; + }; + + top: top@f0010000 { + compatible = "nvt,nvt_top"; + reg = <0xf0010000 0x2000 + 0xf0030000 0x2000 + 0xf0070000 0x10000>; + }; + + sie@f0c00000 { + compatible = "nvt,drv_sie"; + reg = <0xf0c00000 0x900 + 0xf0d20000 0x900 + 0xF0D30000 0x900>; + interrupts = <0 1 4 + 0 2 4 + 0 3 4>; + + }; + + tge@f0cc0000 { + compatible = "nvt,kdrv_tge"; + reg = <0xf0cc0000 0x150>; + interrupts = <0 22 4>; + }; + + rhe@f0ce0000 { + compatible = "nvt,kdrv_rhe"; + reg = <0xf0ce0000 0x900>; + interrupts = <0 13 4>; + }; + + ime@f0c40000 { + compatible = "nvt,kdrv_ime"; + reg = <0xf0c40000 0x1000>; + interrupts = <0 6 4>; + }; + + ife2@f0d00000 { + compatible = "nvt,kdrv_ife2"; + reg = <0xf0d00000 0x100>; + interrupts = <0 9 4>; + }; + + ise@f0c90000 { + compatible = "nvt,kdrv_ise"; + reg = <0xf0c90000 0x100>; + interrupts = <0 21 4 + 0 85 4>; + }; + + ipe@f0c30000 { + compatible = "nvt,kdrv_ipe"; + reg = <0xf0c30000 0x900>; + interrupts = <0 5 4>; + }; + + ife@f0c70000 { + compatible = "nvt,kdrv_ife"; + reg = <0xf0c70000 0x800>; + interrupts = <0 8 4>; + }; + + vpe@f0cd0000 { + compatible = "nvt,kdrv_vpe"; + reg = <0xf0cd0000 0x1040>; + interrupts = <0 62 4>; + }; + + ai@f0c60000 { + compatible = "nvt,kdrv_ai"; + reg = <0xf0c60000 0x23c + 0xf0d50000 0x114 + 0xf0cb0000 0x22c>; + interrupts = <0 14 4 + 0 13 4 + 0 11 4>; + clock-frequency = <600000000 480000000 600000000>; + }; + + md@f0c10000 { + compatible = "nvt,kdrv_md"; + reg = <0xf0c10000 0x150>; + interrupts = <0 46 4>; + clock-frequency = <240000000>; + }; + dis@f0c50000 { + compatible = "nvt,kdrv_dis"; + reg = <0xf0c50000 0x114>; + interrupts = <0 10 4>; + }; + + coe@f0a11000 { + compatible = "nvt,nvt_coe"; + reg = <0xf0a11000 0x2c0>; + }; + + dce@f0c20000 { + compatible = "nvt,kdrv_dce"; + reg = <0xf0c20000 0x650>; + interrupts = <0 7 4>; + }; + + ive@f0d70000 { + compatible = "nvt,kdrv_ive"; + reg = <0xf0d70000 0x6c>; + interrupts = <0 53 4>; + }; + + sde@f0d90000 { + compatible = "nvt,kdrv_sde"; + reg = <0xf0d90000 0x90>; + interrupts = <0 74 4>; + }; + + ide@f0800000 { + compatible = "nvt,nvt_ide"; + reg = <0xf0800000 0x1000>; + interrupts = <0 48 4>; + }; + + dsi@f0840000 { + compatible = "nvt,nvt_dsi"; + reg = <0xf0840000 0x1000>; + interrupts = <0 50 4>; + }; + + csi@f0280000 { + compatible = "nvt,nvt_csi"; + reg = <0xf0280000 0x100 + 0xf0330000 0x100>; + interrupts = <0 54 4 + 0 55 4>; + }; + + lvds@f0270000 { + compatible = "nvt,nvt_lvds"; + reg = <0xF0270000 0x200 + 0xF0370000 0x200>; + interrupts = <0 54 4 + 0 55 4>; + }; + + senphy@f06b0000 { + compatible = "nvt,nvt_senphy"; + reg = <0xF06B0000 0x100>; + }; + + ssenif@f0xx0000 { + compatible = "nvt,nvt_ssenif"; + reg = <0xF02C0000 0x2000>; + interrupts = <0 61 4>; + }; + + sif@f0240000 { + compatible = "nvt,nvt_sif"; + reg = <0xf0240000 0x200>; + interrupts = <0 40 4>; + clock-frequency = <1000000>; + }; + + graphic@f0c80000 { + compatible = "nvt,nvt_graphic"; + reg = <0xF0C80000 0x300 + 0xF0D10000 0x100>; + interrupts = <0 18 4 + 0 19 4>; + }; + + affine@f0ca0000 { + compatible = "nvt,nvt_affine"; + reg = <0xF0CA0000 0x100>; + interrupts = <0 52 4>; + }; + + h26x@f0a10000 { + compatible = "nvt,nvt_h26x"; + reg = <0xf0a10000 0xa00>; + interrupts = <0 16 4>; + power_saving = <0>; + }; + + timer@f0040000 { + compatible = "nvt,nvt_timer"; + reg = <0xf0040000 0x300>; + interrupts = <0 0 4>; + }; + + eac@f0640000 { + compatible = "nvt,nvt_eac"; + reg = <0xF0640000 0x200>; + }; + + jpg@f0a00000 { + compatible = "nvt,nvt_jpg"; + reg = <0xf0a00000 0x100>; + interrupts = <0 17 4>; + }; + + nvt_usb2host@f0600000 { + compatible = "nvt,ehci-nvtivot"; + reg = <0xf0600000 0x10000>; + interrupts = <0 27 4>; + }; + + nvt_usb2dev@f0600000 { + compatible = "nvt,fotg200_udc"; + reg = <0xf0600000 0x10000>; + interrupts = <0 27 4>; + }; + + nvt_usb_chrg@f0600000 { + compatible = "nvt,nvt_usb_chrgdet"; + reg = <0xf0600000 0x10000>; + }; + + dai@f0630000 { + compatible = "nvt,nvt_dai"; + reg = <0xF0630000 0xbc>; + interrupts = <0 15 4>; + }; + + rotate@f0cf0000 { + compatible = "nvt,nvt_rotation"; + reg = <0xF0CF0000 0x100>; + interrupts = <0 81 4>; + }; + + drvdump@0 { + compatible = "nvt,nvt_drvdump"; + }; + + dsp@f1430000 { + compatible = "nvt,nvt_dsp"; + reg = <0xF1430000 0x200 + 0xF2000000 0x1000000 + 0xF1440000 0x200 + 0xF3000000 0x1000000>; + interrupts = <0 76 4 + 0 77 4>; + }; + + spi0: spi@f0230000 { + compatible = "nvt,nvt_spi"; + reg = <0xf0230000 0x10000>; + interrupts = <0 35 4>; + dma-support = <0>; + nvt-devname = <0>; + }; + + spi1: spi@f0320000 { + compatible = "nvt,nvt_spi"; + reg = <0xf0320000 0x10000>; + interrupts = <0 36 4>; + dma-support = <0>; + nvt-devname = <1>; + }; + + spi2: spi@f0340000 { + compatible = "nvt,nvt_spi"; + reg = <0xf0340000 0x10000>; + interrupts = <0 37 4>; + dma-support = <0>; + nvt-devname = <2>; + }; + + sdp@f0390000 { + compatible = "nvt,nvt_sdp"; + reg = <0xf0390000 0x28>; + interrupts = <0 12 4>; + }; + + tse@f0650000 { + compatible = "nvt,nvt_tse"; + reg = <0xF0650000 0x90>; + interrupts = <0 23 4>; + }; + + remote@f0250000 { + compatible = "nvt,nvt_remote"; + reg = <0xf0250000 0x28>; + interrupts = <0 25 4>; + }; + + rng: rng@f0680000 { + compatible = "nvt,nvt_rng"; + reg = <0xf0680000 0x100>; + }; + + nvt_arb@f0000000 { + compatible = "nvt,nvt_arb"; + reg = <0xF0000000 0xA000 + 0xF0FE0000 0x300>; + interrupts = <0 33 4>; + }; + + nvt_otp@f0660000 { + compatible = "nvt,nvt_otp"; + reg = <0xF0660000 0x70>; + }; + + kdrv_ipp { + clock-frequency = <240000000>; + }; + + uvcp: uvcp@f0690000 { + compatible = "nvt,nvt_uvcp"; + reg = <0xf0690000 0x200>; + interrupts = <0 59 4>; + }; + pll_preset@0 { + pll3{pll_config = <3 0 0>;}; + pll4{pll_config = <4 0 0>;}; + pll5{pll_config = <5 297000000 1>;}; + pll6{pll_config = <6 0 0>;}; + pll7{pll_config = <7 0 0>;}; + pll8{pll_config = <8 0 0>;}; + pll9{pll_config = <9 0 0>;}; + pll11{pll_config = <11 0 0>;}; + pll12{pll_config = <12 0 1>;}; + }; +}; +# 11 "nvt-evb.dts" 2 +# 1 "nvt-top.dtsi" 1 +&top { + sdio{pinmux = <0x5>;}; + sdio2{pinmux = <0x5>;}; + sdio3{pinmux = <0x0>;}; + nand{pinmux = <0x5>;}; + sensor{pinmux = <0x0>;}; + sensor2{pinmux = <0x0>;}; + mipi_lvds{pinmux = <0x0>;}; + i2c{pinmux = <0x40>;}; + sif{pinmux = <0x0>;}; + uart{pinmux = <0x1021>;}; + spi{pinmux = <0x0>;}; + sdp{pinmux = <0x0>;}; + remote{pinmux = <0x0>;}; + pwm{pinmux = <0x8000>;}; + pwm2{pinmux = <0x100000>;}; + ccnt{pinmux = <0x0>;}; + audio{pinmux = <0x0>;}; + lcd{pinmux = <0x10000000>;}; + tv{pinmux = <0x0>;}; + eth{pinmux = <0x0>;}; + misc{pinmux = <0x0>;}; +}; +# 12 "nvt-evb.dts" 2 +# 1 "nvt-i2c.dtsi" 1 + + + + + + + +/ { + i2c0: i2c@f0220000 { compatible = "nvt,nvt_i2c"; reg = <0xf0220000 0x100>; interrupts = <0 41 4>; clock-frequency = <400000>; id = <0>; }; + i2c1: i2c2@f0350000 { compatible = "nvt,nvt_i2c"; reg = <0xf0350000 0x100>; interrupts = <0 42 4>; clock-frequency = <400000>; id = <1>; }; + i2c2: i2c3@f03a0000 { compatible = "nvt,nvt_i2c"; reg = <0xf03a0000 0x100>; interrupts = <0 60 4>; clock-frequency = <50000>; id = <2>; }; +}; +# 13 "nvt-evb.dts" 2 +# 1 "nvt-gpio.dtsi" 1 +&top { +# 201 "nvt-gpio.dtsi" + pgpio11{gpio_config = <(11 + 0x20) 1>;}; + pgpio7{gpio_config = <(7 + 0x20) 0>;}; + +}; +# 14 "nvt-evb.dts" 2 +# 1 "nvt-peri-dev.dtsi" 1 +# 11 "nvt-peri-dev.dtsi" +&i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + + + + + +}; + +&i2c1 { + #address-cells = <1>; + #size-cells = <0>; +}; + +&i2c2 { + #address-cells = <1>; + #size-cells = <0>; +}; + +&spi0 { + status = "okay"; + #address-cells = <1>; + #size-cells = <0>; +# 44 "nvt-peri-dev.dtsi" +}; + +&spi1 { + status = "okay"; +}; + +&spi2 { + status = "okay"; +}; +# 15 "nvt-evb.dts" 2 +# 1 "nvt-audio.dtsi" 1 + + + + + + + +/ { + audio@1 { type = "none"; i2s_ctrl = <0>; sif_channel = <0>; gpio_cold_reset = <0>; gpio_data = <0>; gpio_clk = <0>; gpio_cs = <0>; adc_zero = <0>; }; + audio@2 { type = "embedded"; i2s_ctrl = <4>; sif_channel = <0>; gpio_cold_reset = <0>; gpio_data = <0>; gpio_clk = <0>; gpio_cs = <0>; adc_zero = <0>; }; +}; +# 16 "nvt-evb.dts" 2 +# 1 "nvt-display.dtsi" 1 + + + + + + + +# 1 "/home/payton/S530/BSP/linux-kernel/include/dt-bindings/pinctrl/nvt_lcd.h" 1 +# 9 "nvt-display.dtsi" 2 +# 25 "nvt-display.dtsi" +/ { + display { type = "lcd"; lcd_ctrl = <1>; sif_channel = <4>; gpio_cs = <(7 + 0x20)>; gpio_clk = <(8 + 0x20)>; gpio_data = <(9 + 0x20)>; }; + logo { enable = <1>; lcd_type = <5>; lcd_rotate = <270>; lcd_reset = <(1 + 0x60)>; lcd_bl_gpio = <(11 + 0x20) 1>; lcd_power = <(8 + 0x20) 1>;}; +}; +# 17 "nvt-evb.dts" 2 +# 1 "nvt-media.dtsi" 1 +# 10 "nvt-media.dtsi" +# 1 "nvt-basic.dtsi" 1 +# 11 "nvt-basic.dtsi" +/ { + model = "Novatek NA51089"; + compatible = "novatek,na51089", "nvt,ca9"; + interrupt-parent = <&gic>; + #address-cells = <1>; + #size-cells = <1>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-a9"; + reg = <0x0>; + next-level-cache = <&L2>; + clock-frequency = <960000000>; + }; + }; + + cg@f0020000 { + compatible = "nvt,core_clk"; + reg = <0xf0020000 0x1000>; + }; + + + periph_clk: periph_clk { + compatible = "nvt,periph_clk"; + #clock-cells = <0>; + clock-output-names = "periph_clk"; + }; + + global_timer@ffd00200 { + compatible = "arm,cortex-a9-global-timer"; + reg = <0xffd00200 0x20>; + interrupts = <1 11 0xf01>; + clocks = <&periph_clk>; + }; + + private_timer@ffd00600 { + compatible = "arm,cortex-a9-twd-timer"; + reg = <0xffd00600 0x20>; + interrupts = <1 13 0xf01>; + clocks = <&periph_clk>; + }; + + pmu { + compatible = "arm,cortex-a9-pmu"; + interrupts = <0 112 4>; + interrupt-affinity = <&cpu0>; + }; + + L2: cache-controller@ffe00000 { + compatible = "arm,pl310-cache"; + reg = <0xffe00000 0x1000>; + interrupts = <0 96 4>; + cache-unified; + arm,shared-override; + cache-level = <2>; + arm,data-latency = <2 2 2>; + arm,tag-latency = <2 2 2>; + }; + + gic: interrupt-controller@0xffd00000 { + compatible = "arm,cortex-a9-gic"; + #interrupt-cells = <3>; + interrupt-controller; + reg = <0xffd01000 0x1000>, + <0xffd00100 0x1000>; + }; + + scu: snoop-control-unit@0xffd00000 { + compatible = "arm,cortex-a9-scu"; + reg = <0xffd00000 0x100>; + }; +}; +# 11 "nvt-media.dtsi" 2 + +/ { + nvtmpp { + compatible = "nvt,nvtmpp"; + }; + + isf_stream { + compatible = "nvt,isf_stream"; + }; + + isf_flow { + compatible = "nvt,isf_flow"; + }; + + isf_vdocap { + compatible = "nvt,isf_vdocap"; + }; + + isf_vdoprc { + compatible = "nvt,isf_vdoprc"; + }; + + isf_dummy { + compatible = "nvt,isf_dummy"; + }; + + isf_vdoenc { + compatible = "nvt,isf_vdoenc"; + }; + + isf_vdodec { + compatible = "nvt,isf_vdodec"; + }; + + isf_vdoout { + compatible = "nvt,isf_vdoout"; + }; + + dispobj { + compatible = "nvt,nvt_dispobj"; + }; + + dispdev { + compatible = "nvt,nvt_dispdev"; + }; + + audio { + compatible = "nvt,nvt_audio"; + }; + + msdcnvt { + compatible = "nvt,msdcnvt"; + }; + + msdcnvt_adj { + compatible = "nvt,msdcnvt_adj"; + }; + + msdcnvt_custom_si { + compatible = "nvt,msdcnvt_custom_si"; + }; + + wavstudio { + compatible = "nvt,wavstudio"; + }; + + isf_audenc { + compatible = "nvt,isf_audenc"; + }; + + isf_auddec { + compatible = "nvt,isf_auddec"; + }; + + isf_audcap { + compatible = "nvt,isf_audcap"; + }; + + isf_audout { + compatible = "nvt,isf_audout"; + }; + + nvt_ipc { + compatible = "nvt,nvt_ipc"; + }; +}; +# 18 "nvt-evb.dts" 2 +# 1 "nvt-mem-tbl.dtsi" 1 + + + + + + +/ { + + nvt_memory_cfg { + #address-cells = <1>; + #size-cells = <1>; + dram { reg = <0x00000000 0x08000000>; }; + shmem{ reg = <0x00007E00 0x00000200>; }; + loader { reg = <0x01000000 0x00080000>; }; + fdt { reg = <0x01800000 0x00040000>; }; + rtos { reg = <0x01840000 0x00FC0000>; }; + linuxtmp{ reg = <0x02800000 0x04000000>; }; + uboot{ reg = <0x06800000 0x01640000>; }; + logo-fb{ reg = <0x07E40000 0x001C0000>; }; + }; + + + memory { device_type = "memory"; reg = <0x00000000 0x01800000 0x02000000 0x01500000>; }; + + + reserved-memory { + #address-cells = <1>; + #size-cells = <1>; + ranges; + }; + + + + + + + libc-heap { size = <0x00200000>; }; + + hdal-memory { + #address-cells = <1>; + #size-cells = <1>; + media { reg = <0x03500000 0x04B00000>; }; + }; + + hdal-maxpath-cfg { + + vdocap_active_list = <1 0 0 0 0 0 0 0>; + vdoprc_maxdevice = <2>; + vdoenc_maxpath = <4>; + vdodec_maxpath = <3>; + vdoout_maxdevice = <1>; + adocap_maxdevice = <1>; + adoout_maxdevice = <2>; + adoenc_maxpath = <1>; + adodec_maxpath = <1>; + + gfx_maxjob = <2>; + + stamp_maximg = <9>; + + vdoprc_maxstamp = <4 4>; + + vdoprc_maxmask = <4 4>; + vdoenc_maxstamp = <9 9>; + vdoenc_maxmask = <0 64>; + vdoout_maxstamp = <0 16>; + vdoout_maxmask = <0 64>; + }; +}; +# 19 "nvt-evb.dts" 2 +# 1 "nvt-storage-partition.dtsi" 1 + + + + + + + +&nor { + partition_loader { label = "loader"; reg = <0x0 0x0000000 0x0 0x10000>; }; + partition_fdt { label = "fdt"; reg = <0x0 0x10000 0x0 0x10000>; }; + partition_fdt.restore { label = "fdt.restore"; reg = <0x0 0x20000 0x0 0x10000>; }; + partition_fdt.app { label = "fdt.app"; reg = <0x0 0x30000 0x0 0x20000>; }; + partition_uboot { label = "uboot"; reg = <0x0 0x50000 0x0 0xA0000>; }; + partition_uenv { label = "uenv"; reg = <0x0 0xF0000 0x0 0x10000>; }; + partition_kernel { label = "kernel"; reg = <0x0 0x100000 0x0 0x260000>; }; + partition_rootfs { label = "rootfs"; reg = <0x0 0x360000 0x0 0x3E0000>; }; + partition_rootfs1 { label = "rootfs1"; reg = <0x0 0x740000 0x0 0x810000>; }; + partition_rtos { label = "rtos"; reg = <0x0 0xF50000 0x0 0x900000>; }; + partition_app { label = "app"; reg = <0x0 0x1850000 0x0 0x50000>; }; + partition_sys { label = "sys"; reg = <0x0 0x18A0000 0x0 0x10000>; }; + partition_all { label = "all"; reg = <0x0 0x0000000 0x0 0x2000000>; }; +}; +# 20 "nvt-evb.dts" 2 +# 1 "nvt-info.dtsi" 1 + + + + + + + +/ { + nvt_info { + BIN_NAME = "FW98565A"; + BIN_NAME_T = "FW98565T"; + RTOS_APP_MAIN = "cardv"; + + EMBMEM_BLK_SIZE = "0x10000"; +# 24 "nvt-info.dtsi" + EMBMEM = "EMBMEM_SPI_NOR"; +# 34 "nvt-info.dtsi" + FW_TYPE = "FW_TYPE_PARTIAL"; + + + + + + UI_STYLE = "UI_STYLE_LVGL"; + + + + + + NVT_CFG_APP_EXTERNAL = "hostapd wireless_tool iperf-3 wpa_supplicant dhd_priv isp_demon"; + + NVT_CFG_APP = "mem cardv memcpy"; + + NVT_ROOTFS_ETC = ""; + + NVT_BINARY_FILE_STRIP = "yes"; + + NVT_CFG_KERNEL_CFG = "na51089_evb_cardv_defconfig_release"; + + NVT_MAKE_POST = "make_post.sh"; + + NVT_SAMPLES_INSTALL = "DISABLE"; + + NVT_CFG_UBOOT_CFG = ""; + + + + + + + + NVT_LINUX_SMP = "NVT_LINUX_SMP_OFF"; + + + + + + + + NVT_CHIP_ID = "CHIP_NA51089"; + + + + + + + + NVT_LINUX_COMPRESS = "NVT_LINUX_COMPRESS_GZ"; + + + + + + + + NVT_DEFAULT_NETWORK_BOOT_PROTOCOL = "NVT_DEFAULT_NETWORK_BOOT_PROTOCOL_STATIC_IP"; +# 103 "nvt-info.dtsi" + NVT_ROOTFS_TYPE = "NVT_ROOTFS_TYPE_RAMDISK"; +# 113 "nvt-info.dtsi" + LCD1 = "disp_if8b_lcd1_psd200_st7789v"; +# 126 "nvt-info.dtsi" + SENSOR1 = "sen_os05b10"; + SENSOR1_CFG = "sen_os05b10_565"; + SENSOR2 = "sen_off"; + SENSOR2_CFG = "sen_off"; + + + + + + NVT_ROOTFS_RW_PART_EN = "NVT_ROOTFS_RW_PART_EN_ON"; + + + + + + + NVT_ETHERNET = "NVT_ETHERNET_NONE"; +# 151 "nvt-info.dtsi" + NVT_SDIO_WIFI = "NVT_SDIO_WIFI_NONE"; + + + + + + NVT_USB_WIFI = "NVT_USB_WIFI_NONE"; + + + + + + NVT_USB_4G = "NVT_USB_4G_NONE"; + + + + + + + WIFI_RTK_MDL = "WIFI_RTK_MDL_8189"; + + + + + + + + WIFI_BRCM_MDL = "WIFI_BRCM_MDL_43456c5_ampk6256c5"; + + + + + + + WIFI_NVT_MDL = "WIFI_NVT_MDL_18211"; + + + + + + + NVT_CURL_SSL = "NVT_CURL_SSL_OPENSSL"; +# 201 "nvt-info.dtsi" + NVT_UBOOT_ENV_IN_STORG_SUPPORT = "NVT_UBOOT_ENV_IN_STORG_SUPPORT_OFF"; + + + + + + + TOUCH = "TOUCH_OFF"; + + + + + + + UBOOT_ONLY_LOAD_LINUX = "UBOOT_ONLY_LOAD_LINUX_ON"; + + }; +}; +# 21 "nvt-evb.dts" 2 +# 1 "nvt-nvtpack.dtsi" 1 + + + + + + + +&nor { + + + + + nvtpack { + ver = "NVTPACK_FW_INI_16072017"; + method = <1>; + index { + id0 { partition_name = "loader"; source_file = ""; }; + id1 { partition_name = "fdt"; source_file = "nvt-evb.bin"; }; + id2 { partition_name = "fdt.restore"; source_file = ""; }; + id3 { partition_name = "fdt.app"; source_file = "../application.bin"; }; + id4 { partition_name = "uboot"; source_file = "u-boot.bin"; }; + id5 { partition_name = "uenv"; source_file = ""; }; + id6 { partition_name = "kernel"; source_file = "uImage.bin"; }; + id7 { partition_name = "rootfs"; source_file = "rootfs.ramdisk.bin"; }; + id8 { partition_name = "rootfs1"; source_file = "rootfs_1.squash.bin"; }; + id9 { partition_name = "rtos"; source_file = "../rtos-main.bin"; }; + id10 { partition_name = "app"; source_file = "appfs.cardv.jffs2.nor.bin"; }; + id11 { partition_name = "sys"; source_file = ""; }; + }; + }; +}; +# 21 "nvt-evb.dts" 2 diff --git a/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-top.dtsi b/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-top.dtsi index e629d9cd5..5d0d0b831 100755 --- a/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-top.dtsi +++ b/configs/Linux/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-top.dtsi @@ -8,7 +8,7 @@ mipi_lvds{pinmux = <0x0>;}; i2c{pinmux = <0x40>;}; sif{pinmux = <0x0>;}; - uart{pinmux = <0x1>;}; + uart{pinmux = <0x1021>;}; spi{pinmux = <0x0>;}; sdp{pinmux = <0x0>;}; remote{pinmux = <0x0>;}; diff --git a/configs/rtos/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-top.dtsi b/configs/rtos/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-top.dtsi index 3b67e92e3..30bc0fe76 100755 --- a/configs/rtos/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-top.dtsi +++ b/configs/rtos/cfg_565_HUNTING_EVB_LINUX_4G_S530/nvt-top.dtsi @@ -8,7 +8,7 @@ mipi_lvds{pinmux = <0x0>;}; i2c{pinmux = <0x40>;}; sif{pinmux = <0x0>;}; - uart{pinmux = <0x1>;}; + uart{pinmux = <0x1021>;}; spi{pinmux = <0x0>;}; sdp{pinmux = <0x0>;}; remote{pinmux = <0x0>;}; diff --git a/rtos/build/nvt-tools/__pycache__/pyfdt.cpython-36.pyc b/rtos/build/nvt-tools/__pycache__/pyfdt.cpython-36.pyc index 52efa3d8f..e8ee6ac4f 100644 Binary files a/rtos/build/nvt-tools/__pycache__/pyfdt.cpython-36.pyc and b/rtos/build/nvt-tools/__pycache__/pyfdt.cpython-36.pyc differ diff --git a/rtos/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S530/DxHunting.c b/rtos/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S530/DxHunting.c index 57df70396..258262070 100755 --- a/rtos/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S530/DxHunting.c +++ b/rtos/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S530/DxHunting.c @@ -134,7 +134,7 @@ void DrvGPIO_SetPhotoMovieModeFromMonitor(UINT32 u32PhotoMovieMode) UINT32 DrvGPIO_GetPhotoMovieModeFromMonitor(void) { static BOOL first_entry = TRUE; - + int ret = 1; UINT8 value; if(first_entry == TRUE){ @@ -147,8 +147,8 @@ UINT32 DrvGPIO_GetPhotoMovieModeFromMonitor(void) g_uiBootMode = DX_HUNTING_MODE_OTHER; return g_uiBootMode; } - sf_mod_init(); - + ret = sf_mod_init(); + printf("%s:%d ret:%d\n", __FUNCTION__, __LINE__,ret); value = sf_get_power_on_mode(); sf_mcu_wdg_set(5); diff --git a/rtos/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S530/IOCfg.h b/rtos/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S530/IOCfg.h index e452d04d7..bb6146148 100755 --- a/rtos/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S530/IOCfg.h +++ b/rtos/code/application/source/cardv/SrcCode/Dx/565_HUNTING_EVB_LINUX_4G_S530/IOCfg.h @@ -338,7 +338,7 @@ extern BOOL GPIOMap_DetPoweroff(void); #define GPIO_CHARGEIC_STATE P_GPIO_12 #define GPIO_CHARGEIC_ADC_SWITCH L_GPIO_0 -#define GPIO_ACC P_GPIO_5 +//#define GPIO_ACC P_GPIO_5 #define GPIO_PA P_GPIO_0 #define GPIO_PARKING P_GPIO_6 diff --git a/rtos/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h b/rtos/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h index 0bc9fdc8f..8fb95d541 100755 --- a/rtos/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h +++ b/rtos/code/application/source/cardv/SrcCode/PrjCfg_HUNTING_S530.h @@ -944,8 +944,8 @@ #define POWERON_FAST_SLICE_ENC_VER2 ENABLE #define DZOOM_FUNC ENABLE #define MOVIE_AI_DEMO DISABLE -#define HUNTING_MCU_I2C ENABLE -#define HUNTING_MCU_UART DISABLE +#define HUNTING_MCU_I2C DISABLE +#define HUNTING_MCU_UART ENABLE #define HUNTING_IR_LED_940 ENABLE//DISABLE #define SF_BASE_VERSION "7MD4RCwD3T1" diff --git a/rtos/code/application/source/cardv/SrcCode/System/SysMain.c b/rtos/code/application/source/cardv/SrcCode/System/SysMain.c index 65d9cd460..ba86374bc 100755 --- a/rtos/code/application/source/cardv/SrcCode/System/SysMain.c +++ b/rtos/code/application/source/cardv/SrcCode/System/SysMain.c @@ -20,6 +20,9 @@ #define __DBGLVL__ ((THIS_DBGLVL>=PRJ_DBG_LVL)?THIS_DBGLVL:PRJ_DBG_LVL) #define __DBGFLT__ "*" //*=All, [mark]=CustomClass #include +#if HUNTING_CAMERA_MCU == ENABLE +#include +#endif extern void System_BootStart(void); extern void System_BootEnd(void); @@ -710,7 +713,10 @@ exit: ////////////////////////////////////////////////////////////// UserMainProc_Exit(); ////////////////////////////////////////////////////////////// - System_PowerOffStart(); + //System_PowerOffStart(); + #if HUNTING_CAMERA_MCU == ENABLE + sf_mcu_reg_set(SF_MCU_POWEROFF,paramArray[0]); + #endif } diff --git a/rtos/code/driver/na51089/include/sf_commu_mcu.h b/rtos/code/driver/na51089/include/sf_commu_mcu.h index ed109dc2b..376cd7474 100755 --- a/rtos/code/driver/na51089/include/sf_commu_mcu.h +++ b/rtos/code/driver/na51089/include/sf_commu_mcu.h @@ -25,11 +25,13 @@ extern "C"{ #endif // __cplusplus +#include #define SERIAL_DEVICE_PATH "/dev/ttyS2" +#define BUF_REG_SIZE (REG_SIZE*2+8) typedef struct { - unsigned char buf[32]; + unsigned char buf[BUF_REG_SIZE]; unsigned int index; }SMAPBUF_t; /* @@ -60,9 +62,14 @@ int sf_commu_get_mcu(unsigned char reg); int sf_getRegFromMcu_depack(unsigned char * dataToParse, unsigned int datalen, unsigned char * regAddr, unsigned char * regVal); int sf_getRegFromMcu_ack(unsigned char regAddr, unsigned char regVal); unsigned char sf_commu_parse_mcu_data(unsigned char * src, unsigned int len); -void sf_commu_mcu_task_start(void); +int sf_commu_mcu_task_start(void); void sf_commu_mcu_task_stop(void); unsigned char sf_commu_mcu_task_running(void); +unsigned int sf_get_mcu_reg_ack_depack_many(unsigned char reg[], unsigned char val[], unsigned int * num); +int sf_set_mcu_reg_many(unsigned char reg[], unsigned char val[], unsigned int num); +int sf_get_mcu_reg_many(unsigned char reg[], unsigned int num); +int sf_commu_set_mcu_many(unsigned char reg[], unsigned char val[], unsigned int *num); +int sf_commu_get_mcu_many(unsigned char reg[], unsigned char val[], unsigned int *num); #ifdef __cplusplus } diff --git a/rtos/code/driver/na51089/include/sf_mcu.h b/rtos/code/driver/na51089/include/sf_mcu.h index 9742abd2b..74d39ba05 100755 --- a/rtos/code/driver/na51089/include/sf_mcu.h +++ b/rtos/code/driver/na51089/include/sf_mcu.h @@ -126,7 +126,7 @@ #define WDT_OFF 0x01 #define DEBUG_MODE_ON 0x02 -#if defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) +#if 0//defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) #define REG_SIZE 82 typedef enum @@ -223,7 +223,7 @@ typedef enum RESERVER13, RESERVER14, }PARA_REG; - +#endif typedef enum { POWEROFF_COUNTDOWN = 1, POWEROFF_PVDOWN, @@ -251,8 +251,8 @@ typedef enum { WORKING_TIME_ALL = 0xff, }WORKING_TIME_TYPE; -#elif defined(_MODEL_565_HUNTING_EVB_LINUX_4G_68CS_) - +//#elif defined(_MODEL_565_HUNTING_EVB_LINUX_4G_68CS_) +#if 1 #define REG_SIZE 91 typedef enum @@ -361,8 +361,6 @@ typedef enum RESERVER12 = 89, RESERVER13 = 90, }PARA_REG; -#else - #endif diff --git a/rtos/code/driver/na51089/source/mcu/sf_commu_mcu.c b/rtos/code/driver/na51089/source/mcu/sf_commu_mcu.c index 373a5ee2f..55bf92d32 100755 --- a/rtos/code/driver/na51089/source/mcu/sf_commu_mcu.c +++ b/rtos/code/driver/na51089/source/mcu/sf_commu_mcu.c @@ -48,8 +48,10 @@ #include "GxUSB.h" #include "kwrap/task.h" #include +#include "NvtUser/NvtUser.h" +#include "AppControl/AppControl.h" -#include "sf_commu_mcu.h" +#include #define SERIAL_DEVICE_PATH "/dev/ttyS2" @@ -58,6 +60,7 @@ extern "C" { #endif #endif + unsigned char mcu_upgrade_buf[32]; unsigned char mcu_upgrade_buf_len; @@ -120,7 +123,7 @@ static unsigned short sf_crc16_check(unsigned char * dataIn, int length) return result; } -static unsigned char sndBuf[32] = +static unsigned char sndBuf[BUF_REG_SIZE] = { 0 }; @@ -132,28 +135,32 @@ SMAPBUF_t smap_buf = int SMAP_waitAck = 0; -unsigned char mcu_buf[32] = {0}; +unsigned char mcu_buf[BUF_REG_SIZE] = {0}; unsigned int mcu_buf_len = 0; +unsigned char cmpRegBuf[BUF_REG_SIZE] = {0}; +unsigned char cmpValBuf[BUF_REG_SIZE] = {0}; static unsigned char sf_commu_mcu_exit = 1; static VK_TASK_HANDLE sfCommuMcuThread = 0; THREAD_RETTYPE sf_commu_mcu_task(void *arg); - + int gsfd = -1; void mcubuf_reset(void) { mcu_buf_len = 0; - memset(mcu_buf, 0x00, sizeof(mcu_buf)); + memset(mcu_buf, 0x00, sizeof(mcu_buf)); } int sf_commu_write(unsigned char * buf, int len) { int ret = FAIL; - ret = uart3_write(buf, len); - if(ret < 0) + + // vos_flag_set(FLG_ID_UART3, UART3_FLAG_DATAVALID); + if(ret <= 0) { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); return FAIL; } return ret; @@ -162,10 +169,25 @@ int sf_commu_write(unsigned char * buf, int len) int sf_commu_read(unsigned char * buf, int len) { - int ret = SUCCESS; - ret = uart3_read(buf, len); + INT32 ret = 0; + //int j = 0; + /* + UART_DATA_PARA DataPara; + DataPara.Action = UART_ACT_GET; + DataPara.BufferInfo.uiSize = len; + DataPara.BufferInfo.pBuffer = buf; + ret = uart3_operateData(&DataPara); + */ + //uart3_waitData(UART_ACT_GET); + //printf("%s:%d s\r\n", __FUNCTION__, __LINE__); + + ret = (INT32)uart3_read(buf, len); + if(ret < 0) - return FAIL; + { + printf("%s:%d error ret:%lu\r\n", __FUNCTION__, __LINE__,ret); + return 0; + } return ret; } @@ -244,6 +266,97 @@ int sf_get_mcu_reg(unsigned char reg) return 0x01; } +int sf_set_mcu_reg_many(unsigned char reg[], unsigned char val[], unsigned int num) +{ + unsigned short index = 0; + unsigned short crc = 0; + unsigned short crc_start = 0; + unsigned short crc_end = 0; + unsigned int i = 0; + int ret = FAIL; + memset(sndBuf, 0x00, sizeof(sndBuf)); + // uint8_t i = 0; + sndBuf[index] = 0x55; + index++; + sndBuf[index] = 0xAA; + index++; + crc_start = index; + sndBuf[index] = 0x04; + index++; + sndBuf[index] = num; + + for(i = 0; i < num; i++) + { + index++; + sndBuf[index] = reg[i]; + index++; + sndBuf[index] = val[i]; + + } + index++; + crc_end = index; + crc = sf_crc16_check(&sndBuf[crc_start], crc_end - crc_start); + sndBuf[index] = (crc & 0xff00) >> 8; + index++; + sndBuf[index] = crc & 0x00ff; + index++; + sndBuf[index] = 0xFF; + index++; + sndBuf[index] = 0xEE; + ret = sf_commu_write(sndBuf, index + 1); + if(ret == FAIL) + { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); + } + return 0x03; +} + +int sf_get_mcu_reg_many(unsigned char reg[], unsigned int num) +{ + unsigned short index = 0; + unsigned short crc = 0; + unsigned short crc_start = 0; + unsigned short crc_end = 0; + unsigned int i = 0; + int ret = FAIL; + //uint8_t i = 0; + memset(sndBuf, 0x00, sizeof(sndBuf)); + sndBuf[index] = 0x55; + index++; + sndBuf[index] = 0xAA; + index++; + crc_start = index; + sndBuf[index] = 0x02; + index++; + sndBuf[index] = num; + + + for(i = 0; i < num; i++) + { + index++; + sndBuf[index] = reg[i]; + } + + index++; + crc_end = index; + crc = sf_crc16_check(&sndBuf[crc_start], crc_end - crc_start); + sndBuf[index] = (crc & 0xff00) >> 8; + index++; + sndBuf[index] = crc & 0x00ff; + index++; + sndBuf[index] = 0xFF; + index++; + sndBuf[index] = 0xEE; + + ret = sf_commu_write(sndBuf, index + 1); + if(ret == FAIL) + { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); + } + + return 0x01; +} + unsigned int sf_set_mcu_reg_ack_depack(unsigned int * address, unsigned int * value) { unsigned short crc1 = (((unsigned short) smap_buf.buf[smap_buf.index - 4]) << 8) | smap_buf.buf[smap_buf.index - 3]; @@ -295,6 +408,42 @@ unsigned int sf_get_mcu_reg_ack_depack(unsigned int * address, unsigned int * va return (unsigned int)smap_buf.buf[2]; } + + +unsigned int sf_get_mcu_reg_ack_depack_many(unsigned char reg[], unsigned char val[], unsigned int * num) +{ + unsigned short crc1 = (((unsigned short) smap_buf.buf[smap_buf.index - 4] << 8) & 0xff00) | smap_buf.buf[smap_buf.index - 3]; + unsigned short crc2 = 0; + unsigned int i = 0; + unsigned int j = 4; + + crc2 = sf_crc16_check(&smap_buf.buf[2], smap_buf.index - 6); + + if (crc2 != crc1) + { + printf("crc error crc1 %d, crc2 %d, function %s, file %s, line %d\r\n", crc1, crc2, __FUNCTION__, + __FILE__, __LINE__); + return - 1; + } + *num = smap_buf.buf[3]; + + for(i = 0; i < *num; i++) + { + reg[i]= smap_buf.buf[j]; + j++; + val[i]= smap_buf.buf[j]; + j++; + } + + if (smap_buf.buf[2] == 0xFF) /* error command 0xff */ + { + printf("%s:%d command error\r\n", __FUNCTION__, __LINE__); + return - 1; + } + + return (unsigned int)smap_buf.buf[2]; +} + int sf_commu_wait(unsigned char cmd) { volatile char trytimes = 0; @@ -315,7 +464,9 @@ void sf_commu_reset(void) { smap_buf.index = 0; SMAP_waitAck = 0; - memset(smap_buf.buf, 0x00, 32); + memset(smap_buf.buf, 0x00, sizeof(smap_buf.buf)); + memset(cmpRegBuf, 0x00, sizeof(cmpRegBuf)); + memset(cmpValBuf, 0x00, sizeof(cmpValBuf)); } int sf_commu_set_mcu(unsigned char reg, unsigned char val) @@ -323,7 +474,7 @@ int sf_commu_set_mcu(unsigned char reg, unsigned char val) int ret = -1; unsigned int address = 0; unsigned int value = 0; - printf("Reg_Data[%02d,0x%02x]\n", reg,val); + //printf("W_addr[%02d,0x%02x]\n", reg,val); sf_commu_reset(); sf_set_mcu_reg(reg, val); ret = sf_commu_wait(0x03); @@ -355,13 +506,14 @@ int sf_commu_get_mcu(unsigned char reg) sf_commu_reset(); sf_get_mcu_reg(reg); - ret = sf_commu_wait(0x01); - if(ret < 0) - { - printf("%s:%d time out\r\n", __FUNCTION__, __LINE__); - sf_commu_reset(); - return - 1; - } + ret = sf_commu_wait(0x01); + if(ret < 0) + { + printf("%s:%d time out\r\n", __FUNCTION__, __LINE__); + sf_commu_reset(); + return - 1; + } + ret = sf_get_mcu_reg_ack_depack(&address, &value); if (ret < 0 || address != reg) { @@ -375,6 +527,79 @@ int sf_commu_get_mcu(unsigned char reg) return ret; } +int sf_commu_set_mcu_many(unsigned char reg[], unsigned char val[], unsigned int *num) +{ + int ret = -1; + //unsigned int address = 0; + //unsigned int value = 0; + unsigned int i = 0; + //printf("W_addr[%02d,0x%02x]\n", reg,val); + sf_commu_reset(); + sf_set_mcu_reg_many(reg, val, *num); + ret = sf_commu_wait(0x04); + if(ret < 0) + { + printf("%s:%d time out\r\n", __FUNCTION__, __LINE__); + sf_commu_reset(); + return - 1; + } + + ret = sf_get_mcu_reg_ack_depack_many(cmpRegBuf, cmpValBuf, num); + if (ret < 0) + { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); + ret = -1; + } + else + { + for(i = 0; i < *num; i++) + { + if((reg[i] != cmpRegBuf[i]) || (val[i] != cmpValBuf[i])) + { + printf("%s:%d error address %d, value %d get address %d, value %d\r\n", __FUNCTION__, __LINE__, reg[i], val[i], cmpRegBuf[i], cmpValBuf[i]); + ret = -1; + } + } + } + + return ret; +} + +int sf_commu_get_mcu_many(unsigned char reg[], unsigned char val[], unsigned int *num) +{ + int ret = 0; + unsigned int i = 0; + + sf_commu_reset(); + sf_get_mcu_reg_many(reg,*num); + ret = sf_commu_wait(0x02); + if(ret < 0) + { + printf("%s:%d time out\r\n", __FUNCTION__, __LINE__); + sf_commu_reset(); + return - 1; + } + + ret = sf_get_mcu_reg_ack_depack_many(cmpRegBuf, val, num); + if (ret < 0) + { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); + ret = -1; + } + else + { + for(i = 0; i < *num; i++) + { + if(reg[i] != cmpRegBuf[i]) + { + printf("%s:%d error\r\n", __FUNCTION__, __LINE__); + ret = -1; + } + } + } + + return ret; +} int sf_getRegFromMcu_depack(unsigned char * dataToParse, unsigned int datalen, unsigned char * regAddr, unsigned char * regVal) { @@ -457,6 +682,7 @@ unsigned char sf_commu_parse_mcu_data(unsigned char * src, unsigned int len) //stMessageBuf.arg2 = SF_KEY_PIN_DATAREADY; //sf_com_message_send_to_app(&stMessageBuf); ret = 0x05; + Ux_PostEvent(NVTEVT_SYSTEM_SHUTDOWN, 1, APP_POWER_OFF_APO); } else { @@ -488,7 +714,7 @@ unsigned char sf_commu_parse_mcu_data(unsigned char * src, unsigned int len) THREAD_RETTYPE sf_commu_mcu_task(void *arg) { THREAD_ENTRY(); - static unsigned char buffer[32] = {0}; + static unsigned char buffer[BUF_REG_SIZE] = {0}; int i = 0; int readLen = 0; int len = 0; @@ -501,24 +727,18 @@ THREAD_RETTYPE sf_commu_mcu_task(void *arg) unsigned char copy_size = 0; //sf_commu_mcu_interface_init(115200, 'N', 8, 1, 'N'); //sf_commu_mcu_open(); - int rt = 0; - static int InitFlag = 1; - - if(InitFlag) - { - InitFlag = 0; - rt = sf_init_mcu(); - printf("%s:%d %d\r\n", __FUNCTION__, __LINE__,rt); - } + //FLGPTN FlgPtn; + mcubuf_reset(); CHKPNT; while(sf_commu_mcu_exit == 0) { - readLen = sf_commu_read(buffer + len, 32); - + readLen = sf_commu_read(buffer + len, 1); + if(readLen > 0) { len += readLen; + //printf("%s:%d len = %d readLen = %d\n",__FUNCTION__,__LINE__, len, readLen); } while(i < len) @@ -585,6 +805,7 @@ THREAD_RETTYPE sf_commu_mcu_task(void *arg) memcpy(smap_buf.buf + smap_buf.index, &buffer[start], copy_size); smap_buf.index += copy_size; //index从0开始 SMAP_waitAck = 1; + //printf("%s:%d SMAP_waitAck 1\n", __FUNCTION__, __LINE__); } } @@ -610,36 +831,50 @@ THREAD_RETTYPE sf_commu_mcu_task(void *arg) } } } - vos_util_delay_us(10000);//10ms } THREAD_RETURN(0); } -void sf_commu_mcu_task_start(void) +int sf_commu_mcu_task_start(void) { printf("%s:%d s\r\n", __FUNCTION__, __LINE__); if(sf_commu_mcu_exit == 1) - { - sfCommuMcuThread = vos_task_create(sf_commu_mcu_task, NULL, "sf_commu_mcu_task", 18, 2048); + { + sf_commu_mcu_exit = 0; + int rt = 0; + static int InitFlag = 1; + //T_CFLG cflg ; + + if(InitFlag) + { + //vos_flag_create(&FLG_ID_UART3, &cflg, "SF UART receive FLG"); + //vos_flag_clr(FLG_ID_UART3, UART3_FLAG_ALL); + InitFlag = 0; + rt = sf_init_mcu(); + printf("%s:%d %d\r\n", __FUNCTION__, __LINE__,rt); + + } + sfCommuMcuThread = vos_task_create(sf_commu_mcu_task, NULL, "sf_commu_mcu_task", 10, 4096); if(!sfCommuMcuThread) { DBG_ERR("[ERROR] sf_commu_mcu_task thread creat failed!\r\n"); - return ; + return -1; } else { vos_task_resume(sfCommuMcuThread); } - sf_commu_mcu_exit = 0; } + return 0; } void sf_commu_mcu_task_stop(void) { sf_commu_mcu_exit = 1; + //vos_flag_destroy(FLG_ID_UART3); vos_task_destroy(sfCommuMcuThread); } diff --git a/rtos/code/driver/na51089/source/mcu/sf_mcu_dev.c b/rtos/code/driver/na51089/source/mcu/sf_mcu_dev.c index 7ccead5aa..c4c195083 100755 --- a/rtos/code/driver/na51089/source/mcu/sf_mcu_dev.c +++ b/rtos/code/driver/na51089/source/mcu/sf_mcu_dev.c @@ -55,10 +55,10 @@ static UINT32 simCardInsert=0; static UINT8 gModuleSleep = 1; static UINT32 SmsCheck = 0; static SF_CAMERA_CMD_S CameraCmd = {0}; +static UINT8 McuProductInfo = 0; #if defined(_MODEL_565_HUNTING_EVB_LINUX_4G_68CS_) static UINT8 drNoResetTimeSync = FALSE; //0:reset; 1:no reset; -static UINT8 McuProductInfo = 0; #elif defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) static UINT8 isSignalReady = 0; @@ -180,81 +180,6 @@ int sf_init_mcu(void) return ret; } -#else - -UINT8 sf_mcu_read(UINT32 reg, UINT8 *data) -{ - UINT8 data2 = 0; - - *data = sf_commu_get_mcu(reg); - //vos_util_delay_us(30); - - data2 = sf_commu_get_mcu(reg); - printf("R_addr[%lu]=0x%02x\n", reg, data2); - - if(*data != data2) - { - printf("%s:%d ERROR\n", __FUNCTION__, __LINE__); - printf("[ERROR]-[sf_i2c_read]reg:%lu,data:%d,data2:%d\n", reg, *data, data2); - vos_util_delay_us(300); - *data = sf_commu_get_mcu(reg); - printf("[ERROR]-[sf_i2c_read]reg:%lu,data3:%d,data2:%d\n", reg, *data, data2); - } - - //vos_util_delay_us(200); - - return 0; -} - -UINT8 sf_mcu_write(UINT32 reg, UINT32 data) -{ - UINT8 data2 = 0; - - sf_commu_set_mcu(reg, data); - //vos_util_delay_us(20); - - data2 = sf_commu_get_mcu(reg); - printf("W_addr[%lu]=0x%02x\n", reg, data2); - - if(data != data2) - { - printf("%s:%d ERROR reg:%lu,data:%lu,data2:%d\n", __FUNCTION__, __LINE__, reg, data, data2); - vos_util_delay_us(300); - sf_commu_set_mcu(reg, data); - } - - //vos_util_delay_us(200); - - return 0; -} - -int sf_init_mcu(void) -{ - CHKPNT; - ER ret = 0; - UART_INIT_PARA UartParaBasic; - UartParaBasic.BaudRate = UART_BAUDRATE_115200; - UartParaBasic.BaudRate = 115200; - UartParaBasic.Length = UART_LEN_L8_S1; - UartParaBasic.Parity = UART_PARITY_NONE; - UartParaBasic.FlowCtrlMode = UART_FC_MODE_NONE; - UartParaBasic.DataTransMode = UART_DATA_TRANS_PIO; - ret = uart3_open(); - uart3_initHW(&UartParaBasic); - return ret; -} - -#endif - -int sf_off_mcu(void) -{ - - #if HUNTING_MCU_I2C != ENABLE - uart3_close(); - #endif - return 0; -} - UINT8 sf_mcu_write_multi(UINT8 reg[], UINT8 data[], UINT32 num) { UINT32 i; @@ -266,19 +191,6 @@ UINT8 sf_mcu_write_multi(UINT8 reg[], UINT8 data[], UINT32 num) return SUCCESS; } -/************************************************* - Function: sf_get_daily_report_start_mode - Description: get dailyreport start mode - Input: N/A - Output: N/A - Return: 0:ON mode 1:OFF mode - Others: N/A -*************************************************/ -UINT8 sf_get_daily_report_start_mode(void) -{ - return DailyReportStartMode; -} - /************************************************* Function: sf_mcu_power_on_para_get Description: read MCU register data to update uipara and variable. @@ -302,7 +214,7 @@ UINT8 sf_mcu_power_on_para_get(MCUParam_t attrId) } sf_mcu_read(MCU_SUB_VER, &McuSubVersion); - #if defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) + #if 0//defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) sf_mcu_read(MCU_VER, &mcuVer); McuVersion = mcuVer; #else @@ -345,6 +257,227 @@ UINT8 sf_mcu_power_on_para_get(MCUParam_t attrId) return startMode; } +#else + +UINT8 sf_mcu_read(UINT32 reg, UINT8 *data) +{ + //UINT8 data2 = 0; + + *data = sf_commu_get_mcu(reg); + //vos_util_delay_us(30); + + //data2 = sf_commu_get_mcu(reg); + printf("R_addr[%lu]=0x%02x\n", reg, *data); + + /*if(*data != data2) + { + printf("%s:%d ERROR\n", __FUNCTION__, __LINE__); + printf("[ERROR]-[sf_i2c_read]reg:%lu,data:%d,data2:%d\n", reg, *data, data2); + vos_util_delay_us(300); + *data = sf_commu_get_mcu(reg); + printf("[ERROR]-[sf_i2c_read]reg:%lu,data3:%d,data2:%d\n", reg, *data, data2); + }*/ + + //vos_util_delay_us(200); + + return 0; +} + +UINT8 sf_mcu_write(UINT32 reg, UINT32 data) +{ + //UINT8 data2 = 0; + + sf_commu_set_mcu(reg, data); + //vos_util_delay_us(20); + printf("W_addr[%lu]=0x%lu\n", reg, data); + + /*data2 = sf_commu_get_mcu(reg); + printf("W_addr[%lu]=0x%02x\n", reg, data2); + + if(data != data2) + { + printf("%s:%d ERROR reg:%lu,data:%lu,data2:%d\n", __FUNCTION__, __LINE__, reg, data, data2); + vos_util_delay_us(300); + sf_commu_set_mcu(reg, data); + }*/ + + //vos_util_delay_us(200); + + return 0; +} + +int sf_init_mcu(void) +{ + CHKPNT; + ER ret = 0; + UART_INIT_PARA UartParaBasic; + UartParaBasic.BaudRate = UART_BAUDRATE_115200; + UartParaBasic.BaudRate = 115200; + UartParaBasic.Length = UART_LEN_L8_S1; + UartParaBasic.Parity = UART_PARITY_NONE; + UartParaBasic.FlowCtrlMode = UART_FC_MODE_NONE; + UartParaBasic.DataTransMode = UART_DATA_TRANS_PIO; + //uart3_setConfig(UART_CONFIG_ID_RX_TRIGGER_LEVEL,0x0); + ret = uart3_open(); + uart3_initHW(&UartParaBasic); + uart3_setConfig(UART_CONFIG_ID_RX_TRIGGER_LEVEL,0x0); + + /*UART_DATA_PARA DataPara; + DataPara.Action = UART_ACT_GET; + DataPara.BufferInfo.uiSize = 64; + DataPara.BufferInfo.pBuffer = getbuffer; + ret = uart3_operateData(&DataPara);*/ + + return ret; +} + +UINT8 sf_mcu_write_multi(UINT8 reg[], UINT8 data[], UINT32 num) +{ + UINT32 i; + unsigned int pnum = num; + if(0 <= sf_commu_set_mcu_many(reg, data, &pnum)) + { + for(i = 0; i < num; i++) + { + printf("W_addr[%d]=0x%02x\n", reg[i], data[i]); + } + return SUCCESS; + } + return FAIL; +} + +UINT8 sf_mcu_read_multi(UINT8 reg[], UINT8 data[], UINT32 num) +{ + UINT32 i; + unsigned int pnum = num; + if(0 <= sf_commu_get_mcu_many(reg, data, &pnum)) + { + for(i = 0; i < num; i++) + { + printf("R_addr[%d]=0x%02x\n", reg[i], data[i]); + } + return SUCCESS; + } + return FAIL; +} + +/************************************************* + Function: sf_mcu_power_on_para_get + Description: read MCU register data to update uipara and variable. + Input: attrId:which kind of para want to get + Output: N/A + Return: start mode + Others: N/A +*************************************************/ +UINT8 sf_mcu_power_on_para_get(MCUParam_t attrId) +{ + UINT8 dataTemp1 = 0, dataTemp2 = 0; + UINT8 startMode = 0; + //UINT8 mcuVer = 0; + UINT8 mcuReg[REG_SIZE] = { 0 }; + UINT8 mcuData[REG_SIZE] = { 0 }; + UINT8 i = 0; + + if(attrId != SF_MCU_POWERON) + { + sf_mcu_read(START_MODE, &dataTemp1); + startMode = dataTemp1 & 0x1F; + + return startMode; + } + mcuReg[i] = MCU_SUB_VER; + mcuReg[i++] = MCU_VER_L; + mcuReg[i++] = MCU_VER_H; + mcuReg[i++] = MCU_PRODUCT_INFO; + mcuReg[i++] = START_MODE; + mcuReg[i++] = LUMINANCE_L; + mcuReg[i++] = LUMINANCE_H; + sf_mcu_read_multi(mcuReg, mcuData, i); + i = 0; + McuSubVersion = mcuData[i]; + + McuVersion = mcuData[i++]; + McuVersion = (UINT16)mcuData[i++] << 8 | McuVersion; + McuProductInfo = mcuData[i++]; + dataTemp1 = mcuData[i++]; + startMode = dataTemp1 & 0x1F; + DailyReportStartMode = (dataTemp1 & 0xc0) >> 6; + dataTemp1= mcuData[i++]; + dataTemp2 = mcuData[i++]; + IRSHTTER = (dataTemp2 << 8) | dataTemp1; + +#if 0 + sf_mcu_read(MCU_SUB_VER, &McuSubVersion); + #if 0//defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) + sf_mcu_read(MCU_VER, &mcuVer); + McuVersion = mcuVer; + #else + sf_mcu_read(MCU_VER_L, &mcuVer); + McuVersion = mcuVer; + sf_mcu_read(MCU_VER_H, &mcuVer); + McuVersion = (UINT16)mcuVer << 8 | McuVersion; + sf_mcu_read(MCU_PRODUCT_INFO, &McuProductInfo); + #endif + + sf_mcu_read(START_MODE, &dataTemp1); + startMode = dataTemp1 & 0x1F; + DailyReportStartMode = (dataTemp1 & 0xc0) >> 6; + +#if 0 + sf_mcu_i2c_read(CAMERA_MODE, &CameraMode); + sf_mcu_i2c_read(IRLED_LUMINANCE, &IrLedPercent); +#endif + + sf_mcu_read(LUMINANCE_L, &dataTemp1); + sf_mcu_read(LUMINANCE_H, &dataTemp2); + IRSHTTER = (dataTemp2 << 8) | dataTemp1; +#endif + + #if defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) + if(startMode == PWR_ON_TIME_SYNC) + { + startMode = PWR_ON_DAILY_REPORT; + } + else + #endif + { + if(startMode > PWR_ON_TIME_SEND) //if start mode err, USB IN default power on SETUP + { + startMode = PWR_ON_SETUP; + } + } + + printf(" start mode = %d IRSHTTER = %d\n", startMode, IRSHTTER); + + return startMode; +} + +#endif + +int sf_off_mcu(void) +{ + + #if HUNTING_MCU_I2C != ENABLE + uart3_close(); + #endif + return 0; +} + + + +/************************************************* + Function: sf_get_daily_report_start_mode + Description: get dailyreport start mode + Input: N/A + Output: N/A + Return: 0:ON mode 1:OFF mode + Others: N/A +*************************************************/ +UINT8 sf_get_daily_report_start_mode(void) +{ + return DailyReportStartMode; +} + UINT8 sf_mcu_wdg_set(UINT8 value) { @@ -1064,6 +1197,8 @@ UINT8 sf_mcu_reg_set(MCUParam_t attrId, UINT8 val) sf_mcu_write_multi(mcuReg, mcuData, i); return SUCCESS; } +//#if 1 + #elif defined(_MODEL_565_HUNTING_EVB_LINUX_4G_S530_) /************************************************* @@ -1198,7 +1333,7 @@ UINT8 sf_mcu_reg_set(MCUParam_t attrId, UINT8 val) if(gpsAlwaysFlag && simCardInsert) temp |= 0x80; - mcuReg[i] = FUNCTION_SWTICH; + mcuReg[i] = FUNCTION_SWTICH0; mcuData[i++] = temp; if(SysGetFlag(TimelapseSwitch)) @@ -1705,7 +1840,7 @@ int sf_mod_init(void) #if HUNTING_MCU_I2C == ENABLE rt = sf_init_mcu(); #else - sf_commu_mcu_task_start(); + rt = sf_commu_mcu_task_start(); #endif #endif } diff --git a/rtos/code/na51089_linux_sdk_rtos_filelist.txt b/rtos/code/na51089_linux_sdk_rtos_filelist.txt index 5eefb76d3..72cbe53cb 100755 --- a/rtos/code/na51089_linux_sdk_rtos_filelist.txt +++ b/rtos/code/na51089_linux_sdk_rtos_filelist.txt @@ -1,6 +1,6 @@ ; Source Insight Project File List -; Project Name: na51089_linux_sdk_rtos -; Generated by Source Insight 4.00.0107 at 2023/3/13 17:07:06 +; Project Name: na51089_rtos +; Generated by Source Insight 4.00.0107 at 2023/3/28 16:02:21 ; Version=4.00.0107 ; ; Each line should contain either a file name, a wildcard, or a sub-directory name. @@ -9,24 +9,42 @@ application\Makefile application\source\cardv\gprof_user_guide.txt application\source\cardv\Makefile -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxCamera_Sensor.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxCfg.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxCfg.h -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxCmd.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxDisplay_LCD.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxHunting.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxInput_Key.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxOutput_LED.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxPower_Battery.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxPower_DC.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxSound_Audio.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxStorage_Card.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxStorage_EmbMem.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxUsb.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\DxWiFi.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\IOCfg.c -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\IOCfg.h -application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G\sf_led.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxCamera_Sensor.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxCfg.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxCfg.h +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxCmd.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxDisplay_LCD.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxHunting.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxInput_Key.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxOutput_LED.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxPower_Battery.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxPower_DC.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxSound_Audio.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxStorage_Card.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxStorage_EmbMem.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxUsb.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\DxWiFi.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\IOCfg.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\IOCfg.h +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_68CS\sf_led.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxCamera_Sensor.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxCfg.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxCfg.h +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxCmd.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxDisplay_LCD.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxHunting.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxInput_Key.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxOutput_LED.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxPower_Battery.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxPower_DC.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxSound_Audio.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxStorage_Card.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxStorage_EmbMem.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxUsb.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\DxWiFi.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\IOCfg.c +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\IOCfg.h +application\source\cardv\SrcCode\Dx\565_HUNTING_EVB_LINUX_4G_S530\sf_led.c application\source\cardv\SrcCode\Dx\DxCommon.c application\source\cardv\SrcCode\Dx\DxVer.c application\source\cardv\SrcCode\Dx\include\DrvExt.h @@ -259,6 +277,8 @@ application\source\cardv\SrcCode\NVTUserCommand.h application\source\cardv\SrcCode\PrjCfg.h application\source\cardv\SrcCode\PrjCfg_Default.h application\source\cardv\SrcCode\PrjCfg_HUNTING.h +application\source\cardv\SrcCode\PrjCfg_HUNTING_68CS.h +application\source\cardv\SrcCode\PrjCfg_HUNTING_S530.h application\source\cardv\SrcCode\PrjInc.h application\source\cardv\SrcCode\ProjectInfo.h application\source\cardv\SrcCode\Startup\bin_info.c @@ -627,6 +647,7 @@ driver\na51089\include\pmu.h driver\na51089\include\PowerIC_i2c.h driver\na51089\include\remote.h driver\na51089\include\serial.h +driver\na51089\include\sf_commu_mcu.h driver\na51089\include\sf_mcu.h driver\na51089\include\touch\touch_common.h driver\na51089\include\touch\touch_dbg.h @@ -658,6 +679,7 @@ driver\na51089\source\icomm_ssv6x5x\wifi\ssv6x5x\novatek_wifi.h driver\na51089\source\icomm_ssv6x5x\wifi\ssv6x5x\ssv_wifi_api.h driver\na51089\source\icomm_ssv6x5x\wifi\wifi.c driver\na51089\source\mcu\Makefile +driver\na51089\source\mcu\sf_commu_mcu.c driver\na51089\source\mcu\sf_i2c_driver.c driver\na51089\source\mcu\sf_mcu_dev.c driver\na51089\source\mcu\sf_sd_common.c