Example #1
0
void IOKey(void *argv){
	reg_type receiver_control = LoadWord(RECEIVER_CONTROL);
	SetBit(&receiver_control, IO_INTERRUPT_ENABLE);
	while(!prog_finished && (WaitForSingleObject(hRunMutex, 75L) == WAIT_TIMEOUT)){
		if(kbhit()){
			char ch = getch();
		/*	for(size_t i = 0 ; i < 1000; i++)
				printf("Inside if kbhit() ch = %c\n", ch);*/
			StoreByte(ch, RECEIVER_DATA);
			
			//muxtex in StoreByte function
			if(bitState(cpo_reg[STATUS], INTERRUPT_ENABLE) && bitState(cpo_reg[STATUS], EXCEPTION_LEVEL)
				&& bitState(receiver_control, IO_INTERRUPT_ENABLE)){
				SetCause(INTERRUPT);
				SetBit(&cpo_reg[CAUSE], 0XD);//set pending bit
				/*need to rectify perhaps*/
				SetBit(&receiver_control, IO_READY);
				StoreWord(receiver_control, RECEIVER_CONTROL);
			/*	for(size_t i = 0 ; i < 1000; i++)
					printf("Inside inside of kbhit() set state cause: %X\n", cpo_reg[CAUSE]);*/
			}//end of if
		}//end of if kbhit
		ReleaseMutex(hRunMutex);//unlock
	}//end of while prog_finished
}
Example #2
0
void ExceptionBase::SetCause(const ExceptionBase& cause)
{
    SetCause(cause.Clone());
}