Пример #1
0
void YushanII_login_stop(void){
       #ifdef DUMP_LOGGING_FILE
       uint32_t LogSize;
       uint8_t *pLog;
       uint16_t error;
       pr_info("[CAM] %s",__func__);
       Ilp0100_loggingStop();
       Ilp0100_loggingGetSize(&LogSize);
       pLog = kmalloc(LogSize,GFP_KERNEL);
       memset(pLog,0x00,LogSize);
       pr_info("[CAM] read back LogSize:%d",LogSize);
       error = Ilp0100_loggingReadBack(pLog,&LogSize);
       pr_info("[CAM] read back error no:%d",error);
       dump_logging_file(pLog,LogSize);
       Ilp0100_loggingClose();
       #endif
       return;
}
ilp0100_error Ilp0100_DumpLogInFile(uint8_t *pFileName)
{
	ilp0100_error Ret=ILP0100_ERROR_NONE;
	uint8_t *pBuffer;
	FILE *pFile;

	uint32_t BufferSize;

	Ret= Ilp0100_loggingGetSize(&BufferSize);
	if(Ret==ILP0100_ERROR_NONE){
		pBuffer = kmalloc(size_t size, gfp_t flags)(sizeof(uint8_t)*BufferSize);
		Ret     = Ilp0100_loggingReadBack(pBuffer, &BufferSize);
	}
	/* Dump buffer in file */
	/* dump_in_file is customer defined function to dump in ilp0100_log.bin file content of pBuffer */
	if(Ret==ILP0100_ERROR_NONE){
		pFile = fopen ( pFileName , "wb" );
		fwrite(pBuffer, sizeof(uint8_t), BufferSize, pFile);
		fclose(pFile);
	}

	return Ret;
}
ilp0100_error Ilp0100_DumpLogInFile(uint8_t *pFileName)
{
	ilp0100_error Ret=ILP0100_ERROR_NONE;
	uint8_t *pBuffer;
	FILE *pFile;

	uint32_t BufferSize;

	Ret= Ilp0100_loggingGetSize(&BufferSize);
	if(Ret==ILP0100_ERROR_NONE){
		pBuffer = kmalloc(size_t size, gfp_t flags)(sizeof(uint8_t)*BufferSize);
		Ret     = Ilp0100_loggingReadBack(pBuffer, &BufferSize);
	}
	
	
	if(Ret==ILP0100_ERROR_NONE){
		pFile = fopen ( pFileName , "wb" );
		fwrite(pBuffer, sizeof(uint8_t), BufferSize, pFile);
		fclose(pFile);
	}

	return Ret;
}