Exemplo n.º 1
0
Arquivo: main.c Projeto: nqd/cc3200
//****************************************************************************
//
//! Main function
//!
//! \param none
//!
//! This function
//!    1. Invokes the SLHost task
//!    2. Invokes the GetNTPTimeTask
//!
//! \return None.
//
//****************************************************************************
void main()
{
    long lRetVal = -1;

    //
    // Initialize Board configurations
    //
    BoardInit();

    //
    // Enable and configure DMA
    //
    UDMAInit();

    //
    // Pinmux for UART
    //
    PinMuxConfig();

    //
    // Configuring UART
    //
    InitTerm();

    //
    // Display Application Banner
    //
    DisplayBanner(APP_NAME);

    //
    // Start the SimpleLink Host
    //
    lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    //
    // Start the GetNTPTime task
    //
    lRetVal = osi_TaskCreate(GetNTPTimeTask,
                    (const signed char *)"Get NTP Time",
                    OSI_STACK_SIZE,
                    NULL,
                    1,
                    NULL );

    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    //
    // Start the task scheduler
    //
    osi_start();
}
Exemplo n.º 2
0
void main(void)
{
    int16_t moyenne;

    BoardInit();

    /* Configuration de l'ADC
     *  horloge: oscillateur RC interne
     *  résultat justifié à droite
     *  temps d'acquisition: 2*Tad (délai minimum entre 2 conversions)
     *  canal 4
     *  interruption desactivée
     *  tensions référence par défaut (Vref+ = AVdd / Vref- = AVss)
     */
    OpenADC(ADC_FOSC_RC|ADC_RIGHT_JUST|ADC_2_TAD, ADC_CH4|ADC_INT_OFF, 0);

    moyenne = 0;
    for (uint8_t i = 0; i < 16; i++) {
        ConvertADC();               /* démarrage conversion */
        while (BusyADC());          /* attente fin conversion */
        moyenne += ReadADC();       /* lecture résultat */
    }
    moyenne /= 16;

    while (1);
}
Exemplo n.º 3
0
//*****************************************************************************
//
//! Main 
//!
//! \param  none
//!
//! \return None
//!
//*****************************************************************************
void main()
{
    long lRetVal = -1;
    //
    // Initialize board configuration
    //
    BoardInit();

    PinMuxConfig();

    #ifndef NOTERM
        InitTerm();
    #endif

    lRetVal = ssl();
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
    }

    //
    // power off network processor
    //
    sl_Stop(SL_STOP_TIMEOUT);
    LOOP_FOREVER();
}
Exemplo n.º 4
0
void
CmtSdCard::InitSetup( OMAP_MMCHS_REGS *mmc ) {
  uint32 reg_val;

  cmtDebug1( 4, 1, "InitSetup SoftReset", 0 );
  BoardInit( mmc );

  mmc->MMCHS_SYSCONFIG |= MMC_SOFTRESET;
  while( (__raw_readl( &(mmc->MMCHS_SYSSTATUS) ) & RESETDONE) == 0 );

  cmtDebug1( 4, 2, "...done. InitSetup AllReset", 0 );
  mmc->MMCHS_SYSCTL |= SOFTRESETALL;
  while( (__raw_readl( &(mmc->MMCHS_SYSCTL) ) & SOFTRESETALL) != 0x0 );

  cmtDebug1( 4, 3, "...done. InitSetup Clock Config", 0 );
  mmc->MMCHS_HCTL = DTW_1_BITMODE | SDBP_PWROFF | SDVS_3V0;
  mmc->MMCHS_CAPA |= VS30_3V0SUP | VS18_1V8SUP;

  reg_val = mmc->MMCHS_CON & RESERVED_MASK;

  mmc->MMCHS_CON = CTPL_MMC_SD | reg_val | WPP_ACTIVEHIGH |
      CDP_ACTIVEHIGH | MIT_CTO | DW8_1_4BITMODE | MODE_FUNC |
      STR_BLOCK | HR_NOHOSTRESP | INIT_NOINIT | NOOPENDRAIN;

  ClockConfig( mmc, CLK_INITSEQ, 0 );
  mmc->MMCHS_HCTL |= SDBP_PWRON;

  mmc->MMCHS_IE = 0x307f0033;
  cmtDebug1( 4, 4, "...done.", 0 );

  InitStream( mmc );
  }
Exemplo n.º 5
0
int main() {
	long lRetVal = -1;
	val=0;
	BoardInit();
	PinMuxConfig();
	LedInit();
	
	//create OS tasks
	lRetVal = osi_TaskCreate(PushButtonHandler, 
		(signed char*) "PushButtonHandler",
		OSI_STACK_SIZE, NULL, 2, &g_PushButtonTask);

	if(lRetVal < 0)
    {
    ERR_PRINT(lRetVal);
    LOOP_FOREVER();
    }

    lRetVal = osi_TaskCreate(MainLoop, (signed char*)"MainLoop", 
                	OSI_STACK_SIZE, NULL, 1, NULL );
    
    if(lRetVal < 0)
    {
    ERR_PRINT(lRetVal);
    LOOP_FOREVER();
    }

    osi_start();

    for(;;) {

    }

	return 0;
}
Exemplo n.º 6
0
static void Init()
{
    long lRetVal = -1;
    BoardInit();
    UDMAInit();
    PinMuxConfig();
    InitTerm();

    InitializeAppVariables();

    //
    // Following function configure the device to default state by cleaning
    // the persistent settings stored in NVMEM (viz. connection profiles &
    // policies, power policy etc)
    //
    // Applications may choose to skip this step if the developer is sure
    // that the device is in its default state at start of applicaton
    //
    // Note that all profiles and persistent settings that were done on the
    // device will be lost
    //
    lRetVal = ConfigureSimpleLinkToDefaultState();

    if (lRetVal < 0) {
        if (DEVICE_NOT_IN_STATION_MODE == lRetVal)
            UART_PRINT(
                    "Failed to configure the device in its default state \n\r");

        LOOP_FOREVER()
        ;
    }

    //
    // Asumption is that the device is configured in station mode already
    // and it is in its default state
    //
    lRetVal = sl_Start(0, 0, 0);
    if (lRetVal < 0) {
        UART_PRINT("Failed to start the device \n\r");
        LOOP_FOREVER()
        ;
    }

    UART_PRINT("Connecting to AP: '%s'...\r\n", SSID_NAME);

    // Connecting to WLAN AP - Set with static parameters defined at common.h
    // After this call we will be connected and have IP address
    lRetVal = WlanConnect();
    if (lRetVal < 0) {
        UART_PRINT("Connection to AP failed \n\r");
        LOOP_FOREVER()
        ;
    }

    UART_PRINT("Connected to AP: '%s' \n\r", SSID_NAME);

#ifdef NEW_ID
    iobeam_Reset();
#endif
}
Exemplo n.º 7
0
//****************************************************************************
//! Main function
//!
//! \param none
//! 
//! \return None.
//
//****************************************************************************
void main()
{
    // Initialize the board
    BoardInit();
    // Configure the pinmux settings for the peripherals exercised
    PinMuxConfig();

	#ifndef NOTERM
		// Configuring UART
		InitTerm();
		ClearTerm();
	#endif

    // Start the TCPServer task
    long lRetVal = osi_TaskCreate(InfiniteLoopTask,
                    (const signed char *)"Infinite Loop Task",
                    OSI_STACK_SIZE, 
                    NULL, 
                    1, 
                    NULL );
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);

        while(1);
    }

    // Start the task scheduler
    osi_start();

    TimerDeinitStop();
}
int main()
{
	/*
	 * Preparation
	 */
    // Board Initialization
    BoardInit();
    // Configuring UART
    InitTerm();

    // Connect to AP
    // Put your SSID and password in common.h
    long lRetVal = ConnectToAP();
    if(lRetVal < 0)
    {
    	UART_PRINT("Connection to AP failed\n\r");
        LOOP_FOREVER();
    }
    UART_PRINT("Connected to AP\n\r");
    if(lRetVal < 0)
    {
        LOOP_FOREVER();
    }

    // Declare thing
    Thing_Struct thing;

    // Connect to thethingsiO server
    lRetVal = ConnectTo_thethingsiO(&thing.thing_client);
       if(lRetVal < 0)
       {
           LOOP_FOREVER();
       }
    UART_PRINT("Thing client connected\n\r");

    // In order to initialize the thing correctly you have to use one of
    // following two methods:
    // 1. If you have already activated your thing you should set the token
    thing.token = "YOUR TOKEN HERE";
    // 2. Or if not copy the provided activation code here
    // and uncomment the following line
    // char *act_code = "YOUR ACTIVATION CODE HERE";
    // and activate the thing (uncomment the following line)
    // char *token = thing_activate(&thing, act_code);

    /* Intializes random number generator */
  //  time_t t;
  //  srand((unsigned) time(&t));
    while(1)
    {
    	char *sub = thing_subscribe(&thing);
    	if (strlen(sub) > 0)
    	{
    		UART_PRINT(sub);
    		UART_PRINT("\n\r");
    	}
    	// Free memory
    	free(sub);
    }
}
Exemplo n.º 9
0
int target_initialise(void)
{
    BoardInit();
    wlan_configure();
    sl_Start(0, 0, 0);
    // Both SSID and PASSWORD must be defined externally.
    wlan_connect(WIFI_SSID, WIFI_PASSWORD, SL_SEC_TYPE_WPA_WPA2);
}
Exemplo n.º 10
0
//##############################################################################################################
void SX1278TASK_PROCESS(void const * argument)
{
  uint32_t  Last;
  BoardInit( );    
  Radio = RadioDriverInit( );    
  Radio->Init( );
  Radio_UserInit();
  Radio->StartRx( );  
  Last=HAL_GetTick();
  while(1)
  {
    switch( Radio->Process( ))
    {
      case RF_CHANNEL_ACTIVITY_DETECTED:
        __NOP();
      break;
      case RF_CHANNEL_EMPTY:
        __NOP();__NOP();
      break;
      case RF_LEN_ERROR:
        __NOP();__NOP();__NOP();
      break;
      case RF_IDLE:
          __NOP();__NOP();__NOP();__NOP();        
      break;
      case RF_BUSY:
        __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();
      break;
      
      case RF_RX_TIMEOUT:
        Radio_RxTimeout();
        break;
      case RF_RX_DONE:
        Radio->GetRxPacket( RadioBuffer, ( uint16_t* )&RadioLength );
        if( RadioLength > 0 )
        {
          Radio_RxDone(RadioBuffer,RadioLength);
        }        
        break;
      case RF_TX_DONE:    
        __NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();__NOP();
        Radio->StartRx( );
        break;
      case RF_TX_TIMEOUT:
        
      break;
      default:
        break;
    }    
    osDelay(1);
    if(HAL_GetTick()-Last < 100)
    {
      Last = HAL_GetTick();
      Radio_Misc_Per100ms();
    }
  }
  
}
Exemplo n.º 11
0
Board *PlayerMinMaxTestSetup() {
	uint8_t
		width = 6,
		height = 6;
	Board *b = BoardAlloc();
	BoardInit(b,width,height,PlayerMinMaxTestMap);
	PlayerMinMaxInit(b);
	return b;
}
Exemplo n.º 12
0
void RadioStart()
{
	bool bTX = false;
  BoardInit( );

  GreenLedBlink();
	RedLedBlink();


  Radio = RadioDriverInit();
  Radio->Init();

  Radio->StartRx( );

	while(1)
	{
	  switch(Radio->Process())
    {
    case RF_RX_DONE:
				Radio->GetRxPacket( Buffer, ( uint16_t* )&BufferSize );
				if( BufferSize > 0 )
        {
					if (bDeviceState == CONFIGURED)
					{
						if (packet_sent == 1)
						{
							CDC_Send_DATA ((unsigned char*)Buffer,BufferSize);
						}
					}
				}

				GreenLedBlink();
				Radio->StartRx( );

				break;
    case RF_TX_DONE:
				RedLedBlink();
        Radio->StartRx( );
				bTX = false;
        break;
    default:
			if (bDeviceState == CONFIGURED)
			{
				if(bTX) break;
				if (Receive_length  != 0)
				{
					Radio->SetTxPacket( (unsigned char*)Receive_Buffer,Receive_length );
					CDC_Receive_DATA();
					Receive_length = 0;
					bTX = true;
				}
			}
			break;
    }
	}
}
Exemplo n.º 13
0
 int main( void)
 {
    BoardInit();

    while( 1)
    {		
        StateFlow();
    }	 

 }
Exemplo n.º 14
0
Arquivo: main.cpp Projeto: hangc2/wif
//****************************************************************************
//							MAIN FUNCTION
//****************************************************************************
int main()
{
    long lRetVal = -1;
    //
    // Board Initialization
    //
    BoardInit();

    //
    // Enable and configure DMA
    //
    UDMAInit();
    //
    // Pinmux for UART
    //
    PinMuxConfig();
    //
    // Configuring UART
    //
    InitTerm();
    //
    // Display Application Banner
    //
    DisplayBanner(APP_NAME);
    //
    // Start the SimpleLink Host
    //
    lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }
    //
    // Start the Receiving file
    //

    lRetVal = osi_TaskCreate(cmd_dispatcher,
                    (const signed char *)"TFTP",
                    OSI_STACK_SIZE,
                    NULL,
                    1,
                    NULL );
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    //
    // Start the task scheduler
    //
    osi_start();
    return 0;
}
Exemplo n.º 15
0
//****************************************************************************
//							MAIN FUNCTION
//****************************************************************************
void main() {
	
	//
	// Board Initialization
	//
	BoardInit();

	//
	// Pinmux for UART
	//
	PinMuxConfig();

#ifndef NOTERM
	//
	// Configuring UART
	//
	InitTerm();
	
    //
    // Display Application Banner
    //
    DisplayBanner(APP_NAME);
#endif

    //
    // Enable and configure DMA
    //
    UDMAInit();

    //
    // Start the SimpleLink Host
    //
    VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
    //
    // Start the HttpServer Task
    //
    //

    osi_TaskCreate(HttpServerAppTask,
                    "WebSocketApp",
                        OSI_STACK_SIZE,
                        NULL,
                        HTTP_SERVER_APP_TASK_PRIORITY,
                        NULL );

    UART_PRINT("HttpServerApp Initialized \n\r");

    //
    // Start the task scheduler
    //
    osi_start();

	return;
}
Exemplo n.º 16
0
static void
StartApplication (void)
{
    mainFrm = 0;
    pen_down = false;
    selected_robot = 0;
    MemSet (&game, sizeof (Game), '\0');
    Restore ();
    BoardInit ();
    DamageBoard ();
}
Exemplo n.º 17
0
int main(void)
{
    long lRetVal = -1;

    //
    // initialize board configurations
    //
    BoardInit();

    //
    // Pinmux GPIO for LEDs
    //
    PinMuxConfig();

#ifndef NOTERM
    //
    // Configuring UART
    //
    InitTerm();
#endif

    //
    // Configure LEDs
    //
    GPIO_IF_LedConfigure(LED1|LED2|LED3);

    GPIO_IF_LedOff(MCU_ALL_LED_IND);

    //
    // Simplelinkspawntask
    //
    lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    lRetVal = osi_TaskCreate(XmppClient, (const signed char*)"XmppClient",\
                                OSI_STACK_SIZE, NULL, 1, NULL );
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    osi_start();

    while(1)
    {

    }

}
Exemplo n.º 18
0
//****************************************************************************
//
//! Main function
//!
//! \param none
//! 
//! This function  
//!    1. Invokes the SLHost task
//!    2. Invokes the LPDSTCPServerTask
//!
//! \return None.
//
//****************************************************************************
void main()
{
    long lRetVal = -1;

    //
    // Initialize the board
    //
    BoardInit();

    //
    // Configure the pinmux settings for the peripherals exercised
    //
    PinMuxConfig();

#ifndef NOTERM
    //
    // Configuring UART
    //
    InitTerm();
    ClearTerm();
#endif

    //
    // Start the SimpleLink Host
    //
    lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    //
    // Start the TCPServer task
    //
    lRetVal = osi_TaskCreate(TCPServerTask,
                    (const signed char *)"DeepSleep TCP",
                    OSI_STACK_SIZE, 
                    NULL, 
                    1, 
                    NULL );
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    //
    // Start the task scheduler
    //
    osi_start();
}
Exemplo n.º 19
0
//*****************************************************************************
//
//! Main 
//!
//! \param  none
//!
//! \return 0
//!
//*****************************************************************************
int
main()
{
    //
    // Board Initialisation
    //
    BoardInit();
    //
    // Call the NwpFilter
    //
    NwpFilter(NULL);
    LOOP_FOREVER();
}
Exemplo n.º 20
0
//*****************************************************************************
//
//! Main 
//!
//! \param  none
//!
//! This function
//!    1. Invokes the SLHost task
//!    2. Invokes the MqttClient
//!
//! \return None
//!
//*****************************************************************************
void main()
{ 
    long lRetVal = -1;
    //
    // Initialize the board configurations
    //
    BoardInit();

    //
    // Pinmux for UART
    //
    PinMuxConfig();

    //
    // Configuring UART
    //
    InitTerm();

    //
    // Display Application Banner
    //
    DisplayBanner("MQTT_Client");

    //
    // Start the SimpleLink Host
    //
    lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    //
    // Start the MQTT Client task
    //
    osi_MsgQCreate(&g_PBQueue,"PBQueue",sizeof(event_msg),10);
    lRetVal = osi_TaskCreate(MqttClient,
                            (const signed char *)"Mqtt Client App",
                            OSI_STACK_SIZE, NULL, 2, NULL );

    if(lRetVal < 0)
    {
        ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }
    //
    // Start the task scheduler
    //
    osi_start();
}
Exemplo n.º 21
0
//*****************************************************************************
//
//!    main function demonstrates the use of the timers to generate
//! periodic interrupts.
//!
//! \param  None
//!
//! \return none
//
//*****************************************************************************
int
main(void)
{
    //
    // Initialize board configurations
    BoardInit();
    //
    // Pinmuxing for LEDs
    //
    PinMuxConfig();
    //
    // configure the LED RED and GREEN
    //
    GPIO_IF_LedConfigure(LED1|LED3);

    GPIO_IF_LedOff(MCU_RED_LED_GPIO);
    GPIO_IF_LedOff(MCU_GREEN_LED_GPIO); 

    //
    // Base address for first timer
    //
    g_ulBase = TIMERA0_BASE;
    //
    // Base address for second timer
    //
    g_ulRefBase = TIMERA1_BASE;
    //
    // Configuring the timers
    //
    Timer_IF_Init(PRCM_TIMERA0, g_ulBase, TIMER_CFG_PERIODIC, TIMER_A, 0);
    Timer_IF_Init(PRCM_TIMERA1, g_ulRefBase, TIMER_CFG_PERIODIC, TIMER_A, 0);

    //
    // Setup the interrupts for the timer timeouts.
    //
    Timer_IF_IntSetup(g_ulBase, TIMER_A, TimerBaseIntHandler);
    Timer_IF_IntSetup(g_ulRefBase, TIMER_A, TimerRefIntHandler);

    //
    // Turn on the timers feeding values in mSec
    //
    Timer_IF_Start(g_ulBase, TIMER_A, 500);
    Timer_IF_Start(g_ulRefBase, TIMER_A, 1000);
	
    //
    // Loop forever while the timers run.
    //
    while(FOREVER)
    {
    }
}
Exemplo n.º 22
0
//****************************************************************************
//                            MAIN FUNCTION
//****************************************************************************
void main(void)
{
    int iRetVal;
    //
    // Board Initialisation
    //
    BoardInit();

    //
    // Configure the pinmux settings for the peripherals exercised
    //
    PinMuxConfig();

    //
    // Initialize the platform
    //
    platform_init();

    //
    // Configuring UART
    //
    g_tUartHndl = uart_open(PRCM_UARTA0);

    //
    // Start the SimpleLink Host
    //
    iRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
    if(iRetVal < 0)
    {
        UART_PRINT("could not create simplelink task\n\r");
        LOOP_FOREVER();
    }
    //
    // setting up timer and gpio as source for wake up from HIBERNATE
    //
    iRetVal = osi_TaskCreate(TimerGPIOTask,
                             (const signed char *)"set wk_src for hibernate",
                             OSI_STACK_SIZE, NULL, 1, NULL );
    if(iRetVal < 0)
    {
        UART_PRINT("Task creation failed\n\r");
        LOOP_FOREVER();
    }

    //
    // Start the task scheduler
    //
    osi_start();

}
Exemplo n.º 23
0
// HACK: Should be actually Mos6502Init.
main ()
{
	BoardInit ();

	reactive_link ( "PHI0", 0, phi_worker );
	PeekerAddItem ("PHI0");

	ClocksInit ();
	PredecodeInit ();
	DispatcherInit ();

	reactive_assign ( "PHI0", 0 );

	PeekerFlush ("state.txt");
}
Exemplo n.º 24
0
/*!
 * This is the State Machine of the Demo Application.
 */
void StateMachine(void)
{
	switch (DEMO_SR)
	{
		case DEMO_BOOT:
			BoardInit();
			ENABLE_GLOBAL_INTERRUPTS();
			EZMacPRO_Init();
			/* Wait until device goes to Sleep. */
			WAIT_FLAG_TRUE(fEZMacPRO_StateSleepEntered);
			/* Clear State transition flags. */
			fEZMacPRO_StateWakeUpEntered = 0;
			vP2P_demo_TxInit();			// Point to point demo initialisation.
			DEMO_SR = DEMO_TX;			// Go to TX state.
			break;

		case DEMO_TX:
			// LFT expired, send next packet.
			if (fEZMacPRO_LFTimerExpired)
			{
				fEZMacPRO_LFTimerExpired = 0;
				// Send packet then place the radio to sleep.
				vP2P_demo_SendPacketGoToSleep();
				DEMO_SR = DEMO_TX_WF_ACK;	// Go to TX wait for acknowledgement state.
			}
			break;

		case DEMO_TX_WF_ACK:
			// Auto-acknowledgement has arrived.
			if (fEZMacPRO_PacketSent)
			{
				fEZMacPRO_PacketSent = 0;
				LED1_TOGGLE();
				DEMO_SR = DEMO_TX;			// Go to TX state.
			}

			// Auto-acknowledgement has not arrived.
			if (fEZMacPRO_AckTimeout)
			{
				fEZMacPRO_AckTimeout = 0;
				DEMO_SR = DEMO_TX;			// Go to TX state.
			}
			break;

		default:
			break;
	}
}
Exemplo n.º 25
0
//****************************************************************************
//
//! Main function invoking the sleep and deepsleep functionality
//!
//! \param none
//! 
//! This function  
//!    1. Invokes the API that implements Sleep followed by wakeup using WDT
//!    2. Invokes the API that implements DeepSleep followed by wakeup 
//!       using WDT
//!    3. Invokes the API that implements Sleep followed by wakeup using GPT
//!    4. Invokes the API that implements DeepSleep followed by wakeup 
//!       using GPT
//!
//! \return None.
//
//****************************************************************************
void main()
{
    //
    // Initialize the MCU
    //
    BoardInit();
    
    //
    // Configure the pinmux settings for the peripherals exercised
    //
    PinMuxConfig();
    
    //
    // Initialze the UART
    //
    InitTerm();

    DisplayBanner(APP_NAME);
    
    DBG_PRINT("SLEEP_DEEPSLEEP: Test Begin\n\r");
    
    //
    // Sleep followed by wakeup using WDT
    //
    PerformPRCMSleepWDTWakeup();
    
    //
    // DeepSleep followed by wakeup using WDT
    //
    PerformPRCMDeepSleepWDTWakeup();
    
    //
    // Sleep followed by wakeup using GPT
    //
    PerformPRCMSleepGPTWakeup();
    
    //
    // DeepSleep followed by wakeup using GPT
    //
    PerformPRCMDeepSleepGPTWakeup();
    
    DBG_PRINT("SLEEP_DEEPSLEEP: Test Complete\n\r");

    //
    // Done. Loop here
    //
    while(1);
}
Exemplo n.º 26
0
//****************************************************************************
//
//! Main function
//!
//! \param none
//! 
//! This function  
//!    1. Configures the GPIOA1 and A2 interrupt.
//!
//! \return None.
//
//****************************************************************************
int main() {
	//
	// Initialize Board configurations
	//
	BoardInit();

	//
	// Power on the corresponding GPIO port B for 9,10,11.
	// Set up the GPIO lines to mode 0 (GPIO)
	//
	PinMuxConfig();

	//
	// Configure the GPIO13 - SW2 interrupt
	//
	MAP_GPIOIntRegister(GPIOA1_BASE, GPIOA1IntHandler);
	MAP_GPIOIntTypeSet(GPIOA1_BASE, GPIO_PIN_5, GPIO_RISING_EDGE);

	//
	// Configure the GPIO22 interrupt
	//
	MAP_GPIOIntRegister(GPIOA2_BASE, GPIOA2IntHandler);
	MAP_GPIOIntTypeSet(GPIOA2_BASE, GPIO_PIN_6, GPIO_RISING_EDGE);

	//
	// Enable GPIO13 Interrupt
	//
	MAP_GPIOIntClear(GPIOA1_BASE, GPIO_PIN_5);
	MAP_IntPendClear(INT_GPIOA1);
	MAP_IntEnable(INT_GPIOA1);
	MAP_GPIOIntEnable(GPIOA1_BASE, GPIO_PIN_5);

	//
	// Enable GPIO22 Interrupt
	//
	MAP_GPIOIntClear(GPIOA2_BASE, GPIO_PIN_6);
	MAP_IntPendClear(INT_GPIOA2);
	MAP_IntEnable(INT_GPIOA2);
	MAP_GPIOIntEnable(GPIOA2_BASE, GPIO_PIN_6);

	//
	// Infinite loop. All processing happens now in the interrupt handler.
	while (1) {

	}

	return 0;
}
Exemplo n.º 27
0
void platform_init(void)
{
	long lRetVal;

    //
    // Board Initialization
    //
    BoardInit();

    //
    // configure the GPIO pins for LEDs,UART
    //
    PinMuxConfig();

    //
    // Configure the UART
    //
#ifndef NOTERM
    InitTerm();

    ClearTerm();
#endif  //NOTERM

    my_logger_init(logger_writer);

    //
    // Start the SimpleLink Host
    //
    lRetVal = VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);
    ASSERT(lRetVal >= 0);

    //
    // Start the IoTKit runloop task
    //
    lRetVal = osi_TaskCreate(application_main, (const signed char*)"appmain",
    						MAIN_TASK_STACK_SIZE, NULL, MAIN_TASK_PRIORITY, NULL);
    ASSERT(lRetVal >= 0);

    UDMAInit();
    _platform_spi_init();

    //
    // Start the task scheduler
    //
    osi_start();

}
Exemplo n.º 28
0
//*****************************************************************************
//                            MAIN FUNCTION
//*****************************************************************************
void main() {
	//
	// Board Initialization
	//
	BoardInit();

	//
	// configure the GPIO pins for LEDs,UART
	//
	PinMuxConfig();

	//
	// Configure the UART
	//
#ifndef NOTERM
	InitTerm();
#endif  //NOTERM
	//
	// Display Application Banner
	//
	DisplayBanner(APPLICATION_NAME);

	//
	// Configure all 3 LEDs
	//
	GPIO_IF_LedConfigure(LED1 | LED2 | LED3);

	// switch off all LEDs
	GPIO_IF_LedOff(MCU_ALL_LED_IND);

	FileTest();

	/*//
	 // Start the SimpleLink Host
	 //
	 VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);

	 //
	 // Start the WlanStationMode task
	 //
	 osi_TaskCreate( WlanStationMode, (const signed char*)"Wlan Station Task",
	 OSI_STACK_SIZE, NULL, 1, NULL );
	 //
	 // Start the task scheduler
	 //
	 osi_start();*/
}
Exemplo n.º 29
0
Arquivo: init.c Projeto: dtbinh/M2
void _start() {
    BoardEarlyInit();
    cpu_early_init();

    BoardConsoleInit();
    BoardConsolePuts("\n\n================\nuC-sdk - booting\n================\n");

    libc_init();

    BoardInit();
    cpu_init();

    BoardLateInit();
    cpu_late_init();

    exit(main(0, NULL, NULL));
}
Exemplo n.º 30
0
int main(void) {
    SystemInit();
    GLCD_Init();
    GLCD_Clear(Black);
		GLCD_SetTextColor(Red);
		GLCD_SetBackColor(Black);
		__enable_irq();
	
		GLCD_DisplayString(1, 1, 1, "Status: ");
		GLCD_DisplayString(1, 9, 1, "START");
		GLCD_DisplayString(4, 5, 1, "TIMER");
		BoardInit();
	
		hwInterrupt(min_to_run * ms_in_min);
		GLCD_DisplayString(1, 9, 1, "END  ");
    return 0;
}