#include <tk/tkernel.h>
#include <tm/tmonitor.h>

#include "fsl_debug_console.h"

LOCAL void task_1(INT stacd, void *exinf);	// task execution function
LOCAL ID	tskid_1;			// Task ID number
LOCAL T_CTSK ctsk_1 = {				// Task creation information
	.itskpri	= 10,
	.stksz		= 1024,
	.task		= task_1,
	.tskatr		= TA_HLNG | TA_RNG3,
};

LOCAL void task_1(INT stacd, void *exinf)
{
	while(1) {
		out_w(GPIO_PTOR(1), (1<<2));	// Inverts the LED on the board.
		
		tk_dly_tsk(500);
	}
}

/* User Main */
EXPORT INT usermain(void)
{
	tskid_1 = tk_cre_tsk(&ctsk_1);		// Create Task
	tk_sta_tsk(tskid_1, 0);			// Start Task

	tk_slp_tsk(TMO_FEVR);

	return 0;
}
