Exemplo n.º 1
0
void dfu_init()
{
    if( hw_check_skip_bootloader() )
        hw_boot_image( 0 );

    // For software resets, extend the DFU countdown
    if( hw_check_extend_bootloader() )
        dfu_reset_counter = 30;

    // Otherwise prep for loading
    dfu_status.bStatus = OK;
    dfu_status.bwPollTimeout0 = 0x00;
    dfu_status.bwPollTimeout1 = 0x00;
    dfu_status.bwPollTimeout2 = 0x00;
    dfu_status.bState = dfuIDLE;
    dfu_status.iString = 0x00;          /* all strings must be 0x00 until we make them! */

    if( ( *( volatile uint32_t* ) FLASH_TARGET ) == 0xFFFFFFFF )
    {
        dfu_reset_counter = 0xFFFF;
    }

    hw_enable_watchdog();

    usb_reg_class_drvr(dfu_ep_init, dfu_req_handler, dfu_rx_handler);
}
Exemplo n.º 2
0
void cdc_init()
{
    // hook the putchar function into the printf stdout filestream. This is needed
    // for printf to work.
    stdout = &file_str;

    usb_reg_class_drvr(cdc_ep_init, cdc_req_handler, cdc_rx_handler);
}
Exemplo n.º 3
0
/*
 * Initialize the CDC class driver. We basically register our init, request handler,
 * and rx data handler with the USB core.
 */
void cdc_init()
{
	usb_reg_class_drvr(cdc_ep_init,
			   cdc_req_handler,
			   cdc_rx_handler);
}