Пример #1
0
//*****************************************************************************
//
// This is the main loop that runs the application.
//
//*****************************************************************************
int
main(void)
{
    uint32_t ui32SysClock;

    //
    // Run from the PLL at 120 MHz.
    //
    ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
                                           SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
                                           SYSCTL_CFG_VCO_480), 120000000);

    //
    // Configure the device pins.
    //
    PinoutSet();

    //
    // Initialize the display driver.
    //
    Kentec320x240x16_SSD2119Init(ui32SysClock);

    //
    // Initialize the touch screen driver.
    //
    TouchScreenInit(ui32SysClock);

    //
    // Set the touch screen event handler.
    //
    TouchScreenCallbackSet(UITouchCallback);

    //
    // Set the system tick to fire 100 times per second.
    //
    ROM_SysTickPeriodSet(ui32SysClock / SYSTICKS_PER_SECOND);
    ROM_SysTickIntEnable();
    ROM_SysTickEnable();

    //
    // Initialize the USB stack for device mode.
    //
    USBStackModeSet(0, eUSBModeDevice, 0);

    //
    // Initialize the USB keyboard interface.
    //
    USBKeyboardInit();

    //
    // Initialize the USB mouse interface.
    //
    USBMouseInit();

    //
    // Call the composite device initialization for both the mouse and
    // keyboard.
    //
    USBDHIDMouseCompositeInit(0, &g_sMouseDevice, &g_psCompDevices[0]);
    USBDHIDKeyboardCompositeInit(0, &g_sKeyboardDevice, &g_psCompDevices[1]);

    //
    // Pass the device information to the USB library and place the device
    // on the bus.
    //
    USBDCompositeInit(0, &g_sCompDevice, DESCRIPTOR_DATA_SIZE,
                      g_pui8DescriptorData);

    //
    // Initialize the user interface.
    //
    UIInit();

    while(1) {
        //
        // Run the main loop for the user interface.
        //
        UIMain();
    }
}
Пример #2
0
int __cdecl main(
	int				ArgC,
	char **			ArgV)
#endif
{
	int				iResCode = 0;

#if defined( FLM_UNIX)
	struct rlimit l;

	if (getrlimit(RLIMIT_NOFILE, &l) < 0)
	{
		fprintf(stderr, "Could not get the maximum number of open files: %s",
				strerror(errno));
		exit(1);
	}

	if (geteuid() == 0)
		l.rlim_max = 65536;		// big enough for our needs

	l.rlim_cur = l.rlim_max;

    // increase the fd table
	if (setrlimit(RLIMIT_NOFILE, &l) < 0)
		fprintf(stderr, "Could not increase the number of open files to %ld",
				l.rlim_max);
#endif

#ifdef FLM_NLM

	/* Setup the routines to be called when the NLM exits itself */

	atexit( domEditCleanup);

	/* Register to see the DOWN server event. */

	if (!gv_bSynchronized)
	{
		SynchronizeStart();
		gv_bSynchronized = TRUE;
	}
#endif

	gv_szDbPath[ 0] = 0;
	gv_szRflDir[ 0] = 0;
	gv_szPassword[0] = 0;
	gv_bAllowLimited = FALSE;

	if( ArgC >= 2)
	{
		f_strcpy( gv_szDbPath, ArgV[ 1]);
	}
	if( ArgC >= 3)
	{
		f_strcpy( gv_szRflDir, ArgV[ 2]);
	}
	
	if (ArgC >= 4)
	{
		f_strcpy( gv_szPassword, ArgV[ 3]);
	}

	if (ArgC >=5)
	{
		if (f_strnicmp( ArgV[ 4], "TRUE", 4) == 0)
		{
			gv_bAllowLimited = TRUE;
		}
	}

	UIMain( NULL);

//Exit:

#ifdef FLM_NLM
	if (!gv_bSynchronized)
	{
		SynchronizeStart();
		gv_bSynchronized = TRUE;
	}
#endif
	gv_bRunning = FALSE;
	

	return( iResCode);
}