Exemplo n.º 1
0
/************************************************************************************************
 *功能:	按键2的功能实现,减小oled最后一行的值,DisplayDebug[6].num和DisplayDebug[6].num每次
 *			减小ButtenDisplay.interval,而ButtenDisplay.interval每次减小1。
 *形参:
 *      	无
 *返回:
 *      	无
 */
 void Butten3_IO_ISR()
{
	if(gpio_get(Butten3_PIN) == TurnOn)
	{
		ClosePID();
		Dly_ms(10);
		if(gpio_get(Butten3_PIN) == TurnOn)
		{
			switch(ButtenDisplay.flag)
			{
			case 0:
				DisplayDebug[6].num -= ButtenDisplay.interval;
				break;
			case 1:
				DisplayDebug[7].num -= ButtenDisplay.interval;
				break;
			case 2:
				ButtenDisplay.interval -= 1;
				break;
			default:
				;
			}
		}
		OpenPID();
	}
}
Exemplo n.º 2
0
Arquivo: debug.c Projeto: Disar/Kha
HL_API bool hl_debug_breakpoint( int pid ) {
#	if defined(HL_WIN)
	return (bool)DebugBreakProcess(OpenPID(pid));
#	elif defined(USE_PTRACE)
	return kill(pid,SIGTRAP) == 0;
#	else
	return false;
#	endif
}
Exemplo n.º 3
0
Arquivo: debug.c Projeto: Disar/Kha
HL_API bool hl_debug_flush( int pid, vbyte *addr, int size ) {
#	if defined(HL_WIN)
	return (bool)FlushInstructionCache(OpenPID(pid),addr,size);
#	elif defined(USE_PTRACE)
	return true;
#	else
	return false;
#	endif
}
Exemplo n.º 4
0
/*********************************************************************
 *功能:	按键1的功能实现,切换oled最后一行的显示信息
 *形参:
 *      	无
 *返回:
 *      	无
 */
void Butten1_IO_ISR()
{
	if(gpio_get(Butten1_PIN) == TurnOn)
	{
		ClosePID();
		Dly_ms(10);
		if(gpio_get(Butten1_PIN) == TurnOn)
		{
			if(++ButtenDisplay.flag == 3)
			{
				ButtenDisplay.flag = 0;
			}
		}
		OpenPID();
	}
}
Exemplo n.º 5
0
Arquivo: debug.c Projeto: Disar/Kha
HL_API bool hl_debug_read( int pid, vbyte *addr, vbyte *buffer, int size ) {
#	if defined(HL_WIN)
	return (bool)ReadProcessMemory(OpenPID(pid),addr,buffer,size,NULL);
#	elif defined(USE_PTRACE)
	while( size ) {
		long v = ptrace(PTRACE_PEEKDATA,pid,addr,0);
		if( size >= sizeof(long) )
			*(long*)buffer = v;
		else {
			memcpy(buffer,&v,size);
			break;
		}
		addr += sizeof(long);
		size -= sizeof(long);
		buffer += sizeof(long);
	}
	return true;	
#	else
	return false;
#	endif
}
Exemplo n.º 6
0
Arquivo: debug.c Projeto: Disar/Kha
HL_API bool hl_debug_write( int pid, vbyte *addr, vbyte *buffer, int size ) {
#	if defined(HL_WIN)
	return (bool)WriteProcessMemory(OpenPID(pid),addr,buffer,size,NULL);
#	elif defined(USE_PTRACE)
	while( size ) {
		int sz = size >= sizeof(long) ? sizeof(long) : size;
		long v = *(long*)buffer;
		if( sz != sizeof(long) ) {
			long cur = ptrace(PTRACE_PEEKDATA,pid,addr);
			memcpy((char*)&v+sz,(char*)&cur+sz,sizeof(long)-sz);
		}
		if( ptrace(PTRACE_POKEDATA,pid,addr,v) < 0 )
			return false;
		addr += sz;
		size -= sz;
		buffer += sz;
	}
	return true;
#	else
	return false;
#	endif
}