////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2002 Xilinx, Inc.  All rights reserved.
//
// Xilinx, Inc.
// XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A 
// COURTESY TO YOU.  BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS
// ONE POSSIBLE   IMPLEMENTATION OF THIS FEATURE, APPLICATION OR 
// STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION
// IS FREE FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE 
// FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION.  
// XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO 
// THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO 
// ANY WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE 
// FROM CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY 
// AND FITNESS FOR A PARTICULAR PURPOSE.
// 
// Date   : 2002, November.
// Author : Raj Nagarajan (rajn@xilinx.com)
// Company: Xilinx
// Group  : Emerging Software Technologies
//
// $Id :$
//
//////////////////////////////////////////////////////////////////////////////

/**************************************************************************/
/**
 * @file libprocess.c
 *
 * This contains system call wrapper functions for Process Management.
 * The system call wrapper functions are put in a library libw.a and is used
 * by application program to make system calls.
 ***************************************************************************/
#include <sys/mblaze_asm.h>
#include <sys/process.h>
#include <sys/syscall.h>
#include <os_config.h>

/*
 * The register r18 contains the system call number.
 * Branch is then made to the system call handler routine.
 */

/**************************************************************************/
/**
 * Same as sys_process_create() - Refer sys/process.c
 ***************************************************************************/
int process_create( unsigned int start, int prio ) 
{
	JMP_SYSCALL_HANDLER( _MB_Process_Create )
}

#ifdef CONFIG_PROCESS_EXIT
/**************************************************************************/
/**
 * Same as sys_exit() - Refer sys/process.c
 ***************************************************************************/
int process_exit()
{
  JMP_SYSCALL_HANDLER( _MB_Process_Exit ) ;
  // while(1);
}
#endif

#ifdef CONFIG_PROCESS_KILL
/**************************************************************************/
/**
 * Same as sys_process_kill() - Refer sys/process.c
 ***************************************************************************/
int process_kill( char pid )
{
	JMP_SYSCALL_HANDLER( _MB_Process_Kill )
}
#endif

/**************************************************************************/
/**
 * Same as sys_process_status() - Refer sys/process.c
 ***************************************************************************/
int process_status( int pid, p_stat *ps )
{
	JMP_SYSCALL_HANDLER( _MB_Process_Status )
}

#ifdef CONFIG_PROCESS_SLEEP
int process_sleep()
{
	JMP_SYSCALL_HANDLER( _MB_Process_Sleep )
}
#endif

#ifdef CONFIG_PROCESS_YIELD
/**************************************************************************/
/**
 * Same as sys_process_yield() - Refer sys/process.c
 ***************************************************************************/
int process_yield() 
{
	JMP_SYSCALL_HANDLER( _MB_Process_Yield )
}

int get_currentPID() 
{
	JMP_SYSCALL_HANDLER( _MB_Process_GetPID )
}

int process_getpriority()
{
	JMP_SYSCALL_HANDLER( _MB_Process_GetPriority )
}

int process_setpriority( int priority )
{
	JMP_SYSCALL_HANDLER( _MB_Process_SetPriority )
}

#endif
