/**********************************************************************
 
	Copyright (C) 2003 Hirohisa MORI <joshua@nichibun.ac.jp>
 
	This program is free software; you can redistribute it 
	and/or modify it under the terms of the GLOBALBASE 
	Library General Public License (G-LGPL) as published by 

	http://www.globalbase.org/
 
	This program is distributed in the hope that it will be 
	useful, but WITHOUT ANY WARRANTY; without even the 
	implied warranty of MERCHANTABILITY or FITNESS FOR A 
	PARTICULAR PURPOSE.

**********************************************************************/

/************************************

	machine dependent
	task system

*************************************/

#ifndef ___TASK_H___
#define ___TASK_H___

/*
#define DEADLOCK_CHECK
*/

#define PRI_MAX		6

#include	"machine/task.h"

void init_task(int);
SEM new_lock(int level);
void _lock_task(SEM,char *,int);
void _unlock_task(SEM,char *,char *, int);

#define lock_task(s)	_lock_task((s),__FILE__,__LINE__)
#define unlock_task(s,str)	_unlock_task((s),(str),__FILE__,__LINE__)

void rw_lock_init(RW_LOCK *,int);
void read_lock(RW_LOCK *);
void write_lock(RW_LOCK *);
void rwl_unlock(RW_LOCK *);
void sleep_task(unsigned int,SEM);
void wakeup_task(unsigned int);
#ifndef create_task
int create_task(void (*func)(),int data,int pri);
#endif
void sleep_sec(int);

extern int (*int_handler)();


#endif

