예제 #1
0
/*----------------------------------------------------------------------*
                            rtp_thread_spawn
 *----------------------------------------------------------------------*/
int rtp_thread_spawn (RTP_HANDLE         * newThread,
                      RTP_ENTRY_POINT_FN   entryPoint,
                      const char         * name,
                      int                  stackSizeIndex,
                      int                  priorityIndex,
                      void               * userData)
{
    PIFACE pi;
    int * index = (int *) userData;
    
    if ((rtp_strcmp(name, "ip interpret") == 0) && !IPTaskInitialized[*index])
    {
        IPTaskInitialized[*index] = 1;

        IPTaskContinuation[*index].InitializeCallback((HAL_CALLBACK_FPN) entryPoint, userData);
    }
    
    else if ((rtp_strcmp(name, "timer comp") == 0) && !TimerTaskCompInitialized)
    {
        TimerTaskCompInitialized = 1;
        
        TimerTaskCompletion.InitializeForUserMode((HAL_CALLBACK_FPN) entryPoint, userData);
            
        TimerTaskCompletion.EnqueueDelta(cfg_protocol_data.timer_freq * 1000);
    }       
    
    else if ((rtp_strcmp(name, "timer cont") == 0) && !TimerTaskContInitialized)
    {      
        TimerTaskContInitialized = 1;

        TimerTaskContinuation.InitializeCallback((HAL_CALLBACK_FPN) entryPoint,userData);    
    } 
    
    else if ((rtp_strcmp(name, "interrupt task") == 0) && !InterruptTaskContInitialized[*index])
    {
        pi = (PIFACE) &ifaces[*index];
        if (!pi)
        {
            return -1;
        }

        InterruptTaskContInitialized[*index] = 1;
        
        InterruptTaskContinuation[*index].InitializeCallback((HAL_CALLBACK_FPN) entryPoint,pi);
    }
    
    else if ((rtp_strcmp(name, "dhcp") == 0) && !DHCPTaskInitialized)
    {
        DHCPTaskInitialized = 1;
        
        DHCPTaskContinuation.InitializeCallback((HAL_CALLBACK_FPN) entryPoint,userData);
    }
    
    return (0);    
}
예제 #2
0
void Events_SetBoolTimer( BOOL* TimerCompleteFlag, UINT32 MillisecondsFromNow )
{
    NATIVE_PROFILE_PAL_EVENTS();
    // we assume only 1 can be active, abort previous just in case
    g_Events_BoolTimerCompletion.Abort();

    if(TimerCompleteFlag)
    {
        g_Events_BoolTimerCompletion.InitializeForISR( local_Events_SetBoolTimer_Callback, TimerCompleteFlag );

        g_Events_BoolTimerCompletion.EnqueueDelta( MillisecondsFromNow * 1000 );
    }
}
예제 #3
0
/*----------------------------------------------------------------------*
                            rtp_thrd_timer_completion
 *----------------------------------------------------------------------*/
void rtp_thrd_timer_completion(void* arg)
{
    NATIVE_PROFILE_PAL_NETWORK();
    /* Schedule the timer task to run as a continuation */
    if(!TimerTaskContinuation.IsLinked())
    {
        TimerTaskContinuation.Enqueue();
    }
    /////////////////////////////////////////////////////////////////
    // DO NT CHANGE!
    // KEEP the timeout IN SYNC with _CFG_TIMER_FREQ
    TimerTaskCompletion.EnqueueDelta(cfg_protocol_data.timer_freq * 1000);    
    // DO NT CHANGE!
    /////////////////////////////////////////////////////////////////
}
예제 #4
0
/* ********************************************************************
   Transmit. a packet over the packet driver interface.
   
   This routine is called when a packet needs sending. The packet contains a
   full ethernet frame to be transmitted. The length of the packet is 
   provided.
  
   Returns 0 if successful or errno if unsuccessful
  
   ********************************************************************     */
err_t loop_lwip_xmit( struct netif *pNetIF, struct pbuf *pPBuf)
{
    NATIVE_PROFILE_HAL_DRIVERS_ETHERNET();

#if defined(FAKE_ASYNC_LOOPBACK_PROCESSING)
    // store the packet and process it asynchronously by calling SOCKETS_RestartTcpIpProcessor()
    // this would also require fakign an interrupt to 'receive' the packet
    
    g_dummy_pbuf_chain[g_dummy_pbuf_current] = pPBuf;
    if(++g_dummy_pbuf_current == PBUF_CHAIN_DEPTH) g_dummy_pbuf_current = 0;

    g_fake_loopback_ISR.EnqueueDelta(10 * 1000);

    SOCKETS_RestartTcpIpProcessor(10 * 1000);
    
#else
    pNetIF->input( pPBuf, pNetIF );
#endif

    return( ERR_OK );    
}
void LargeBuffer_ManagedToNative( UINT16 marshalId, const BYTE* pData, size_t size )
{
    if(!g_LargeBufferCompletionInit)
    {
        g_LargeBufferTestCompletion.InitializeForUserMode(LargeBufferTest_Completion, (void*)marshalId);
        g_LargeBufferCompletionInit = TRUE;
    }

    if(!g_LargeBufferTestCompletion.IsLinked()) 
    {
        g_LargeBufferTestCompletion.EnqueueDelta(1000);
    }

    int len = (size > ARRAYSIZE(s_Data)) ? ARRAYSIZE(s_Data) : size;
    
    for(int i=0; i<len; i++)
    {
        s_Data[i] = pData[size - 1 - i];
    }

    s_LastSize = len;
}
예제 #6
0
BOOL TEvents::TEvents_1()
{
   UINT32         count = 100;
   UINT32         signaled;
   HAL_COMPLETION compObj;


   compObj.InitializeForISR(CompletionCallback, NULL);

    while (count--)
    {
        compObj.EnqueueDelta(1000*2);
        signaled = Events_WaitForEvents(s_event,50);

        if (signaled != s_event)
        {
            return false; 
        }
    }


    return true; 
}