// kernel.h


#ifndef _KERNEL_H_
#define _KERNEL_H_




// MACROS
#ifndef COP_ON
#define COP_ON()  	0
#define COP_OFF()	0
#endif



// ERROR MESSAGES
#define KERNEL_ERROR_MSG
#define KERNEL_DEBUG



// CONSTANTS
/* these must be set correctly for the code 
   to operate properly, ...or at all.  */
#define initial_heap_size 350	   // best guess for heap initialization
#define numtasks 3		  		   // total number of loaded tasks
#define numresources 2			   // total number of defined resources




// ENUMERATIONS
enum task_state { 	 	idle	 = 0, 
	 			  		pending	 = 1, 
				  		running	 = 2, 
				  		waiting	 = 3, 
				  		finished = 4
				};
enum resource_state { 	notbusy	 = 0, 
	 				  	busy	 = 1
					};
enum message_box { 	  	state_flag 	  = 0x01, 
	 			   		priority_flag = 0x02 
				 };  	// =4, =8, =16, etc.
				 
enum message_box_data { state_box  	  = 0, 
	 				  	priority_box  = 1 
					  }; // =2, =3, =4, etc.



// MESSAGES
#ifndef msg
#define msg(x)	(1 << (x))
#endif



// FUNCTION PROTOTYPES
char get_task_id(void);
int get_task_state(unsigned char id);
int get_task_priority(unsigned char id);
int get_task_messages(unsigned char id);
int set_task_state(unsigned char id, unsigned char state);
int set_task_priority(unsigned char id, unsigned char priority);
/*
unsigned long get_time(void);
void set_time(unsigned char hour, unsigned char min, unsigned char sec);
void start_task(unsigned char id);
void stop_task(unsigned char id);
*/



#endif
