Exemple #1
0
static void Task_Start(void *arg)
{
#if (USE_RTOS)
    APP_init();
#endif
    OSA_TaskDestroy (OSA_TaskGetHandler());
    }
int main(void)
{
    gpio_pin_config_t config;

    BOARD_InitPins();
    BOARD_BootClockHSRUN();
    BOARD_InitDebugConsole();

    /* Enable USB Host VBUS */
    config.outputLogic = 1;
    config.pinDirection = kGPIO_DigitalOutput;

    GPIO_PinInit(GPIOC, 9, &config);

    APP_init();

    while (1)
    {
#if ((defined USB_HOST_CONFIG_KHCI) && (USB_HOST_CONFIG_KHCI))
        USB_HostKhciTaskFunction(g_hostHandle);
#endif
#if ((defined USB_HOST_CONFIG_EHCI) && (USB_HOST_CONFIG_EHCI))
        USB_HostEhciTaskFunction(g_hostHandle);
#endif

        USB_HosCdcTask(&g_cdc);
    }
}
Exemple #3
0
/*FUNCTION*----------------------------------------------------------------
* 
* Function Name  : Main_Task
* Returned Value : None
* Comments       :
*     First function called.  Calls the Test_App
*     callback functions.
* 
*END*--------------------------------------------------------------------*/
void Main_Task
   (
      uint32_t param
   )
{   
    UNUSED_ARGUMENT (param)
	APP_init();  

}
Exemple #4
0
int main(void)
#endif
{
    hardware_init();
    OSA_Init();
    dbg_uart_init();

#if !(USE_RTOS)
    APP_init();
#endif

    OS_Task_create(Task_Start, NULL, 4L, 3000L, "task_start", NULL);
    OSA_Start();
#if !defined(FSL_RTOS_MQX)
    return 1;
#endif
}
/*
*------------------------------------------------------------------------------
* void main(void)

* Summary	: Application specifc main routine. Initializes all port and
*			: pheriperal and put the main task into an infinite loop.
*
* Input		: None
*
* Output	: None
*
*------------------------------------------------------------------------------
*/
void main(void)
{
	UINT8 i;

	BOARD_init();
	TIMER0_init(TIMER0_RELOAD,0);

	APP_init();

	EnableInterrupts();

	//DelayMs(3000);
		

   	while(TRUE)
    {


		if( heartBeatCount >= 100 )
		{
			HB_task();
			heartBeatCount = 0;
		}

		if( comUpdateCount >= 2 )
		{
			MB_task();
			//COM_task();
			comUpdateCount = 0;
		}

		//ClrWdt();

		if( appUpdateCount >= 50 )
		{
			APP_task();
			appUpdateCount = 0;
		}
		//ClrWdt();


		ClrWdt();
				
    }
}
Exemple #6
0
static void Task_Start(void *arg)
{
#if (USE_RTOS)
    APP_init();
    while (TRUE)
    {
#endif
    /* call the periodic task function */
    USB_CDC_Periodic_Task();

    /*check whether enumeration is complete or not */
    if ((start_app == TRUE) && (start_transactions == TRUE))
    {
        Virtual_Com_App();
    }
#if (USE_RTOS)
}/* Endwhile */
#endif
}
Exemple #7
0
void main(void)
#endif

#endif
{
    hardware_init();
    OSA_Init();
    dbg_uart_init();

#if !(USE_RTOS)
    APP_init();
#endif
    

    OS_Task_create(Task_Start, NULL, 4L, 1000L, "task_start", NULL);

    OSA_Start();
#if (!defined(FSL_RTOS_MQX))&(defined(__CC_ARM) || defined(__GNUC__))
    return 1;
#endif
}
Exemple #8
0
void main(void)
{
	UINT8 count=0, i, uartData;
	UINT8 blink = 0;

	BRD_init();			//board initialization

	DigitDisplay_init(NO_OF_DIGITS); //Digit Display initialization

	TMR0_init(DIGIT_REFRESH_PERIOD,DigitDisplay_task);		//initialize timer0
 	COM_init(CMD_SOP , CMD_EOP ,RESP_SOP , RESP_EOP , APP_comCallBack);
	APP_init();

	EnableInterrupts();		//Interrupts initialization
	
	ENABLE_GLOBAL_INT();

	

	while(1)
	{


	`	if(heartBeatCount >= 600 )
		{	

			HB_task();
			heartBeatCount = 0;
		}
		
		if(appUpdateCount >= 500)
		{
			APP_task();	
			appUpdateCount = 0;
		}
		COM_task();
	}


}
/*-----------------------------------------------------------------------------
A little more thorough description than was provided for global
functions, as this is the only place to put descriptions for local functions.

Returns: Describe return value here.
-----------------------------------------------------------------------------*/
int app_init()
{
      ucos_init();
      ucos_startup();
               
      /* Register all objects */
      ucos_register_object(SYSDEF_OBJID_APP,
                          SYSCFG_UCOS_OBJECT_PRIO_LOW,
                          (ucos_object_entry_t)APP_entry,
                          "APP");
   
      /*******************************************************/
      /* Initialize all objects. NOTE: the order is of great */
      /* importance and must not be changed                  */
      /*******************************************************/
         
      APP_init();
      HMG_init_ps();
      HMG_init_traffic();
#if (defined(DE_NETWORK_SUPPORT) && (DE_NETWORK_SUPPORT & CFG_NETWORK_AMP ))
      HMG_init_pal();
#endif
   
      /*******************************************************/
      /* Now startup all objects.NOTE: the order is of great */
      /* importance and must not be changed                  */
      /*******************************************************/
   
      APP_startUp();
      HMG_startUp_ps();
      HMG_startUp_traffic();
#if (defined(DE_NETWORK_SUPPORT) && (DE_NETWORK_SUPPORT & CFG_NETWORK_AMP ))
      HMG_startUp_pal();
#endif
   
      return 0;
}
Exemple #10
0
/*
*------------------------------------------------------------------------------
* void main(void)

* Summary	: Application specifc main routine. Initializes all port and
*			: pheriperal and put the main task into an infinite loop.
*
* Input		: None
*
* Output	: None
*
*------------------------------------------------------------------------------
*/
void main(void)
{
	UINT8 i;
#ifdef KEYPAD_TEST
	UINT8 scancode, duration;
#endif

	BOARD_init();
	TIMER0_init(TIMER0_RELOAD,0);
		
	LCD_init();


#ifdef TEST_LCD
	for(i = 0 ; i< 26; i++)
	{
		LCD_putChar(i+'A');
		DelayMs(200);
	}
	LCD_clear();
#endif


#ifdef TOWER_LAMP_TEST
	GREEN = 1;
	DelayMs(1000);
	GREEN = 0;

	YELLOW = 1;
	DelayMs(1000);
	YELLOW = 0;

	RED = 1;
	DelayMs(1000);
	RED = 0;


	BUZZER = 1;
	DelayMs(1000);
	BUZZER = 0;

#endif


	KEYPAD_init();
	


	UI_init();			//MUST BE DONE AFTER IAS INIT

	APP_init();


#ifdef __UART_TEST__
	COM_txStr("IDEONICS ANDON TERMINAL ");
#endif	


	EnableInterrupts();

	//DelayMs(3000);
		

   	while(TRUE)
    {


		if( heartBeatCount >= 100 )
		{
			HB_task();
			heartBeatCount = 0;
		}


		if( keypadUpdateCount >= 8 )
		{
			KEYPAD_task();
			LinearKeyPad_scan(  );
			keypadUpdateCount = 0;
		}

		if( comUpdateCount >= 2 )
		{
			MB_task();
			//COM_task();
			comUpdateCount = 0;
		}

		//ClrWdt();

		if( appUpdateCount >= 50 )
		{
			APP_task();
			appUpdateCount = 0;
		}
	//ClrWdt();
	


#ifdef KEYPAD_TEST
		if( KEYPAD_read(&scancode, &duration) == TRUE )
			LCD_putChar(scancode);
#else
	if( uiUpdateCount >=40 )
	{
		
		UI_task();
		uiUpdateCount = 0;
	}
#endif


		ClrWdt();
				
    }
}
void main(void)
{
    static DWORD currentTick = 0;
	static DWORD bsdTick = 0;
    static DWORD dwLastIP = 0;
	UINT8 i;

    // Initialize application specific hardware
    BRD_init();

    // Initialize stack-related hardware components that may be 
    // required by the UART configuration routines
    TickInit();
    #if defined(STACK_USE_MPFS2)
    MPFSInit();
    #endif

    // Initialize Stack and application related NV variables into AppConfig.
    InitAppConfig();

    // Initialize core stack layers (MAC, ARP, TCP, UDP) and
    // application modules (HTTP, SNMP, etc.)
    StackInit();

   

	#ifdef __MODBUS__
	APP_init( );
	UART_init( 62500 );
	#endif

	EnableInterrupts( );

/*	for( i = 0; i < 26; i++ )
	{
		UART_write( 'A' + i );
		UART_transmit();
	}*/



    // Now that all items are initialized, begin the co-operative
    // multitasking loop.  This infinite loop will continuously 
    // execute all stack-related tasks, as well as your own
    // application's functions.  Custom functions should be added
    // at the end of this loop.
    // Note that this is a "co-operative mult-tasking" mechanism
    // where every task performs its tasks (whether all in one shot
    // or part of it) and returns so that other tasks can do their
    // job.
    // If a task needs very lgong time to do its job, it must be broken
    // down into smaller pieces so that other tasks can have CPU time.
    while(1)
    {
        // Blink LED0 (right most one) every second.
        if(TickGet() - currentTick >= TICK_SECOND/2ul)
        {
            currentTick = TickGet();
//			COM_task( );
 //           LED0_IO ^= 1;
//			TxData = TRUE;
        }

        // This task performs normal stack task including checking
        // for incoming packet, type of packet and calling
        // appropriate stack entity to process it.
        StackTask();
        
      

        // This tasks invokes each of the core stack application tasks
        StackApplications();

        // Process application specific tasks here.
        // For this demo app, this will include the Generic TCP 
        // client and servers, and the SNMP, Ping, and SNMP Trap
        // demos.  Following that, we will process any IO from
        // the inputs on the board itself.
        // Any custom modules or processing you need to do should
        // go here.
  

        #if defined(STACK_USE_ICMP_CLIENT)
        PingDemo();
        #endif
     
        #if defined(STACK_USE_BERKELEY_API)
       // BerkeleyTCPClientDemo();
		if(TickGet() - bsdTick >= TICK_SECOND)
        {
			bsdTick = currentTick;
            BerkeleyTCPServerDemo();
        }
        
        //BerkeleyUDPClientDemo();
        #endif

      

		#ifdef __MODBUS__
		eMBPoll( );
		COM_task( );

		#endif
	
    }
}
void main(void)
{
	UINT8 i,j;
	BOOL ledStrip_On = 0;
	BRD_init();
	HB_init();
    External_Init();
	MMD_init();  // Display initialization
    


	COM_init(CMD_SOP,CMD_EOP,RESP_SOP,RESP_EOP,APP_comCallBack);
	
	LinearKeyPad_init( );

	DelayMs(3000);

	InitializeRtc();	


	APP_init();




	TMR0_init(TICK_PERIOD,0);	//initialize timer0
	TMR1_init(MMD_REFRESH_PERIOD,MMD_refreshDisplay);


	EnableInterrupts();

#ifdef __SET_RTC__


	WriteRtcTimeAndDate(writeTimeDateBuffer);
#endif

	while(1)
	{

		if( comUpdateCount > 5 )
		{
		
			COM1_task();	
			//COM2_task();	
			comUpdateCount = 0;
		}
#ifdef TIME_DEBUG	
		if(  heartBeatCount >= 250 )
		{
#endif
			UpdateRealTimeClockTask();
			if( TimeClockUpdateRequired == TRUE)
			{
				HB_task();
			
				TimeClockUpdateRequired = FALSE;
			}

#ifdef TIME_DEBUG
		heartBeatCount = 0;
		}
#endif
		if(  heartBeatCount >= 250 )
		{
				APP_task();
				 heartBeatCount = 0;
		}

		if( mmdUpdateCount >= 5 )
		{
			MMD_task();
			mmdUpdateCount = 0;
		}
		
		if(keypadUpdate_count >= 10)
		{
			//LinearKeyPad_scan();
			keypadUpdate_count = 0;
		}


	}
}
Exemple #13
0
/******************************************************************************
 * Function:        uint8_t InitIO(void)
 * PreCondition:    None
 * Input:           void
 * Output:          true   - Card initialized
 *                  false   - Card not initialized
 *****************************************************************************/
uint8_t DIRECT_InitIO (void* config)
{
    APP_init();
    return  true;
}
Exemple #14
0
/*
*------------------------------------------------------------------------------
* void main(void)

* Summary	: Application specifc main routine. Initializes all port and
*			: pheriperal and put the main task into an infinite loop.
*
* Input		: None
*
* Output	: None
*
*------------------------------------------------------------------------------
*/
void main(void)
{
	UINT8 i;
	volatile UINT16 StartupDelay = 0 ;

#ifdef KEYPAD_TEST
	UINT8 scancode, duration;
#endif

	BOARD_init();
	TIMER0_init(TIMER0_RELOAD,0);
		
	LCD_init();

	for(i = 0 ; i< strlen(DeviceTag); i++)
	{
		LCD_putChar(DeviceTag[i]);
		//DelayMs(200);
	}
	//LCD_clear();


#ifdef TOWER_LAMP_TEST
	GREEN = 1;
	DelayMs(1000);
	GREEN = 0;

	YELLOW = 1;
	DelayMs(1000);
	YELLOW = 0;

	RED = 1;
	DelayMs(1000);
	RED = 0;


	BUZZER = 1;
	DelayMs(1000);
	BUZZER = 0;

#endif


	
	KEYPAD_init();
	


	UI_init();			//MUST BE DONE AFTER IAS INIT

	APP_init();


#ifdef __UART_TEST__
	COM_txStr(DeviceTag);
#endif	


	EnableInterrupts();

	//DelayMs(3000);
		

   	while(TRUE)
    {


		if( heartBeatCount >= 100 )
		{
			HB_task();
			heartBeatCount = 0;
			if(StartupDelay <= STARTDELAY_TIME)
				StartupDelay++;
		}


		if( keypadUpdateCount >= 8 )
		{
			if(StartupDelay >= STARTDELAY_TIME)
			{
				KEYPAD_task();
				keypadUpdateCount = 0;
			}
		}

		if( comUpdateCount >= 2 )
		{
			COM_task();
			comUpdateCount = 0;
		}

		//ClrWdt();

	if( appUpdateCount >= 100 )
	{
		APP_task();
		appUpdateCount = 0;
	}
	//ClrWdt();
	


#ifdef KEYPAD_TEST
		if( KEYPAD_read(&scancode, &duration) == TRUE )
			LCD_putChar(scancode);
#else
	if( uiUpdateCount >=40)
	{
		
		UI_task();
		uiUpdateCount = 0;
	}
#endif


		ClrWdt();
				
    }
}