// interrupts.c

#include <stdio.h>
#include "912D60.h"
#include "kernel.h"



// FUNCTION PROTOTYPES
void _start(void);



/* Example code flow for all of these handlers:

	// IF interrupt isn't very time critical:
	   figure out who cares, if anyone, then send a msg to the caring task 


	if (resource[ADC].owner != 255)
		task[resource[ADC].owner].message |= ADC_MSG;



	// IF interrupt is time critical:  (ie, there's data that needs to be serviced)	
	   get the data, put it in a buffer, then put the data in the message buffer 

	task[resource[ADC].owner].message_data[ADC_MSG] = ADC;	// ADC = correct port definition?
*/





// GLOBALS
extern unsigned int interrupt_flags_ADC;
extern unsigned int interrupt_flags_TC;






void MDCOF_handler(void) {

	 /*// LOCAL VARIABLES
	 extern unsigned long int time_tick;
	 
	 // acknowledge the interrupt, incriment global time_tick
	 MCFLG = 0x80;
	 time_tick++;
	 */

}




void KWU_handler(void) {}




void ADC_handler(void) {}



/* #pragma interrupt_handler SCI0_handler()

void SCI0_handler(void) {



} */




void SCI1_handler(void) {}




void SPI_handler(void) {}




void PAIE_handler(void) {}




void PAO_handler(void) {}




void TOF_handler(void) {

	 // LOCAL VARIABLES
	 extern unsigned long int time_tick;
	 
	 // acknowledge the interrupt, incriment global time_tick
	 TFLG2 = 0x80;
	 time_tick++;

}




void TC7_handler(void) {}




void TC6_handler(void) {}




void TC5_handler(void) {}




void TC4_handler(void) {}




void TC3_handler(void) {}




void TC2_handler(void) {}




void TC1_handler(void) {}




void TC0_handler(void) {}




void IRQ_handler(void) {}




void XIRQ_handler(void) {}




void SWI_handler(void) {}




void COP_handler(void) {

	 puts("COP RESET!");
	 _start();

}




void CLM_handler(void) {}




