changeset 2:f068965d9269

Activity function for the Context Unit Elem
author sohan
date Wed, 07 Mar 2012 17:24:57 +0100
parents 46c8ea895bff
children 03de56d9aad5
files ContextUnitElem_Activities.c
diffstat 1 files changed, 55 insertions(+), 0 deletions(-) [+]
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ContextUnitElem_Activities.c	Wed Mar 07 17:24:57 2012 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +
     1.5 +/*
     1.6 + *  Copyright 2011 OpenSourceStewardshipFoundation.org
     1.7 + *  Licensed under GNU General Public License version 2
     1.8 + *
     1.9 + * Author: seanhalle@yahoo.com
    1.10 + *
    1.11 + */
    1.12 +
    1.13 +#include "HWSim__LPGPU_Arch__HWDef/HWSim__LPGPU_Arch__HWDef.h"
    1.14 +#include ¨contextUnitElem.h¨
    1.15 +
    1.16 +
    1.17 +//====================================================================
    1.18 +/*This is the ping-pong element for the Hello World hardware
    1.19 + *
    1.20 + *It has only one kind of activity, which only puts a communication on
    1.21 + * the element's one out-port.
    1.22 + * 
    1.23 + *The in-port has only one trigger registered on it, which fires that
    1.24 + * activity.
    1.25 + */
    1.26 +
    1.27 +#define NO_MSG NULL
    1.28 +#define PORT0 0
    1.29 +
    1.30 +/*
    1.31 + *Note, the returned value is passed to the timing function
    1.32 + */
    1.33 +void *
    1.34 +contextUnitElem_SchedulerActivity_behavior( void *_params, HWSimElem *elem )
    1.35 + {
    1.36 +   PingPongParams  *params;
    1.37 +   params    = (PingPongParams *)_params;
    1.38 +//         DEBUG( dbgHW, "ping pong activity\n", clone_PingPongParams(params) );
    1.39 +   
    1.40 +//   HWSim__send_on_port( NO_MSG, PORT0, elem );
    1.41 +  ContextUnit currentContext;
    1.42 +   
    1.43 +   currentcontext=elem->state[0];
    1.44 +   
    1.45 +   while (currentcontext->FS.PS.ReadyForPipe!=true)
    1.46 +        currentcontext++;
    1.47 +        /* This port contains Instr+PC+ContextId*/
    1.48 +        //Need to decide the structure of Signals
    1.49 +        //Need to take care of boundaries conditions
    1.50 +        outPorts[0].lastMsgSent=;
    1.51 +        currentcontext++;
    1.52 + }
    1.53 +
    1.54 +HWSimTimeSpan
    1.55 +contextUnitElem_SchedulerActivity_timing( void * dataFromBehaviorFn )
    1.56 + {
    1.57 +   return 10;
    1.58 + }
    1.59 \ No newline at end of file