Skip to content
Snippets Groups Projects
Select Git revision
  • 31d8ebebc0796873f7c70db80a04acdcbb307ed8
  • master default protected
  • LUFA-170418
  • LUFA-151115
  • LUFA-140928
  • LUFA-140302
  • LUFA-130901
  • LUFA-130901-BETA
  • LUFA-130303
  • LUFA-120730
  • LUFA-120730-BETA
  • LUFA-120219
  • LUFA-120219-BETA
  • LUFA-111009
  • LUFA-111009-BETA
  • LUFA-110528
  • LUFA-110528-BETA
17 results

BootloaderDFU.c

Blame
    • Dean Camera's avatar
      c5038f1b
      Renamed all library events to properly seperate out Device and Host mode... · c5038f1b
      Dean Camera authored
      Renamed all library events to properly seperate out Device and Host mode events. Changed the firing conditions for some events to ensure that events are fired by their own USB mode only.
      
      Remove VBUS events - not needed as the library takes care of VBUS detection and feedback on supported AVRs via the USB_Device_Connected and USB_Device_Disconnected events.
      
      Fixed incorrect Host state assignment in the incomplete BluetoothHost demo.
      c5038f1b
      History
      Renamed all library events to properly seperate out Device and Host mode...
      Dean Camera authored
      Renamed all library events to properly seperate out Device and Host mode events. Changed the firing conditions for some events to ensure that events are fired by their own USB mode only.
      
      Remove VBUS events - not needed as the library takes care of VBUS detection and feedback on supported AVRs via the USB_Device_Connected and USB_Device_Disconnected events.
      
      Fixed incorrect Host state assignment in the incomplete BluetoothHost demo.
    BootloaderDFU.c 22.47 KiB
    /*
                 LUFA Library
         Copyright (C) Dean Camera, 2009.
                  
      dean [at] fourwalledcubicle [dot] com
          www.fourwalledcubicle.com
    */
    
    /*
      Copyright 2009  Dean Camera (dean [at] fourwalledcubicle [dot] com)
    
      Permission to use, copy, modify, and distribute this software
      and its documentation for any purpose and without fee is hereby
      granted, provided that the above copyright notice appear in all
      copies and that both that the copyright notice and this
      permission notice and warranty disclaimer appear in supporting
      documentation, and that the name of the author not be used in
      advertising or publicity pertaining to distribution of the
      software without specific, written prior permission.
    
      The author disclaim all warranties with regard to this
      software, including all implied warranties of merchantability
      and fitness.  In no event shall the author be liable for any
      special, indirect or consequential damages or any damages
      whatsoever resulting from loss of use, data or profits, whether
      in an action of contract, negligence or other tortious action,
      arising out of or in connection with the use or performance of
      this software.
    */
    
    /** \file
     *
     *  Main source file for the DFU class bootloader. This file contains the complete bootloader logic.
     */
    
    #define  INCLUDE_FROM_BOOTLOADER_C
    #include "BootloaderDFU.h"
    
    /** Flag to indicate if the bootloader is currently running in secure mode, disallowing memory operations
     *  other than erase. This is initially set to the value set by SECURE_MODE, and cleared by the bootloader
     *  once a memory erase has completed.
     */
    bool IsSecure      = SECURE_MODE;
    
    /** Flag to indicate if the bootloader should be running, or should exit and allow the application code to run
     *  via a soft reset. When cleared, the bootloader will abort, the USB interface will shut down and the application
     *  jumped to via an indirect jump to location 0x0000 (or other location specified by the host).
     */
    bool RunBootloader = true;
    
    /** Flag to indicate if the bootloader is waiting to exit. When the host requests the bootloader to exit and
     *  jump to the application address it specifies, it sends two sequential commands which must be properly
     *  acknowledged. Upon reception of the first the RunBootloader flag is cleared and the WaitForExit flag is set,
     *  causing the bootloader to wait for the final exit command before shutting down.
     */
    bool WaitForExit = false;
    
    /** Current DFU state machine state, one of the values in the DFU_State_t enum. */
    uint8_t DFU_State = dfuIDLE;
    
    /** Status code of the last executed DFU command. This is set to one of the values in the DFU_Status_t enum after
     *  each operation, and returned to the host when a Get Status DFU request is issued.
     */
    uint8_t DFU_Status = OK;
    
    /** Data containing the DFU command sent from the host. */
    DFU_Command_t SentCommand;
    
    /** Response to the last issued Read Data DFU command. Unlike other DFU commands, the read command
     *  requires a single byte response from the bootloader containing the read data when the next DFU_UPLOAD command