#ifndef _aplmt_os_statusapi_h_
#define _aplmt_os_statusapi_h_
/*----------------------------------------------------------------------------
** SUMMARY: Kernel/Scheduler Status and Statistics Interfaces (KSTAT)
**
** DESCRIPTION:
**  This file provides the interface for obtain status and statistics about
**  the kernel and/or scheduler.  This interface is OPTIONAL and is not 
**  guarantied to be supported by all platforms.  
**
** CONFIGURATION 
** -------------
**  COMPILE:        none.
**                                            
**  APPLICATION:    none.
**
**  PLATFORM:       Types:
**                      PLATFORM_APLMT_SCHEDSTATUS_T
**                                            
**                  Definitions:
**                      PLATFORM_APLMT_SCHEDSTATE_RUNNING
**                      PLATFORM_APLMT_SCHEDSTATE_READY_TO_RUN
**                      PLATFORM_APLMT_SCHEDSTATE_SLEEPING
**                      PLATFORM_APLMT_SCHEDSTATE_WAITING_THREAD_SEMA
**                      PLATFORM_APLMT_SCHEDSTATE_WAITING_THREAD_SEMA_TIMEOUT
**                      PLATFORM_APLMT_SCHEDSTATE_WAITING_SEMA
**                      PLATFORM_APLMT_SCHEDSTATE_WAITING_SEMA_TIMEOUT
**                      PLATFORM_APLMT_SCHEDSTATE_WAITING_MUTEX
**                      PLATFORM_APLMT_SCHEDSTATE_WAITING_SYNC_FLAG
**                                            
**                                            
**                                            
**                                            
**  NOTES:
**  1. Unless explicitly stated otherwise, NONE of the following methods may be 
**     called from interrupt service routines.
**  2. Unless explicitly stated otherwise, NONE of the following methods may be 
**     called before the platform's kernel is running.
**  3. Unless explicitly stated otherwise, all of the following methods ARE 
**     thread-safe.
**  4. For efficency/optimization some methods are 'inlined'.  The inlining
**     is done by using the preprocessor/macros.  The application should
**     treat all methods as function calls and not rely on the fact they may
**     be currently defined as macros.
----------------------------------------------------------------------------*/


#include "apl/types/types.h"        /* For: basic types */


#ifdef __cplusplus
extern "C" {
#endif



/*-------------- CONSTANTS -------------------------------------------------*/
/** The are only two 'thread states' guarantied by this interface, running 
    and not-running (not-running is any value that does not equal running).
    Obviously, the current thread is 'running' and all other threads are 
    'not-running'
 */
#define APLMT_SCHEDSTATE_RUNNING                      PLATFORM_APLMT_SCHEDSTATE_RUNNING

/** The following are more detailed states of the high level 'not-running'
    state.  All of the states below are optional and are not guarantied
    to be supported by all platforms. 
 */
#define APLMT_SCHEDSTATE_READY_TO_RUN                 PLATFORM_APLMT_SCHEDSTATE_READY_TO_RUN
#define APLMT_SCHEDSTATE_SLEEPING                     PLATFORM_APLMT_SCHEDSTATE_SLEEPING
#define APLMT_SCHEDSTATE_WAITING_THREAD_SEMA          PLATFORM_APLMT_SCHEDSTATE_WAITING_THREAD_SEMA
#define APLMT_SCHEDSTATE_WAITING_THREAD_SEMA_TIMEOUT  PLATFORM_APLMT_SCHEDSTATE_WAITING_THREAD_SEMA_TIMEOUT
#define APLMT_SCHEDSTATE_WAITING_SEMA                 PLATFORM_APLMT_SCHEDSTATE_WAITING_SEMA
#define APLMT_SCHEDSTATE_WAITING_SEMA_TIMEOUT         PLATFORM_APLMT_SCHEDSTATE_WAITING_SEMA_TIMEOUT
#define APLMT_SCHEDSTATE_WAITING_MUTEX                PLATFORM_APLMT_SCHEDSTATE_WAITING_MUTEX
#define APLMT_SCHEDSTATE_WAITING_SYNC_FLAG            PLATFORM_APLMT_SCHEDSTATE_WAITING_SYNC_FLAG


/*-------------- TYPES -----------------------------------------------------*/
/** Thread scheduling status */
#define AplmtSchedStatus                    PLATFORM_APLMT_SCHEDSTATUS_T


/*-------------- INLINE PLATFORM IMPLEMENTATION ----------------------------*/
#include "platform/statusapi.h"       


/*-------------- PUBLIC/PUBLISHED API --------------------------------------*/
/** This method returns the thread/scheduling state of the specified thread.
    NOTES: 
        o Calling this method on the current thread will always return:
          APLMT_SCHEDSTATE_RUNNING
        o The platform is not required to support all of the various
          defined not-running states.  Check your platform documentation for 
          what states it supports.

    Prototype:
        AplmtSchedStatus Aplmt_getSchedulingStatus( AplmtThreadHdl thread );
 */
#define Aplmt_getSchedulingStatus           _Aplmt_getSchedulingStatus




#ifdef __cplusplus
}
#endif
/*--------------------------------------------------------------------------*/
#endif  /* end _aplmt_os_statusapi_h_ */
