Ejemplo n.º 1
0
int main()
{
    int32_t  rc;
    uint32_t  numBlks, blkSize;
    uint8_t  inquiryResult[INQUIRY_LENGTH];

    /* SystemClockUpdate() updates the SystemFrequency variable */
    SystemClockUpdate();

    UART_Init(57600);          /* Initialize the serial port to view the log messages                       */
    Host_Init();               /* Initialize the lpc17xx host controller                                    */
    rc = Host_EnumDev();       /* Enumerate the device connected                                            */
    if (rc == OK) {
		/* Initialize the mass storage and scsi interfaces */
        rc = MS_Init( &blkSize, &numBlks, inquiryResult );
        if (rc == OK) {
            rc = FAT_Init();   /* Initialize the FAT16 file system                                          */
            if (rc == OK) {
                Main_Copy();   /* Call the application                                                      */
            } else {
                return (0);
            }
        } else {
            return (0);
        }
    } else {							
        return (0);
    }
    while(1);
}
Ejemplo n.º 2
0
// called by the emscripten runtime once our
// <component>.js.mem file has been downloaded
// and used to initialize the intial state of
// our heap
extern "C" int main(int, char**)
{
  MS_SetLocale(ms_get_browser_language());

  // MS_Init calls init_fs which calls async_startup_complete
  MS_Init("");
  return 0;
}
/*
 ********************************************************************************
 * main
 ********************************************************************************
 */
int main( void )
{


    /* Disable watchdog if enabled by bootloader/fuses */
    MCUSR &= ~(1 << WDRF);
    wdt_disable();

    /* Disable clock division */
    CPU_PRESCALE(0);
    LED_CONFIG;
    LED_ON;
    
    /* Initialize Keyboard Driver */
    KB_Init();

    /* Initialize Mouse Driver */
    MS_Init();
    
    /* Initialize USB Joystick variables */
    usb_joystick_raz();

    /* Enable interrupts */
    sei( );

    /* Initialize USB Joystick */
    usb_init();
    while (!usb_configured()) ;
    _delay_ms(1000);
    LED_OFF;

    /* Send a first packet */
    usb_joystick_send();

    /* Reset the mouse */
    MS_MouseReset();

    /*
	 * Comment that code to test rotation speed for a given position.
	 */
    while( 1 )
    {
        KB_EventTask();
		MS_EventTask();
    }
    
    /*
     * Uncomment that code to test rotation speed for a given position.
     */
//	while( 1 )
//    {
//		usb_joystick_move_zrz(153, 128);
//		usb_joystick_send();
//		_delay_ms(5000);
//	}

    return 0;
}
Ejemplo n.º 4
0
DSTATUS disk_initialize(BYTE drv /* Physical drive nmuber (0..) */
)
{
	DSTATUS stat;
	int result;

	(void) result;

	switch (drv)
	{
	case ATA:
		// result = ATA_disk_initialize();
		stat = STA_NOINIT;
		// translate the result code here
		return stat;

	case MMC:
		stat = MMC_disk_initialize();
		return stat;

	case USB:
#if WITH_USB_MS
		/* USB host init and enumeration */
		if ( usb_status & STA_NOINIT ) {
			Host_Init();
			if ( Host_EnumDev() == OK ) {
				/* mass-storage init */
				if ( MS_Init(&blkSize, &numBlks, inquiryResult) == OK ) {
					usb_status &= ~STA_NOINIT;
				} else {
					/* MS init fail */
				}
			} else {
				/* host init and/or enum fail */
			}
		}
		return usb_status;
#else
		stat = STA_NOINIT;
		return stat;
#endif
	}
	return STA_NOINIT;
}
Ejemplo n.º 5
0
int main()
{
    USB_INT32S  rc;
	USB_INT32U  numBlks, blkSize;
	USB_INT08U  inquiryResult[INQUIRY_LENGTH];

// Code Red - if CMSIS 1.3 setup is being used, then SystemInit() routine
// will be called by startup code rather than in application's main()
#ifndef __USE_CMSIS
	SystemInit();                               /* initialize clocks */
#endif

 

    UART_Init(115200);         /* Initialize the serial port to view the log messages                       */
    Host_Init();               /* Initialize the lpc17xx host controller                                    */
    rc = Host_EnumDev();       /* Enumerate the device connected                                            */
    if (rc == OK) {
		/* Initialize the mass storage and scsi interfaces */
        rc = MS_Init( &blkSize, &numBlks, inquiryResult );
        if (rc == OK) {
            rc = FAT_Init();   /* Initialize the FAT16 file system                                          */
            if (rc == OK) {
                Main_Copy();   /* Call the application                                                      */
            } else {
				while ( 1 );
                return (0);
            }
        } else {
			while ( 1 );
            return (0);
        }
    } else {							
		while ( 1 );
        return (0);
    }
    while(1);
}