Пример #1
0
void main(void)
{
extern void HardwareSetup( void );

	/* Renesas provided CPU configuration routine.  The clocks are configured in
	here. */
	HardwareSetup();

	/* Create the queue. */
	xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );

	if( xQueue != NULL )
	{
		/* Start the two tasks as described at the top of this file. */
		xTaskCreate( prvQueueReceiveTask, "Rx", configMINIMAL_STACK_SIZE, NULL, configQUEUE_RECEIVE_TASK_PRIORITY, NULL );
		xTaskCreate( prvQueueSendTask, "TX", configMINIMAL_STACK_SIZE, NULL, configQUEUE_SEND_TASK_PRIORITY, NULL );

		/* Start the tasks running. */
		vTaskStartScheduler();
	}

	/* If all is well we will never reach here as the scheduler will now be
	running.  If we do reach here then it is likely that there was insufficient
	heap available for the idle task to be created. */
	for( ;; );
}
void PowerON_Reset_PC(void)
{
#ifdef __RXV2
    set_extb(__sectop("EXCEPTVECT"));
#endif
    set_intb(__sectop("C$VECT"));

#ifdef __ROZ                        /* Initialize FPSW */
#define _ROUND 0x00000001           /* Let FPSW RMbits=01 (round to zero) */
#else
#define _ROUND 0x00000000           /* Let FPSW RMbits=00 (round to nearest) */
#endif
#ifdef __DOFF
#define _DENOM 0x00000100           /* Let FPSW DNbit=1 (denormal as zero) */
#else
#define _DENOM 0x00000000           /* Let FPSW DNbit=0 (denormal as is) */
#endif

    set_fpsw(FPSW_init | _ROUND | _DENOM);

    _INITSCT();                     /* Initialize Sections */
    HardwareSetup();                /* Use Hardware Setup */
    nop();
    set_psw(PSW_init);              /* Set Ubit & Ibit for PSW */
    main();
    brk();
}
Пример #3
0
void PowerON_Reset_PC(void)
{
    /* ==== VBR setting ==== */
    set_vbr((void *)((char *)&INT_Vectors - INT_OFFSET));


    /* ==== HardwareSetup Function ==== */
    HardwareSetup();                /* Use Hardware Setup */

    /* ==== B and D sections initialization ==== */
#ifdef COPY_SECTION_P
    ProgCopy();
#endif

    _INITSCT();


    /* ==== Status Register setting ==== */
    set_cr(SR_Init);

    /* ==== Main function call ==== */
    main();

    /* ==== Sleep instruction execute ==== */
    sleep();
}
Пример #4
0
/******************************************************************************
* Outline       : PowerON_Reset_PC
* Description   : This program is the MCU's entry point from a power-on reset.
*                 The function configures the MCU stack, then calls the
*                 HardwareSetup function and main function sequentially.
* Argument      : none
* Return value  : none
******************************************************************************/
void PowerON_Reset_PC(void)
{
    /* Initialise the MCU processor word */
#if __RENESAS_VERSION__ >= 0x01010000    
    set_intb((void *)__sectop("C$VECT"));
#else
    set_intb((unsigned long)__sectop("C$VECT"));
#endif    
    set_fpsw(FPSW_init);

    /* Initialise the MCU stack area */
    _INITSCT();

    /* Configure the MCU and YRDK hardware */
    HardwareSetup();

    /* Change the MCU's usermode from supervisor to user */        
    nop();
    set_psw(PSW_init);      
    Change_PSW_PM_to_UserMode();

    /* Call the main program function */
    main();

    /* Invoke a break interrupt */
    brk();
}
Пример #5
0
void PowerON_Reset(void)
{
    set_intb(__sectop("C$VECT"));

    _INITSCT();                     /* Initialize Sections */
    HardwareSetup();                /* Use Hardware Setup */
    nop();
    set_psw(PSW_init);              /* Set Ubit & Ibit for PSW */
    main();
    brk();
}
Пример #6
0
int main(void)
{
extern void HardwareSetup( void );

	/* Renesas provided CPU configuration routine.  The clocks are configured in
	here. */
	HardwareSetup();

	/* Turn all LEDs off. */
	vParTestInitialise();

	/* Start the reg test tasks which test the context switching mechanism. */
	xTaskCreate( prvRegTest1Task, "RegTst1", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_1_PARAMETER, tskIDLE_PRIORITY, NULL );
	xTaskCreate( prvRegTest2Task, "RegTst2", configMINIMAL_STACK_SIZE, ( void * ) mainREG_TEST_2_PARAMETER, tskIDLE_PRIORITY, NULL );

	/* The web server task. */
	xTaskCreate( vuIP_Task, "uIP", mainuIP_STACK_SIZE, NULL, mainuIP_TASK_PRIORITY, NULL );

	/* Start the check task as described at the top of this file. */
	xTaskCreate( prvCheckTask, "Check", configMINIMAL_STACK_SIZE, NULL, mainCHECK_TASK_PRIORITY, NULL );

	/* Create the standard demo tasks. */
	vStartBlockingQueueTasks( mainBLOCK_Q_PRIORITY );
	vCreateBlockTimeTasks();
	vStartSemaphoreTasks( mainSEM_TEST_PRIORITY );
	vStartPolledQueueTasks( mainQUEUE_POLL_PRIORITY );
	vStartIntegerMathTasks( mainINTEGER_TASK_PRIORITY );
	vStartGenericQueueTasks( mainGEN_QUEUE_TASK_PRIORITY );
	vStartLEDFlashTasks( mainFLASH_TASK_PRIORITY );
	vStartQueuePeekTasks();
	vStartRecursiveMutexTasks();
	vStartInterruptQueueTasks();
	vStartMathTasks( mainFLOP_TASK_PRIORITY );

	/* The suicide tasks must be created last as they need to know how many
	tasks were running prior to their creation in order to ascertain whether
	or not the correct/expected number of tasks are running at any given time. */
	vCreateSuicidalTasks( mainCREATOR_TASK_PRIORITY );

	/* Start the tasks running. */
	vTaskStartScheduler();

	/* If all is well we will never reach here as the scheduler will now be
	running.  If we do reach here then it is likely that there was insufficient
	heap available for the idle task to be created. */
	for( ;; );
	
	return 0;
}
Пример #7
0
void Init_SmartNavi()
{

	HardwareSetup();
	R_TMR_CreateOneShot(PDL_TMR_UNIT0,PDL_TMR_OUTPUT_OFF,1,tick_flag,4);
    R_INTC_CreateExtInterrupt(PDL_INTC_IRQ5,PDL_INTC_LOW ,Pen_flag,1); 		
		
	
	//	sendtoRTC();
	    Init_ADS7843();
		#ifdef GpsOn
	    getPos();
		#endif
		tone(1);
    	font_index();
    	font_index1();
    	LcdInit();
		LcdClear();
	    Gsm_State();		//initialize variable
		Init_Sim900();

}
Пример #8
0
__entry(vect=0) void PowerON_Reset(void)
{ 
	 set_imask_ccr(1);
	_INITSCT();

//	_CALL_INIT();					// Remove the comment when you use global class object

//	_INIT_IOLIB();					// Remove the comment when you use SIM I/O

//	errno=0;						// Remove the comment when you use errno
//	srand(1);						// Remove the comment when you use rand()
//	_s1ptr=NULL;					// Remove the comment when you use strtok()
		
	HardwareSetup();				// Remove the comment when you use Hardware Setup
	set_imask_ccr(0);

	main();

//	_CLOSEALL();					// Remove the comment when you use SIM I/O

//	_CALL_END();					// Remove the comment when you use global class object
	
	sleep();
}
Пример #9
0
int  main(void)
{
    AppMode_T AppMode; APP_STATE_E state=UPDATE_TEMPERATURE; 
    char LCDString[30], temp_char[2]; uint16_t temp; float ftemp;
  
    HardwareSetup();

    /************************initializa LCD module********************************/
    SPI2_Init();
    InitialiseLCD();
    led_init();
    MSTimerInit();

    /* Default app mode */
    AppMode = GAINSPAN_DEMO;
    
    /* If the CIK is exist, auto into the Exosite mode */
    NVSettingsLoad(&GNV_Setting);
    
    /* Determine if SW1 & SW3 is pressed at power up to enter programming mode */
    if (Switch1IsPressed() && Switch3IsPressed()) {
         AppMode = PROGRAM_MODE;
    }
    else if(Switch3IsPressed() && Switch2IsPressed())
    {
         AppMode = EXOSITE_ERASE;
    }
    else if(Switch1IsPressed())
    {
        AppMode = RUN_EXOSITE;
    }
    else if(Switch2IsPressed())
    {
        AppMode = RUN_PROVISIONING;
    }
    else if(Switch3IsPressed())
    {
        AppMode = RUN_OVER_AIR_DOWNLOAD;
    }
    
    if(AppMode == GAINSPAN_DEMO) {
        LCDDisplayLogo();
        LCDSelectFont(FONT_SMALL);
        DisplayLCD(LCD_LINE3, "RL78G14 RDK    V2.0");
        DisplayLCD(LCD_LINE4, "   Wi-Fi & Cloud   ");
        DisplayLCD(LCD_LINE5, "     demos by:     ");
        DisplayLCD(LCD_LINE6, "Gainspan           ");
        DisplayLCD(LCD_LINE7, "Exosite            ");
        DisplayLCD(LCD_LINE8, "Future Designs, Inc");
        MSTimerDelay(3500);
        ClearLCD();
        DisplayLCD(LCD_LINE1, "Demo Modes:        ");
        DisplayLCD(LCD_LINE2, "-RST no key:       ");
        DisplayLCD(LCD_LINE3, "   GS Web Server   ");
        DisplayLCD(LCD_LINE4, "-RST + SW1:        ");
        DisplayLCD(LCD_LINE5, "   Exosite Cloud   ");
        DisplayLCD(LCD_LINE6, "-RST + SW2:        ");
        DisplayLCD(LCD_LINE7, "   AP Provisioning ");
        DisplayLCD(LCD_LINE8, "-RST + SW3: OTA    ");
        MSTimerDelay(3000);
        ClearLCD();
        
        LCDSelectFont(FONT_LARGE);
        if(Exosite_GetCIK(NULL))
        {
          AppMode = RUN_EXOSITE;
        }
    }
    
    DisplayLCD(LCD_LINE1, "Starting..."); 
    /*****************************************************************************/  
    SPI_Init(GAINSPAN_SPI_RATE);  
   /* Setup LCD SPI channel for Chip Select P10, active low, active per byte  */
    SPI_ChannelSetup(GAINSPAN_SPI_CHANNEL, false, true);
    GainSpan_SPI_Start();

    PM15 &= ~(1 << 2);
    P15 &= ~(1 << 2);
    
    if(AppMode == PROGRAM_MODE) {
        App_ProgramMode();
    }
    else if (AppMode == RUN_EXOSITE)
    {          
        DisplayLCD(LCD_LINE1, " CLOUD DEMO ");
        Temperature_Init();
        Potentiometer_Init();  
        App_Exosite();
    }
    else if(AppMode == RUN_PROVISIONING)
    {
      App_WebProvisioning();
    }
     else if(AppMode == RUN_OVER_AIR_DOWNLOAD)
    {
       App_OverTheAirProgrammingPushMetheod();
    }
    else if (AppMode == EXOSITE_ERASE)
    {
       ClearLCD();
       LCDSelectFont(FONT_SMALL);
       DisplayLCD(LCD_LINE3, "EEPROM ERASING ... ");
       MSTimerDelay(2000);
       Exosite_Init("renesas", "rl78g14", IF_WIFI, 1);
       DisplayLCD(LCD_LINE3, "                   ");
       DisplayLCD(LCD_LINE4, "Please reset device");
       while(1);
    }
    else{
        UART0_Start(GAINSPAN_CONSOLE_BAUD);
       // UART2_Start(GAINSPAN_UART_BAUD);
 
        Temperature_Init();
        Potentiometer_Init();
    
       // sprintf(LCDString, "RDK Demo %s", VERSION_TEXT);
       // DisplayLCD(LCD_LINE1, (const uint8_t *)LCDString);
   
        /* Before doing any tests or apps, startup the module */
        /* and nonvolatile stettings */
        App_Startup();
        // Now connect to the system
        //App_Connect(&G_nvsettings.webprov);
     
       //  App_PassThroughSPI();
         
         /******************Start Processing Sensor data******************/
         
         uint32_t start = MSTimerGet();  uint8_t c;
         Accelerometer_Init();
         while(1) 
         { 
          // if (GainSpan_SPI_ReceiveByte(GAINSPAN_SPI_CHANNEL, &c)) 
           if(App_Read(&c, 1, 0)) 
             AtLibGs_ReceiveDataProcess(c);
                   
        /* Timeout? */
           if (MSTimerDelta(start) >= 100)     // every 100 ms, read sensor data
           {  
              led_task();
              switch(state)
              {              
                case UPDATE_TEMPERATURE:         
                // Temperature sensor reading
                  temp = Temperature_Get();
#if 0                 
                   // Get the temperature and show it on the LCD
                  temp_char[0] = (int16_t)temp / 16;
                  temp_char[1] = (int16_t)((temp & 0x000F) * 10) / 16;
#endif 
                  temp_char[1] = (temp & 0xFF00)>>8;
                  temp_char[0] = temp & 0xFF;
                  
                  ftemp = *(uint16_t *)temp_char;
                  
                  gTemp_F = ((ftemp/5)*9)/128 + 22;
              
                  // Display the contents of lcd_buffer onto the debug LCD 
                  //sprintf((char *)LCDString, "TEMP: %d.%d C", temp_char[0], temp_char[1]);
                  sprintf((char *)LCDString, "TEMP: %.1fF", gTemp_F);
                  DisplayLCD(LCD_LINE6, (const uint8_t *)LCDString);  
                  state = UPDATE_LIGHT;
                break;
                
                case UPDATE_LIGHT:
                 // Light sensor reading
                  gAmbientLight = LightSensor_Get();
                    // Display the contents of lcd_buffer onto the debug LCD 
                  sprintf((char *)LCDString, "Light: %d ", gAmbientLight);
                  DisplayLCD(LCD_LINE7, (const uint8_t *)LCDString);
                  state = UPDATE_ACCELEROMETER;
                break;
                
                case UPDATE_ACCELEROMETER: 
                 // 3-axis accelerometer reading
                  Accelerometer_Get();
                  sprintf((char *)LCDString, "x%2d y%2d z%2d", gAccData[0], gAccData[1], gAccData[2]);
                  DisplayLCD(LCD_LINE8, (const uint8_t *)LCDString); 
                  state = UPDATE_TEMPERATURE;
                break;
              }
              start = MSTimerGet();
           }
         }          
    }    
Пример #10
0
int main(void)
{
    AppMode_T AppMode;
    WDTIMK = 0U;	/* enable INTWDTI interrupt */
   
    
    HardwareSetup();
    MSTimerInit();
    
    /************************initializa LCD module********************************/
    SPI2_Init();
    InitialiseLCD();
    led_init();
    
    /* Default app mode */
    AppMode = RUN_EXOSITE;

    /* Determine if SW1 & SW3 is pressed at power up to enter nvm erase mode */
    if (Switch1IsPressed() && Switch3IsPressed())
    {

        DisplayLCD(LCD_LINE1, "*NVM ERASED*");
        DisplayLCD(LCD_LINE2, "Reboot      ");
        DisplayLCD(LCD_LINE3, "  Device    ");
        while(1)
        {
            // wait here
        }
    }
    else if(Switch1IsPressed())
    {
        AppMode = ACTIVATE_MODEM;
    }
    
    DisplayLCD(LCD_LINE1, "Initializing");
    DisplayLCD(LCD_LINE2, "  Novatel   ");
    DisplayLCD(LCD_LINE3, "   Modem    ");
        
    // reset the modem
    P8 &= ~(1<<POWER_OFF_PIN); //SET LOW
    PM8 &= ~(1<<POWER_OFF_PIN); //SET AS OUTPUT
    P8 |= (1<<POWER_OFF_PIN);  //SET HIGH
    MSTimerDelay(500); //pulse
    P8 &= ~(1<<POWER_OFF_PIN); //SET LOW


    // pulse the phone pin as well
    ADPC = 0x09U;   //DEFAULT is all AINx pins are Analog, change 8-15
                    // to digital
    P15 &= ~(1<<MODEM_PHON_PIN); //SET LOW
    PM15 &= ~(1<<MODEM_PHON_PIN); //SET AS OUTPUT
    P15 |= (1<<MODEM_PHON_PIN);  //SET HIGH
    MSTimerDelay(500); //pulse
    P15 &= ~(1<<MODEM_PHON_PIN); //SET LOW
    PM15 |= (1<<MODEM_PHON_PIN); //SET AS INPUT
    
    // wait for modem to power up
    DisplayLCD(LCD_LINE1, "Waiting for ");
    DisplayLCD(LCD_LINE2, "  Modem to  ");
    DisplayLCD(LCD_LINE3, " Initialize ");
    DisplayLCD(LCD_LINE4, "      3     ");
    MSTimerDelay(1000);
    DisplayLCD(LCD_LINE4, "      2     ");
    MSTimerDelay(1000);
    DisplayLCD(LCD_LINE4, "      1     ");
    MSTimerDelay(1000);
    DisplayLCD(LCD_LINE4, "");
    // Start UART0 for Novatel modem
    UART0_Start(NOVATEL_UART_BAUD_RATE);

   

    /* If the CIK is exist, auto into the Exosite mode */
    NVSettingsLoad(&GNV_Setting);
    
    
   

    if(AppMode == RUN_EXOSITE)
    {
        LCDDisplayLogo();
        LCDSelectFont(FONT_SMALL);
        DisplayLCD(LCD_LINE3, "RL78G14 RDK    V2.0");
        DisplayLCD(LCD_LINE4, "   Cellular        ");
        DisplayLCD(LCD_LINE5, "     demos by:     ");
        DisplayLCD(LCD_LINE6, "Novatel            ");
        DisplayLCD(LCD_LINE7, "Exosite            ");
        MSTimerDelay(3500);
        ClearLCD();
        DisplayLCD(LCD_LINE1, "Demo Modes:        ");
        DisplayLCD(LCD_LINE2, "-RST no key:       ");
        DisplayLCD(LCD_LINE3, "   ExoSite App     ");
        DisplayLCD(LCD_LINE4, "-RST + SW1 & SW3:  ");
        DisplayLCD(LCD_LINE5, "   Reset NVM       ");
        DisplayLCD(LCD_LINE6, "-RST + SW1:        ");
        DisplayLCD(LCD_LINE7, "   Cell Activate   ");
        MSTimerDelay(3000);
        ClearLCD();

        LCDSelectFont(FONT_LARGE);
        DisplayLCD(LCD_LINE1, "Exosite DEMO");
        
        Temperature_Init();
        Potentiometer_Init();
        
        App_Exosite();
    }
    else if (AppMode == ACTIVATE_MODEM)
    {
        ATModem_CellActivate();
    }

   

    return 0;
}