File:  [Apple Darwin 0.x] / driverkit / notes / fcTimer
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:37:50 2018 UTC (8 years, 2 months ago) by root
Branches: MAIN, Apple
CVS tags: HEAD, Darwin03, Darwin02
Darwin 0.2 Driver Kit

			fc timer notes
			
states
	idle				TS_IDLE
	running, t/o msg enabled	TS_RUN_MSG
	running, t/o msg disabled	TS_RUN_POLL
	timeout, no msg sent		TS_TIMEOUT
	timeout, msg sent		TS_TIMEOUT_MSG
	
transitions

	TS_IDLE
		==> TS_RUN_MSG     : startTimer(TRUE)
		==> TS_RUN_POLL    : startTimer(FALSE)
	TS_RUN_MSG
		==> TS_IDLE        : stopTimer
		==> TS_TIMEOUT_MSG : floppyTimeout()
	TS_RUN_POLL
		==> TS_IDLE	   : stopTimer
		==> TS_TIMEOUT	   : floppyTimeout()
	TS_TIMEOUT_MSG
		==> TS_IDLE	   : stopTimer
		==> TS_IDLE	   : waitIntr
	XXX
		==> TS_IDLE	   : stopTimer
	timeout, no msg sent
	timeout, msg sent

startTimer(seconds, boolean_t msg) 
{
	IOTimeout();
	timerState = TS_RUN_POLL or TS_RUN_MSG;
}

stopTimer()
{
	switch(timerState) {
	    case TS_TIMEOUT_MSG:
	    	get the message from timerPort;
	    case TS_RUN_POLL:
	    case TS_RUN_MSG:
		IOUnTimeout();
 	    case TS_TIMEOUT:
	    case TS_IDLE:
	    	nop;
	}
	timerState = TS_IDLE;
}

timerInit() {
	timerState = TS_IDLE;
}

floppyTimeout(id)
{
	switch(timerState) {
	    case TS_RUN_MSG:
	   	send timeout msg to timeoutPort;
		timerState = TS_TIMEOUT_MSG;
	    case TS_RUN_POLL:
	    	timerState = TS_TIMEOUT;
	    default:
	    	huh?
}

waitIntr(seconds)
{	
	startTimer(seconds, TRUE);
	msg_receive on fcPortSet;
	if msg from timeoutPort {
		timerInit();
		rtn = timeout;		
	}
	else {
		timerStop();
		rtn = OK;
		/* old fc interrupt code to get status, etc.? */
	}
}


unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.