⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sys_debug.c

📁 DVB软件,基于CT216软件的开发源程序.
💻 C
📖 第 1 页 / 共 5 页
字号:
{
	bool8 b8Status = FALSE;
#if 0
	u8 au8DirName[8];
#endif

	_u32DifferentPlaybackFileIndex = 0;

	b8Status = AP_PVR_RegisterNotify((AP_PVR_NOTIFY)sys_test_pvr_callback);
	if(b8Status == TRUE)
	{
		printf(">> PVR: initial callback normally.\n");
	}
	else
	{
		printf(">> PVR: initial callback fail.\n");
	}
	
	b8Status = AP_PVR_SetDeviceType(EN_USB_DEVICE);
	if(b8Status == TRUE)
	{
		printf(">> PVR: set device normally.\n");
	}
	else
	{
		printf(">> PVR: set device fail.\n");
	}
#if 0
	// Set Root
	if (DVB_FILECTRL_CdRoot(EN_USB_DEVICE) == FALSE)
	{
		printf(">> PVR: loop playback set root fail\n");
		return;
	}

	// Set My Record Directory
	sprintf (au8DirName, "MYRECORD");
	DVB_FILECTRL_MkDir (EN_USB_DEVICE, au8DirName);
	if (DVB_FILECTRL_Cd (EN_USB_DEVICE, au8DirName) == FALSE)
	{
		printf(">> PVR: loop playback set MYRECORD fail\n");
		return;
	}
#endif
}

AP_PVR_NOTIFY sys_test_pvr_callback(EN_PVR_EVENT enPvrEvent)
{
	u32 u32Time = 0;
	u32 u32MS = 0;
	u32 u32S = 0;
	u32 u32Min = 0;
	u32 u32Hour = 0;
	u32 u32Day = 0;

	extern void ap_ch_switch_lock(bool8 b8Enable);

	_enPVRCurrentEvent = enPvrEvent;
	printf(">> PVR: callback start ticks=%ld\n", DVB_TimerGet());
	switch (enPvrEvent)
	{
		case EN_PVR_EVENT_RECORD_START:
			printf(">> PVR: callback EN_PVR_EVENT_RECORD_START\n");
			break;

		case EN_PVR_EVENT_RECORD_NEW_HANDLE:
			printf(">> PVR: callback EN_PVR_EVENT_RECORD_NEW_HANDLE\n");
			break;

		case EN_PVR_EVENT_PLAYBACK_START:
			_b8LongTestKeyPlayback = TRUE;
			printf(">> PVR: callback EN_PVR_EVENT_PLAYBACK_START\n");
			break;

		case EN_PVR_EVENT_RECORD_FINISH:
			printf(">> PVR: callback EN_PVR_EVENT_RECORD_FINISH\n");
			break;

		case EN_PVR_EVENT_RECORD_STOP:
			printf(">> PVR: callback EN_PVR_EVENT_RECORD_STOP\n");
			break;

		case EN_PVR_EVENT_WRITE_FAIL:
			printf(">> PVR: callback EN_PVR_EVENT_WRITE_FAIL\n");
			break;

		case EN_PVR_EVENT_PLAYBACK_FINISH:
			_b8LongTestKeyPlayback = FALSE;

			ap_ch_switch_lock(FALSE);

			_u32PVRPlaybackEndTime = DVB_TimerGet();
			u32Time = _u32PVRPlaybackEndTime - _u32PVRPlaybackStartTime;
			u32MS = u32Time % 1000;
			u32Time = u32Time / 1000;
			u32S = u32Time % 60;
			u32Time = u32Time / 60;
			u32Min = u32Time % 60;
			u32Time = u32Time / 60;
			u32Hour = u32Time % 24;
			u32Day = u32Time / 24;

			printf(">> PVR: callback EN_PVR_EVENT_PLAYBACK_FINISH [%ld]\n", _u32PVRPlaybackEndTime);
			printf(">> PVR: callback EN_PVR_EVENT_PLAYBACK_FINISH time [%ld %02ld:%02ld:%02ld.%03ld] normally.\n", 
				u32Day, u32Hour, u32Min, u32S, u32MS);
			break;

		case EN_PVR_EVENT_PLAYBACK_STOP:
			_b8LongTestKeyPlayback = FALSE;

			ap_ch_switch_lock(FALSE);

			_u32PVRPlaybackEndTime = DVB_TimerGet();
			u32Time = _u32PVRPlaybackEndTime - _u32PVRPlaybackStartTime;
			u32MS = u32Time % 1000;
			u32Time = u32Time / 1000;
			u32S = u32Time % 60;
			u32Time = u32Time / 60;
			u32Min = u32Time % 60;
			u32Time = u32Time / 60;
			u32Hour = u32Time % 24;
			u32Day = u32Time / 24;

			printf(">> PVR: callback EN_PVR_EVENT_PLAYBACK_STOP [%ld]\n", _u32PVRPlaybackEndTime);
			printf(">> PVR: callback EN_PVR_EVENT_PLAYBACK_STOP time [%ld %02ld:%02ld:%02ld.%03ld] normally.\n", 
				u32Day, u32Hour, u32Min, u32S, u32MS);
			break;

		case EN_PVR_EVENT_READ_FAIL:
			printf(">> PVR: callback EN_PVR_EVENT_READ_FAIL\n");
			break;

		case EN_PVR_EVENT_DISK_FULL:
			printf(">> PVR: callback EN_PVR_EVENT_DISK_FULL\n");
			break;

		case EN_PVR_EVENT_PLAYBACK_END_OF_BEGIN:
			printf(">> PVR: callback EN_PVR_EVENT_PLAYBACK_END_OF_BEGIN\n");
			break;

		case EN_PVR_EVENT_PLAYBACK_END_OF_RECORDING:
			ap_ch_switch_lock(FALSE);

			printf(">> PVR: callback EN_PVR_EVENT_PLAYBACK_END_OF_RECORDING\n");
			break;

		case EN_PVR_EVENT_PLAYBACK_PAUSE:
			printf(">> PVR: callback EN_PVR_EVENT_PLAYBACK_PAUSE\n");
			break;

		case EN_PVR_EVENT_PLAYBACK_SKIP:
			printf(">> PVR: callback EN_PVR_EVENT_PLAYBACK_SKIP\n");
			break;

		case EN_PVR_EVENT_NONE:
			printf(">> PVR: callback EN_PVR_EVENT_NONE\n");
			break;

		default:
			printf(">> PVR: callback default\n");
			break;
	}
	printf(">> PVR: callback end ticks=%ld\n", DVB_TimerGet());
}

void sys_test_pvr_get_info(u32 u32FileIndex)
{
	bool8 b8Status = FALSE;
	PVRInfo stPVRInfo;
	u8 u8Index = 0;

	memset(&stPVRInfo, 0, sizeof(stPVRInfo));
	b8Status = AP_PVR_GetInfo(&stPVRInfo);
	if(b8Status == TRUE)
	{
		printf(">> PVR: get info [%ld] normally.\n", u32FileIndex);
		printf(">> PVR: get info: Service Type [%d]\n", stPVRInfo.u8ServiceType);
		printf(">> PVR: get info: Service Name [%s]\n", (u8*)stPVRInfo.au8ServiceName);
		printf(">> PVR: get info: PID Number [%d]\n", stPVRInfo.u16PidNumber);
		for(u8Index = 0; u8Index < stPVRInfo.u16PidNumber; u8Index++)
		{
			printf(">> PVR: get info: PID%02d: [0x%08x], \n", stPVRInfo.au16Pid[u8Index][0], stPVRInfo.au16Pid[u8Index][1]);
		}
		printf(">> PVR: get info: Played [%d]\n", stPVRInfo.b8Played);
		printf(">> PVR: get info: Offset File Indxe [%ld]\n", stPVRInfo.u32OffsetFileIndex);
		printf(">> PVR: get info: Offset[%ld]\n", stPVRInfo.u32Offset);
		printf(">> PVR: get info: Date [%s]\n", stPVRInfo.au8Date);
		printf(">> PVR: get info: Start Time [%ld]\n", stPVRInfo.u32StartTime);
		printf(">> PVR: get info: Duration [%ld]\n", stPVRInfo.u32Duration);
		printf(">> PVR: get info: File Size [%ld]\n", stPVRInfo.u32FileSize);

		printf(">> PVR: get info: SbtlCompositionPageID [%d]\n", stPVRInfo.u16SbtlCompositionPageID);
		printf(">> PVR: get info: SbtlAncillaryPageID [%d]\n", stPVRInfo.u16SbtlAncillaryPageID);
		printf(">> PVR: get info: TTXInitPage [%d]\n", stPVRInfo.u16TTXInitPage);
		printf(">> PVR: get info: TTXSubtPage [%d]\n", stPVRInfo.u16TTXSubtPage);
	}
	else
	{
		printf(">> PVR: get info [%ld] fail.\n", u32FileIndex);
	}
}

void sys_test_pvr_get_device_type(void)
{
	switch(AP_PVR_GetDeviceType())
	{
		case EN_NO_DEVICE:
			printf(">> PVR: get device type EN_NO_DEVICE\n");
			break;

		case EN_CARDREADER_DEVICE:
			printf(">> PVR: get device type EN_CARDREADER_DEVICE\n");
			break;

		case EN_USB_DEVICE:
			printf(">> PVR: get device type EN_USB_DEVICE\n");
			break;

		default:
			printf(">> PVR: get device type wrong\n");
			break;
	}
}

void sys_test_pvr_get_file_count(void)
{
	u32 u32FileCount = 0;

	u32FileCount = AP_PVR_GetFileCount();
	printf(">> PVR: get file count [%ld]\n", u32FileCount);
}

void sys_test_pvr_get_file_name(u32 u32FileIndex)
{
	u8 au8FileName[14];

	memset(au8FileName, 0, sizeof(u8) * 14);
	AP_PVR_GetFileName(u32FileIndex, (u8*)&au8FileName);
	printf(">> PVR: get file name [%ld][%s]\n", u32FileIndex, (u8*)au8FileName);
}

void sys_test_pvr_delete_file(u32 u32FileIndex)
{
	bool8 b8Status = FALSE;
	
	b8Status = AP_PVR_DeleteFile(u32FileIndex);
	if(b8Status == TRUE)
	{
		printf(">> PVR: delete file normally.\n");
	}
	else
	{
		printf(">> PVR: delete file fail.\n");
	}
}

void sys_test_pvr_get_partition_total_size(void)
{
	u32 u32Size = 0;
	ST_PENDEV_HANDLEINFO stDeviceInfo;
	ST_FS_PARTITION_INFO stPartitionInfo;
	if( EN_DEV_STATUS_FALSE == DVB_DEVCTRL_LookupByMedia(EN_MEDIA_TS, &stDeviceInfo) )
	{
		printf(">> PVR: Get Device Info fail...\n");
		return;
	}
	if( EN_DEV_USB_LUN0 <= stDeviceInfo.enDeviceType )
	{
		DVB_FILECTRL_GetCurrentPartitionInfo (EN_USB_DEVICE, &stPartitionInfo, FALSE);
	}
	else
	{
		DVB_FILECTRL_GetCurrentPartitionInfo (EN_CARDREADER_DEVICE, &stPartitionInfo, FALSE);
	}
	u32Size = AP_PVR_GetFileSystemPartitionTotalSize();
	printf(">> PVR: partition [%d] total size [%ld]\n", stPartitionInfo.s8PartitionIndex, u32Size);
}

void sys_test_pvr_get_partition_free_size(void)
{
	u32 u32Size = 0;
	
	u32Size = AP_PVR_GetFileSystemPartitionFreeSize();
	printf(">> PVR: partition free size [%ld]\n", u32Size);
}

void sys_test_pvr_format(u8 u8Index)
{
	bool8 b8Status = FALSE;
	
	b8Status = AP_PVR_FileSystemFormat(AP_PVR_GetDeviceType(), u8Index);
	if(b8Status == TRUE)
	{
		printf(">> PVR: format [%d] normally.\n", u8Index);
	}
	else
	{
		printf(">> PVR: format [%d] fail.\n", u8Index);
	}
}

// pvr record
void sys_test_pvr_record_start(void)
{
	bool8 b8Status = FALSE;

	_b8LongTestRecord = FALSE;
	_b8LongTestDifferentRecord = FALSE;

	b8Status = AP_PVR_RecordStart();
	if(b8Status == TRUE)
	{
		printf(">> PVR: record start normally.\n");
	}
	else
	{
		printf(">> PVR: record start fail.\n");
	}
}

void sys_test_pvr_record_stop(void)
{
	bool8 b8Status = FALSE;

	_b8LongTestRecord = FALSE;
	_b8LongTestDifferentRecord = FALSE;

	b8Status = AP_PVR_RecordStop();
	if(b8Status == TRUE)
	{
		printf(">> PVR: record stop normally.\n");
	}
	else
	{
		printf(">> PVR: record stop fail.\n");
	}
}

void sys_test_pvr_record_set_duration(u16 u16Time)
{
	bool8 b8Status = FALSE;

	b8Status = AP_PVR_SetRecordDuration(u16Time);
	if(b8Status == TRUE)
	{
		printf(">> PVR: record set duration [%d]mins normally.\n", u16Time);
	}
	else
	{
		printf(">> PVR: record set duration [%d]mins fail.\n", u16Time);
	}
}

void sys_test_pvr_record_get_duration(void)
{
	u16 u16Time = 0;

	u16Time = AP_PVR_GetRecordDuration();
	printf(">> PVR: record get duration time [%d]mins normally.\n", u16Time);
}

void sys_test_pvr_record_get_start_time(void)
{
	u32 u32Time = 0;
	u32 u32MS = 0;
	u32 u32S = 0;
	u32 u32Min = 0;
	u32 u32Hour = 0;
	u32 u32Day = 0;

	u32Time = AP_PVR_GetRecordStartTime();
	//u32MS = u32Time % 1000;
	//u32Time = u32Time / 1000;
	u32S = u32Time % 60;
	u32Time = u32Time / 60;
	u32Min = u32Time % 60;
	u32Time = u32Time / 60;
	u32Hour = u32Time % 24;
	u32Day = u32Time / 24;
	
	printf(">> PVR: record get start time [%ld %02ld:%02ld:%02ld.%03ld] normally.\n", 
		u32Day, u32Hour, u32Min, u32S, u32MS);
}

void sys_test_pvr_record_get_past_time(void)
{
	u32 u32Time = 0;
	u32 u32MS = 0;
	u32 u32S = 0;
	u32 u32Min = 0;
	u32 u32Hour = 0;
	u32 u32Day = 0;

	u32Time = AP_PVR_GetRecordPastTime();
	//u32MS = u32Time % 1000;
	//u32Time = u32Time / 1000;
	u32S = u32Time % 60;
	u32Time = u32Time / 60;
	u32Min = u32Time % 60;
	u32Time = u32Time / 60;
	u32Hour = u32Time % 24;
	u32Day = u32Time / 24;

	printf(">> PVR: record get past time [%ld %02ld:%02ld:%02ld.%03ld] normally.\n", 
		u32Day, u32Hour, u32Min, u32S, u32MS);
}

// pvr playback
void sys_test_pvr_playback_start(u32 u32FileIndex)
{
	bool8 b8Status = FALSE;
	extern void ap_ch_switch_lock(bool8 b8Enable);

	printf(">> sys_test_pvr_playback_start start\n");

	_b8LongTestPlayback = FALSE;
	_b8LongTestDifferentPlayback = FALSE;

	b8Status = AP_PVR_PlaybackStart(TRUE, FALSE);
	_u32PVRPlaybackStartTime = DVB_TimerGet();
	if(b8Status == TRUE)
	{
		ap_ch_switch_lock(TRUE);
		printf(">> PVR: playback start [%ld] [%ld] normally.\n", u32FileIndex, _u32PVRPlaybackStartTime);
	}
	else
	{
		printf(">> PVR: playback start [%ld] [%ld] fail.\n", u32FileIndex, _u32PVRPlaybackStartTime);
	}
}

void sys_test_pvr_playback_pause(bool8 b8Pause)
{
	bool8 b8Status = FALSE;

	b8Status = AP_PVR_PlaybackPause(b8Pause);
	if(b8Status == TRUE)
	{
		printf(">> PVR: playback pause [%d] normally.\n", b8Pause);
	}
	else
	{
		printf(">> PVR: playback pause [%d] fail.\n", b8Pause);
	}
}

void sys_test_pvr_playback_stop(void)
{
	bool8 b8Status = FALSE;

	_b8LongTestPlayback = FALSE;
	_b8LongTestDifferentPlayback = FALSE;

	b8Status = AP_PVR_PlaybackStop();
	if(b8Status == TRUE)
	{
		printf(">> PVR: playback stop normally.\n");
	}
	else
	{
		printf(">> PVR: playback stop fail.\n");
	}
}

void sys_test_pvr_playback_fast_forward(u8 u8Speed)
{
	bool8 b8Status = FALSE;

	switch(u8Speed)
	{
		case 1:
			b8Status = AP_PVR_SetPlaybackSpeed(EN_PLAY_SPEED_NORMAL);
			break;

		case 2:
			b8Status = AP_PVR_SetPlaybackSpeed(EN_FF_SPEED_X2);
			break;

		case 4:
			b8Status = AP_PVR_SetPlaybackSpeed(EN_FF_SPEED_X4);
			break;

		case 8:
			b8Status = AP_PVR_SetPlaybackSpeed(EN_FF_SPEED_X8);
			break;

		case 16:
			b8Status = AP_PVR_SetPlaybackSpeed(EN_FF_SPEED_X16);
			break;

		case 32:
			b8Status = AP_PVR_SetPlaybackSpeed(EN_FF_SPEED_X32);
			break;
			
		default:
			printf(">> PVR: playback fast forward speed [%d] wrong.\n", u8Speed);
			break;
	}
	if(b8Status == TRUE)
	{
		printf(">> PVR: playback fast forward speed [%d] normally.\n", u8Speed);
	}
	else
	{
		printf(">> PVR: playback fast forward speed [%d] fail.\n", u8Speed);
	}
}

void sys_test_pvr_playback_slow_forward(u8 u8Speed)
{
	bool8 b8Status = FALSE;

	switch(u8Speed)
	{
		case 1:
			b8Status = AP_PVR_SetPlaybackSpeed(EN_PLAY_SPEED_NORMAL);
			break;

		case 2:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -