Ejemplo n.º 1
0
void lwip_interrupt_continuation( void )
{
    NATIVE_PROFILE_PAL_NETWORK();
    GLOBAL_LOCK(irq);
    
    if(!InterruptTaskContinuation.IsLinked())
    {
        InterruptTaskContinuation.Enqueue();
    }
}
Ejemplo n.º 2
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);    
}
Ejemplo n.º 3
0
BOOL LWIP_SOCKETS_Driver::Initialize()
{   
    NATIVE_PROFILE_PAL_NETWORK();

    PostAddressChangedContinuation.InitializeCallback(PostAddressChanged, NULL);
    PostAvailabilityOnContinuation.InitializeCallback(PostAvailabilityOn, NULL);
    PostAvailabilityOffContinuation.InitializeCallback(PostAvailabilityOff, NULL);

    /* Initialize the lwIP stack */
    tcpip_init(TcpipInitDone, NULL);
    
    return TRUE;
}
Ejemplo n.º 4
0
void LWIP_SOCKETS_Driver::Link_callback(struct netif *netif)
{
	if (netif_is_link_up(netif))
	{
		if (!PostAvailabilityOnContinuation.IsLinked())
			PostAvailabilityOnContinuation.Enqueue();
	}
	else
	{
		if (!PostAvailabilityOffContinuation.IsLinked())
			PostAvailabilityOffContinuation.Enqueue();
	}
    Events_Set(SYSTEM_EVENT_FLAG_SOCKET);
    Events_Set(SYSTEM_EVENT_FLAG_NETWORK);
}
Ejemplo n.º 5
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!
    /////////////////////////////////////////////////////////////////
}
BOOL ENC28J60_LWIP_Driver::Close( ENC28J60_LWIP_DRIVER_CONFIG* config, int index )
{
    NATIVE_PROFILE_HAL_DRIVERS_ETHERNET();

    if(config == NULL) return FALSE;

    LwipUpTimeCompletion.Abort();

    netif_set_link_down( &g_ENC28J60_NetIF );
    netif_set_down( &g_ENC28J60_NetIF );
    netif_remove( &g_ENC28J60_NetIF );

    /* Disable the INTERRUPT pin */                            
    CPU_GPIO_EnableInputPin2(config->INT_Pin, 
                              FALSE,                         /* Glitch filter enable */
                              NULL,                          /* ISR                  */
                              0,                             /* minor number         */
                              GPIO_INT_NONE,                 /* Interrupt edge       */
                              RESISTOR_PULLUP);              /* Resistor State       */

    InterruptTaskContinuation.Abort();

    LwipNetworkStatus = FALSE;
    
    enc28j60_lwip_close( &g_ENC28J60_NetIF );

    memset(&g_ENC28J60_NetIF, 0, sizeof(g_ENC28J60_NetIF));

    return TRUE;

}
void InitContinuations( struct netif *pNetIf )
{
    InterruptTaskContinuation.InitializeCallback( (HAL_CALLBACK_FPN)STM32F4_ETH_LWIP_recv, (void*)pNetIf );

    LwipUpTimeCompletion.InitializeForUserMode( (HAL_CALLBACK_FPN)lwip_network_uptime_completion, (void*)pNetIf );
    LwipUpTimeCompletion.EnqueueDelta64( 2000000 );
}
Ejemplo n.º 8
0
void InitContinuations( struct netif *pNetIf )
{
    InterruptTaskContinuation.InitializeCallback( (HAL_CALLBACK_FPN)LPC24XX_EMAC_lwip_recv, pNetIf );

    LwipUpTimeCompletion.InitializeForUserMode( (HAL_CALLBACK_FPN)lwip_network_uptime_completion, pNetIf );
    LwipUpTimeCompletion.EnqueueDelta64( 2000000 );
}
void InitContinuations( struct netif* pNetIf )
{
    InterruptTaskContinuation.InitializeCallback( (HAL_CALLBACK_FPN)enc28j60_lwip_interrupt, &g_ENC28J60_NetIF );

    LwipUpTimeCompletion.InitializeForUserMode( (HAL_CALLBACK_FPN)lwip_network_uptime_completion, pNetIf );
    
    LwipUpTimeCompletion.EnqueueDelta64( 500000 );
}
Ejemplo n.º 10
0
BOOL LWIP_SOCKETS_Driver::Uninitialize()
{
    NATIVE_PROFILE_PAL_NETWORK();      

    PostAddressChangedContinuation.Abort();
    PostAvailabilityOnContinuation.Abort();
    PostAvailabilityOffContinuation.Abort();

    for(int i=0; i<g_NetworkConfig.NetworkInterfaceCount; i++)
    {
        Network_Interface_Close(i);
    }

    tcpip_shutdown();

    return TRUE;
}
Ejemplo n.º 11
0
/*----------------------------------------------------------------------*
                            rtp_thread_kill
 *----------------------------------------------------------------------*/
int rtp_thread_kill (RTP_HANDLE         * newThread,
                      RTP_ENTRY_POINT_FN   entryPoint,
                      const char         * name,
                      int                  stackSizeIndex,
                      int                  priorityIndex,
                      void               * userData)
{
    int * index = (int *) userData;
    
    if ((rtp_strcmp(name, "ip interpret") == 0) && IPTaskInitialized[*index])
    {
        IPTaskInitialized[*index] = 0;

        IPTaskContinuation[*index].Abort();
    }
    
    else if ((rtp_strcmp(name, "timer comp") == 0) && TimerTaskCompInitialized)
    {
        TimerTaskCompInitialized = 0;
        
        TimerTaskCompletion.Abort();
    }       
    
    else if ((rtp_strcmp(name, "timer cont") == 0) && TimerTaskContInitialized)
    {      
        TimerTaskContInitialized = 0;

        TimerTaskContinuation.Abort();
    } 
    
    else if ((rtp_strcmp(name, "interrupt task") == 0) && InterruptTaskContInitialized[*index])
    {
        InterruptTaskContInitialized[*index] = 0;
        
        InterruptTaskContinuation[*index].Abort();
    }
    
    else if ((rtp_strcmp(name, "dhcp") == 0) && DHCPTaskInitialized)
    {
        DHCPTaskInitialized = 0;
        
        DHCPTaskContinuation.Abort();
    }
    
    return (0);    
}
Ejemplo n.º 12
0
void LWIP_SOCKETS_Driver::Status_callback(struct netif *netif)
{
	if (!PostAddressChangedContinuation.IsLinked())
		PostAddressChangedContinuation.Enqueue();

#if !defined(BUILD_RTM)
	lcd_printf("\f\n\n\n\n\n\nLink Update: %s\n", (netif_is_up(netif) ? "UP  " : "DOWN"));
	lcd_printf("         IP: %d.%d.%d.%d\n", (netif->ip_addr.addr >> 0) & 0xFF,
		(netif->ip_addr.addr >> 8) & 0xFF,
		(netif->ip_addr.addr >> 16) & 0xFF,
		(netif->ip_addr.addr >> 24) & 0xFF);
	lcd_printf("         SM: %d.%d.%d.%d\n", (netif->netmask.addr >> 0) & 0xFF,
		(netif->netmask.addr >> 8) & 0xFF,
		(netif->netmask.addr >> 16) & 0xFF,
		(netif->netmask.addr >> 24) & 0xFF);
	lcd_printf("         GW: %d.%d.%d.%d\n", (netif->gw.addr >> 0) & 0xFF,
		(netif->gw.addr >> 8) & 0xFF,
		(netif->gw.addr >> 16) & 0xFF,
		(netif->gw.addr >> 24) & 0xFF);
	debug_printf("IP Address: %d.%d.%d.%d\n", (netif->ip_addr.addr >> 0) & 0xFF,
		(netif->ip_addr.addr >> 8) & 0xFF,
		(netif->ip_addr.addr >> 16) & 0xFF,
		(netif->ip_addr.addr >> 24) & 0xFF);
#if LWIP_DNS
	if (netif->flags & NETIF_FLAG_DHCP)
	{
		struct ip_addr dns1 = dns_getserver(0);
		struct ip_addr dns2 = dns_getserver(1);

		lcd_printf("         dns1: %d.%d.%d.%d\n", (dns1.addr >> 0) & 0xFF,
			(dns1.addr >> 8) & 0xFF,
			(dns1.addr >> 16) & 0xFF,
			(dns1.addr >> 24) & 0xFF);

		lcd_printf("         dns2: %d.%d.%d.%d\n", (dns2.addr >> 0) & 0xFF,
			(dns2.addr >> 8) & 0xFF,
			(dns2.addr >> 16) & 0xFF,
			(dns2.addr >> 24) & 0xFF);
	}
#endif
#endif
    Events_Set(SYSTEM_EVENT_FLAG_SOCKET);
    Events_Set(SYSTEM_EVENT_FLAG_NETWORK);
}
void HAL_COMPLETION::Execute()
{
    NATIVE_PROFILE_PAL_ASYNC_PROC_CALL();
    ASSERT_IRQ_MUST_BE_OFF();

#if defined(_DEBUG)
    this->Start_RTC_Ticks = 0;
#endif

    if(this->ExecuteInISR)
    {
        HAL_CONTINUATION* cont = this;

        cont->Execute();
    }
    else
    {
        this->Enqueue();
    }
}
Ejemplo n.º 14
0
BOOL AT91_EMAC_LWIP_Driver::Close(void)
{
    LwipUpTimeCompletion.Abort();

    CPU_INTC_DeactivateInterrupt(AT91C_ID_EMAC);

    InterruptTaskContinuation.Abort();

    LwipNetworkStatus = 0;

    netif_set_down( &g_AT91_EMAC_NetIF );
    netif_remove( &g_AT91_EMAC_NetIF );

    AT91_EMAC_LWIP_close( &g_AT91_EMAC_NetIF );
    
    memset( &g_AT91_EMAC_NetIF, 0, sizeof g_AT91_EMAC_NetIF );

    return TRUE;
}
BOOL SH7264_SMSC_LWIP_Driver::Close(void)
{
    LwipUpTimeCompletion.Abort();

    //CPU_INTC_DeactivateInterrupt(SH7264C_ID_EDMAC);
    CPU_INTC_DeactivateInterrupt(81);

    InterruptTaskContinuation.Abort();

    LwipNetworkStatus = 0;

    netif_set_down( &g_SH7264_SMSC_NetIF );
    netif_remove( &g_SH7264_SMSC_NetIF );

    SH7264_SMSC_lwip_close( &g_SH7264_SMSC_NetIF );
    
    memset( &g_SH7264_SMSC_NetIF, 0, sizeof g_SH7264_SMSC_NetIF);

    return TRUE;
}
Ejemplo n.º 16
0
BOOL LPC24XX_EMAC_LWIP_Driver::Close( )
{
    LwipUpTimeCompletion.Abort();

    /* Disable the interrupt */
    CPU_INTC_DeactivateInterrupt(LPC24XX_VIC::c_IRQ_INDEX_EMAC);

    InterruptTaskContinuation.Abort();

    LwipNetworkStatus = 0;

    netif_set_down( &g_LPC24XX_EMAC_NetIF );
    netif_remove( &g_LPC24XX_EMAC_NetIF );

    LPC24XX_EMAC_lwip_close( &g_LPC24XX_EMAC_NetIF );
    
    memset( &g_LPC24XX_EMAC_NetIF, 0, sizeof g_LPC24XX_EMAC_NetIF);

    return TRUE;
}
void DeInitContinuations()
{
    LwipUpTimeCompletion.Abort();
    InterruptTaskContinuation.Abort();
}