nt9856x/code/application/source/sf_app/code/include/sf_common.h
2023-11-24 14:56:27 +08:00

94 lines
3.2 KiB
C
Executable File

#ifndef __SF_COMMON_H__
#define __SF_COMMON_H__
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif
#include <kwrap/nvt_type.h>
#define IS_RELEASE 1
#if IS_RELEASE
#define SF_DEBUG_FAST_CAPTURE 0 /*1:ON -> reuse CameraMode:0 Normal; 1 fast capture*/
#define SF_DEBUG_COLLECT_EXP_AGC 0
#define SF_DEBUG_EXIF_LOG 0
#define SF_DEBUG_EXIF_AE_AWB 0
#define SF_DEBUG_TEMPER_ADC 0
#define SF_DEBUG_BATTERY_ADC 0
#define SF_DEBUG_IQ 0
#define SF_DEBUG_LIGHT_AE 0
#define SF_TRIGGER_TIME_TEST 0
#define SF_DEBUG_CAPTURE_MONITOR 0
#define SF_TEST_QLOG_CERR 0 /*423 and 407 Error saving test.*/
#define SF_TEST_ERROR_CODE 0
#define GSM_LOG_ENCODE 1
#define SF_TEST_COMPRESSED_GRAPH 0
#else /*DEBUG INFO*/
#define SF_DEBUG_FAST_CAPTURE 0 /*1:ON -> reuse CameraMode:0 Normal; 1 fast capture*/
#define SF_DEBUG_COLLECT_EXP_AGC 0
#define SF_DEBUG_EXIF_LOG 0
#define SF_DEBUG_EXIF_AE_AWB 0
#define SF_DEBUG_TEMPER_ADC 0
#define SF_DEBUG_BATTERY_ADC 0
#define SF_DEBUG_IQ 0
#define SF_DEBUG_LIGHT_AE 0
#define SF_TRIGGER_TIME_TEST 0
#define SF_DEBUG_CAPTURE_MONITOR 0
#define SF_TEST_QLOG_CERR 1/*423 and 407 Error saving test.*/
#define SF_TEST_ERROR_CODE 0
#define GSM_LOG_ENCODE 0
#define SF_BATTERY_TEST 0
#define SF_TEST_COMPRESSED_GRAPH 0
#endif
#define SF_LOG_HEAD "[%s:%d]"
#define SF_DEBUG_HEAD "SF_DEBUG[%s:%d]"
#define SF_ERROR_HEAD "SF_ERROR[%s:%d]"
#define LOG_END ";\n"
#define SF_LOG(format, args...) (printf( SF_LOG_HEAD format LOG_END, __FUNCTION__ , __LINE__, ##args))
#define SF_DEBUG(format, args...) (printf( SF_DEBUG_HEAD format LOG_END, __FUNCTION__ , __LINE__, ##args))
#define SF_ERROR(format, args...) (printf( SF_ERROR_HEAD format LOG_END, __FUNCTION__ , __LINE__, ##args))
/** 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)
#define SF_STRLEN(a) (UINT32)strlen((char *)a)
#define SF_STRCPY(a, b) strcpy((char *)a, (char *)b)
#define SF_STRNCPY(a, b, c) strncpy((char *)a, (char *)b, c)
#define SF_STRCMP(a, b) strcmp((char *)a, (char *)b)
#define SF_STRNCMP(a, b, c) strncmp((char *)a, (char *)b, c)
#define SF_STRSTR(a, b) (UINT8 *)strstr((char *)a, (char *)b)
#define SF_STRTOK(a, b) (UINT8 *)strtok((char *)a, (char *)b)
#define SF_SPRINTF(a, ...) sprintf((char *)a, __VA_ARGS__)
#define SF_STRCASECMP(a, b) strcasecmp((char *)a, (char *)b)
#define SF_STRSEP(a, b) strsep((char **)a, (char *)b)
#define SF_STRCAT(a, b) strcat((char *)a, (char *)b)
#define SF_STRTOLL(a, b, c) strtoll((char *)a, (char **)b, c)
void app_message_recv_start(void);
UINT8 sf_get_module_update(void);
void sf_set_module_update(UINT8 flag);
UINT8 sf_get_fw_update(void);
void sf_set_fw_update(UINT8 flag);
UINT8 sf_app_get_night_led_flag(void);
void sf_set_mcu_update_flag(UINT8 flag);
UINT8 sf_get_mcu_update_flag(void);
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif
#endif