Example #1
0
int
main(
	int argc,
	char **argv
)
{
	UINT32 ret;
	UINT32 i;

	gp_ver = gpICVersion();

	if (argc < 2) {
#ifndef SYSCONFIG_MODULE_ALLIN_ROOTFS
		ret = sysInit();
#endif
		//sleep(10);
	}
	else {
		for (i=1; i<argc; i++) {
			if (strcmp(argv[i], "backlight_enable") == 0) {
				backlightEnable(1);
			}
			else if (strcmp(argv[i], "backlight_disable") == 0) {
				backlightEnable(0);
			}
			else if (strcmp(argv[i], "core") == 0) {
				sysCoreInit();
#ifdef SYSCONFIG_MODULE_ALLIN_ROOTFS
				sysInit();
#endif
			}
			else if (strcmp(argv[i], "main_storage") == 0) {
				sysMainStorageInit();
			}
			else if (strcmp(argv[i], "version") == 0) {
				sysShowVersion();
			}
			else if (strcmp(argv[i], "audio_power_off") == 0) {
				audioPowerOff();
			}
			else if(strcmp(argv[i], "usb") == 0){
				usbhostInit();
			}
		}
	}

	return ret;
}
Example #2
0
int XHServiceBasePrivate::run(bool asService, const std::vector<std::string> &argList)
{
	int argc = argList.size();
    std::vector<char *> argv(argc);	
	std::vector<std::string>  argvData;
	for (int i = 0; i < argc; ++i)
		argvData.push_back(argList[i]);
	for (int i = 0; i < argc; ++i){
		char* c;
		const int len = argvData[i].length();
		c = new char[len + 1];
		strcpy(c, argvData[i].c_str());
		argv[i] = c;
	}

    if (asService && !sysInit())
        return -1;

	q_ptr->createApplication(argc,argv.data());   

    if (asService)
        sysSetPath();

    XHServiceStarter starter(this);
	starter.slotStart();
	// TODO 
    int res = q_ptr->executeApplication();
    if (asService)
        sysCleanup();
    return res;
}
Example #3
0
void main( void )
{
    PYGMYFILE pygmyFile;
    u8 i, ucStatus, ucBuffer[ 65 ], *ucSubString;

    sysInit();
    print( COM3, "\rUpdating bootloader, cancel boot after completion" );
    print( COM3, "\rOpening Resource..." );
    if( !fileOpenResource( &pygmyFile, (u8*)PYGMY_boothex ) ){
        print( COM3, "\rFile Failed to Open" );
    } else{
        print( COM3, "\rErasing..." );
        for( i = 0; i < 8; i++ ){
            fpecErasePage( i );
        } // for;
        print( COM3, "\rFlashing..." );
        for( ucStatus = 0; !( fileIsEOF( &pygmyFile ) ) && ucStatus != 0xFF; ){
            for( i = 0; i < 64; i++ ){
                ucBuffer[ i ] = fileGetChar( &pygmyFile );
                if( ucBuffer[ i ] == '\r' ){
                    ucBuffer[ i ] = '\0';
                    ucSubString = getNextSubString( (u8*)ucBuffer, WHITESPACE|NEWLINE );
                    // Add 1 to pointer before passing to skip the ':' packet start char
                    ucStatus = fpecProcessIHEX( (u8*)( ucSubString + 1 ) );
                    break; // Time to fetch next IHEX entry
                } // if
            } // for
        } // for
    } // else
    print( COM3, "\rBootloader Updated" );
    print( COM3, "\rReseting..." );
    delay( 100 );
    PYGMY_RESET;
    //boot();
}
Example #4
0
/*!
  Special constructor for X11, ref. the documentation of
  QApplication's corresponding constructor. The application identifier
  will be \a appId. \a dpy, \a argc, \a
  argv, \a visual, and \a cmap are passed on to the QApplication
  constructor.
*/
QtSingleApplication::QtSingleApplication(Display* dpy, const QString &appId, int argc, char** argv, Qt::HANDLE visual, Qt::HANDLE cmap)
    : QApplication(dpy, argc, argv, visual, cmap)
    , peer(0)
    , actWin(0)
{
    sysInit(appId);
}
Example #5
0
/*!
  Special constructor for X11, ref. the documentation of
  QApplication's corresponding constructor. The application identifier
  will be QCoreApplication::applicationFilePath(). \a dpy, \a argc, \a
  argv, \a visual, and \a cmap are passed on to the QApplication
  constructor.
*/
QtSingleApplication::QtSingleApplication(Display* dpy, int &argc, char** argv, Qt::HANDLE visual, Qt::HANDLE cmap)
    : QApplication(dpy, argc, argv, visual, cmap)
    , peer(0)
    , actWin(0)
{
    sysInit();
}
Example #6
0
/*!
  Special constructor for X11, ref. the documentation of
  QApplication's corresponding constructor. The application identifier
  will be QCoreApplication::applicationFilePath(). \a dpy, \a visual,
  and \a cmap are passed on to the QApplication constructor.
*/
QtSingleApplication::QtSingleApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE cmap)
    : QApplication(dpy, visual, cmap)
    , peer(0)
    , actWin(0)
{
    sysInit();
}
Example #7
0
QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char** argv)
    : QApplication(argc, argv)
    , peer(0)
    , actWin(0)
{
    sysInit(appId);
}
Example #8
0
int main(void) {
    srand(time(0));

    if(!sysInit()) return 1;
    if(!sysLoadFiles()) return 1;

    gameTitle();

    while(!quit) {
        startTimer = SDL_GetTicks();

        sysInput();
        gameLogic();
        drawEverything();

        // Update the screen
        if(SDL_Flip(screen) == -1) return 1;
        
        // Limit the frame rate
        endTimer = SDL_GetTicks();
        deltaTimer = endTimer - startTimer;
        if(deltaTimer < (1000/FPS))
            SDL_Delay((1000/FPS)-deltaTimer);
    }
    gameCleanup();
    sysCleanup();
}
Example #9
0
int main(int argc, char *argv[]) {
    srand(time(0));

    if(!sysInit()) return 1;
    if(!sysLoadFiles()) return 1;

    gameModeInit();
    menuInit();
    gameTitle();

    while(!quit) {
        startTimer = SDL_GetTicks();

        sysInput();
        gameLogic();
        drawEverything();

        // Update the screen
        SDL_RenderPresent(renderer);
        
        // Limit the frame rate
        endTimer = SDL_GetTicks();
        deltaTimer = endTimer - startTimer;
        if(deltaTimer < (1000/FPS))
            SDL_Delay((1000/FPS)-deltaTimer);
    }
    blockCleanup();
    sysCleanup();
}
Example #10
0
QtSingleApplication::QtSingleApplication(Display* dpy, const QString &appId,
    int argc, char **argv, Qt::HANDLE visual, Qt::HANDLE colormap)
    : QApplication(dpy, argc, argv, visual, colormap)
{
    this->appId = appId;
    sysInit(appId);
}
Example #11
0
void main( void )
{
    sysInit();
    
    // Your code here

    while( 1 ){;}
}
Example #12
0
void
beginProgram (int argumentCount, char **argumentVector) {
#if defined(GRUB_RUNTIME)

#else /* at exit */
  atexit(endProgram);
#endif /* at exit */

#ifdef WINDOWS
  sysInit();
#endif /* WINDOWS */

  prepareLocale();

  if (!(programPath = getProgramPath())) programPath = argumentVector[0];

  if (!isExplicitPath(programPath)) {
    char *path = findProgram(programPath);
    if (!path) path = testProgram(".", programPath);
    if (path) programPath = path;
  }

  if (isExplicitPath(programPath)) {
#if defined(HAVE_REALPATH) && defined(PATH_MAX)
    if (!isAbsolutePath(programPath)) {
      char buffer[PATH_MAX];
      char *path = realpath(programPath, buffer);

      if (path) {
        char *realPath = strdup(path);

        if (realPath) {
          programPath = realPath;
        } else {
          logMallocError();
        }
      } else {
        logSystemError("realpath");
      }
    }
#endif /* defined(HAVE_REALPATH) && defined(PATH_MAX) */

    if (!isAbsolutePath(programPath)) {
      char *directory;

      if ((directory = getWorkingDirectory())) {
        char *path;
        if ((path = makePath(directory, programPath))) programPath = path;
        free(directory);
      }
    }
  }

  programName = locatePathName(programPath);
  setLogPrefix(programName);
}
Example #13
0
/*!
    Creates a QtSingleApplication object, given an already open display
    \a dpy. Uses the identifier \a id. \a argc and \a argv are
    passed on to the QAppliation constructor. If \a visual and \a colormap
    are non-zero, the application will use those as the default Visual and
    Colormap contexts.

    There can only be one QtSingleApplication object(and since there
    can only be one QApplication object you do not need to create
    another QApplication object yourself).

    \warning Qt only supports TrueColor visuals at depths higher than 8
    bits-per-pixel.

    This is available only on X11.
*/
QtSingleApplication::QtSingleApplication(Display* dpy, const QString &id, int argc, char **argv,
                                         Qt::HANDLE visual, Qt::HANDLE colormap)
    : QApplication(dpy, argc, argv, visual, colormap)
{
    d = new QtSingletonPrivate;
    d->id = id;
    actWin = 0;

    sysInit();
}
Example #14
0
void main(void)
{
	__disable_interrupt();
	sysInit();
	setupIR();
	setupTimer();
	__enable_interrupt();
	
  __bis_SR_register(LPM3_bits + GIE);
}
Example #15
0
int main(void)
{
	WDTCTL = WDTPW + WDTHOLD;             // Stop watchdog timer
	_disable_interrupts();
	sysInit();
	_enable_interrupts();

	while(1){
		if(uartCheck) uartParse();
	}
}
Example #16
0
// ********************************************************************************************
// cncInit()
// ********************************************************************************************
int cncInit(CNC_DATA *cncDataPtr)
{
   sysInit(&cncDataPtr->sysData);
   intpInit(&cncDataPtr->intpData);
   decInit(&cncDataPtr->decData);
   mmiInit(&cncDataPtr->mmiData);   
   /// Initialize all Data Ptr
   linkInit(&cncDataPtr->linkData);
   TeachInit(&cncDataPtr->teachData);

	return 1;
}
Example #17
0
/*!
    Creates a QtSingleApplication object with the identifier \a id. \a
    argc, \a argv and \a type are passed on to the QAppliation
    constructor.

    There can only be one QtSingleApplication object(and since there
    can only be one QApplication object you do not need to create
    another QApplication object yourself).

    \warning On X11 type can not be QApplication::Tty.

*/
QtSingleApplication::QtSingleApplication(const QString &id, int &argc, char **argv, Type type)
    : QApplication(argc, argv, type)
{
#ifdef Q_WS_X11
    Q_ASSERT_X(type != Tty, "QtSingleApplication::QtSingleApplication",
               "QApplication::Tty cannot be used with QtSingleApplication on X11");
#endif
    d = new QtSingletonPrivate;
    d->id = id;
    actWin = 0;

    sysInit();
}
Example #18
0
void main() {
	sysInit();
	wait(1);
	level_load("menuLevel2.wmb");
	startMenu();
}
Example #19
0
int main( void )
{
	sysInit();

	/* USB Power dinyalakan supaya memory USB bisa dipakai */
	PCONP |= 0x80000000; 

	FIO0DIR = LED_UTAMA;
	FIO0CLR = LED_UTAMA;	
	
	FIO1DIR = 0xFFFFFFFF;

	#ifdef PAKAI_SERIAL_3
	/* PCONP enable UART3 */
	PCONP |= BIT(25);
	
	/* PCLK UART3, PCLK = CCLK */
	PCLKSEL1 &= ~(BIT(18) | BIT(19));
	PCLKSEL1 |= BIT(18);
	
	/* init TX3, RX3 */
	PINSEL1 &= ~(BIT(18) | BIT(19) | BIT(20) | BIT(21));
	PINSEL1 |= (BIT(18) | BIT(19));
	PINSEL1 |= (BIT(20) | BIT(21));
	PINSEL1 &= ~(BIT(16) | BIT(17));
	/* TXDE di highkan */
	FIO0DIR |= TXDE;
	//FIO0SET = TXDE;		// on	---> bisa kirim
	//FIO0SET &= ~TXDE;		// off	---> gak bisa kirim
	//FIO0CLR = TXDE;
	FIO0SET = TXDE;
	
	FIO0DIR |= RXDE;
	FIO0SET  = RXDE;
	#endif

	#ifdef PAKAI_SERIAL_2
	/* PCONP enable UART2 */
	PCONP |= BIT(24);
	
	/* PCLK UART2, PCLK = CCLK */
	PCLKSEL1 &= ~(BIT(16) | BIT(17));
	PCLKSEL1 |= BIT(16);
	
	/* init TX2, RX2 */
	PINSEL0 |= (BIT(20) | BIT(22));
	#endif

	/*	untuk cek blinking saat system boot */
#ifdef CEK_BLINK
	int t=0;
	while(t<5)
	{
		dele(1000000);
		FIO0CLR = LED_UTAMA;
		dele(1000000);
		FIO0SET = LED_UTAMA;
		t++;
	}
#endif

	xSerialPortInitMinimal( BAUD_RATE, configMINIMAL_STACK_SIZE  );
	#ifdef PAKAI_SERIAL_2
		serial2_init( BAUD_PM, (1 * configMINIMAL_STACK_SIZE) );
	#endif
	#ifdef PAKAI_SERIAL_3
		serial3_init( BAUD_PM, (1 * configMINIMAL_STACK_SIZE) );
	#endif

#ifdef PAKAI_ADC
	init_gpio_adc();
	init_gpio_mmc();
	init_spi_mmc(0);		// untuk adc dan mmc
#endif

#ifdef jalankan
	init_led_utama();
	start_ether();

#if (defined(PAKAI_PM) && defined(AMBIL_PM))
	//init_task_pm();
#endif
	init_shell();
	vTaskStartScheduler();

    /* Will only get here if there was insufficient memory to create the idle
    task. */
	return 0;
#endif
Example #20
0
int main(void){
	
	sysInit();
	
	SPCR = (1 << SPE)  | (1 << MSTR) | (0 << CPOL) | (0 << CPHA) | (0 << SPR1);
	SPSR = (1<<SPI2X);
	W5500_Init();
	
	_delay_ms(10);
	sprintf(gPtrintBuff, "Version: %u\n",getVERSIONR());
	uartPuts(gPtrintBuff);
	//i2cScanner();
	
	si70xx_init();
	
	uartPutsP("\nInto Loop\n");
	
    while (1){
		
		if(milis() - loopTime >= 50){
			
			hsv2rgb(hue_value,255,80, &Rpwm, &Gpwm, &Bpwm, 250);			
			OCR1A = Rpwm;
			OCR1B = Gpwm;
			OCR1C = Bpwm;
			hue_value++;
			if(hue_value > 359){
				hue_value = 0;
			}
			
			float temperature = si70xx_get_temperature();
			float humidity = si70xx_get_humidity();
			
			/*
			while(getSn_SR(SOCK_ID_TCP) != SOCK_ESTABLISHED){
				loopback_tcpc(SOCK_ID_TCP, dIP, dport);
			}
			*/
			
			sprintf(gDATABUF, "%u | Temp: %.2f RH: %.2f \n\0", i , temperature, humidity);
			
			retVal = send(SOCK_ID_TCP, gDATABUF, sizeof(gDATABUF));
			//close(SOCK_ID_TCP);
			
			sprintf(gPtrintBuff, "%u | Sent: %i Sizeof: %u\n", i ,  retVal, sizeof(gDATABUF));
			uartPuts(gPtrintBuff);
			
			i++;
			
			loopTime = milis();
			
		}
		
		
		loopback_tcpc(SOCK_ID_TCP, dIP, dport);
		//send(TCP_)
		char temp = uartGetc();
		if(temp == 'S'){
			printNetInfo();
			//uartPutc(temp);
		}
		
		if(temp == 's'){
			send(SOCK_ID_TCP, 'a', sizeof('a'));
			//uartPutc(temp);
		}
    }
}
Example #21
0
void QtSingleApplication::setAppId(const QString &id)
{
    sysInit(id);
}
Example #22
0
QtSingleApplication::QtSingleApplication(const QString &appId, int &argc, char **argv)
    : QApplication(argc, argv)
{
    this->appId = appId;
    sysInit(appId);
}
Example #23
0
QtSingleApplication::QtSingleApplication(int &argc, char **argv, bool GUIenabled)
    : QApplication(argc, argv, GUIenabled)
{
    sysInit();
}
/*!
    Creates a QtSingleApplication object. The application identifier
    will be QCoreApplication::applicationFilePath(). \a argc, \a
    argv, and \a type are passed on to the QAppliation constructor.
*/
QtSingleApplication::QtSingleApplication(int& argc, char** argv, Type type)
	: QApplication(argc, argv, type)
{
	sysInit();
}
Example #25
0
int main(void)
{
	/* <1> Enable flash. */
	sysFlushCache (I_D_CACHE);
	sysDisableCache ();
	sysEnableCache (CACHE_WRITE_BACK);
	sysInit();
	printf("REG_APLLCON=0x%x REG_UPLLCON=0x%x\n", inpw(REG_APLLCON), inpw(REG_UPLLCON));
	printf("REG_CLKCON=0x%x REG_CLKSEL=0x%x\n", inpw(REG_CLKCON), inpw(REG_CLKSEL));
	printf("REG_CLKDIV0=0x%x REG_CLKDIV1=0x%x\n", inpw(REG_CLKDIV0), inpw(REG_CLKDIV1));
	printf("REG_TICR0=%d\n", inpw(REG_TICR0));
	FTH_Init();
	
#if 0
	test_inet(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_gethost(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_socket(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_netread();
	test_netwrite();
	test_send();
	test_recv();
	test_recvmsg();
	test_sendmsg();
	test_recvfrom(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_sendto(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_netselect();
	test_getsockname();
	test_getsockopt(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_netfcntl(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_netioctl(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_netioctl_withbuf(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_wb740getgateway(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_wb740reboot(g_RemoteNet_Buf, RNT_BUFFER_LEN);
#endif
	test_inet(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_gethost(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_socket(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_netread();
	test_netwrite();
	test_send();
	test_recv();
	test_recvmsg();
	test_sendmsg();
	test_recvfrom(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_sendto(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_netselect();
	test_getsockname();
	test_getsockopt(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_netfcntl(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_netioctl(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_netioctl_withbuf(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_wb740getgateway(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	test_wb740reboot(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	
	// insert test program here
	//GetDevInterface();
	//simple_getgateway();
	//simple_ioctl_withbuf();
	//simple_udpserver();
	//simple_tcpserver();
	//simple_inet_addr();
	//simple_uname();
	//simple_gethostbyaddr();
	//simple_multi_thread();
	//wb740reboot(g_RemoteNet_Buf, RNT_BUFFER_LEN);
	return 0;
}
Example #26
0
VPubDaemon::VPubDaemon(int &argc, char **argv) :
    QCoreApplication(argc, argv)
{
    sysInit();
}
Example #27
0
void main( void )
{
    u8 i, ucChar, *ucEeproms, ucBuffer[ 40 ];

    sysInit();
    socketInit();
    rfInit();
    print( COM3, "\rV2 RFID: 0x%X", socketGetID());
    //mpl115a2Init( TX1, RX1, NONE, NONE );
    //print( COM3, "\rPressure: %f", mpl115a2ReadkPa() );
    //print( COM3, "\rTemp: %f", mpl115a2ReadTemp() );
    //i2cConfig( &globalGasSensorDigipot, DIGIPOT_BASEADDRESS|3, TX1, RX1, I2CSPEEDFAST );
    //digipotSetWiper( &globalGasSensorDigipot, 2, 0 );
    //eepromOpen( 0x2F, TX1, RX1, NONE );
    //eepromPutString( 0, "Test" );
    pinConfig( MCO, OUT );
    pinSet( MCO, HIGH );
    gasSensorInit();
    //print( COM3, "\rGas Sensor: %f", gasSensorRead() );
    //gasSensorSetGain( 0,0 );
    //print( COM3, "\rGas Sensor: %f", gasSensorRead() );
    //gasSensorSetGain( 200,200 );
    //print( COM3, "\rGas Sensor: %f", gasSensorRead() );
    //eepromGetBuffer( 0, ucBuffer, len( "test" ) );
    //print( COM3, "\rEeprom: ucBuffer );
    //print( COM3, "\rEEPROM Direct Read: " );
    /*for( i = 0; i < len( "test" ); i++ ){
        ucChar = eepromGetChar( i );
        if( isAlphaOrNumeric( ucChar ) ) {
            print( COM3, "%c", ucChar );
        } else{
            print( COM3, "(%d)", ucChar  );//ucBuffer, len( "humidity" ) );
        } // else
    } // for
    */
    /* 
    // Test for LCD code
    if( isStringSame( ucBuffer, "<shield lcd>" ) ){
        print( COM3, "\rLCD Shield Detected" );
        fileOpenResource( &fileFont, (u8*)PYGMY_orbitron18 );
        fontLoad( &fileFont, &fontOrbitron18 );
        fontSetAll( &fontOrbitron18 );
    
        pinConfig( A0, PULLUP );
        pinConfig( D3, PULLUP );
        pinConfig( TA0, PULLUP );
        pinConfig( DAC1, PULLUP );
        pinConfig( DAC2, PULLUP );
        pinConfig( TX2, PULLUP );
        pinConfig( RX2, PULLUP );
        drawMainMenu();
    } else{
        hih5030Init( A2, A3 );
    } // else
    */
    
    //taskNewSimple( "humidity", 1000, (void*)threadRFHumiditySave );
    
    //gemInit();
    //fileOpen( &pygmyFile, "picon128", READ );
    //drawImage( 0,0, &pygmyFile, 0 );
    /*ucBuffer = sysAllocate( 5 );
    copyString( "Test", ucBuffer );
    ucBuffer = sysReallocate( ucBuffer, 20 );
    appendString( "ThisToo", ucBuffer );
    print( COM3, "\rTest String: %s", ucBuffer );*/
    //pinConfig( SHIELD_CENTER, PULLUP );
    //pinInterrupt( gemClickMenu, SHIELD_CENTER,  TRIGGER_RISING|TRIGGER_FALLING );
    //drawRect( 0, 20, 127, 40, VISIBLE|BORDER|ROUNDED, 8); 
    //gemDrawMenu();
    //drawWidget( &btnOK );
    //gemInit();
    
    
    //sysFree( ucBuffer );
    //fileOpen( &pygmyFile, "jpeg", READ );
    //drawJPEG( &pygmyFile, 0, 0 );
    //drawPNG( &pygmyFile, 0, 0 ); 
    /*mstatsTemp mstats();
    print( COM3, "\rbytes_total: %d", bytes_total );
    print( COM3, "\rchunks_used: %d", chunks_used );
    print( COM3, "\rbytes_used: %d", bytes_used );
    print( COM3, "\rchunks_free: %d", chunks_free );
    print( COM3, "\rbytes_free: %d", bytes_free );*/
    while(1){;}
}
Example #28
0
QtSingleApplication::QtSingleApplication(Display* dpy, Qt::HANDLE visual, Qt::HANDLE colormap)
    : QApplication(dpy, visual, colormap)
{
    sysInit();
}