
/*
 *  Copyright 2011 OpenSourceStewardshipFoundation.org
 *  Licensed under GNU General Public License version 2
 *
 * Author: seanhalle@yahoo.com
 *
 */

#include "HWSim__LPGPU_Arch__HWDef/HWSim__LPGPU_Arch__HWDef.h"
#include ¨contextUnitElem.h¨


//====================================================================
/*This is the ping-pong element for the Hello World hardware
 *
 *It has only one kind of activity, which only puts a communication on
 * the element's one out-port.
 * 
 *The in-port has only one trigger registered on it, which fires that
 * activity.
 */

#define NO_MSG NULL
#define PORT0 0

/*
 *Note, the returned value is passed to the timing function
 */
void *
contextUnitElem_SchedulerActivity_behavior( void *_params, HWSimElem *elem )
 {
   PingPongParams  *params;
   params    = (PingPongParams *)_params;
//         DEBUG( dbgHW, "ping pong activity\n", clone_PingPongParams(params) );
   
//   HWSim__send_on_port( NO_MSG, PORT0, elem );
  ContextUnit currentContext;
   
   currentcontext=elem->state[0];
   
   while (currentcontext->FS.PS.ReadyForPipe!=true)
        currentcontext++;
        /* This port contains Instr+PC+ContextId*/
        //Need to decide the structure of Signals
        //Need to take care of boundaries conditions
        outPorts[0].lastMsgSent=;
        currentcontext++;
 }

HWSimTimeSpan
contextUnitElem_SchedulerActivity_timing( void * dataFromBehaviorFn )
 {
   return 10;
 }