Example #1
0
/*
** Main Function.
*/
int main(void)
{
    unsigned char choice = 0;

    /* Enable the clocks for McSPI0 module.*/
    McSPI0ModuleClkConfig();

    /* Perform Pin-Muxing for SPI0 Instance.*/
    McSPIPinMuxSetup(0);

    /* Perform Pin-Muxing for CS0 of SPI0 Instance.*/
    McSPI0CSPinMuxSetup(MCSPI_CH_NUM);

    /* Initialize the UART utility functions.*/
    UARTStdioInit();

    /* Enable IRQ in CPSR.*/
    IntMasterIRQEnable();

    UARTPuts("Here the McSPI controller on the SOC communicates with ",-1);
    UARTPuts("the McSPI Flash.\r\n\r\n",-1);

    /* Initialize the EDMA3 instance.*/
    EDMA3Initialize();

    /* Request EDMA3CC for Tx and Rx channels for SPI0. */
    RequestEDMA3Channels();

    /* Set up the McSPI instance.*/
    McSPISetUp();

    /* Enable the SPI Flash for writing to it. */
    WriteEnable();

    UARTPuts("Do you want to erase a sector of the flash before writing to it ?.", -1);
    UARTPuts("\r\nInput y(Y)/n(N) to proceed.\r\n", -1);

    choice = UARTGetc();
    UARTPutc(choice);

    if(('y' == choice) || ('Y' == choice))
    {
        /* Erasing the specified sector of SPI Flash. */
        FlashSectorErase();
    }

    /* Enable the SPI Flash for writing to it. */
    WriteEnable();

    /* Write data of 1 page size into a page of Flash.*/
    FlashPageProgram();

    /* Read data of 1 page size from a page of flash.*/
    ReadFromFlash();

    /* Verify the data written to and read from Flash are same or not.*/
    VerifyData();

    while(1);
}
Example #2
0
static void ReadTouchScreenPress(void)
{
   int xDpos;
   int yDpos;
   POINT stDisplayPoint;

   POINT stTouchScreenPoint;
   do {
              if(IsTSPress) 
              {  
                   IsTSPress = 0;                 
 		   stTouchScreenPoint.x = x_val[0];
		   stTouchScreenPoint.y = y_val[0];
		   getDisplayPoint(&stDisplayPoint, &stTouchScreenPoint, &stMatrix);
                
                   xDpos = stDisplayPoint.x;

                   xDpos = LCD_WIDTH - xDpos;

                   if(xDpos < 0)
                   {
                        xDpos = 0;
                   }

                   if(xDpos > LCD_WIDTH)
                   {
                        xDpos = LCD_WIDTH;
                   }

                   UARTPuts("xDpos=",-1);

                   UARTPutNum(xDpos);

                   yDpos = stDisplayPoint.y;

                   yDpos = LCD_HEIGHT - yDpos;

                   if(yDpos < 0)
                   {
                        yDpos = 0;
                   }

                   if(yDpos > LCD_HEIGHT)
                   {
                        yDpos = LCD_HEIGHT;
                   }
                   
                   UARTPuts("yDpos=",-1);

                   UARTPutNum(yDpos);

                   UARTPuts("\r\n", -1);
                  
                 }
    } while (1);
}
Example #3
0
File: rmpi.c Project: vastsoun/bbmc
int 
cmnd_rmpi_si_func(bbmc_cmd_args_t *args)
{
    int dof_id = args->arg_int[0];
    int ret;
    int i;
    
    rmpi_contrl.traject_func  = traject_rmpi_si;
    rmpi_contrl.contrl_func   = contrl_rmpi_si;
    rmpi_contrl.term_func     = term_rmpi_si;
    
    #ifdef INPUT_QEP_DUAL
        rmpi_io.input_func = input_qei_dual;
    #endif
    #ifdef INPUT_QEP_STD
        rmpi_io.input_func = input_qei_std;
    #endif
    #ifdef INPUT_QEP_CAP
        rmpi_io.input_func = input_qei_cap;
    #endif  
    #ifdef OUTPUT_PWM_DIFF
        rmpi_io.output_func = output_pwm_dif;
    #endif
    #ifdef OUTPUT_PWM_DIR
        rmpi_io.output_func = output_pwm_dir;
    #endif
    
    for(i = 0; i < args->arg_uint[1]; i++)
    {
        //!
        g_flags.datalog = 1;
        g_flags.exec_checkpoint = 1;
        
        bbmc_sysflags_clear(&g_flags, "-isr");
        
        ret = func_rmpi(dof_id);
        
        //!
        g_flags.datalog = 0;
        
        ret = bbmc_goto_home();
        
        if (ret != (RETURN_GOTO + ISR_RETURN_CLEAN))
        {
            return ret;
        }
    }
    
    UARTPuts("\r\nRMPI::SI has completed.\r\n", -1);
    
    UARTPuts("\r\nReturning to BBMC-CLI.\r\n", -1);
    return (RETURN_RMPI + RETURN_RMPI_SI);
}
Example #4
0
/*
** Read config info from SD card files
*/
void configRead()
{
    FIL fileObj;
    FRESULT fresult;
    char data[ 32 ];
    unsigned short bytesRead = 0;
    unsigned int i;

    // Open and read the IP Address file
    fresult = f_open( &fileObj, "ipaddr", FA_READ );

    if( fresult != FR_OK )
    {
        return;
    }

    fresult = f_read( &fileObj, data, 8, &bytesRead );
 
    if( fresult != FR_OK )
    {
        UARTPuts( "Couldn't read ipaddr file... Using Dynamic IP", -1 );
        IPAddress = 0;
        f_close( &fileObj );
        return;
    }

    data[ bytesRead ] = 0;

    UARTPuts( "IP Addr File: Using 0x", -1 );
    UARTPuts( data, -1 );
    UARTPuts( "\n\r", -1 );

    f_close( &fileObj );

    // Decode IP Address
    for( i = 0; i < 8; ++i )
    {
        if( data[ i ] >= '0' && data[ i ] <= '9' )
        {
            data[ i ] -= 0x30;
        }
        else if( data[ i ] >= 'A' && data[ i ] <= 'F' )
        {
            data[ i ] -= 0x37;
        }
        else if( data[ i ] >= 'a' && data[ i ] <= 'f' )
        {
            data[ i ] -= 0x57;
        }

        IPAddress += (unsigned int)(data[ i ]) << ( 28 - i * 4 );
    }
}
Example #5
0
File: rmpi.c Project: vastsoun/bbmc
int 
cmnd_rmpi_si(int argc, char *argv[], bbmc_cmd_args_t *args)
{
    static char *rmpi_goto_format = 
    "\r\nReset to starting position? [Y/n]: ";
    
    static char *rmpi_si_format = 
    "\r\nProceed with System Identification procedure? [Y/n]: ";
    
    char buff[RX_BUFF_SIZE];
    int ret;
    
    args->arg_int[0] = atoi(argv[2]);
    
    if ((args->arg_int[0] < 0) || (args->arg_int[0] > BBMC_DOF_NUM))
    {
        UARTPuts("\r\nerror: cmd_rmpi_si: invalid DOF-id.", -1);
        return (RETURN_ERROR_INVALID_ARG);
    }
    
    ret = cmnd_rmpi_si_args(argc, argv, args);
    
    if (ret < 0)
    {
        return ret;
    }
    
    /*ret = util_checkpoint_yn(rmpi_goto_format, buff);
    
    if (ret == 1)
    {
        ret = bbmc_goto_home();
        
        if (ret != (RETURN_GOTO + ISR_RETURN_CLEAN))
        {
            return ret;
        }
    }*/
    
    g_flags.contrl_run = util_checkpoint_yn(rmpi_si_format, buff);
    
    if (g_flags.contrl_run == 1)
    {
        UARTPuts("\r\nPress any key to start SI procedure...\r\n", -1);
        UARTGets(buff,  2);
        
        return cmnd_rmpi_si_func(args);
    }
    
    UARTPuts("\r\nrmpi: si: procedure has been aborted.\r\n", -1);
    return (RETURN_ERROR_RUN_ABORT);
}
Example #6
0
int main(void)
{
    unsigned int triggerValue = 0;

    /* Setup the MMU and do necessary MMU configurations. */
    MMUConfigAndEnable();

    /* Enable all levels of CACHE. */
    CacheEnable(CACHE_ALL);

    /* Set up the UART2 peripheral */
    UARTStdioInit();

    /* Enable the WDT clocks */
    WatchdogTimer1ModuleClkConfig();

    /* Reset the Watchdog Timer */
    WatchdogTimerReset(SOC_WDT_1_REGS);

    /* Disable the Watchdog timer */
    WatchdogTimerDisable(SOC_WDT_1_REGS);
                                               
    /* Perform the initial settings for the Watchdog Timer */
    WatchdogTimerSetUp();

    /* Send the message to UART console */
    UARTPuts("Program Reset!", -1);
    UARTPuts("Input any key at least once in every 4 seconds to avoid a further reset.\n\r", -1);

    /* Enable the Watchdog Timer */
    WatchdogTimerEnable(SOC_WDT_1_REGS);

    while(1)
    {
        /* Wait for an input through UART. If no input is given, 
        ** the WDT will timeout and reset will occur.
        */
        if(UARTGetc())
        {

            triggerValue += 1;

            /* Write into the trigger register. This will load the value from the 
            ** load register into the counter register and hence timer will start 
            ** from the initial count.
            */
            WatchdogTimerTriggerSet(SOC_WDT_1_REGS, triggerValue);
        }
    }
}
Example #7
0
/*
** DMTimer interrupt service routine.
*/
static void DMTimerIsr(void)
{
    UARTPuts("                Timer ISR Entry.\r\n", -1);

    /* Clear the status of the interrupt flags */
    DMTimerIntStatusClear(SOC_DMTIMER_2_REGS, DMTIMER_INT_OVF_EN_FLAG);

    /* Stop the DMTimer */
    DMTimerDisable(SOC_DMTIMER_2_REGS);

    preemptFlag = 4;

    UARTPuts("                Timer ISR Exit.\r\n", -1);
}
Example #8
0
/*
**  This function will verify the data written to and read from flash and will
**  print the appropriate message.
*/ 
static void VerifyData(void)
{
    unsigned int index = 0;

    for(index = 4; index < 260; index++)
    {
        if(rxBuffer[index] != vrfyData[index - 4])
        {
            UARTPuts("\r\n\r\n", -1);
            UARTPuts("VerifyData: Comparing the data written to and read", -1);
            UARTPuts(" from flash.\r\nThe two data blocks are unequal.", -1);
            UARTPuts(" Mismatch found at index ", -1);
            UARTPutNum((int)index + 1);

            UARTPuts("\r\nThe data in the Flash and the one written ", -1);
            UARTPuts("to it are not equal.\r\n", -1);

            break;
        }
    }
    
    if(260 == index)
    {
        UARTPuts("\r\nThe data in the Flash and the one written ", -1);
        UARTPuts("to it are equal.\r\n", -1);
    }
}
Example #9
0
/*
** DMTimer interrupt service routine.
*/
static void DMTimerIsr(void)
{
    UARTPuts("                Timer ISR Entry.\r\n", -1);

    /* Clear the status of the interrupt flags */
    DMTimerIntStatusClear(TIMER_INST_BASE, DMTIMER_INT_OVF_EN_FLAG);

    /* Stop the DMTimer */
    DMTimerDisable(TIMER_INST_BASE);

    preemptFlag = PREEMPT_FLAG_TIMER_ISR;

    UARTPuts("                Timer ISR Exit.\r\n", -1);
}
Example #10
0
/*
** This is the Interrupt Service Routine(ISR) for RTC.
*/
static void RTCIsr(void)
{
    RTCIntTimerDisable(SOC_RTC_0_REGS);

    UARTPuts("        RTC ISR Entry.\r\n", -1);

    TimerSetupAndEnable();

    preemptFlag = 1;

    /*Wait till any higher priority ISR changes the flag */
    while(1 == preemptFlag);

    UARTPuts("        RTC ISR Exit.\r\n", -1);
}
Example #11
0
/*
** Interrupt Service Routine for UART.
*/
static void UARTIsr(void)
{
    /* Reconfiguring the UART STDIO instance. */
    UARTStdioInit();
    UARTPuts("StarterWare Interrupt Preemption Demonstration.\r\n", -2);

    UARTPuts("UART ISR Entry.\r\n", -1);

    RTCSetupAndEnable();

    /* Wait till any higher priority ISR changes preemptFlag */
    while(PREEMPT_FLAG_DEFAULT == preemptFlag);

    UARTPuts("UART ISR Exit.\r\n", -1);
}
Example #12
0
/*
** This is the Interrupt Service Routine(ISR) for RTC.
*/
static void RTCIsr(void)
{
    RTCIntTimerDisable(RTC_INST_BASE);

    UARTPuts("        RTC ISR Entry.\r\n", -1);

    TimerSetupAndEnable();

    preemptFlag = PREEMPT_FLAG_RTC_ISR;

    /*Wait till any higher priority ISR changes the flag */
    while(PREEMPT_FLAG_RTC_ISR == preemptFlag);

    UARTPuts("        RTC ISR Exit.\r\n", -1);
}
Example #13
0
unsigned int mpeg_idle(mpeg_struct_t *Mpeg_Struct, new_screen* ScreenBuff, FileInfo_t *mpgfile)
{
	if(!Mpeg_Struct) return 0;
	if(!Mpeg_Struct->FrameReady)
	{
		do
		{
		Mpeg_Struct->state = mpeg2_parse(Mpeg_Struct->decoder);
		switch (Mpeg_Struct->state)
		{
			case STATE_BUFFER:
				//size = fread (buffer, 1, _BUFFER_SIZE_, mpgfile);
				Mpeg_Struct->size = read_from_buffer(Mpeg_Struct->buffer, 1, _BUFFER_SIZE_, mpgfile);
				if(!Mpeg_Struct->size) break;
				mpeg2_buffer (Mpeg_Struct->decoder, Mpeg_Struct->buffer, Mpeg_Struct->buffer + Mpeg_Struct->size);
			break;
			case STATE_SEQUENCE:
				mpeg2_convert (Mpeg_Struct->decoder, Mpeg_Struct->mpeg_convert, NULL);
				break;
			case STATE_SLICE:
			case STATE_END:
			case STATE_INVALID_END:
				if (Mpeg_Struct->info->display_fbuf) Mpeg_Struct->FrameReady = 1;
				break;
			default:
				break;
		}
		}while(!Mpeg_Struct->FrameReady && Mpeg_Struct->size);
	}
#ifndef AVR32
	if(Mpeg_Struct->FrameReady == true && (timer_tick(&Mpeg_Struct->FrameDisplay) == true || Mpeg_Struct->EnableFrameLimit == false))
#else
	if(Mpeg_Struct->FrameReady == true)
#endif
	{
		Mpeg_Struct->FrameReady = false;
		/*save_ppm (ScreenBuff, Mpeg_Struct->info->sequence->width, Mpeg_Struct->info->sequence->height,
							Mpeg_Struct->info->display_fbuf->buf[0], Mpeg_Struct->framenum++);*/


		_Fps++;
		//Mpeg_Struct->->info
		if(Mpeg_Struct->info->current_picture->temporal_reference != Mpeg_Struct->temporal_reference)
		{
			Mpeg_Struct->temporal_reference = Mpeg_Struct->info->current_picture->temporal_reference;
			Mpeg_Struct->CallbackDisplayFrame((void*)Mpeg_Struct->CallbackDisplayFrameVariable, Mpeg_Struct->info->display_fbuf->buf[0], 0, 0, Mpeg_Struct->info->sequence->width, Mpeg_Struct->info->sequence->height);
		}
		if(CntToDetermineTheFps != rtcSecUpdate)
		{
			CntToDetermineTheFps = rtcSecUpdate;
			//UARTPuts(DebugCom, "Screen fill capability = ", -1);
			UARTPutNum(DebugCom, _Fps);
			UARTPuts(DebugCom, "Fps\n\r", -1);
	    	_Fps = 0;
		}
	}

	//if(Mpeg_Struct->size == 0) mpeg2_close (Mpeg_Struct->decoder);
	return Mpeg_Struct->size;
}
/**
*\brief This function initializes the MMCSD controller and mounts the device.
*
* \param - none.\n
*
* \return none.\n
*
*/
void HSMMCSDInit(void)
{

    /* Basic controller initializations for MMC_0 MicroSD card */
       HSMMCSDControllerSetup();


    /* Basic controller function for eMMc MMC_1 controller setup*/
    //eMMCControllerSetup();



    /* First check, if card is insterted */
    while(1)
    {

        if (MMCSDCardPresent(&ctrlInfo) == 0)
        {
            UARTPuts("SD Card not found\n\r", -1);
        }
        else
        {
            break;
        }
    }

    /* Initialize the MMCSD controller */
 //   MMCSDCtrlInit(&ctrlInfo);

 //   MMCSDIntEnable(&ctrlInfo);

    HSMMCSDFsMount(0, &sdCard);
}
Example #15
0
int 
global_flags_print (const char *format)
{
    if (sysflags == NULL)
    {
        UARTPuts("\r\nerror: global_flags_print: pointer argument is NULL", -1);
        return -1;
    }
    
    UARTprintf("\r\n%sSystem Flags:\r\n", format);
    UARTprintf("\r\n%sflag        value", format);
    UARTprintf("\r\n%scmdln:         %d", format, g_sysflags.cmdln);
    UARTprintf("\r\n%sdebug:         %d", format, g_sysflags.debug);
    UARTprintf("\r\n%sperf:          %d", format, g_sysflags.perf);
    UARTprintf("\r\n%sdatalog:       %d", format, g_sysflags.datalog);
    UARTprintf("\r\n%scheckpoint:    %d", format, g_sysflags.exec_checkpoint);
    UARTprintf("\r\n%srun:           %d", format, g_sysflags.contrl_run);
    UARTprintf("\r\n%sisr_ret:       %d", format, g_sysflags.isr_return);
    UARTprintf("\r\n%sstop:          %d", format, g_sysflags.stop_immediate);
    
    int i = 0;
    
    for (i = 0; i < BBMC_DOF_NUM; i++)
    {
        UARTprintf("\r\n%spos_reset-%d:   %d", format,(i+1), g_sysflags.gpos_reset[i]);
    }
    
    return 0;
}
Example #16
0
/**
*\brief This function initializes the MMCSD controller and mounts the device.
*
* \param - none.\n
*
* \return none.\n
*
*/
void HSMMCSDInit(void)
{

    /* Basic controller initializations */
    HSMMCSDControllerSetup();

    /* First check, if card is insterted */
    while(1)
    {

        if (MMCSDCardPresent(&ctrlInfo) == 0)
        {
            UARTPuts("MMC/SD Card not found\n\r", -1);
        }
        else
        {
            break;
        }
    }

    /* Initialize the MMCSD controller */
    MMCSDCtrlInit(&ctrlInfo);

    MMCSDIntEnable(&ctrlInfo);

    HSMMCSDFsMount(0, &sdCard);
}
Example #17
0
int 
global_flags_set (system_flag flag)
{
    int i = 0;
    
    /* init appropriately */
    if (flag == ALL)
    {
        g_sysflags.cmdln = 1;
        g_sysflags.debug = 1;
        
        g_sysflags.perf = 1;
        g_sysflags.datalog = 1;
        
        g_sysflags.exec_checkpoint = 1;
        g_sysflags.contrl_run = 1;
        
        g_sysflags.isr_return = 1;
        g_sysflags.stop_immediate = 1;
    
        for (i = 1; i < BBMC_DOF_NUM; i++)
        {
            g_sysflags.gpos_reset[i] = 1;
        }
    }
    
    else if (flag == ISR)
    {
        g_sysflags.isr_return = 1;
        g_sysflags.stop_immediate = 1;
    }
    
    else if (flag == POS_RESET)
    {
        for (i = 0; i < BBMC_DOF_NUM; i++)
        {
            g_sysflags.gpos_reset[i] = 1;
        }
    }
    
    else if (flag == CLI)
    {
        g_sysflags.cmdln = 1;
        g_sysflags.debug = 1;
    }
    
    else if (flag == CMD)
    {
        g_sysflags.exec_checkpoint = 1;
        g_sysflags.contrl_run = 1;
    }
    
    else
    {
        UARTPuts("error: sytemflags_set: set_mode argument is invalid\r\n", -1);
        return -1;
    }
    
    return 0;
}
Example #18
0
File: rmpi.c Project: vastsoun/bbmc
int 
cmnd_rmpi(int argc, char *argv[])
{
    bbmc_cmd_args_t args;
    
    if (argc > 2)
    {
        if (!strcmp((const char *)argv[1],"break"))
        {
            return cmnd_rmpi_break(argc, argv, &args);
        }
        
        else if (!strcmp((const char *)argv[1],"step"))
        {
            return cmnd_rmpi_step(argc, argv, &args);
        }
        
        else if (!strcmp((const char *)argv[1],"step2"))
        {
            return cmnd_rmpi_step2(argc, argv, &args);
        }
        
        else if (!strcmp((const char *)argv[1],"sine"))
        {
            return cmnd_rmpi_sine(argc, argv, &args);
        }
        
        else if (!strcmp((const char *)argv[1],"pid"))
        {
            return cmnd_rmpi_pid_tune(argc, argv, &args);
        }
        
        else if (!strcmp((const char *)argv[1],"si"))
        {
            return cmnd_rmpi_si(argc, argv, &args);
        }
        
        else
        {
            UARTPuts("\r\nerror: cmnd_rmpi: not enough arguments specified.\r\n", -1);
            return (RETURN_ERROR_INVALID_ARG);
        }
    }
    
    UARTPuts("\r\nerror: cmnd_rmpi: not enough arguments specified.\r\n", -1);
    return (RETURN_ERROR_FEW_ARGS);
}
Example #19
0
/**
 * \brief   Configure the MMC/SD bus width
 *
 * \param    mmcsdCtrlInfo It holds the mmcsd control information.
 *
 * \param   buswidth   SD/MMC bus width.\n
 *
 *  buswidth can take the values.\n
 *     HS_MMCSD_BUS_WIDTH_4BIT.\n
 *     HS_MMCSD_BUS_WIDTH_1BIT.\n
 *
 * \return  None.
 *
 **/
unsigned int MMCSDBusWidthSet(mmcsdCtrlInfo *ctrl)
{
    mmcsdCardInfo *card = ctrl->card;
    unsigned int status = 0;
    mmcsdCmd capp;

    if (card->cardType == MMCSD_CARD_MMC)
    {//на проверку шины положили потому что не получается нифига эта проверка)
    	//а не сделать ли нам все по спецификации и не через анус? - не сделать)
		//если надо 4 бита
    	if (card->sd_ver < 4)
    	{
    		UARTPuts("Card restricted to 1-wire wide bus mode.\n", -1);
    		return 1; //какие мы молодцы!
    	}
		if (card->busWidth & SD_BUS_WIDTH_4BIT)
		{
			if (ctrl->busWidth & SD_BUS_WIDTH_4BIT)
			{
				//тест шины 4 бита - забили на него
				ctrl->busWidthConfig(ctrl, SD_BUS_WIDTH_4BIT);
				capp.idx = SD_CMD(6);
				capp.flags = SD_CMDRSP_BUSY;
				capp.arg = 0x03B70100;
				status = ctrl->cmdSend(ctrl, &capp);
				if (status == 0)  return 0;
				//аццки важный фикс!! без этого вылетает!
				//ждем пока карта не снимет busy!
		        while (!(HWREG(ctrl->memBase + MMCHS_PSTATE) & (unsigned int)BIT(20)));
			}
		}
		else if (card->busWidth & SD_BUS_WIDTH_8BIT) //хотим 8 бит
		{
			if (ctrl->busWidth & SD_BUS_WIDTH_8BIT)
			{
				//тест шины 8 бит - забили на него
				ctrl->busWidthConfig(ctrl, SD_BUS_WIDTH_8BIT);
				capp.idx = SD_CMD(6);
				capp.flags = SD_CMDRSP_BUSY;
				capp.arg = 0x03B70200;
				status = ctrl->cmdSend(ctrl, &capp);
				if (status == 0)  return 0;
				//аццки важный фикс!! без этого вылетает!
				//ждем пока карта не снимет busy!
		        while (!(HWREG(ctrl->memBase + MMCHS_PSTATE) & (unsigned int)BIT(20)));

			}
		}



	}
    else
    {
    	return 0;
    }

    return 1; //какие мы молодцы!
}
Example #20
0
/*
** Steps to be taken when SR Turbo is selected
*/
void ActionDVFSSrTurbo(void)
{
    DynamicVoltFreqChange(SR_TURBO);
    mpuOpp = SR_TURBO;

    UARTPuts("\r\nSR TURBO selected (vdd_mpu at 1.26V, 720MHz) \r\n", -1);
    updatePage(CLICK_IDX_DVFS);
}
Example #21
0
/*
** Steps to be taken when OPP120 is selected
*/
void ActionDVFSOpp120(void)
{
    DynamicVoltFreqChange(OPP_120);
    mpuOpp = OPP_120;

    UARTPuts("\r\nOPP120 selected (vdd_mpu at 1.20V, 600MHz) \r\n", -1);
    updatePage(CLICK_IDX_DVFS);
}
Example #22
0
File: rmpi.c Project: vastsoun/bbmc
int 
cmnd_rmpi_pid_tune(int argc, char *argv[], bbmc_cmd_args_t *args)
{
    static char *rmpi_goto_format = 
    "\r\nReset to starting position? [Y/n]: ";
    
    static char *rmpi_pid_tune_format = 
    "\r\nProceed with PID-tune procedure? [Y/n]: ";
    
    char buff[RX_BUFF_SIZE];
    
    args->arg_int[0] = atoi((const char*)argv[2]);
    
    if ((args->arg_int[0] < 0) || (args->arg_int[0] > BBMC_DOF_NUM))
    {
        UARTPuts("\r\nerror: cmnd_rmpi_pid_tune: invalid DOF-id.", -1);
        return RETURN_ERROR_INVALID_ARG;
    }
    
    int ret = cmnd_rmpi_pid_tune_args(argc, argv, args);
    
    if (ret < 0)
    {
        return ret;
    }
    
    ret = cmnd_run_position_init(RUN_POSINIT_Y, RUN_POSINIT_X);
        
    if (ret != 0)
    {
        return ret;
    }
    
    g_flags.contrl_run = util_checkpoint_yn(rmpi_pid_tune_format, buff);
    
    if (g_flags.contrl_run == 1)
    {
        UARTPuts("\r\nPress any key to start PID-Tune procedure...\r\n", -1);
        UARTGets(buff,  2);
        
        return cmnd_rmpi_pid_tune_func(args);
    }
    
    UARTPuts("\r\nrmpi: si: procedure has been aborted.\r\n", -1);
    return (RETURN_ERROR_RUN_ABORT);
}
Example #23
0
File: rmpi.c Project: vastsoun/bbmc
int 
cmnd_rmpi_break_func(bbmc_cmd_args_t *args)
{
    int dof_id = args->arg_int[0];
    int ret;
    int i;
    
    rmpi_contrl.traject_func  = traject_null;
    rmpi_contrl.contrl_func   = contrl_rmpi_breakaway;
    rmpi_contrl.term_func     = term_rmpi_breakaway;
    
    #ifdef INPUT_QEP_DUAL
        rmpi_io.input_func = input_qei_dual;
    #endif
    #ifdef INPUT_QEP_STD
        rmpi_io.input_func = input_qei_std;
    #endif
    #ifdef INPUT_QEP_CAP
        rmpi_io.input_func = input_qei_cap;
    #endif  
    #ifdef OUTPUT_PWM_DIFF
        rmpi_io.output_func = output_pwm_dif;
    #endif
    #ifdef OUTPUT_PWM_DIR
        rmpi_io.output_func = output_pwm_dir;
    #endif
    
    //!
    g_flags.datalog = 1;
    g_flags.exec_checkpoint = 1;
    
    bbmc_sysflags_clear(&g_flags, "-isr");
    
    /*while (fabs(state->state.count[1] - controller->arg_int[1]) <= 
               RMPI_BREAKAWAY_STOP_POSITION_THR)
    {
        ret = func_rmpi(dof_id);
    }*/
    
    
    UARTPuts("\r\nRMPI::BREAK-Away has completed.\r\n", -1);
    
    UARTPuts("\r\nReturning to BBMC-CLI.\r\n", -1);
    return (RETURN_RMPI + RETURN_RMPI_PID_TUNE);
}
Example #24
0
/*
** Steps to be taken when OPP50 is selected
*/
void ActionDVFSOpp50(void)
{
    DynamicVoltFreqChange(OPP_50);
  
    mpuOpp = OPP_50;

    UARTPuts("\r\nOPP50 selected (vdd_mpu at 0.95V, 275MHz) \r\n", -1);
    updatePage(CLICK_IDX_DVFS);
}
Example #25
0
int 
qei_data_cpy (bbmc_input_encoder_t volatile *src,
              bbmc_input_encoder_t volatile *dest)
{
    if (src == NULL)
    {
        UARTPuts("\r\nerror: qei_data_cpy: src pointer is NULL\r\n", -1);
        return -1;
    }
    
    if (dest == NULL)
    {
        UARTPuts("\r\nerror: qei_data_cpy: dest pointer is NULL\r\n", -1);
        return -2;
    }
    
    return dev_qei_data_cpy  (src, dest);
}
Example #26
0
int
global_flags_gpreset_set (int dev_id, pos_reset value)
{
    if (dev_id >= BBMC_DOF_NUM)
    {
        UARTPuts("error: global_flags_gpreset_set: dev_id argument is invalid\r\n", -1);
        return -1;
    }
    
    if ((value != 0) || (value != 1))
    {
        UARTPuts("\r\nerror: global_flags_gpreset_set: invalid set value", -1);
        return -2;
    }
    
    g_sysflags.gpos_reset[dev_id-1] = (int)value;
    
    return 0;
}
Example #27
0
pos_reset
global_flags_gpreset_get (int dev_id)
{
    if (dev_id >= BBMC_DOF_NUM)
    {
        UARTPuts("error: global_flags_gpreset_get: dev_id argument is invalid\r\n", -1);
        return -1;
    }
    
    return (pos_reset)g_sysflags.gpos_reset[dev_id-1];
}
Example #28
0
//TODO
int 
qei_data_init (bbmc_input_encoder_t volatile *data)
{
    if (data == NULL)
    {
        UARTPuts("\r\nerror: qei_data_init: data pointer is NULL\r\n", -1);
        return -1;
    }
    
    return dev_qei_data_init(data);
}
Example #29
0
/*
 * \brief This function initializes the system and copies the image. 
 *
 * \param  none
 *
 * \return none 
*/
int main(void)
{
    /* Configures PLL and DDR controller*/
    BlPlatformConfig();

    UARTPuts("MAACS ", -1);
    UARTPuts(deviceType, -1);
    UARTPuts(" Boot Loader\n\r", -1);
		UARTPuts("Version 0.0.0\n\r",-1);
		UARTPuts("Revised by: Jacob Cook\n\r",-1);

    /* Copies application from non-volatile flash memory to RAM */
    ImageCopy();

    UARTPuts("Jumping to MAACS Flight Software...\r\n\n", -1);

    /* Do any post-copy config before leaving boot loader */
    BlPlatformConfigPostBoot();

    /* Giving control to the application */
    appEntry = (void (*)(void)) entryPoint;

    (*appEntry)( );

    return 0;
}
Example #30
0
File: rmpi.c Project: vastsoun/bbmc
int 
cmnd_rmpi_pid_tune_func(bbmc_cmd_args_t *args)
{
    int dof_id = args->arg_int[0];
    int ret;
    int i;
    
    rmpi_contrl.traject_func  = traject_rmpi_pid_tune;
    rmpi_contrl.contrl_func   = run_contrl;
    rmpi_contrl.term_func     = run_term;
    
    #ifdef INPUT_QEP_DUAL
        rmpi_io.input_func = input_qei_dual;
    #endif
    #ifdef INPUT_QEP_STD
        rmpi_io.input_func = input_qei_std;
    #endif
    #ifdef INPUT_QEP_CAP
        rmpi_io.input_func = input_qei_cap;
    #endif  
    #ifdef OUTPUT_PWM_DIFF
        rmpi_io.output_func = output_pwm_dif;
    #endif
    #ifdef OUTPUT_PWM_DIR
        rmpi_io.output_func = output_pwm_dir;
    #endif
    
    //!
    g_flags.datalog = 1;
    g_flags.exec_checkpoint = 1;
    
    bbmc_sysflags_clear(&g_flags, "-isr");
    
    ret = func_rmpi(dof_id);
        
    UARTPuts("\r\nRMPI::PID-TUNE has completed.\r\n", -1);
    
    UARTPuts("\r\nReturning to BBMC-CLI.\r\n", -1);
    return (RETURN_RMPI + RETURN_RMPI_PID_TUNE);
}