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

                   Copyright (c) 2007 SKY Computers, Inc.

    Including this file, and any software and its file formats and  visual
    displays described herein, all  rights  reserved,  may  only  be  used
    pursuant  to  the  applicable  software  license  agreement;  contains
    confidential and proprietary information  of SKY  and/or third parties
    which is protected by copyright trade secret and trademark law and may
    not  be  provided or otherwise made available  without  prior  written
    authorization.

                       Restricted Rights Legend

    Use,  duplication,  or disclosure  by  the  Government  is  subject to
    restrictions as set  forth in subdivision  (c)(1)(ii) of the Rights in
    Technical Data and Computer  Software  clauses at  DFARS  252.227-7013
    (October 1988) and FAR 52.227-19(c) (June 1987).

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

/*
 *--------------------------------------------------------------------------
 *
 >++
 *
 *   File:  ex_tcb.h 
 *
 *   Function:  To define the common structures and parameters used
 *
 *   Calling Sequence: N.A.
 *
 *   Implementation Details:
 *       1. See below.
 *
 *   Restrictions:
 *       1. None
 *
 >**
 *   Revision Information:
 *    Date       By    Rev   Changes Made....
 *    10/16/07   bwj   0.0   New Module, in process.
 >--
 *--------------------------------------------------------------------------
 */

#ifndef _TH_TCB_H_
#define _TH_TCB_H_

/* Some Time_Trac parameters. */
#define  TT_MAX_EVENTS      (10000)
#define  V_SIZE              (1024*64)

#define NUM_CO_THREADS         (4)                    /* main thread counts as one */
#define NUM_THREADS            (1+NUM_CO_THREADS+1)   /* main thread and cleanup thread each count as one */
#define NUM_PASSES             (25)

/* For the thread control block ... */
struct thread_control_block
{
  int Rank;                   /* starting from 0 for the main, never changes */
  int Comm;                   /* see COMM_*, below, set by main thread */
  int Status;                 /* set by the compute thread */
  int Pass;                   /* pass count from the main thread */
  int Faults;                 /* unused */
};

typedef struct thread_control_block TCB;

/* For the parameter block ... */
struct ex_param_block
{
    int Rank;                   /* starting from 0 for the main */
    int Comm;                   /* see COMM_*, below */
    int Status;
};

typedef struct ex_param_block EPB;

/* NOTE: The names array just below MUST match these values. */
#define COMM_NONE   (0)         /* unused */
#define COMM_INIT   (1)
#define COMM_COMP   (2)
#define COMM_EXIT   (3)

#ifdef EX_MAIN
const char *task_name[] = {
    "No State",                 /* 0 */
    "Init",                     /* 1 */
    "Compute",                  /* 2 */
    "Exit",                     /* 3 */
    "Unknown"
};
#else
extern const char *task_name[];
#endif

#define STAT_NONE   (0)         /* unused */
#define STAT_WAIT   (1)         /* thread is waiting for a command */
#define STAT_RUN    (2)         /* thread is computing */
#define STAT_DONE   (3)         /* thread is done computing */
#define STAT_EXIT   (4)         /* thread exiting */

#ifdef EX_MAIN
const char *stat_name[] = {
    "None",                     /* 0 */
    "Waiting",                  /* 1 */
    "Running",                  /* 2 */
    "Done",                     /* 3 */
    "Exiting",                  /* 4 */
    "Unknown"               
};
#else
extern const char *stat_name[];
#endif

extern void *ex_mem_alloc (int rank, int bytes, int align, char *str);
 
#endif

/* --------------------------- End of Module ---------------------------- */

