Skip to content
Snippets Groups Projects
Select Git revision
  • a6cc492e025ad194214421f40d2014ceec7e55e6
  • master default
  • dev
3 results

MenuParentView.js

Blame
  • BootloaderCDC.c 16.95 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 CDC class bootloader. This file contains the complete bootloader logic.
     */
     
    #define  INCLUDE_FROM_BOOTLOADERCDC_C
    #include "BootloaderCDC.h"
    
    /* Globals: */
    /** Line coding options for the virtual serial port. Although the virtual serial port data is never
     *  sent through a physical serial port, the line encoding data must still be read and preserved from
     *  the host, or the host will detect a problem and fail to open the port. This structure contains the
     *  current encoding options, including baud rate, character format, parity mode and total number of 
     *  bits in each data chunk.
     */
    CDC_Line_Coding_t LineCoding = { .BaudRateBPS = 9600,
                                     .CharFormat  = OneStopBit,
                                     .ParityType  = Parity_None,
                                     .DataBits    = 8            };
    
    /** Current address counter. This stores the current address of the FLASH or EEPROM as set by the host,
     *  and is used when reading or writing to the AVRs memory (either FLASH or EEPROM depending on the issued
     *  command.)
     */
    uint32_t CurrAddress;
    
    /** 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.
     */
    bool RunBootloader = true;
    
    
    /** Main program entry point. This routine configures the hardware required by the bootloader, then continuously 
     *  runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start
     *  the loaded application code.
     */
    int main(void)
    {
    	/* Setup hardware required for the bootloader */