Started to clean up the AVRISP Programmer project code, donated by Opendous Inc.
*\r
* \param Command Single character AVR910 protocol command indicating what memory operation to perform\r
*/\r
-static void ProgramReadWriteMemoryBlock(const uint8_t Command)\r
+static void ReadWriteMemoryBlock(const uint8_t Command)\r
{\r
uint16_t BlockSize;\r
char MemoryType;\r
else if ((Command == 'B') || (Command == 'g'))\r
{\r
/* Delegate the block write/read to a seperate function for clarity */\r
- ProgramReadWriteMemoryBlock(Command);\r
+ ReadWriteMemoryBlock(Command);\r
}\r
else if (Command == 'R')\r
{\r
\r
/* Function Prototypes: */\r
#if defined(INCLUDE_FROM_BOOTLOADERCDC_C) || defined(__DOXYGEN__)\r
- static void ProgramReadWriteMemoryBlock(const uint8_t Command);\r
+ static void ReadWriteMemoryBlock(const uint8_t Command);\r
static uint8_t FetchNextCommandByte(void);\r
- static void WriteNextResponseByte(const uint8_t Response);\r
+ static void WriteNextResponseByte(const uint8_t Response);\r
#endif\r
\r
#endif\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DSTATIC_ENDPOINT_CONFIGURATION\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
-CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DUSE_SINGLE_DEVICE_CONFIGURATION\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSB_DEVICE_ONLY -DUSE_NONSTANDARD_DESCRIPTOR_NAMES\r
+CDEFS += -DSTATIC_ENDPOINT_CONFIGURATION -DFIXED_CONTROL_ENDPOINT_SIZE=8\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DUSE_SINGLE_DEVICE_CONFIGURATION\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DSTATIC_ENDPOINT_CONFIGURATION\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
-CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DFIXED_CONTROL_ENDPOINT_SIZE=32 -DUSE_SINGLE_DEVICE_CONFIGURATION\r
-CDEFS += -DNO_CLEARSET_FEATURE_REQUEST\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSB_DEVICE_ONLY -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_CLEARSET_FEATURE_REQUEST\r
+CDEFS += -DSTATIC_ENDPOINT_CONFIGURATION -DFIXED_CONTROL_ENDPOINT_SIZE=32\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DUSE_SINGLE_DEVICE_CONFIGURATION\r
+\r
\r
# Place -D or -U options here for ASM sources\r
ADEFS = -DF_CPU=$(F_CPU)\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DSTATIC_ENDPOINT_CONFIGURATION\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
-CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DFIXED_CONTROL_ENDPOINT_SIZE=8 -DUSE_SINGLE_DEVICE_CONFIGURATION\r
-CDEFS += -DNO_CLEARSET_FEATURE_REQUEST\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSB_DEVICE_ONLY -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_CLEARSET_FEATURE_REQUES\r
+CDEFS += -DSTATIC_ENDPOINT_CONFIGURATION -DFIXED_CONTROL_ENDPOINT_SIZE=8\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS += -DUSE_RAM_DESCRIPTORS -DBOOT_START_ADDR=$(BOOT_START)UL -DUSE_SINGLE_DEVICE_CONFIGURATION\r
+\r
\r
# Place -D or -U options here for ASM sources\r
ADEFS = -DF_CPU=$(F_CPU)\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
-CDEFS += -DNO_STREAM_CALLBACKS\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_HOST_ONLY -DNO_STREAM_CALLBACKS\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
# Place -D or -U options here for ASM sources\r
ADEFS = -DF_CPU=$(F_CPU)\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_HOST_ONLY -DNO_STREAM_CALLBACKS\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_HOST_ONLY -DNO_STREAM_CALLBACKS\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_HOST_ONLY -DNO_STREAM_CALLBACKS\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_HOST_ONLY -DNO_STREAM_CALLBACKS\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
\r
# Display size of file.\r
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex\r
-EELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf\r
+ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf\r
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) )\r
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr )\r
\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_HOST_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_HOST_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_HOST_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_HOST_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+\r
CDEFS += -DNO_DECODE_ETHERNET -DNO_DECODE_ARP -DNO_DECODE_ICMP -DNO_DECODE_IP -DNO_DECODE_TCP -DNO_DECODE_UDP -DNO_DECODE_DHCP\r
\r
\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_HOST_ONLY -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_HOST_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES\r
CDEFS += -DNUM_BLOCKS=100 -DBLOCK_SIZE=8 -DNUM_HANDLES=20\r
\r
\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
* - Fixed KeyboardMouse demo discarding the wIndex value in the REQ_GetReport request\r
* - USBtoSerial demo now discards all Rx data when not connected to a USB host, rather than buffering characters for transmission\r
* next time the device is attached to a host.\r
+ * - Added new F_CLOCK compile time constant to the library and makefiles, to give the raw input clock (used to feed the PLL before any\r
+ * clock prescaling is performed) frequency, so that the PLL prescale mask can be determined\r
*\r
* \section Sec_ChangeLog090209 Version 090209\r
*\r
#endif\r
\r
/* Preprocessor Checks and Defines: */\r
- #if (F_CPU == 8000000)\r
+ #if !defined(F_CLOCK)\r
+ #error F_CLOCK is not defined. You must device F_CLOCK to the frequency of the unprescaled input clock in your project makefile.\r
+ #define F_CLOCK 0\r
+ #endif\r
+ \r
+ #if (F_CLOCK == 8000000)\r
#if (defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__))\r
#define USB_PLL_PSC 0\r
#elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || \\r
#elif (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__))\r
#define USB_PLL_PSC 0\r
#endif\r
- #elif (F_CPU == 16000000)\r
+ #elif (F_CLOCK == 16000000)\r
#if (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__) || defined(__AVR_ATmega32U6__))\r
#define USB_PLL_PSC ((1 << PLLP2) | (1 << PLLP1))\r
#elif (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__))\r
* directory into a /Board/ folder inside the application directory, and the stub driver completed with the appropriate code to drive the\r
* custom board's hardware.\r
*\r
- * \subsection SSec_F_CPU The F_CPU Parameter\r
- * This parameter indicates the target AVR's master clock frequency, in Hz. Consult your AVR model's datasheet for allowable clock frequencies\r
- * if the USB interface is to be operational.\r
+ * \subsection SSec_F_CLOCK The F_CLOCK Parameter\r
+ * This parameter indicates the target AVR's input clock frequency, in Hz. This is the actual clock input, before any prescaling is performed. In the\r
+ * USB AVR architecture, the input clock before any prescaling is fed directly to the PLL subsystem, and thus the PLL is derived directly from the\r
+ * clock input. The PLL then feeds the USB and other sections of the AVR with the correct upscaled frequencies required for those sections to function.\r
*\r
- * <b>Note that this value does not actually *alter* the AVR's clock frequency</b>, it is just a way to indicate to the library the clock frequency\r
+ * <b>Note that this value does not actually *alter* the AVR's input clock frequency</b>, it is just a way to indicate to the library the clock frequency\r
* of the AVR as set by the AVR's fuses. If this value does not reflect the actual running frequency of the AVR, incorrect operation of one of more\r
* library components will ocurr.\r
*\r
+ * \subsection SSec_F_CPU The F_CPU Parameter\r
+ * This parameter indicates the target AVR's master CPU clock frequency, in Hz.\r
+ *\r
+ * <b>Note that this value does not actually *alter* the AVR's CPU clock frequency</b>, it is just a way to indicate to the library the clock frequency\r
+ * of the AVR core as set by the AVR's fuses. If this value does not reflect the actual running frequency of the AVR, incorrect operation of one of more\r
+ * library components will ocurr.\r
+ *\r
* \subsection SSec_CDEFS The CDEFS Parameter\r
* Most applications will actually have multiple CDEF lines, which are concatenated together with the "+=" operator. This ensures that large\r
* numbers of configuration options remain readable by splitting up groups of options into seperate lines.\r
*\r
* \section Sec_MigrationXXXXXX Migrating from 090209 to XXXXXX\r
*\r
+ * <b>All</b>\r
+ * - LUFA projects must now give the raw input clock frequency (before any prescaling) as a compile time constant "F_CLOCK",\r
+ * defined in the project makefile and passed to the compiler via the -D switch.\r
+ * - The makefile EEPROM programming targets for FLIP and dfu-programmer no longer program in the FLASH data in addition to the\r
+ * EEPROM data into the device. If both are to be programmed, both the EEPROM and FLASH programming targets must be called.\r
+ *\r
+ * <b>Library Demos</b>\r
+ * - The USBtoSerial demo now discards all data when not connected to a host, rather than buffering it for later transmission.\r
*\r
* \section Sec_Migration090209 Migrating from 081217 to 090209\r
*\r
#define AVRDEVCODE02 0x56 /* ATtiny15 */\r
#define AVRDEVCODE03 0x5E /* ATtiny261 */\r
#define AVRDEVCODE04 0x76 /* ATmega8 */\r
-#define AVRDEVCODE05 0x74 /*ATmega16 */\r
+#define AVRDEVCODE05 0x74 /* ATmega16 */\r
#define AVRDEVCODE06 0x72 /* ATmega32 */\r
#define AVRDEVCODE07 0x45 /* ATmega64 */\r
#define AVRDEVCODE08 0x74 /* ATmega644 */\r
/** Flag to indicate if the USART is currently transmitting data from the Rx_Buffer circular buffer. */\r
volatile bool Transmitting = false;\r
\r
-\r
/* some global variables used throughout */\r
-uint8_t tempIOreg = 0;\r
-uint8_t tempIOreg2 = 0;\r
-uint8_t tempIOreg3 = 0;\r
-uint8_t tempIOreg4 = 0;\r
-uint8_t dataWidth = 0;\r
-uint8_t firstRun = 1;\r
-uint8_t deviceCode = 0;\r
-uint8_t tempByte = 0;\r
uint16_t currAddress = 0;\r
-uint16_t timerval = 0;\r
-\r
-\r
\r
/** Main program entry point. This routine configures the hardware required by the application, then\r
starts the scheduler to run the application tasks.\r
/* Hardware Initialization */\r
LEDs_Init();\r
ReconfigureSPI();\r
- // prepare PortB\r
- DDRB = 0;\r
- PORTB = 0;\r
+\r
DDRC |= ((1 << PC2) | (1 << PC4) | (1 << PC5) | (1 << PC6) | (1 << PC7)); //AT90USBxx2\r
// PC2 is also used for RESET, so set it HIGH initially - note 'P' command sets it to LOW (Active)\r
PORTC |= ((1 << PC2) | (1 << PC4) | (1 << PC5) | (1 << PC6) | (1 << PC7)); //AT90USBxx2\r
PORTB |= (1 << PB0);\r
// make sure DataFlash devices to not interfere - deselect them by setting PE0 and PE1 HIGH:\r
PORTE = 0xFF;\r
- DDRE = 0xFF;\r
-\r
- // initialize Timer1 for use in delay function\r
- TCCR1A = 0;\r
- //TCCR1B = (1 << CS10); // no prescaling, use CLK\r
- TCCR1B = ((1 << CS12) | (1 << CS10)); // prescale by CLK/1024\r
- // 8MHz/1024 = 7813 ticks per second --> ~8 ticks per millisecond (ms)\r
- timerval = TCNT1; // start timer1\r
-\r
+ DDRE = 0xFF;\r
\r
/* Ringbuffer Initialization */\r
Buffer_Initialize(&Rx_Buffer);\r
case REQ_SetControlLineState:\r
if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE))\r
{\r
-#if 0\r
- /* NOTE: Here you can read in the line state mask from the host, to get the current state of the output handshake\r
- lines. The mask is read in from the wValue parameter, and can be masked against the CONTROL_LINE_OUT_* masks\r
- to determine the RTS and DTR line states using the following code:\r
- */\r
-\r
- uint16_t wIndex = Endpoint_Read_Word_LE();\r
- \r
- // Do something with the given line states in wIndex\r
-#endif\r
- \r
/* Acknowedge the SETUP packet, ready for data transfer */\r
Endpoint_ClearSetupReceived();\r
\r
{\r
if (USB_IsConnected)\r
{\r
-#if 0\r
- /* NOTE: Here you can use the notification endpoint to send back line state changes to the host, for the special RS-232\r
- handshake signal lines (and some error states), via the CONTROL_LINE_IN_* masks and the following code:\r
- */\r
-\r
- USB_Notification_Header_t Notification = (USB_Notification_Header_t)\r
- {\r
- NotificationType: (REQDIR_DEVICETOHOST | REQTYPE_CLASS | REQREC_INTERFACE),\r
- Notification: NOTIF_SerialState,\r
- wValue: 0,\r
- wIndex: 0,\r
- wLength: sizeof(uint16_t),\r
- };\r
- \r
- uint16_t LineStateMask;\r
- \r
- // Set LineStateMask here to a mask of CONTROL_LINE_IN_* masks to set the input handshake line states to send to the host\r
- \r
- Endpoint_SelectEndpoint(CDC_NOTIFICATION_EPNUM);\r
- Endpoint_Write_Stream_LE(&Notification, sizeof(Notification));\r
- Endpoint_Write_Stream_LE(&LineStateMask, sizeof(LineStateMask));\r
- Endpoint_ClearCurrentBank();\r
-#endif\r
-\r
/* Select the Serial Rx Endpoint */\r
Endpoint_SelectEndpoint(CDC_RX_EPNUM);\r
\r
/* Store each character from the endpoint */\r
Buffer_StoreElement(&Rx_Buffer, Endpoint_Read_Byte());\r
\r
-\r
-\r
-\r
- /* Each time there is an element, check which comand should be\r
- run and if enough data is available to run that command.\r
- There are 1-byte, 2-byte, 3-byte, 4-byte commands, and 5-byte commands\r
- Remember that the "which command" byte counts as 1 */\r
- if (Rx_Buffer.Elements == 0) {\r
- // do nothing, wait for data\r
- } else {\r
- tempByte = Buffer_PeekElement(&Rx_Buffer); // peek at first element\r
-\r
- /* make sure the issued command and associated data are all ready */\r
- if (Rx_Buffer.Elements == 1) { // zero data byte command\r
- if ((tempByte == 'P') | (tempByte == 'a') | (tempByte == 'm') |\r
- (tempByte == 'R') | (tempByte == 'd') | (tempByte == 'e') |\r
- (tempByte == 'L') | (tempByte == 's') | (tempByte == 't') | \r
- (tempByte == 'S') | (tempByte == 'V') | (tempByte == 'v') |\r
- (tempByte == 'p') | (tempByte == 'F')) {\r
- processHostSPIRequest(); // command has enough data, process it\r
- }\r
- } else if (Rx_Buffer.Elements == 2) { // one data byte command\r
- if ((tempByte == 'T') | (tempByte == 'c') | (tempByte == 'C') |\r
- (tempByte == 'D') | (tempByte == 'l') | (tempByte == 'f') |\r
- (tempByte == 'x') | (tempByte == 'y')) {\r
- processHostSPIRequest(); // command has enough data, process it\r
- }\r
- } else if (Rx_Buffer.Elements == 3) { // two data byte command\r
- if ((tempByte == 'A') | (tempByte == 'Z')) {\r
- processHostSPIRequest(); // command has enough data, process it\r
- }\r
- } else if (Rx_Buffer.Elements == 4) { // three data byte command\r
- if ((tempByte == ':')) {\r
- processHostSPIRequest(); // command has enough data, process it\r
- }\r
- } else if (Rx_Buffer.Elements == 5) { // four data byte command\r
- if ((tempByte == '.')) {\r
- processHostSPIRequest(); // command has enough data, process it\r
- }\r
- } else {\r
- // do nothing\r
- }\r
+ /* Run the given command once enough data is available. */\r
+ if (Rx_Buffer.Elements)\r
+ {\r
+ const uint8_t ZeroDataByteCommands[] = {'P', 'a', 'm', 'R', 'd', 'e', 'L', 's', 't', 'S', 'V', 'v', 'p', 'F'};\r
+ const uint8_t OneDataByteCommands[] = {'T', 'c', 'C', 'D', 'l', 'f', 'x', 'y'};\r
+ const uint8_t TwoDataByteCommands[] = {'A', 'Z'};\r
+ const uint8_t ThreeDataByteCommands[] = {':'};\r
+ const uint8_t FourDataByteCommands[] = {'.'};\r
+ \r
+ const struct\r
+ {\r
+ const uint8_t TotalCommands;\r
+ const uint8_t* CommandBytes;\r
+ } AVR910Commands[] = {{sizeof(ZeroDataByteCommands), ZeroDataByteCommands},\r
+ {sizeof(OneDataByteCommands), OneDataByteCommands},\r
+ {sizeof(TwoDataByteCommands), TwoDataByteCommands},\r
+ {sizeof(ThreeDataByteCommands), ThreeDataByteCommands},\r
+ {sizeof(FourDataByteCommands), FourDataByteCommands}};\r
+ \r
+ /* Determine the data length of the issued command */\r
+ uint8_t CommandDataLength = (Rx_Buffer.Elements - 1);\r
+ \r
+ /* Loop through each of the possible command bytes allowable from the given command data length */\r
+ for (uint8_t CurrentCommand = 0; CurrentCommand < AVR910Commands[CommandDataLength].TotalCommands; CurrentCommand++)\r
+ {\r
+ /* If issues command matches an allowable command, process it */\r
+ if (Buffer_PeekElement(&Rx_Buffer) == AVR910Commands[CommandDataLength].CommandBytes[CurrentCommand])\r
+ processHostSPIRequest();\r
+ }\r
}\r
-\r
-\r
-\r
}\r
\r
/* Clear the endpoint buffer */\r
Endpoint_ClearCurrentBank();\r
}\r
- \r
- /* Check if Rx buffer contains data */\r
- if (Rx_Buffer.Elements)\r
- {\r
- /* Initiate the transmission of the buffer contents if USART idle */\r
- if (!(Transmitting))\r
- {\r
- Transmitting = true;\r
- /* The following flushes the receive buffer to prepare for new data and commands */\r
- /* Need to flush the buffer as the command byte which is peeked above needs to be */\r
- /* dealt with, otherwise the command bytes will overflow the buffer eventually */\r
- //Buffer_GetElement(&Rx_Buffer); // works also\r
- Buffer_Initialize(&Rx_Buffer);\r
- }\r
- }\r
\r
/* Select the Serial Tx Endpoint */\r
Endpoint_SelectEndpoint(CDC_TX_EPNUM);\r
}\r
}\r
\r
-\r
-\r
/** Function to manage status updates to the user. This is done via LEDs on the given board, if available, but may be changed to\r
- log to a serial port, or anything else that is suitable for status updates.\r
+ * log to a serial port, or anything else that is suitable for status updates.\r
*\r
- \param CurrentStatus Current status of the system, from the USBtoSerial_StatusCodes_t enum\r
+ * \param CurrentStatus Current status of the system, from the USBtoSerial_StatusCodes_t enum\r
*/\r
void UpdateStatus(uint8_t CurrentStatus)\r
{\r
LEDs_SetAllLEDs(LEDMask);\r
}\r
\r
-\r
/** Reconfigures SPI to match the current serial port settings issued by the host. */\r
void ReconfigureSPI(void)\r
{\r
uint8_t SPCRmask = (1 << SPE) | (1 << MSTR); // always enable SPI as Master\r
uint8_t SPSRmask = 0;\r
\r
- /* Determine data width */\r
- if (LineCoding.ParityType == Parity_Odd) {\r
- dataWidth = 16;\r
- } else if (LineCoding.ParityType == Parity_Even) {\r
- dataWidth = 32;\r
- } else if (LineCoding.ParityType == Parity_None) {\r
- dataWidth = 8;\r
- }\r
-\r
/* Determine stop bits - 1.5 stop bits is set as 1 stop bit due to hardware limitations */\r
/* For SPI, determine whether format is LSB or MSB */\r
if (LineCoding.CharFormat == TwoStopBits) { \r
\r
SPCR = SPCRmask;\r
SPSR = SPSRmask;\r
-\r
- // only read if first run\r
- if (firstRun) {\r
- tempIOreg = SPSR; //need to read to initiliaze\r
- tempIOreg = SPDR; //need to read to initiliaze\r
- firstRun = 0;\r
- }\r
-\r
}\r
\r
\r
//PORTB = 0; // set clock to zero\r
RESETPORT = (1 << RESETPIN); // set RESET pin on target to 1\r
RESETPORT2 = (1 << RESETPIN2);\r
- delay_ms(DELAY_SHORT);\r
+ _delay_ms(DELAY_SHORT);\r
//RESETPORT = (RESETPORT & ~(1 << RESETPIN)); // set RESET pin on target to 0 - Active\r
RESETPORT = 0x00;\r
RESETPORT2 = 0;\r
- delay_ms(DELAY_SHORT);\r
+ _delay_ms(DELAY_SHORT);\r
SPI_SendByte(0xAC);\r
SPI_SendByte(0x53);\r
SPI_SendByte(0x00);\r
SPI_SendByte(0x00);\r
- delay_ms(DELAY_VERYSHORT);\r
+ _delay_ms(DELAY_VERYSHORT);\r
Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
\r
} else if (firstByte == 'T') { // Select device type\r
- deviceCode = Buffer_GetElement(&Rx_Buffer); // set device type\r
+ Buffer_GetElement(&Rx_Buffer); // set device type\r
Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
\r
} else if (firstByte == 'a') { // Report autoincrement address\r
SPI_SendByte((currAddress >> 8)); // high byte\r
SPI_SendByte((currAddress)); // low byte\r
SPI_SendByte(readByte1); // data\r
- delay_ms(DELAY_MEDIUM); // certain MCUs require a delay of about 24585 cycles\r
+ _delay_ms(DELAY_MEDIUM); // certain MCUs require a delay of about 24585 cycles\r
Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
\r
} else if (firstByte == 'C') { // Write program memory, high byte\r
SPI_SendByte((currAddress >> 8)); // high byte\r
SPI_SendByte((currAddress)); // low byte\r
SPI_SendByte(0x00);\r
- delay_ms(DELAY_LONG);\r
+ _delay_ms(DELAY_LONG);\r
Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
\r
} else if (firstByte == 'R') { // Read Program Memory\r
SPI_SendByte((currAddress >> 8)); // high byte\r
SPI_SendByte((currAddress)); // low byte\r
SPI_SendByte(readByte1); // data\r
- delay_ms(DELAY_MEDIUM);\r
+ _delay_ms(DELAY_MEDIUM);\r
currAddress++; // increment currAddress\r
Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
\r
SPI_SendByte(0x80);\r
SPI_SendByte(0x04);\r
SPI_SendByte(0x00);\r
- delay_ms(DELAY_LONG);\r
+ _delay_ms(DELAY_LONG);\r
Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
\r
} else if (firstByte == 'l') { // write lock bits\r
SPI_SendByte(((0x06 & readByte1) | 0xE0)); // TODO - is this correct???\r
SPI_SendByte(0x00);\r
SPI_SendByte(0x00);\r
- delay_ms(DELAY_MEDIUM);\r
+ _delay_ms(DELAY_MEDIUM);\r
Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
\r
} else if (firstByte == 'f') { // write fuse bits\r
SPI_SendByte(readByte3);\r
readByte1 = SPI_TransferByte(0x00);\r
Buffer_StoreElement(&Tx_Buffer, readByte1);\r
- delay_ms(DELAY_MEDIUM);\r
+ _delay_ms(DELAY_MEDIUM);\r
Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
\r
} else if (firstByte == '.') { // New Universal Command\r
SPI_SendByte(readByte3);\r
readByte1 = SPI_TransferByte(readByte4);\r
Buffer_StoreElement(&Tx_Buffer, readByte1);\r
- delay_ms(DELAY_MEDIUM);\r
+ _delay_ms(DELAY_MEDIUM);\r
Buffer_StoreElement(&Tx_Buffer, CR_HEX); // return carriage return (CR_HEX) if successful\r
\r
} else if (firstByte == 'Z') { // Special test command\r
}\r
}\r
\r
-\r
-void delay_ms(uint8_t dly) {\r
- uint16_t endtime = 0;\r
-\r
- endtime = TCNT1;\r
- if (endtime > 63486) {\r
- endtime = (dly * DELAY_MULTIPLE);\r
- } else {\r
- endtime += (dly * DELAY_MULTIPLE);\r
- }\r
-\r
- timerval = TCNT1;\r
- while (timerval < endtime) {\r
- timerval = TCNT1;\r
- }\r
-}\r
#define _AVRISP_PROGRAMMER_H_\r
\r
/* Includes: */\r
+ #include <util/delay.h>\r
#include <avr/io.h>\r
#include <avr/wdt.h>\r
#include <avr/interrupt.h>\r
void ReconfigureSPI(void);\r
void UpdateStatus(uint8_t CurrentStatus);\r
void processHostSPIRequest(void);\r
- void delay_ms(uint8_t dly);\r
\r
#endif\r
F_CPU = 8000000\r
\r
\r
+# Input clock frequency.\r
+# This will define a symbol, F_CLOCK, in all source code files equal to the \r
+# input clock frequency (before any prescaling is performed). This value may\r
+# differ from F_CPU if prescaling is used on the latter, and is required as the\r
+# raw input clock is fed directly to the PLL sections of the AVR for high speed\r
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'\r
+# at the end, this will be done automatically to create a 32-bit value in your\r
+# source code.\r
+#\r
+# If no clock division is performed on the input clock inside the AVR (via the\r
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.\r
+F_CLOCK = 8000000\r
+\r
+\r
# Output format. (can be srec, ihex, binary)\r
FORMAT = ihex\r
\r
\r
\r
# Place -D or -U options here for C sources\r
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS\r
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)\r
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY\r
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"\r
\r
\r
# Place -D or -U options here for ASM sources\r
F_CPU = 16000000
+# Input clock frequency.
+# This will define a symbol, F_CLOCK, in all source code files equal to the
+# input clock frequency (before any prescaling is performed). This value may
+# differ from F_CPU if prescaling is used on the latter, and is required as the
+# raw input clock is fed directly to the PLL sections of the AVR for high speed
+# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL'
+# at the end, this will be done automatically to create a 32-bit value in your
+# source code.
+#
+# If no clock division is performed on the input clock inside the AVR (via the
+# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU.
+F_CLOCK = 8000000
+
+
# Output format. (can be srec, ihex, binary)
FORMAT = ihex
# Place -D or -U options here for C sources
-CDEFS = -DF_CPU=$(F_CPU)UL -DBOARD=BOARD_$(BOARD) -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS
-CDEFS += -DUSB_DEVICE_ONLY -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
+CDEFS = -DF_CPU=$(F_CPU)UL -DF_CLOCK=$(F_CLOCK)UL -DBOARD=BOARD_$(BOARD)
+CDEFS += -DUSE_NONSTANDARD_DESCRIPTOR_NAMES -DNO_STREAM_CALLBACKS -DUSB_DEVICE_ONLY
+CDEFS += -DUSE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
CDEFS += -DMAG_T1_CLOCK="(1 << 0)"
CDEFS += -DMAG_T1_DATA="(1 << 1)"