parent
f580232392
commit
d9643cf6ec
File diff suppressed because one or more lines are too long
@ -0,0 +1,707 @@ |
||||
# Hey Emacs, this is a -*- makefile -*- |
||||
#---------------------------------------------------------------------------- |
||||
# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. |
||||
# >> Modified for use with the LUFA project. << |
||||
# |
||||
# Released to the Public Domain |
||||
# |
||||
# Additional material for this makefile was written by: |
||||
# Peter Fleury |
||||
# Tim Henigan |
||||
# Colin O'Flynn |
||||
# Reiner Patommel |
||||
# Markus Pfaff |
||||
# Sander Pool |
||||
# Frederik Rouleau |
||||
# Carlos Lamas |
||||
# Dean Camera |
||||
# Opendous Inc. |
||||
# Denver Gingerich |
||||
# |
||||
#---------------------------------------------------------------------------- |
||||
# On command line: |
||||
# |
||||
# make all = Make software. |
||||
# |
||||
# make clean = Clean out built project files. |
||||
# |
||||
# make coff = Convert ELF to AVR COFF. |
||||
# |
||||
# make extcoff = Convert ELF to AVR Extended COFF. |
||||
# |
||||
# make program = Download the hex file to the device, using avrdude. |
||||
# Please customize the avrdude settings below first! |
||||
# |
||||
# make dfu = Download the hex file to the device, using dfu-programmer (must |
||||
# have dfu-programmer installed). |
||||
# |
||||
# make flip = Download the hex file to the device, using Atmel FLIP (must |
||||
# have Atmel FLIP installed). |
||||
# |
||||
# make dfu-ee = Download the eeprom file to the device, using dfu-programmer |
||||
# (must have dfu-programmer installed). |
||||
# |
||||
# make flip-ee = Download the eeprom file to the device, using Atmel FLIP |
||||
# (must have Atmel FLIP installed). |
||||
# |
||||
# make doxygen = Generate DoxyGen documentation for the project (must have |
||||
# DoxyGen installed) |
||||
# |
||||
# make debug = Start either simulavr or avarice as specified for debugging, |
||||
# with avr-gdb or avr-insight as the front end for debugging. |
||||
# |
||||
# make filename.s = Just compile filename.c into the assembler code only. |
||||
# |
||||
# make filename.i = Create a preprocessed source file for use in submitting |
||||
# bug reports to the GCC project. |
||||
# |
||||
# To rebuild project do "make clean" then "make all". |
||||
#---------------------------------------------------------------------------- |
||||
|
||||
|
||||
# MCU name |
||||
MCU = ### INSERT NAME OF MICROCONTROLLER MODEL HERE ### |
||||
|
||||
|
||||
# Targeted chip architecture (see library "Architectures" documentation) |
||||
ARCH = XMEGA |
||||
|
||||
|
||||
# Target board (see library "Board Types" documentation, NONE for projects not requiring |
||||
# LUFA board drivers). If USER is selected, put custom board drivers in a directory called |
||||
# "Board" inside the application directory. |
||||
BOARD = ### INSERT NAME OF BOARD HERE, OR NONE IF NO BOARD DRIVERS USED ### |
||||
|
||||
|
||||
# Processor frequency. |
||||
# This will define a symbol, F_CPU, in all source code files equal to the |
||||
# processor frequency in Hz. You can then use this symbol in your source code to |
||||
# calculate timings. Do NOT tack on a 'UL' at the end, this will be done |
||||
# automatically to create a 32-bit value in your source code. |
||||
# |
||||
# This should be the frequency the system core runs at, after the system clock |
||||
# has been set up correctly and started. |
||||
F_CPU = ### INSERT PRESCALED SYSTEM CLOCK SPEED HERE, IN HZ ### |
||||
|
||||
|
||||
# USB controller master clock frequency. |
||||
# This will define a symbol, F_USB, in all source code files equal to the |
||||
# input clock frequency (before any prescaling is performed) in Hz. This value may |
||||
# differ from F_CPU, as the USB clock is often sourced from the same oscillator as |
||||
# the CPU clock, but run through multipliers and dividers to achieve the desired |
||||
# clock rate. |
||||
# |
||||
# For the UC3 chips, this should be equal to 48MHz or 96MHz. |
||||
F_USB = ### INSERT CLOCK TO USB MODULE HERE, IN HZ ### |
||||
|
||||
|
||||
# Output format. (can be srec, ihex, binary) |
||||
FORMAT = ihex |
||||
|
||||
|
||||
# Target file name (without extension). |
||||
TARGET = ### INSERT NAME OF MAIN FILENAME HERE, WITHOUT EXTENSION ### |
||||
|
||||
|
||||
# Object files directory |
||||
# To put object files in current directory, use a dot (.), do NOT make |
||||
# this an empty or blank macro! |
||||
OBJDIR = . |
||||
|
||||
|
||||
# Path to the LUFA library |
||||
LUFA_PATH = ### INSERT PATH TO LUFA LIBRARY RELATIVE TO PROJECT DIRECTORY HERE ### |
||||
|
||||
|
||||
# LUFA library compile-time options and predefined tokens (add '-D' before each token) |
||||
LUFA_OPTS = ### INSERT LUFA COMPILE TIME TOKES HERE ### |
||||
|
||||
|
||||
# Create the LUFA source path variables by including the LUFA root makefile |
||||
include $(LUFA_PATH)/LUFA/makefile |
||||
|
||||
|
||||
# List C source files here. (C dependencies are automatically generated.) |
||||
SRC = $(TARGET).c \ |
||||
$(LUFA_SRC_USB) \ |
||||
$(LUFA_SRC_USBCLASS) |
||||
### INSERT ADDITIONAL PROJECT SOURCE FILENAMES OR LUFA MODULE NAMES HERE ### |
||||
|
||||
|
||||
# List C++ source files here. (C dependencies are automatically generated.) |
||||
CPPSRC = |
||||
|
||||
|
||||
# List Assembler source files here. |
||||
# Make them always end in a capital .S. Files ending in a lowercase .s |
||||
# will not be considered source files but generated files (assembler |
||||
# output from the compiler), and will be deleted upon "make clean"! |
||||
# Even though the DOS/Win* filesystem matches both .s and .S the same, |
||||
# it will preserve the spelling of the filenames, and gcc itself does |
||||
# care about how the name is spelled on its command-line. |
||||
ASRC = |
||||
|
||||
|
||||
# Optimization level, can be [0, 1, 2, 3, s]. |
||||
# 0 = turn off optimization. s = optimize for size. |
||||
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) |
||||
OPT = s |
||||
|
||||
|
||||
# List any extra directories to look for include files here. |
||||
# Each directory must be seperated by a space. |
||||
# Use forward slashes for directory separators. |
||||
# For a directory that has spaces, enclose it in quotes. |
||||
EXTRAINCDIRS = $(LUFA_PATH)/ |
||||
|
||||
|
||||
# Compiler flag to set the C Standard level. |
||||
# c89 = "ANSI" C |
||||
# gnu89 = c89 plus GCC extensions |
||||
# c99 = ISO C99 standard (not yet fully implemented) |
||||
# gnu99 = c99 plus GCC extensions |
||||
CSTANDARD = -std=gnu99 |
||||
|
||||
|
||||
# Place -D or -U options here for C sources |
||||
CDEFS = -DF_CPU=$(F_CPU)UL |
||||
CDEFS += -DF_USB=$(F_USB)UL |
||||
CDEFS += -DBOARD=BOARD_$(BOARD) |
||||
CDEFS += -DARCH=ARCH_$(ARCH) |
||||
CDEFS += $(LUFA_OPTS) |
||||
|
||||
|
||||
# Place -D or -U options here for ASM sources |
||||
ADEFS = -DF_CPU=$(F_CPU) |
||||
ADEFS += -DF_USB=$(F_USB)UL |
||||
ADEFS += -DBOARD=BOARD_$(BOARD) |
||||
ADEFS += -DARCH=ARCH_$(ARCH) |
||||
ADEFS += $(LUFA_OPTS) |
||||
|
||||
# Place -D or -U options here for C++ sources |
||||
CPPDEFS = -DF_CPU=$(F_CPU)UL |
||||
CPPDEFS += -DF_USB=$(F_USB)UL |
||||
CPPDEFS += -DBOARD=BOARD_$(BOARD) |
||||
CPPDEFS += -DARCH=ARCH_$(ARCH) |
||||
CPPDEFS += $(LUFA_OPTS) |
||||
|
||||
|
||||
# Debugging format. |
||||
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. |
||||
# AVR Studio 4.10 requires dwarf-2. |
||||
# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. |
||||
DEBUG = dwarf-2 |
||||
|
||||
|
||||
#---------------- Compiler Options C ---------------- |
||||
# -g*: generate debugging information |
||||
# -O*: optimization level |
||||
# -f...: tuning, see GCC manual and avr-libc documentation |
||||
# -Wall...: warning level |
||||
# -Wa,...: tell GCC to pass this to the assembler. |
||||
# -adhlns...: create assembler listing |
||||
CFLAGS = -g$(DEBUG) |
||||
CFLAGS += $(CDEFS) |
||||
CFLAGS += -O$(OPT) |
||||
CFLAGS += -funsigned-char |
||||
CFLAGS += -funsigned-bitfields |
||||
CFLAGS += -ffunction-sections |
||||
CFLAGS += -fno-inline-small-functions |
||||
CFLAGS += -fpack-struct |
||||
CFLAGS += -fshort-enums |
||||
CFLAGS += -fno-strict-aliasing |
||||
CFLAGS += -Wall |
||||
CFLAGS += -Wstrict-prototypes |
||||
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) |
||||
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) |
||||
CFLAGS += $(CSTANDARD) |
||||
|
||||
|
||||
#---------------- Compiler Options C++ ---------------- |
||||
# -g*: generate debugging information |
||||
# -O*: optimization level |
||||
# -f...: tuning, see GCC manual and avr-libc documentation |
||||
# -Wall...: warning level |
||||
# -Wa,...: tell GCC to pass this to the assembler. |
||||
# -adhlns...: create assembler listing |
||||
CPPFLAGS = -g$(DEBUG) |
||||
CPPFLAGS += $(CPPDEFS) |
||||
CPPFLAGS += -O$(OPT) |
||||
CPPFLAGS += -funsigned-char |
||||
CPPFLAGS += -funsigned-bitfields |
||||
CPPFLAGS += -fpack-struct |
||||
CPPFLAGS += -fshort-enums |
||||
CPPFLAGS += -ffunction-sections |
||||
CPPFLAGS += -fno-strict-aliasing |
||||
CPPFLAGS += -fno-exceptions |
||||
CPPFLAGS += -Wall |
||||
CPPFLAGS += -Wundef |
||||
CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) |
||||
CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) |
||||
#CPPFLAGS += $(CSTANDARD) |
||||
|
||||
|
||||
#---------------- Assembler Options ---------------- |
||||
# -Wa,...: tell GCC to pass this to the assembler. |
||||
# -adhlns: create listing |
||||
# -gstabs: have the assembler create line number information; note that |
||||
# for use in COFF files, additional information about filenames |
||||
# and function names needs to be present in the assembler source |
||||
# files -- see avr-libc docs [FIXME: not yet described there] |
||||
# -listing-cont-lines: Sets the maximum number of continuation lines of hex |
||||
# dump that will be displayed for a given single line of source input. |
||||
ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 |
||||
|
||||
|
||||
#---------------- Library Options ---------------- |
||||
# Minimalistic printf version |
||||
PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min |
||||
|
||||
# Floating point printf version (requires MATH_LIB = -lm below) |
||||
PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt |
||||
|
||||
# If this is left blank, then it will use the Standard printf version. |
||||
PRINTF_LIB = |
||||
#PRINTF_LIB = $(PRINTF_LIB_MIN) |
||||
#PRINTF_LIB = $(PRINTF_LIB_FLOAT) |
||||
|
||||
|
||||
# Minimalistic scanf version |
||||
SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min |
||||
|
||||
# Floating point + %[ scanf version (requires MATH_LIB = -lm below) |
||||
SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt |
||||
|
||||
# If this is left blank, then it will use the Standard scanf version. |
||||
SCANF_LIB = |
||||
#SCANF_LIB = $(SCANF_LIB_MIN) |
||||
#SCANF_LIB = $(SCANF_LIB_FLOAT) |
||||
|
||||
|
||||
MATH_LIB = -lm |
||||
|
||||
|
||||
# List any extra directories to look for libraries here. |
||||
# Each directory must be seperated by a space. |
||||
# Use forward slashes for directory separators. |
||||
# For a directory that has spaces, enclose it in quotes. |
||||
EXTRALIBDIRS = |
||||
|
||||
|
||||
|
||||
#---------------- External Memory Options ---------------- |
||||
|
||||
# 64 KB of external RAM, starting after internal RAM (ATmega128!), |
||||
# used for variables (.data/.bss) and heap (malloc()). |
||||
#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff |
||||
|
||||
# 64 KB of external RAM, starting after internal RAM (ATmega128!), |
||||
# only used for heap (malloc()). |
||||
#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff |
||||
|
||||
EXTMEMOPTS = |
||||
|
||||
|
||||
|
||||
#---------------- Linker Options ---------------- |
||||
# -Wl,...: tell GCC to pass this to linker. |
||||
# -Map: create map file |
||||
# --cref: add cross reference to map file |
||||
LDFLAGS = -Wl,-Map=$(TARGET).map,--cref |
||||
LDFLAGS += -Wl,--relax |
||||
LDFLAGS += -Wl,--gc-sections |
||||
LDFLAGS += $(EXTMEMOPTS) |
||||
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) |
||||
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) |
||||
#LDFLAGS += -T linker_script.x |
||||
|
||||
|
||||
|
||||
#---------------- Programming Options (avrdude) ---------------- |
||||
|
||||
# Programming hardware |
||||
# Type: avrdude -c ? |
||||
# to get a full listing. |
||||
# |
||||
AVRDUDE_PROGRAMMER = jtagmkII |
||||
|
||||
# com1 = serial port. Use lpt1 to connect to parallel port. |
||||
AVRDUDE_PORT = usb |
||||
|
||||
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex |
||||
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep |
||||
|
||||
|
||||
# Uncomment the following if you want avrdude's erase cycle counter. |
||||
# Note that this counter needs to be initialized first using -Yn, |
||||
# see avrdude manual. |
||||
#AVRDUDE_ERASE_COUNTER = -y |
||||
|
||||
# Uncomment the following if you do /not/ wish a verification to be |
||||
# performed after programming the device. |
||||
#AVRDUDE_NO_VERIFY = -V |
||||
|
||||
# Increase verbosity level. Please use this when submitting bug |
||||
# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> |
||||
# to submit bug reports. |
||||
#AVRDUDE_VERBOSE = -v -v |
||||
|
||||
AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) |
||||
AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) |
||||
AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) |
||||
AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) |
||||
|
||||
|
||||
|
||||
#---------------- Debugging Options ---------------- |
||||
|
||||
# For simulavr only - target MCU frequency. |
||||
DEBUG_MFREQ = $(F_CPU) |
||||
|
||||
# Set the DEBUG_UI to either gdb or insight. |
||||
# DEBUG_UI = gdb |
||||
DEBUG_UI = insight |
||||
|
||||
# Set the debugging back-end to either avarice, simulavr. |
||||
DEBUG_BACKEND = avarice |
||||
#DEBUG_BACKEND = simulavr |
||||
|
||||
# GDB Init Filename. |
||||
GDBINIT_FILE = __avr_gdbinit |
||||
|
||||
# When using avarice settings for the JTAG |
||||
JTAG_DEV = /dev/com1 |
||||
|
||||
# Debugging port used to communicate between GDB / avarice / simulavr. |
||||
DEBUG_PORT = 4242 |
||||
|
||||
# Debugging host used to communicate between GDB / avarice / simulavr, normally |
||||
# just set to localhost unless doing some sort of crazy debugging when |
||||
# avarice is running on a different computer. |
||||
DEBUG_HOST = localhost |
||||
|
||||
|
||||
|
||||
#============================================================================ |
||||
|
||||
|
||||
# Define programs and commands. |
||||
SHELL = sh |
||||
CC = avr-gcc |
||||
OBJCOPY = avr-objcopy |
||||
OBJDUMP = avr-objdump |
||||
SIZE = avr-size |
||||
AR = avr-ar rcs |
||||
NM = avr-nm |
||||
AVRDUDE = avrdude |
||||
REMOVE = rm -f |
||||
REMOVEDIR = rm -rf |
||||
COPY = cp |
||||
WINSHELL = cmd |
||||
|
||||
|
||||
# Define Messages |
||||
# English |
||||
MSG_ERRORS_NONE = Errors: none |
||||
MSG_BEGIN = -------- begin -------- |
||||
MSG_END = -------- end -------- |
||||
MSG_SIZE_BEFORE = Size before: |
||||
MSG_SIZE_AFTER = Size after: |
||||
MSG_COFF = Converting to AVR COFF: |
||||
MSG_EXTENDED_COFF = Converting to AVR Extended COFF: |
||||
MSG_FLASH = Creating load file for Flash: |
||||
MSG_EEPROM = Creating load file for EEPROM: |
||||
MSG_EXTENDED_LISTING = Creating Extended Listing: |
||||
MSG_SYMBOL_TABLE = Creating Symbol Table: |
||||
MSG_LINKING = Linking: |
||||
MSG_COMPILING = Compiling C: |
||||
MSG_COMPILING_CPP = Compiling C++: |
||||
MSG_ASSEMBLING = Assembling: |
||||
MSG_CLEANING = Cleaning project: |
||||
MSG_CREATING_LIBRARY = Creating library: |
||||
|
||||
|
||||
|
||||
|
||||
# Define all object files. |
||||
OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) |
||||
|
||||
# Define all listing files. |
||||
LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) |
||||
|
||||
|
||||
# Compiler flags to generate dependency files. |
||||
GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d |
||||
|
||||
|
||||
# Combine all necessary flags and optional flags. |
||||
# Add target processor to flags. |
||||
ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) |
||||
ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) |
||||
ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# Default target. |
||||
all: begin gccversion sizebefore build sizeafter end |
||||
|
||||
# Change the build target to build a HEX file or a library. |
||||
build: elf hex eep lss sym |
||||
#build: lib |
||||
|
||||
|
||||
elf: $(TARGET).elf |
||||
hex: $(TARGET).hex |
||||
eep: $(TARGET).eep |
||||
lss: $(TARGET).lss |
||||
sym: $(TARGET).sym |
||||
LIBNAME=lib$(TARGET).a |
||||
lib: $(LIBNAME) |
||||
|
||||
|
||||
|
||||
# Eye candy. |
||||
# AVR Studio 3.x does not check make's exit code but relies on |
||||
# the following magic strings to be generated by the compile job. |
||||
begin: |
||||
@echo |
||||
@echo $(MSG_BEGIN) |
||||
|
||||
end: |
||||
@echo $(MSG_END) |
||||
@echo |
||||
|
||||
|
||||
# Display size of file. |
||||
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex |
||||
ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf |
||||
MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) |
||||
FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) |
||||
|
||||
|
||||
sizebefore: |
||||
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ |
||||
2>/dev/null; echo; fi |
||||
|
||||
sizeafter: |
||||
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ |
||||
2>/dev/null; echo; fi |
||||
|
||||
|
||||
|
||||
# Display compiler version information. |
||||
gccversion : |
||||
@$(CC) --version |
||||
|
||||
|
||||
# Program the device. |
||||
program: $(TARGET).hex $(TARGET).eep |
||||
$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) |
||||
|
||||
flip: $(TARGET).hex |
||||
batchisp -hardware usb -device $(MCU) -operation erase f |
||||
batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program |
||||
batchisp -hardware usb -device $(MCU) -operation start reset 0 |
||||
|
||||
dfu: $(TARGET).hex |
||||
dfu-programmer $(MCU) erase |
||||
dfu-programmer $(MCU) flash $(TARGET).hex |
||||
dfu-programmer $(MCU) reset |
||||
|
||||
flip-ee: $(TARGET).hex $(TARGET).eep |
||||
$(COPY) $(TARGET).eep $(TARGET)eep.hex |
||||
batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase |
||||
batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program |
||||
batchisp -hardware usb -device $(MCU) -operation start reset 0 |
||||
$(REMOVE) $(TARGET)eep.hex |
||||
|
||||
dfu-ee: $(TARGET).hex $(TARGET).eep |
||||
dfu-programmer $(MCU) eeprom-flash $(TARGET).eep |
||||
dfu-programmer $(MCU) reset |
||||
|
||||
|
||||
# Generate avr-gdb config/init file which does the following: |
||||
# define the reset signal, load the target file, connect to target, and set |
||||
# a breakpoint at main(). |
||||
gdb-config: |
||||
@$(REMOVE) $(GDBINIT_FILE) |
||||
@echo define reset >> $(GDBINIT_FILE) |
||||
@echo SIGNAL SIGHUP >> $(GDBINIT_FILE) |
||||
@echo end >> $(GDBINIT_FILE) |
||||
@echo file $(TARGET).elf >> $(GDBINIT_FILE) |
||||
@echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) |
||||
ifeq ($(DEBUG_BACKEND),simulavr) |
||||
@echo load >> $(GDBINIT_FILE) |
||||
endif |
||||
@echo break main >> $(GDBINIT_FILE) |
||||
|
||||
debug: gdb-config $(TARGET).elf |
||||
ifeq ($(DEBUG_BACKEND), avarice) |
||||
@echo Starting AVaRICE - Press enter when "waiting to connect" message displays. |
||||
@$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ |
||||
$(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) |
||||
@$(WINSHELL) /c pause |
||||
|
||||
else |
||||
@$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ |
||||
$(DEBUG_MFREQ) --port $(DEBUG_PORT) |
||||
endif |
||||
@$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) |
||||
|
||||
|
||||
|
||||
|
||||
# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. |
||||
COFFCONVERT = $(OBJCOPY) --debugging |
||||
COFFCONVERT += --change-section-address .data-0x800000 |
||||
COFFCONVERT += --change-section-address .bss-0x800000 |
||||
COFFCONVERT += --change-section-address .noinit-0x800000 |
||||
COFFCONVERT += --change-section-address .eeprom-0x810000 |
||||
|
||||
|
||||
|
||||
coff: $(TARGET).elf |
||||
@echo |
||||
@echo $(MSG_COFF) $(TARGET).cof |
||||
$(COFFCONVERT) -O coff-avr $< $(TARGET).cof |
||||
|
||||
|
||||
extcoff: $(TARGET).elf |
||||
@echo |
||||
@echo $(MSG_EXTENDED_COFF) $(TARGET).cof |
||||
$(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof |
||||
|
||||
|
||||
|
||||
# Create final output files (.hex, .eep) from ELF output file. |
||||
%.hex: %.elf |
||||
@echo |
||||
@echo $(MSG_FLASH) $@ |
||||
$(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@ |
||||
|
||||
%.eep: %.elf |
||||
@echo |
||||
@echo $(MSG_EEPROM) $@ |
||||
-$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ |
||||
--change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 |
||||
|
||||
# Create extended listing file from ELF output file. |
||||
%.lss: %.elf |
||||
@echo |
||||
@echo $(MSG_EXTENDED_LISTING) $@ |
||||
$(OBJDUMP) -h -S -z $< > $@ |
||||
|
||||
# Create a symbol table from ELF output file. |
||||
%.sym: %.elf |
||||
@echo |
||||
@echo $(MSG_SYMBOL_TABLE) $@ |
||||
$(NM) -n $< > $@ |
||||
|
||||
|
||||
|
||||
# Create library from object files. |
||||
.SECONDARY : $(TARGET).a |
||||
.PRECIOUS : $(OBJ) |
||||
%.a: $(OBJ) |
||||
@echo |
||||
@echo $(MSG_CREATING_LIBRARY) $@ |
||||
$(AR) $@ $(OBJ) |
||||
|
||||
|
||||
# Link: create ELF output file from object files. |
||||
.SECONDARY : $(TARGET).elf |
||||
.PRECIOUS : $(OBJ) |
||||
%.elf: $(OBJ) |
||||
@echo |
||||
@echo $(MSG_LINKING) $@ |
||||
$(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) |
||||
|
||||
|
||||
# Compile: create object files from C source files. |
||||
$(OBJDIR)/%.o : %.c |
||||
@echo |
||||
@echo $(MSG_COMPILING) $< |
||||
$(CC) -c $(ALL_CFLAGS) $< -o $@ |
||||
|
||||
|
||||
# Compile: create object files from C++ source files. |
||||
$(OBJDIR)/%.o : %.cpp |
||||
@echo |
||||
@echo $(MSG_COMPILING_CPP) $< |
||||
$(CC) -c $(ALL_CPPFLAGS) $< -o $@ |
||||
|
||||
|
||||
# Compile: create assembler files from C source files. |
||||
%.s : %.c |
||||
$(CC) -S $(ALL_CFLAGS) $< -o $@ |
||||
|
||||
|
||||
# Compile: create assembler files from C++ source files. |
||||
%.s : %.cpp |
||||
$(CC) -S $(ALL_CPPFLAGS) $< -o $@ |
||||
|
||||
|
||||
# Assemble: create object files from assembler source files. |
||||
$(OBJDIR)/%.o : %.S |
||||
@echo |
||||
@echo $(MSG_ASSEMBLING) $< |
||||
$(CC) -c $(ALL_ASFLAGS) $< -o $@ |
||||
|
||||
|
||||
# Create preprocessed source for use in sending a bug report. |
||||
%.i : %.c |
||||
$(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ |
||||
|
||||
|
||||
# Target: clean project. |
||||
clean: begin clean_list end |
||||
|
||||
clean_list : |
||||
@echo |
||||
@echo $(MSG_CLEANING) |
||||
$(REMOVE) $(TARGET).hex |
||||
$(REMOVE) $(TARGET).eep |
||||
$(REMOVE) $(TARGET).cof |
||||
$(REMOVE) $(TARGET).elf |
||||
$(REMOVE) $(TARGET).map |
||||
$(REMOVE) $(TARGET).sym |
||||
$(REMOVE) $(TARGET).lss |
||||
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) |
||||
$(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) |
||||
$(REMOVE) $(SRC:.c=.s) |
||||
$(REMOVE) $(SRC:.c=.d) |
||||
$(REMOVE) $(SRC:.c=.i) |
||||
$(REMOVEDIR) .dep |
||||
|
||||
doxygen: |
||||
@echo Generating Project Documentation... |
||||
@doxygen Doxygen.conf |
||||
@echo Documentation Generation Complete. |
||||
|
||||
clean_doxygen: |
||||
rm -rf Documentation |
||||
|
||||
checksource: |
||||
@for f in $(SRC) $(CPPSRC) $(ASRC); do \ |
||||
if [ -f $$f ]; then \ |
||||
echo "Found Source File: $$f" ; \ |
||||
else \ |
||||
echo "Source File Not Found: $$f" ; \ |
||||
fi; done |
||||
|
||||
|
||||
# Create object files directory |
||||
$(shell mkdir $(OBJDIR) 2>/dev/null) |
||||
|
||||
|
||||
# Include the dependency files. |
||||
-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) |
||||
|
||||
|
||||
# Listing of phony targets. |
||||
.PHONY : all begin finish end sizebefore sizeafter gccversion \ |
||||
build elf hex eep lss sym coff extcoff doxygen clean \ |
||||
clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ |
||||
debug gdb-config checksource |
@ -0,0 +1,44 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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. |
||||
*/ |
||||
|
||||
#define __INCLUDE_FROM_USB_DRIVER |
||||
#include "../USBMode.h" |
||||
|
||||
#if defined(USB_CAN_BE_DEVICE) |
||||
|
||||
#include "../Device.h" |
||||
|
||||
void USB_Device_SendRemoteWakeup(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
#endif |
||||
|
@ -0,0 +1,215 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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
|
||||
* \brief USB Device definitions for the AVR XMEGA microcontrollers. |
||||
* \copydetails Group_Device_XMEGA |
||||
* |
||||
* \note This file should not be included directly. It is automatically included as needed by the USB driver |
||||
* dispatch header located in LUFA/Drivers/USB/USB.h. |
||||
*/ |
||||
|
||||
/** \ingroup Group_Device
|
||||
* \defgroup Group_Device_XMEGA Device Management (XMEGA) |
||||
* \brief USB Device definitions for the AVR XMEGA microcontrollers. |
||||
* |
||||
* Architecture specific USB Device definitions for the Atmel AVR XMEGA microcontrollers. |
||||
* |
||||
* @{ |
||||
*/ |
||||
|
||||
#ifndef __USBDEVICE_XMEGA_H__ |
||||
#define __USBDEVICE_XMEGA_H__ |
||||
|
||||
/* Includes: */ |
||||
#include "../../../../Common/Common.h" |
||||
#include "../StdDescriptors.h" |
||||
#include "../USBInterrupt.h" |
||||
#include "../Endpoint.h" |
||||
|
||||
/* Enable C linkage for C++ Compilers: */ |
||||
#if defined(__cplusplus) |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/* Preprocessor Checks: */ |
||||
#if !defined(__INCLUDE_FROM_USB_DRIVER) |
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. |
||||
#endif |
||||
|
||||
#if (defined(USE_RAM_DESCRIPTORS) && defined(USE_EEPROM_DESCRIPTORS)) |
||||
#error USE_RAM_DESCRIPTORS and USE_EEPROM_DESCRIPTORS are mutually exclusive. |
||||
#endif |
||||
|
||||
/* Public Interface - May be used in end-application: */ |
||||
/* Macros: */ |
||||
/** \name USB Device Mode Option Masks */ |
||||
//@{
|
||||
/** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the
|
||||
* USB interface should be initialized in low speed (1.5Mb/s) mode. |
||||
* |
||||
* \note Low Speed mode is not available on all USB AVR models. |
||||
* \n |
||||
* |
||||
* \note Restrictions apply on the number, size and type of endpoints which can be used |
||||
* when running in low speed mode - refer to the USB 2.0 specification. |
||||
*/ |
||||
#define USB_DEVICE_OPT_LOWSPEED (1 << 0) |
||||
|
||||
/** Mask for the Options parameter of the \ref USB_Init() function. This indicates that the
|
||||
* USB interface should be initialized in full speed (12Mb/s) mode. |
||||
*/ |
||||
#define USB_DEVICE_OPT_FULLSPEED (0 << 0) |
||||
//@}
|
||||
|
||||
/** String descriptor index for the device's unique serial number string descriptor within the device.
|
||||
* This unique serial number is used by the host to associate resources to the device (such as drivers or COM port |
||||
* number allocations) to a device regardless of the port it is plugged in to on the host. Some microcontrollers contain |
||||
* a unique serial number internally, and setting the device descriptors serial number string index to this value |
||||
* will cause it to use the internal serial number. |
||||
* |
||||
* On unsupported devices, this will evaluate to \ref NO_DESCRIPTOR and so will force the host to create a pseudo-serial |
||||
* number for the device. |
||||
*/ |
||||
#define USE_INTERNAL_SERIAL NO_DESCRIPTOR |
||||
|
||||
/** Length of the device's unique internal serial number, in bits, if present on the selected microcontroller
|
||||
* model. |
||||
*/ |
||||
#define INTERNAL_SERIAL_LENGTH_BITS 0 |
||||
|
||||
/** Start address of the internal serial number, in the appropriate address space, if present on the selected microcontroller
|
||||
* model. |
||||
*/ |
||||
#define INTERNAL_SERIAL_START_ADDRESS 0 |
||||
|
||||
/* Function Prototypes: */ |
||||
/** Sends a Remote Wakeup request to the host. This signals to the host that the device should
|
||||
* be taken out of suspended mode, and communications should resume. |
||||
* |
||||
* Typically, this is implemented so that HID devices (mice, keyboards, etc.) can wake up the |
||||
* host computer when the host has suspended all USB devices to enter a low power state. |
||||
* |
||||
* \note This macro should only be used if the device has indicated to the host that it |
||||
* supports the Remote Wakeup feature in the device descriptors, and should only be |
||||
* issued if the host is currently allowing remote wakeup events from the device (i.e., |
||||
* the \ref USB_Device_RemoteWakeupEnabled flag is set). When the \c NO_DEVICE_REMOTE_WAKEUP |
||||
* compile time option is used, this macro is unavailable. |
||||
* \n\n |
||||
* |
||||
* \note The USB clock must be running for this function to operate. If the stack is initialized with |
||||
* the \ref USB_OPT_MANUAL_PLL option enabled, the user must ensure that the PLL is running |
||||
* before attempting to call this function. |
||||
* |
||||
* \see \ref Group_StdDescriptors for more information on the RMWAKEUP feature and device descriptors. |
||||
*/ |
||||
void USB_Device_SendRemoteWakeup(void); |
||||
|
||||
/* Inline Functions: */ |
||||
/** Returns the current USB frame number, when in device mode. Every millisecond the USB bus is active (i.e. enumerated to a host)
|
||||
* the frame number is incremented by one. |
||||
*/ |
||||
static inline uint16_t USB_Device_GetFrameNumber(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; |
||||
static inline uint16_t USB_Device_GetFrameNumber(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
#if !defined(NO_SOF_EVENTS) |
||||
/** Enables the device mode Start Of Frame events. When enabled, this causes the
|
||||
* \ref EVENT_USB_Device_StartOfFrame() event to fire once per millisecond, synchronized to the USB bus, |
||||
* at the start of each USB frame when enumerated in device mode. |
||||
* |
||||
* \note Not available when the \c NO_SOF_EVENTS compile time token is defined. |
||||
*/ |
||||
static inline void USB_Device_EnableSOFEvents(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_Device_EnableSOFEvents(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Disables the device mode Start Of Frame events. When disabled, this stops the firing of the
|
||||
* \ref EVENT_USB_Device_StartOfFrame() event when enumerated in device mode. |
||||
* |
||||
* \note Not available when the \c NO_SOF_EVENTS compile time token is defined. |
||||
*/ |
||||
static inline void USB_Device_DisableSOFEvents(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_Device_DisableSOFEvents(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
#endif |
||||
|
||||
/* Private Interface - For use in library only: */ |
||||
#if !defined(__DOXYGEN__) |
||||
/* Inline Functions: */ |
||||
static inline void USB_Device_SetLowSpeed(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_Device_SetLowSpeed(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
static inline void USB_Device_SetFullSpeed(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_Device_SetFullSpeed(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
static inline void USB_Device_SetDeviceAddress(const uint8_t Address) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_Device_SetDeviceAddress(const uint8_t Address) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
static inline bool USB_Device_IsAddressSet(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; |
||||
static inline bool USB_Device_IsAddressSet(void) |
||||
{ |
||||
return false; // TODO
|
||||
} |
||||
|
||||
#if (USE_INTERNAL_SERIAL != NO_DESCRIPTOR) |
||||
static inline void USB_Device_GetSerialString(uint16_t* const UnicodeString) ATTR_NON_NULL_PTR_ARG(1); |
||||
static inline void USB_Device_GetSerialString(uint16_t* const UnicodeString) |
||||
{ |
||||
// TODO
|
||||
} |
||||
#endif |
||||
|
||||
#endif |
||||
|
||||
/* Disable C linkage for C++ Compilers: */ |
||||
#if defined(__cplusplus) |
||||
} |
||||
#endif |
||||
|
||||
#endif |
||||
|
||||
/** @} */ |
||||
|
@ -0,0 +1,201 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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. |
||||
*/ |
||||
|
||||
#define __INCLUDE_FROM_USB_DRIVER |
||||
#include "../USBMode.h" |
||||
|
||||
#if defined(USB_CAN_BE_DEVICE) |
||||
|
||||
#include "EndpointStream_XMEGA.h" |
||||
|
||||
#if !defined(CONTROL_ONLY_DEVICE) |
||||
uint8_t Endpoint_Discard_Stream(uint16_t Length, |
||||
uint16_t* const BytesProcessed) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
uint8_t Endpoint_Null_Stream(uint16_t Length, |
||||
uint16_t* const BytesProcessed) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_LE |
||||
#define TEMPLATE_BUFFER_TYPE const void* |
||||
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) 0 |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) |
||||
#include "Template/Template_Endpoint_RW.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Write_Stream_BE |
||||
#define TEMPLATE_BUFFER_TYPE const void* |
||||
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) |
||||
#include "Template/Template_Endpoint_RW.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_LE |
||||
#define TEMPLATE_BUFFER_TYPE void* |
||||
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) 0 |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() |
||||
#include "Template/Template_Endpoint_RW.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Read_Stream_BE |
||||
#define TEMPLATE_BUFFER_TYPE void* |
||||
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() |
||||
#include "Template/Template_Endpoint_RW.c" |
||||
|
||||
#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) |
||||
#define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_LE |
||||
#define TEMPLATE_BUFFER_TYPE const void* |
||||
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) 0 |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) |
||||
#include "Template/Template_Endpoint_RW.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Write_PStream_BE |
||||
#define TEMPLATE_BUFFER_TYPE const void* |
||||
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) |
||||
#include "Template/Template_Endpoint_RW.c" |
||||
#endif |
||||
|
||||
#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) |
||||
#define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_LE |
||||
#define TEMPLATE_BUFFER_TYPE const void* |
||||
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) 0 |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) |
||||
#include "Template/Template_Endpoint_RW.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Write_EStream_BE |
||||
#define TEMPLATE_BUFFER_TYPE const void* |
||||
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearIN() |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) |
||||
#include "Template/Template_Endpoint_RW.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_LE |
||||
#define TEMPLATE_BUFFER_TYPE void* |
||||
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) 0 |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) |
||||
#include "Template/Template_Endpoint_RW.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Read_EStream_BE |
||||
#define TEMPLATE_BUFFER_TYPE void* |
||||
#define TEMPLATE_CLEAR_ENDPOINT() Endpoint_ClearOUT() |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) |
||||
#include "Template/Template_Endpoint_RW.c" |
||||
#endif |
||||
|
||||
#endif |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_LE |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) 0 |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) |
||||
#include "Template/Template_Endpoint_Control_W.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_Stream_BE |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(*BufferPtr) |
||||
#include "Template/Template_Endpoint_Control_W.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_LE |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) 0 |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() |
||||
#include "Template/Template_Endpoint_Control_R.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_Stream_BE |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Endpoint_Read_8() |
||||
#include "Template/Template_Endpoint_Control_R.c" |
||||
|
||||
#if defined(ARCH_HAS_FLASH_ADDRESS_SPACE) |
||||
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_LE |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) 0 |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) |
||||
#include "Template/Template_Endpoint_Control_W.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_PStream_BE |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(pgm_read_byte(BufferPtr)) |
||||
#include "Template/Template_Endpoint_Control_W.c" |
||||
#endif |
||||
|
||||
#if defined(ARCH_HAS_EEPROM_ADDRESS_SPACE) |
||||
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_LE |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) 0 |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) |
||||
#include "Template/Template_Endpoint_Control_W.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Write_Control_EStream_BE |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Endpoint_Write_8(eeprom_read_byte(BufferPtr)) |
||||
#include "Template/Template_Endpoint_Control_W.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_LE |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) 0 |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr += Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) |
||||
#include "Template/Template_Endpoint_Control_R.c" |
||||
|
||||
#define TEMPLATE_FUNC_NAME Endpoint_Read_Control_EStream_BE |
||||
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1) |
||||
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) BufferPtr -= Amount |
||||
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Endpoint_Read_8()) |
||||
#include "Template/Template_Endpoint_Control_R.c" |
||||
#endif |
||||
|
||||
#endif |
@ -0,0 +1,648 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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
|
||||
* \brief Endpoint data stream transmission and reception management for the AVR XMEGA microcontrollers. |
||||
* \copydetails Group_EndpointStreamRW_XMEGA |
||||
* |
||||
* \note This file should not be included directly. It is automatically included as needed by the USB driver |
||||
* dispatch header located in LUFA/Drivers/USB/USB.h. |
||||
*/ |
||||
|
||||
/** \ingroup Group_EndpointStreamRW
|
||||
* \defgroup Group_EndpointStreamRW_XMEGA Read/Write of Multi-Byte Streams (XMEGA) |
||||
* \brief Endpoint data stream transmission and reception management for the Atmel AVR XMEGA architecture. |
||||
* |
||||
* Functions, macros, variables, enums and types related to data reading and writing of data streams from |
||||
* and to endpoints. |
||||
* |
||||
* @{ |
||||
*/
|
||||
|
||||
#ifndef __ENDPOINT_STREAM_XMEGA_H__ |
||||
#define __ENDPOINT_STREAM_XMEGA_H__ |
||||
|
||||
/* Includes: */ |
||||
#include "../../../../Common/Common.h" |
||||
#include "../USBMode.h" |
||||
#include "../USBTask.h" |
||||
|
||||
/* Enable C linkage for C++ Compilers: */ |
||||
#if defined(__cplusplus) |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/* Preprocessor Checks: */ |
||||
#if !defined(__INCLUDE_FROM_USB_DRIVER) |
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. |
||||
#endif |
||||
|
||||
/* Public Interface - May be used in end-application: */ |
||||
/* Function Prototypes: */ |
||||
/** \name Stream functions for null data */ |
||||
//@{
|
||||
|
||||
/** Reads and discards the given number of bytes from the currently selected endpoint's bank,
|
||||
* discarding fully read packets from the host as needed. The last packet is not automatically |
||||
* discarded once the remaining bytes has been read; the user is responsible for manually |
||||
* discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. |
||||
* |
||||
* If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, |
||||
* failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid |
||||
* storage location, the transfer will instead be performed as a series of chunks. Each time |
||||
* the endpoint bank becomes empty while there is still data to process (and after the current |
||||
* packet has been acknowledged) the BytesProcessed location will be updated with the total number |
||||
* of bytes processed in the stream, and the function will exit with an error code of |
||||
* \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed |
||||
* in the user code - to continue the transfer, call the function again with identical parameters |
||||
* and it will resume until the BytesProcessed value reaches the total transfer length. |
||||
* |
||||
* <b>Single Stream Transfer Example:</b> |
||||
* \code |
||||
* uint8_t ErrorCode; |
||||
* |
||||
* if ((ErrorCode = Endpoint_Discard_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) |
||||
* { |
||||
* // Stream failed to complete - check ErrorCode here
|
||||
* } |
||||
* \endcode |
||||
* |
||||
* <b>Partial Stream Transfers Example:</b> |
||||
* \code |
||||
* uint8_t ErrorCode; |
||||
* uint16_t BytesProcessed; |
||||
* |
||||
* BytesProcessed = 0; |
||||
* while ((ErrorCode = Endpoint_Discard_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) |
||||
* { |
||||
* // Stream not yet complete - do other actions here, abort if required
|
||||
* } |
||||
* |
||||
* if (ErrorCode != ENDPOINT_RWSTREAM_NoError) |
||||
* { |
||||
* // Stream failed to complete - check ErrorCode here
|
||||
* } |
||||
* \endcode |
||||
* |
||||
* \note This routine should not be used on CONTROL type endpoints. |
||||
* |
||||
* \param[in] Length Number of bytes to discard via the currently selected endpoint. |
||||
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current |
||||
* transaction should be updated, \c NULL if the entire stream should be read at once. |
||||
* |
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Discard_Stream(uint16_t Length, |
||||
uint16_t* const BytesProcessed); |
||||
|
||||
/** Writes a given number of zeroed bytes to the currently selected endpoint's bank, sending
|
||||
* full packets to the host as needed. The last packet is not automatically sent once the
|
||||
* remaining bytes have been written; the user is responsible for manually sending the last |
||||
* packet to the host via the \ref Endpoint_ClearIN() macro. |
||||
* |
||||
* If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, |
||||
* failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid |
||||
* storage location, the transfer will instead be performed as a series of chunks. Each time |
||||
* the endpoint bank becomes full while there is still data to process (and after the current |
||||
* packet transmission has been initiated) the BytesProcessed location will be updated with the |
||||
* total number of bytes processed in the stream, and the function will exit with an error code of |
||||
* \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed |
||||
* in the user code - to continue the transfer, call the function again with identical parameters |
||||
* and it will resume until the BytesProcessed value reaches the total transfer length. |
||||
* |
||||
* <b>Single Stream Transfer Example:</b> |
||||
* \code |
||||
* uint8_t ErrorCode; |
||||
* |
||||
* if ((ErrorCode = Endpoint_Null_Stream(512, NULL)) != ENDPOINT_RWSTREAM_NoError) |
||||
* { |
||||
* // Stream failed to complete - check ErrorCode here
|
||||
* } |
||||
* \endcode |
||||
* |
||||
* <b>Partial Stream Transfers Example:</b> |
||||
* \code |
||||
* uint8_t ErrorCode; |
||||
* uint16_t BytesProcessed; |
||||
* |
||||
* BytesProcessed = 0; |
||||
* while ((ErrorCode = Endpoint_Null_Stream(512, &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) |
||||
* { |
||||
* // Stream not yet complete - do other actions here, abort if required
|
||||
* } |
||||
* |
||||
* if (ErrorCode != ENDPOINT_RWSTREAM_NoError) |
||||
* { |
||||
* // Stream failed to complete - check ErrorCode here
|
||||
* } |
||||
* \endcode |
||||
* |
||||
* \note This routine should not be used on CONTROL type endpoints. |
||||
* |
||||
* \param[in] Length Number of zero bytes to send via the currently selected endpoint. |
||||
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current |
||||
* transaction should be updated, \c NULL if the entire stream should be read at once. |
||||
* |
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Null_Stream(uint16_t Length, |
||||
uint16_t* const BytesProcessed); |
||||
|
||||
//@}
|
||||
|
||||
/** \name Stream functions for RAM source/destination data */ |
||||
//@{
|
||||
|
||||
/** Writes the given number of bytes to the endpoint from the given buffer in little endian,
|
||||
* sending full packets to the host as needed. The last packet filled is not automatically sent; |
||||
* the user is responsible for manually sending the last written packet to the host via the |
||||
* \ref Endpoint_ClearIN() macro. |
||||
* |
||||
* If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, |
||||
* failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid |
||||
* storage location, the transfer will instead be performed as a series of chunks. Each time |
||||
* the endpoint bank becomes full while there is still data to process (and after the current |
||||
* packet transmission has been initiated) the BytesProcessed location will be updated with the |
||||
* total number of bytes processed in the stream, and the function will exit with an error code of |
||||
* \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed |
||||
* in the user code - to continue the transfer, call the function again with identical parameters |
||||
* and it will resume until the BytesProcessed value reaches the total transfer length. |
||||
* |
||||
* <b>Single Stream Transfer Example:</b> |
||||
* \code |
||||
* uint8_t DataStream[512]; |
||||
* uint8_t ErrorCode; |
||||
* |
||||
* if ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), |
||||
* NULL)) != ENDPOINT_RWSTREAM_NoError) |
||||
* { |
||||
* // Stream failed to complete - check ErrorCode here
|
||||
* } |
||||
* \endcode |
||||
* |
||||
* <b>Partial Stream Transfers Example:</b> |
||||
* \code |
||||
* uint8_t DataStream[512]; |
||||
* uint8_t ErrorCode; |
||||
* uint16_t BytesProcessed; |
||||
* |
||||
* BytesProcessed = 0; |
||||
* while ((ErrorCode = Endpoint_Write_Stream_LE(DataStream, sizeof(DataStream), |
||||
* &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) |
||||
* { |
||||
* // Stream not yet complete - do other actions here, abort if required
|
||||
* } |
||||
* |
||||
* if (ErrorCode != ENDPOINT_RWSTREAM_NoError) |
||||
* { |
||||
* // Stream failed to complete - check ErrorCode here
|
||||
* } |
||||
* \endcode |
||||
* |
||||
* \note This routine should not be used on CONTROL type endpoints. |
||||
* |
||||
* \param[in] Buffer Pointer to the source data buffer to read from. |
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. |
||||
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current |
||||
* transaction should be updated, \c NULL if the entire stream should be written at once. |
||||
* |
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Write_Stream_LE(const void* const Buffer, |
||||
uint16_t Length, |
||||
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** Writes the given number of bytes to the endpoint from the given buffer in big endian,
|
||||
* sending full packets to the host as needed. The last packet filled is not automatically sent; |
||||
* the user is responsible for manually sending the last written packet to the host via the |
||||
* \ref Endpoint_ClearIN() macro. |
||||
* |
||||
* \note This routine should not be used on CONTROL type endpoints. |
||||
* |
||||
* \param[in] Buffer Pointer to the source data buffer to read from. |
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. |
||||
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current |
||||
* transaction should be updated, \c NULL if the entire stream should be written at once. |
||||
* |
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Write_Stream_BE(const void* const Buffer, |
||||
uint16_t Length, |
||||
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** Reads the given number of bytes from the endpoint from the given buffer in little endian,
|
||||
* discarding fully read packets from the host as needed. The last packet is not automatically |
||||
* discarded once the remaining bytes has been read; the user is responsible for manually |
||||
* discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. |
||||
* |
||||
* If the BytesProcessed parameter is \c NULL, the entire stream transfer is attempted at once, |
||||
* failing or succeeding as a single unit. If the BytesProcessed parameter points to a valid |
||||
* storage location, the transfer will instead be performed as a series of chunks. Each time |
||||
* the endpoint bank becomes empty while there is still data to process (and after the current |
||||
* packet has been acknowledged) the BytesProcessed location will be updated with the total number |
||||
* of bytes processed in the stream, and the function will exit with an error code of |
||||
* \ref ENDPOINT_RWSTREAM_IncompleteTransfer. This allows for any abort checking to be performed |
||||
* in the user code - to continue the transfer, call the function again with identical parameters |
||||
* and it will resume until the BytesProcessed value reaches the total transfer length. |
||||
* |
||||
* <b>Single Stream Transfer Example:</b> |
||||
* \code |
||||
* uint8_t DataStream[512]; |
||||
* uint8_t ErrorCode; |
||||
* |
||||
* if ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), |
||||
* NULL)) != ENDPOINT_RWSTREAM_NoError) |
||||
* { |
||||
* // Stream failed to complete - check ErrorCode here
|
||||
* } |
||||
* \endcode |
||||
* |
||||
* <b>Partial Stream Transfers Example:</b> |
||||
* \code |
||||
* uint8_t DataStream[512]; |
||||
* uint8_t ErrorCode; |
||||
* uint16_t BytesProcessed; |
||||
* |
||||
* BytesProcessed = 0; |
||||
* while ((ErrorCode = Endpoint_Read_Stream_LE(DataStream, sizeof(DataStream), |
||||
* &BytesProcessed)) == ENDPOINT_RWSTREAM_IncompleteTransfer) |
||||
* { |
||||
* // Stream not yet complete - do other actions here, abort if required
|
||||
* } |
||||
* |
||||
* if (ErrorCode != ENDPOINT_RWSTREAM_NoError) |
||||
* { |
||||
* // Stream failed to complete - check ErrorCode here
|
||||
* } |
||||
* \endcode |
||||
* |
||||
* \note This routine should not be used on CONTROL type endpoints. |
||||
* |
||||
* \param[out] Buffer Pointer to the destination data buffer to write to. |
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint. |
||||
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current |
||||
* transaction should be updated, \c NULL if the entire stream should be read at once. |
||||
* |
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Read_Stream_LE(void* const Buffer, |
||||
uint16_t Length, |
||||
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** Reads the given number of bytes from the endpoint from the given buffer in big endian,
|
||||
* discarding fully read packets from the host as needed. The last packet is not automatically |
||||
* discarded once the remaining bytes has been read; the user is responsible for manually |
||||
* discarding the last packet from the host via the \ref Endpoint_ClearOUT() macro. |
||||
* |
||||
* \note This routine should not be used on CONTROL type endpoints. |
||||
* |
||||
* \param[out] Buffer Pointer to the destination data buffer to write to. |
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint. |
||||
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current |
||||
* transaction should be updated, \c NULL if the entire stream should be read at once. |
||||
* |
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Read_Stream_BE(void* const Buffer, |
||||
uint16_t Length, |
||||
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in little endian,
|
||||
* sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared |
||||
* in both failure and success states; the user is responsible for manually clearing the setup OUT to |
||||
* finalize the transfer via the \ref Endpoint_ClearOUT() macro. |
||||
* |
||||
* \note This function automatically clears the control transfer's status stage. Do not manually attempt |
||||
* to clear the status stage when using this routine in a control transaction. |
||||
* \n\n |
||||
* |
||||
* \note This routine should only be used on CONTROL type endpoints. |
||||
* |
||||
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained |
||||
* together; i.e. the entire stream data must be read or written at the one time. |
||||
* |
||||
* \param[in] Buffer Pointer to the source data buffer to read from. |
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. |
||||
* |
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Write_Control_Stream_LE(const void* const Buffer, |
||||
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** Writes the given number of bytes to the CONTROL type endpoint from the given buffer in big endian,
|
||||
* sending full packets to the host as needed. The host OUT acknowledgement is not automatically cleared |
||||
* in both failure and success states; the user is responsible for manually clearing the setup OUT to |
||||
* finalize the transfer via the \ref Endpoint_ClearOUT() macro. |
||||
* |
||||
* \note This function automatically clears the control transfer's status stage. Do not manually attempt |
||||
* to clear the status stage when using this routine in a control transaction. |
||||
* \n\n |
||||
* |
||||
* \note This routine should only be used on CONTROL type endpoints. |
||||
* |
||||
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained |
||||
* together; i.e. the entire stream data must be read or written at the one time. |
||||
* |
||||
* \param[in] Buffer Pointer to the source data buffer to read from. |
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. |
||||
* |
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Write_Control_Stream_BE(const void* const Buffer, |
||||
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** Reads the given number of bytes from the CONTROL endpoint from the given buffer in little endian,
|
||||
* discarding fully read packets from the host as needed. The device IN acknowledgement is not |
||||
* automatically sent after success or failure states; the user is responsible for manually sending the |
||||
* setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro. |
||||
* |
||||
* \note This function automatically clears the control transfer's status stage. Do not manually attempt |
||||
* to clear the status stage when using this routine in a control transaction. |
||||
* \n\n |
||||
* |
||||
* \note This routine should only be used on CONTROL type endpoints. |
||||
* |
||||
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained |
||||
* together; i.e. the entire stream data must be read or written at the one time. |
||||
* |
||||
* \param[out] Buffer Pointer to the destination data buffer to write to. |
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint. |
||||
* |
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Read_Control_Stream_LE(void* const Buffer, |
||||
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** Reads the given number of bytes from the CONTROL endpoint from the given buffer in big endian,
|
||||
* discarding fully read packets from the host as needed. The device IN acknowledgement is not |
||||
* automatically sent after success or failure states; the user is responsible for manually sending the |
||||
* setup IN to finalize the transfer via the \ref Endpoint_ClearIN() macro. |
||||
* |
||||
* \note This function automatically clears the control transfer's status stage. Do not manually attempt |
||||
* to clear the status stage when using this routine in a control transaction. |
||||
* \n\n |
||||
* |
||||
* \note This routine should only be used on CONTROL type endpoints. |
||||
* |
||||
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained |
||||
* together; i.e. the entire stream data must be read or written at the one time. |
||||
* |
||||
* \param[out] Buffer Pointer to the destination data buffer to write to. |
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint. |
||||
* |
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Read_Control_Stream_BE(void* const Buffer, |
||||
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); |
||||
//@}
|
||||
|
||||
/** \name Stream functions for EEPROM source/destination data */ |
||||
//@{
|
||||
|
||||
/** EEPROM buffer source version of \ref Endpoint_Write_Stream_LE().
|
||||
* |
||||
* \param[in] Buffer Pointer to the source data buffer to read from. |
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. |
||||
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current |
||||
* transaction should be updated, \c NULL if the entire stream should be written at once. |
||||
* |
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Write_EStream_LE(const void* const Buffer, |
||||
uint16_t Length, |
||||
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** EEPROM buffer source version of \ref Endpoint_Write_Stream_BE().
|
||||
* |
||||
* \param[in] Buffer Pointer to the source data buffer to read from. |
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. |
||||
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current |
||||
* transaction should be updated, \c NULL if the entire stream should be written at once. |
||||
* |
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Write_EStream_BE(const void* const Buffer, |
||||
uint16_t Length, |
||||
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** EEPROM buffer destination version of \ref Endpoint_Read_Stream_LE().
|
||||
* |
||||
* \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. |
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint. |
||||
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current |
||||
* transaction should be updated, \c NULL if the entire stream should be read at once. |
||||
* |
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Read_EStream_LE(void* const Buffer, |
||||
uint16_t Length, |
||||
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** EEPROM buffer destination version of \ref Endpoint_Read_Stream_BE().
|
||||
* |
||||
* \param[out] Buffer Pointer to the destination data buffer to write to, located in EEPROM memory space. |
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint. |
||||
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current |
||||
* transaction should be updated, \c NULL if the entire stream should be read at once. |
||||
* |
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Read_EStream_BE(void* const Buffer, |
||||
uint16_t Length, |
||||
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** EEPROM buffer source version of Endpoint_Write_Control_Stream_LE.
|
||||
* |
||||
* \note This function automatically clears the control transfer's status stage. Do not manually attempt |
||||
* to clear the status stage when using this routine in a control transaction. |
||||
* \n\n |
||||
* |
||||
* \note This routine should only be used on CONTROL type endpoints. |
||||
* \n\n |
||||
* |
||||
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained |
||||
* together; i.e. the entire stream data must be read or written at the one time. |
||||
* |
||||
* \param[in] Buffer Pointer to the source data buffer to read from. |
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. |
||||
* |
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Write_Control_EStream_LE(const void* const Buffer, |
||||
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** EEPROM buffer source version of \ref Endpoint_Write_Control_Stream_BE().
|
||||
* |
||||
* \note This function automatically clears the control transfer's status stage. Do not manually attempt |
||||
* to clear the status stage when using this routine in a control transaction. |
||||
* \n\n |
||||
* |
||||
* \note This routine should only be used on CONTROL type endpoints. |
||||
* \n\n |
||||
* |
||||
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained |
||||
* together; i.e. the entire stream data must be read or written at the one time. |
||||
* |
||||
* \param[in] Buffer Pointer to the source data buffer to read from. |
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. |
||||
* |
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Write_Control_EStream_BE(const void* const Buffer, |
||||
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_LE().
|
||||
* |
||||
* \note This function automatically clears the control transfer's status stage. Do not manually attempt |
||||
* to clear the status stage when using this routine in a control transaction. |
||||
* \n\n |
||||
* |
||||
* \note This routine should only be used on CONTROL type endpoints. |
||||
* \n\n |
||||
* |
||||
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained |
||||
* together; i.e. the entire stream data must be read or written at the one time. |
||||
* |
||||
* \param[out] Buffer Pointer to the destination data buffer to write to. |
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint. |
||||
* |
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Read_Control_EStream_LE(void* const Buffer, |
||||
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** EEPROM buffer source version of \ref Endpoint_Read_Control_Stream_BE().
|
||||
* |
||||
* \note This function automatically clears the control transfer's status stage. Do not manually attempt |
||||
* to clear the status stage when using this routine in a control transaction. |
||||
* \n\n |
||||
* |
||||
* \note This routine should only be used on CONTROL type endpoints. |
||||
* \n\n |
||||
* |
||||
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained |
||||
* together; i.e. the entire stream data must be read or written at the one time. |
||||
* |
||||
* \param[out] Buffer Pointer to the destination data buffer to write to. |
||||
* \param[in] Length Number of bytes to send via the currently selected endpoint. |
||||
* |
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Read_Control_EStream_BE(void* const Buffer, |
||||
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); |
||||
//@}
|
||||
|
||||
/** \name Stream functions for PROGMEM source/destination data */ |
||||
//@{
|
||||
|
||||
/** FLASH buffer source version of \ref Endpoint_Write_Stream_LE().
|
||||
* |
||||
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. |
||||
* |
||||
* \param[in] Buffer Pointer to the source data buffer to read from. |
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. |
||||
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current |
||||
* transaction should be updated, \c NULL if the entire stream should be written at once. |
||||
* |
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Write_PStream_LE(const void* const Buffer, |
||||
uint16_t Length, |
||||
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** FLASH buffer source version of \ref Endpoint_Write_Stream_BE().
|
||||
* |
||||
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. |
||||
* |
||||
* \param[in] Buffer Pointer to the source data buffer to read from. |
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. |
||||
* \param[in] BytesProcessed Pointer to a location where the total number of bytes processed in the current |
||||
* transaction should be updated, \c NULL if the entire stream should be written at once. |
||||
* |
||||
* \return A value from the \ref Endpoint_Stream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Write_PStream_BE(const void* const Buffer, |
||||
uint16_t Length, |
||||
uint16_t* const BytesProcessed) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_LE().
|
||||
* |
||||
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. |
||||
* |
||||
* \note This function automatically clears the control transfer's status stage. Do not manually attempt |
||||
* to clear the status stage when using this routine in a control transaction. |
||||
* \n\n |
||||
* |
||||
* \note This routine should only be used on CONTROL type endpoints. |
||||
* \n\n |
||||
* |
||||
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained |
||||
* together; i.e. the entire stream data must be read or written at the one time. |
||||
* |
||||
* \param[in] Buffer Pointer to the source data buffer to read from. |
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. |
||||
* |
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Write_Control_PStream_LE(const void* const Buffer, |
||||
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); |
||||
|
||||
/** FLASH buffer source version of \ref Endpoint_Write_Control_Stream_BE().
|
||||
* |
||||
* \pre The FLASH data must be located in the first 64KB of FLASH for this function to work correctly. |
||||
* |
||||
* \note This function automatically clears the control transfer's status stage. Do not manually attempt |
||||
* to clear the status stage when using this routine in a control transaction. |
||||
* \n\n |
||||
* |
||||
* \note This routine should only be used on CONTROL type endpoints. |
||||
* \n\n |
||||
* |
||||
* \warning Unlike the standard stream read/write commands, the control stream commands cannot be chained |
||||
* together; i.e. the entire stream data must be read or written at the one time. |
||||
* |
||||
* \param[in] Buffer Pointer to the source data buffer to read from. |
||||
* \param[in] Length Number of bytes to read for the currently selected endpoint into the buffer. |
||||
* |
||||
* \return A value from the \ref Endpoint_ControlStream_RW_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_Write_Control_PStream_BE(const void* const Buffer, |
||||
uint16_t Length) ATTR_NON_NULL_PTR_ARG(1); |
||||
//@}
|
||||
|
||||
/* Disable C linkage for C++ Compilers: */ |
||||
#if defined(__cplusplus) |
||||
} |
||||
#endif |
||||
|
||||
#endif |
||||
|
||||
/** @} */ |
||||
|
@ -0,0 +1,67 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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. |
||||
*/ |
||||
|
||||
#define __INCLUDE_FROM_USB_DRIVER |
||||
#include "../USBMode.h" |
||||
|
||||
#if defined(USB_CAN_BE_DEVICE) |
||||
|
||||
#include "../Endpoint.h" |
||||
|
||||
#if !defined(FIXED_CONTROL_ENDPOINT_SIZE) |
||||
uint8_t USB_Device_ControlEndpointSize = ENDPOINT_CONTROLEP_DEFAULT_SIZE; |
||||
#endif |
||||
|
||||
bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, |
||||
const uint8_t UECFG0XData, |
||||
const uint8_t UECFG1XData) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
void Endpoint_ClearEndpoints(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
void Endpoint_ClearStatusStage(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
#if !defined(CONTROL_ONLY_DEVICE) |
||||
uint8_t Endpoint_WaitUntilReady(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
#endif |
||||
|
||||
#endif |
||||
|
@ -0,0 +1,787 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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
|
||||
* \brief USB Endpoint definitions for the AVR XMEGA microcontrollers. |
||||
* \copydetails Group_EndpointManagement_XMEGA |
||||
* |
||||
* \note This file should not be included directly. It is automatically included as needed by the USB driver |
||||
* dispatch header located in LUFA/Drivers/USB/USB.h. |
||||
*/ |
||||
|
||||
/** \ingroup Group_EndpointRW
|
||||
* \defgroup Group_EndpointRW_XMEGA Endpoint Data Reading and Writing (XMEGA) |
||||
* \brief Endpoint data read/write definitions for the Atmel AVR XMEGA architecture. |
||||
* |
||||
* Functions, macros, variables, enums and types related to data reading and writing from and to endpoints. |
||||
*/ |
||||
|
||||
/** \ingroup Group_EndpointPrimitiveRW
|
||||
* \defgroup Group_EndpointPrimitiveRW_XMEGA Read/Write of Primitive Data Types (XMEGA) |
||||
* \brief Endpoint primitive read/write definitions for the Atmel AVR XMEGA architecture. |
||||
* |
||||
* Functions, macros, variables, enums and types related to data reading and writing of primitive data types |
||||
* from and to endpoints. |
||||
*/ |
||||
|
||||
/** \ingroup Group_EndpointPacketManagement
|
||||
* \defgroup Group_EndpointPacketManagement_XMEGA Endpoint Packet Management (XMEGA) |
||||
* \brief Endpoint packet management definitions for the Atmel AVR XMEGA architecture. |
||||
* |
||||
* Functions, macros, variables, enums and types related to packet management of endpoints. |
||||
*/ |
||||
|
||||
/** \ingroup Group_EndpointManagement
|
||||
* \defgroup Group_EndpointManagement_XMEGA Endpoint Management (XMEGA) |
||||
* \brief Endpoint management definitions for the Atmel AVR XMEGA architecture. |
||||
* |
||||
* Functions, macros and enums related to endpoint management when in USB Device mode. This |
||||
* module contains the endpoint management macros, as well as endpoint interrupt and data |
||||
* send/receive functions for various data types. |
||||
* |
||||
* @{ |
||||
*/ |
||||
|
||||
#ifndef __ENDPOINT_XMEGA_H__ |
||||
#define __ENDPOINT_XMEGA_H__ |
||||
|
||||
/* Includes: */ |
||||
#include "../../../../Common/Common.h" |
||||
#include "../USBTask.h" |
||||
#include "../USBInterrupt.h" |
||||
|
||||
/* Enable C linkage for C++ Compilers: */ |
||||
#if defined(__cplusplus) |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/* Preprocessor Checks: */ |
||||
#if !defined(__INCLUDE_FROM_USB_DRIVER) |
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. |
||||
#endif |
||||
|
||||
/* Private Interface - For use in library only: */ |
||||
#if !defined(__DOXYGEN__) |
||||
/* Macros: */ |
||||
#define _ENDPOINT_GET_MAXSIZE(EPIndex) _ENDPOINT_GET_MAXSIZE2(ENDPOINT_DETAILS_EP ## EPIndex) |
||||
#define _ENDPOINT_GET_MAXSIZE2(EPDetails) _ENDPOINT_GET_MAXSIZE3(EPDetails) |
||||
#define _ENDPOINT_GET_MAXSIZE3(MaxSize, Banks) (MaxSize) |
||||
|
||||
#define _ENDPOINT_GET_BANKS(EPIndex) _ENDPOINT_GET_BANKS2(ENDPOINT_DETAILS_EP ## EPIndex) |
||||
#define _ENDPOINT_GET_BANKS2(EPDetails) _ENDPOINT_GET_BANKS3(EPDetails) |
||||
#define _ENDPOINT_GET_BANKS3(MaxSize, Banks) (Banks) |
||||
|
||||
#if defined(USB_SERIES_4_AVR) || defined(USB_SERIES_6_AVR) || defined(USB_SERIES_7_AVR) |
||||
#define ENDPOINT_DETAILS_MAXEP 7 |
||||
|
||||
#define ENDPOINT_DETAILS_EP0 64, 1 |
||||
#define ENDPOINT_DETAILS_EP1 256, 2 |
||||
#define ENDPOINT_DETAILS_EP2 64, 2 |
||||
#define ENDPOINT_DETAILS_EP3 64, 2 |
||||
#define ENDPOINT_DETAILS_EP4 64, 2 |
||||
#define ENDPOINT_DETAILS_EP5 64, 2 |
||||
#define ENDPOINT_DETAILS_EP6 64, 2 |
||||
#else |
||||
#define ENDPOINT_DETAILS_MAXEP 5 |
||||
|
||||
#define ENDPOINT_DETAILS_EP0 64, 1 |
||||
#define ENDPOINT_DETAILS_EP1 64, 1 |
||||
#define ENDPOINT_DETAILS_EP2 64, 1 |
||||
#define ENDPOINT_DETAILS_EP3 64, 2 |
||||
#define ENDPOINT_DETAILS_EP4 64, 2 |
||||
#endif |
||||
|
||||
/* Inline Functions: */ |
||||
static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) ATTR_WARN_UNUSED_RESULT ATTR_CONST |
||||
ATTR_ALWAYS_INLINE; |
||||
static inline uint8_t Endpoint_BytesToEPSizeMask(const uint16_t Bytes) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/* Function Prototypes: */ |
||||
void Endpoint_ClearEndpoints(void); |
||||
bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, |
||||
const uint8_t UECFG0XData, |
||||
const uint8_t UECFG1XData); |
||||
|
||||
#endif |
||||
|
||||
/* Public Interface - May be used in end-application: */ |
||||
/* Macros: */ |
||||
/** \name Endpoint Direction Masks */ |
||||
//@{
|
||||
/** Endpoint data direction mask for \ref Endpoint_ConfigureEndpoint(). This indicates that the endpoint
|
||||
* should be initialized in the OUT direction - i.e. data flows from host to device. |
||||
*/ |
||||
#define ENDPOINT_DIR_OUT (0 << EPDIR) |
||||
|
||||
/** Endpoint data direction mask for \ref Endpoint_ConfigureEndpoint(). This indicates that the endpoint
|
||||
* should be initialized in the IN direction - i.e. data flows from device to host. |
||||
*/ |
||||
#define ENDPOINT_DIR_IN (1 << EPDIR) |
||||
//@}
|
||||
|
||||
/** \name Endpoint Bank Mode Masks */ |
||||
//@{
|
||||
/** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates
|
||||
* that the endpoint should have one single bank, which requires less USB FIFO memory but results |
||||
* in slower transfers as only one USB device (the AVR or the host) can access the endpoint's |
||||
* bank at the one time. |
||||
*/ |
||||
#define ENDPOINT_BANK_SINGLE (0 << EPBK0) |
||||
|
||||
/** Mask for the bank mode selection for the \ref Endpoint_ConfigureEndpoint() macro. This indicates
|
||||
* that the endpoint should have two banks, which requires more USB FIFO memory but results |
||||
* in faster transfers as one USB device (the AVR or the host) can access one bank while the other |
||||
* accesses the second bank. |
||||
*/ |
||||
#define ENDPOINT_BANK_DOUBLE (1 << EPBK0) |
||||
//@}
|
||||
|
||||
#if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__)) |
||||
/** Default size of the default control endpoint's bank, until altered by the control endpoint bank size
|
||||
* value in the device descriptor. Not available if the \c FIXED_CONTROL_ENDPOINT_SIZE token is defined. |
||||
*/ |
||||
#define ENDPOINT_CONTROLEP_DEFAULT_SIZE 8 |
||||
#endif |
||||
|
||||
/** Retrieves the maximum bank size in bytes of a given endpoint.
|
||||
* |
||||
* \note This macro will only work correctly on endpoint indexes that are compile-time constants |
||||
* defined by the preprocessor. |
||||
* |
||||
* \param[in] EPIndex Endpoint number, a value between 0 and (\ref ENDPOINT_TOTAL_ENDPOINTS - 1) |
||||
*/ |
||||
#define ENDPOINT_MAX_SIZE(EPIndex) _ENDPOINT_GET_MAXSIZE(EPIndex) |
||||
|
||||
/** Retrieves the total number of banks supported by the given endpoint.
|
||||
* |
||||
* \note This macro will only work correctly on endpoint indexes that are compile-time constants |
||||
* defined by the preprocessor. |
||||
* |
||||
* \param[in] EPIndex Endpoint number, a value between 0 and (\ref ENDPOINT_TOTAL_ENDPOINTS - 1) |
||||
*/ |
||||
#define ENDPOINT_BANKS_SUPPORTED(EPIndex) _ENDPOINT_GET_BANKS(EPIndex) |
||||
|
||||
#if !defined(CONTROL_ONLY_DEVICE) || defined(__DOXYGEN__) |
||||
/** Total number of endpoints (including the default control endpoint at address 0) which may
|
||||
* be used in the device. Different USB AVR models support different amounts of endpoints, |
||||
* this value reflects the maximum number of endpoints for the currently selected AVR model. |
||||
*/ |
||||
#define ENDPOINT_TOTAL_ENDPOINTS ENDPOINT_DETAILS_MAXEP |
||||
#else |
||||
#define ENDPOINT_TOTAL_ENDPOINTS 1 |
||||
#endif |
||||
|
||||
/* Enums: */ |
||||
/** Enum for the possible error return codes of the \ref Endpoint_WaitUntilReady() function.
|
||||
* |
||||
* \ingroup Group_EndpointRW_XMEGA |
||||
*/ |
||||
enum Endpoint_WaitUntilReady_ErrorCodes_t |
||||
{ |
||||
ENDPOINT_READYWAIT_NoError = 0, /**< Endpoint is ready for next packet, no error. */ |
||||
ENDPOINT_READYWAIT_EndpointStalled = 1, /**< The endpoint was stalled during the stream
|
||||
* transfer by the host or device. |
||||
*/ |
||||
ENDPOINT_READYWAIT_DeviceDisconnected = 2, /**< Device was disconnected from the host while
|
||||
* waiting for the endpoint to become ready. |
||||
*/ |
||||
ENDPOINT_READYWAIT_BusSuspended = 3, /**< The USB bus has been suspended by the host and
|
||||
* no USB endpoint traffic can occur until the bus |
||||
* has resumed. |
||||
*/ |
||||
ENDPOINT_READYWAIT_Timeout = 4, /**< The host failed to accept or send the next packet
|
||||
* within the software timeout period set by the |
||||
* \ref USB_STREAM_TIMEOUT_MS macro. |
||||
*/ |
||||
}; |
||||
|
||||
/* Inline Functions: */ |
||||
/** Configures the specified endpoint number with the given endpoint type, direction, bank size
|
||||
* and banking mode. Once configured, the endpoint may be read from or written to, depending |
||||
* on its direction. |
||||
* |
||||
* \param[in] Number Endpoint number to configure. This must be more than 0 and less than |
||||
* \ref ENDPOINT_TOTAL_ENDPOINTS. |
||||
* |
||||
* \param[in] Type Type of endpoint to configure, a \c EP_TYPE_* mask. Not all endpoint types |
||||
* are available on Low Speed USB devices - refer to the USB 2.0 specification. |
||||
* |
||||
* \param[in] Direction Endpoint data direction, either \ref ENDPOINT_DIR_OUT or \ref ENDPOINT_DIR_IN. |
||||
* All endpoints (except Control type) are unidirectional - data may only be read |
||||
* from or written to the endpoint bank based on its direction, not both. |
||||
* |
||||
* \param[in] Size Size of the endpoint's bank, where packets are stored before they are transmitted |
||||
* to the USB host, or after they have been received from the USB host (depending on |
||||
* the endpoint's data direction). The bank size must indicate the maximum packet size |
||||
* that the endpoint can handle. |
||||
* |
||||
* \param[in] Banks Number of banks to use for the endpoint being configured, an \c ENDPOINT_BANK_* mask. |
||||
* More banks uses more USB DPRAM, but offers better performance. Isochronous type |
||||
* endpoints <b>must</b> have at least two banks. |
||||
* |
||||
* \note When the \c ORDERED_EP_CONFIG compile time option is used, Endpoints <b>must</b> be configured in |
||||
* ascending order, or bank corruption will occur. |
||||
* \n\n |
||||
* |
||||
* \note Different endpoints may have different maximum packet sizes based on the endpoint's index - refer to |
||||
* the chosen microcontroller model's datasheet to determine the maximum bank size for each endpoint. |
||||
* \n\n |
||||
* |
||||
* \note The default control endpoint should not be manually configured by the user application, as |
||||
* it is automatically configured by the library internally. |
||||
* \n\n |
||||
* |
||||
* \note This routine will automatically select the specified endpoint upon success. Upon failure, the endpoint |
||||
* which failed to reconfigure correctly will be selected. |
||||
* |
||||
* \return Boolean \c true if the configuration succeeded, \c false otherwise. |
||||
*/ |
||||
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Number, |
||||
const uint8_t Type, |
||||
const uint8_t Direction, |
||||
const uint16_t Size, |
||||
const uint8_t Banks) ATTR_ALWAYS_INLINE; |
||||
static inline bool Endpoint_ConfigureEndpoint(const uint8_t Number, |
||||
const uint8_t Type, |
||||
const uint8_t Direction, |
||||
const uint16_t Size, |
||||
const uint8_t Banks) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Indicates the number of bytes currently stored in the current endpoint's selected bank.
|
||||
* |
||||
* \note The return width of this function may differ, depending on the maximum endpoint bank size |
||||
* of the selected AVR model. |
||||
* |
||||
* \ingroup Group_EndpointRW_XMEGA |
||||
* |
||||
* \return Total number of bytes in the currently selected Endpoint's FIFO buffer. |
||||
*/ |
||||
static inline uint16_t Endpoint_BytesInEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline uint16_t Endpoint_BytesInEndpoint(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Get the endpoint address of the currently selected endpoint. This is typically used to save
|
||||
* the currently selected endpoint number so that it can be restored after another endpoint has |
||||
* been manipulated. |
||||
* |
||||
* \return Index of the currently selected endpoint. |
||||
*/ |
||||
static inline uint8_t Endpoint_GetCurrentEndpoint(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline uint8_t Endpoint_GetCurrentEndpoint(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Selects the given endpoint number. If the address from the device descriptors is used, the
|
||||
* value should be masked with the \ref ENDPOINT_EPNUM_MASK constant to extract only the endpoint |
||||
* number (and discarding the endpoint direction bit). |
||||
* |
||||
* Any endpoint operations which do not require the endpoint number to be indicated will operate on |
||||
* the currently selected endpoint. |
||||
* |
||||
* \param[in] EndpointNumber Endpoint number to select. |
||||
*/ |
||||
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_SelectEndpoint(const uint8_t EndpointNumber) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Resets the endpoint bank FIFO. This clears all the endpoint banks and resets the USB controller's
|
||||
* data In and Out pointers to the bank's contents. |
||||
* |
||||
* \param[in] EndpointNumber Endpoint number whose FIFO buffers are to be reset. |
||||
*/ |
||||
static inline void Endpoint_ResetEndpoint(const uint8_t EndpointNumber) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_ResetEndpoint(const uint8_t EndpointNumber) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Enables the currently selected endpoint so that data can be sent and received through it to
|
||||
* and from a host. |
||||
* |
||||
* \note Endpoints must first be configured properly via \ref Endpoint_ConfigureEndpoint(). |
||||
*/ |
||||
static inline void Endpoint_EnableEndpoint(void) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_EnableEndpoint(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Disables the currently selected endpoint so that data cannot be sent and received through it
|
||||
* to and from a host. |
||||
*/ |
||||
static inline void Endpoint_DisableEndpoint(void) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_DisableEndpoint(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Determines if the currently selected endpoint is enabled, but not necessarily configured.
|
||||
* |
||||
* \return Boolean \c true if the currently selected endpoint is enabled, \c false otherwise. |
||||
*/ |
||||
static inline bool Endpoint_IsEnabled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline bool Endpoint_IsEnabled(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Retrieves the number of busy banks in the currently selected endpoint, which have been queued for
|
||||
* transmission via the \ref Endpoint_ClearIN() command, or are awaiting acknowledgement via the |
||||
* \ref Endpoint_ClearOUT() command. |
||||
* |
||||
* \ingroup Group_EndpointPacketManagement_XMEGA |
||||
* |
||||
* \return Total number of busy banks in the selected endpoint. |
||||
*/ |
||||
static inline uint8_t Endpoint_GetBusyBanks(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; |
||||
static inline uint8_t Endpoint_GetBusyBanks(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Aborts all pending IN transactions on the currently selected endpoint, once the bank
|
||||
* has been queued for transmission to the host via \ref Endpoint_ClearIN(). This function |
||||
* will terminate all queued transactions, resetting the endpoint banks ready for a new |
||||
* packet. |
||||
* |
||||
* \ingroup Group_EndpointPacketManagement_XMEGA |
||||
*/ |
||||
static inline void Endpoint_AbortPendingIN(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Determines if the currently selected endpoint may be read from (if data is waiting in the endpoint
|
||||
* bank and the endpoint is an OUT direction, or if the bank is not yet full if the endpoint is an IN |
||||
* direction). This function will return false if an error has occurred in the endpoint, if the endpoint |
||||
* is an OUT direction and no packet (or an empty packet) has been received, or if the endpoint is an IN |
||||
* direction and the endpoint bank is full. |
||||
* |
||||
* \ingroup Group_EndpointPacketManagement_XMEGA |
||||
* |
||||
* \return Boolean \c true if the currently selected endpoint may be read from or written to, depending |
||||
* on its direction. |
||||
*/ |
||||
static inline bool Endpoint_IsReadWriteAllowed(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline bool Endpoint_IsReadWriteAllowed(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Determines if the currently selected endpoint is configured.
|
||||
* |
||||
* \return Boolean \c true if the currently selected endpoint has been configured, \c false otherwise. |
||||
*/ |
||||
static inline bool Endpoint_IsConfigured(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline bool Endpoint_IsConfigured(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Returns a mask indicating which INTERRUPT type endpoints have interrupted - i.e. their
|
||||
* interrupt duration has elapsed. Which endpoints have interrupted can be determined by |
||||
* masking the return value against <tt>(1 << <i>{Endpoint Number}</i>)</tt>. |
||||
* |
||||
* \return Mask whose bits indicate which endpoints have interrupted. |
||||
*/ |
||||
static inline uint8_t Endpoint_GetEndpointInterrupts(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline uint8_t Endpoint_GetEndpointInterrupts(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Determines if the specified endpoint number has interrupted (valid only for INTERRUPT type
|
||||
* endpoints). |
||||
* |
||||
* \param[in] EndpointNumber Index of the endpoint whose interrupt flag should be tested. |
||||
* |
||||
* \return Boolean \c true if the specified endpoint has interrupted, \c false otherwise. |
||||
*/ |
||||
static inline bool Endpoint_HasEndpointInterrupted(const uint8_t EndpointNumber) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline bool Endpoint_HasEndpointInterrupted(const uint8_t EndpointNumber) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Determines if the selected IN endpoint is ready for a new packet to be sent to the host.
|
||||
* |
||||
* \ingroup Group_EndpointPacketManagement_XMEGA |
||||
* |
||||
* \return Boolean \c true if the current endpoint is ready for an IN packet, \c false otherwise. |
||||
*/ |
||||
static inline bool Endpoint_IsINReady(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline bool Endpoint_IsINReady(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Determines if the selected OUT endpoint has received new packet from the host.
|
||||
* |
||||
* \ingroup Group_EndpointPacketManagement_XMEGA |
||||
* |
||||
* \return Boolean \c true if current endpoint is has received an OUT packet, \c false otherwise. |
||||
*/ |
||||
static inline bool Endpoint_IsOUTReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline bool Endpoint_IsOUTReceived(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Determines if the current CONTROL type endpoint has received a SETUP packet.
|
||||
* |
||||
* \ingroup Group_EndpointPacketManagement_XMEGA |
||||
* |
||||
* \return Boolean \c true if the selected endpoint has received a SETUP packet, \c false otherwise. |
||||
*/ |
||||
static inline bool Endpoint_IsSETUPReceived(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline bool Endpoint_IsSETUPReceived(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Clears a received SETUP packet on the currently selected CONTROL type endpoint, freeing up the
|
||||
* endpoint for the next packet. |
||||
* |
||||
* \ingroup Group_EndpointPacketManagement_XMEGA |
||||
* |
||||
* \note This is not applicable for non CONTROL type endpoints. |
||||
*/ |
||||
static inline void Endpoint_ClearSETUP(void) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_ClearSETUP(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Sends an IN packet to the host on the currently selected endpoint, freeing up the endpoint for the
|
||||
* next packet and switching to the alternative endpoint bank if double banked. |
||||
* |
||||
* \ingroup Group_EndpointPacketManagement_XMEGA |
||||
*/ |
||||
static inline void Endpoint_ClearIN(void) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_ClearIN(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Acknowledges an OUT packet to the host on the currently selected endpoint, freeing up the endpoint
|
||||
* for the next packet and switching to the alternative endpoint bank if double banked. |
||||
* |
||||
* \ingroup Group_EndpointPacketManagement_XMEGA |
||||
*/ |
||||
static inline void Endpoint_ClearOUT(void) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_ClearOUT(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Stalls the current endpoint, indicating to the host that a logical problem occurred with the
|
||||
* indicated endpoint and that the current transfer sequence should be aborted. This provides a |
||||
* way for devices to indicate invalid commands to the host so that the current transfer can be |
||||
* aborted and the host can begin its own recovery sequence. |
||||
* |
||||
* The currently selected endpoint remains stalled until either the \ref Endpoint_ClearStall() macro |
||||
* is called, or the host issues a CLEAR FEATURE request to the device for the currently selected |
||||
* endpoint. |
||||
* |
||||
* \ingroup Group_EndpointPacketManagement_XMEGA |
||||
*/ |
||||
static inline void Endpoint_StallTransaction(void) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_StallTransaction(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Clears the STALL condition on the currently selected endpoint.
|
||||
* |
||||
* \ingroup Group_EndpointPacketManagement_XMEGA |
||||
*/ |
||||
static inline void Endpoint_ClearStall(void) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_ClearStall(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Determines if the currently selected endpoint is stalled, false otherwise.
|
||||
* |
||||
* \ingroup Group_EndpointPacketManagement_XMEGA |
||||
* |
||||
* \return Boolean \c true if the currently selected endpoint is stalled, \c false otherwise. |
||||
*/ |
||||
static inline bool Endpoint_IsStalled(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline bool Endpoint_IsStalled(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Resets the data toggle of the currently selected endpoint. */ |
||||
static inline void Endpoint_ResetDataToggle(void) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_ResetDataToggle(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Determines the currently selected endpoint's direction.
|
||||
* |
||||
* \return The currently selected endpoint's direction, as a \c ENDPOINT_DIR_* mask. |
||||
*/ |
||||
static inline uint8_t Endpoint_GetEndpointDirection(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline uint8_t Endpoint_GetEndpointDirection(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Sets the direction of the currently selected endpoint.
|
||||
* |
||||
* \param[in] DirectionMask New endpoint direction, as a \c ENDPOINT_DIR_* mask. |
||||
*/ |
||||
static inline void Endpoint_SetEndpointDirection(const uint8_t DirectionMask) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_SetEndpointDirection(const uint8_t DirectionMask) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Reads one byte from the currently selected endpoint's bank, for OUT direction endpoints.
|
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
* |
||||
* \return Next byte in the currently selected endpoint's FIFO buffer. |
||||
*/ |
||||
static inline uint8_t Endpoint_Read_8(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline uint8_t Endpoint_Read_8(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Writes one byte to the currently selected endpoint's bank, for IN direction endpoints.
|
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
* |
||||
* \param[in] Data Data to write into the the currently selected endpoint's FIFO buffer. |
||||
*/ |
||||
static inline void Endpoint_Write_8(const uint8_t Data) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_Write_8(const uint8_t Data) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Discards one byte from the currently selected endpoint's bank, for OUT direction endpoints.
|
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
*/ |
||||
static inline void Endpoint_Discard_8(void) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_Discard_8(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Reads two bytes from the currently selected endpoint's bank in little endian format, for OUT
|
||||
* direction endpoints. |
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
* |
||||
* \return Next two bytes in the currently selected endpoint's FIFO buffer. |
||||
*/ |
||||
static inline uint16_t Endpoint_Read_16_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline uint16_t Endpoint_Read_16_LE(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Reads two bytes from the currently selected endpoint's bank in big endian format, for OUT
|
||||
* direction endpoints. |
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
* |
||||
* \return Next two bytes in the currently selected endpoint's FIFO buffer. |
||||
*/ |
||||
static inline uint16_t Endpoint_Read_16_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline uint16_t Endpoint_Read_16_BE(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Writes two bytes to the currently selected endpoint's bank in little endian format, for IN
|
||||
* direction endpoints. |
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
* |
||||
* \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. |
||||
*/ |
||||
static inline void Endpoint_Write_16_LE(const uint16_t Data) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_Write_16_LE(const uint16_t Data) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Writes two bytes to the currently selected endpoint's bank in big endian format, for IN
|
||||
* direction endpoints. |
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
* |
||||
* \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. |
||||
*/ |
||||
static inline void Endpoint_Write_16_BE(const uint16_t Data) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_Write_16_BE(const uint16_t Data) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Discards two bytes from the currently selected endpoint's bank, for OUT direction endpoints.
|
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
*/ |
||||
static inline void Endpoint_Discard_16(void) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_Discard_16(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Reads four bytes from the currently selected endpoint's bank in little endian format, for OUT
|
||||
* direction endpoints. |
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
* |
||||
* \return Next four bytes in the currently selected endpoint's FIFO buffer. |
||||
*/ |
||||
static inline uint32_t Endpoint_Read_32_LE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline uint32_t Endpoint_Read_32_LE(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Reads four bytes from the currently selected endpoint's bank in big endian format, for OUT
|
||||
* direction endpoints. |
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
* |
||||
* \return Next four bytes in the currently selected endpoint's FIFO buffer. |
||||
*/ |
||||
static inline uint32_t Endpoint_Read_32_BE(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline uint32_t Endpoint_Read_32_BE(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Writes four bytes to the currently selected endpoint's bank in little endian format, for IN
|
||||
* direction endpoints. |
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
* |
||||
* \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. |
||||
*/ |
||||
static inline void Endpoint_Write_32_LE(const uint32_t Data) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_Write_32_LE(const uint32_t Data) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Writes four bytes to the currently selected endpoint's bank in big endian format, for IN
|
||||
* direction endpoints. |
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
* |
||||
* \param[in] Data Data to write to the currently selected endpoint's FIFO buffer. |
||||
*/ |
||||
static inline void Endpoint_Write_32_BE(const uint32_t Data) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_Write_32_BE(const uint32_t Data) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Discards four bytes from the currently selected endpoint's bank, for OUT direction endpoints.
|
||||
* |
||||
* \ingroup Group_EndpointPrimitiveRW_XMEGA |
||||
*/ |
||||
static inline void Endpoint_Discard_32(void) ATTR_ALWAYS_INLINE; |
||||
static inline void Endpoint_Discard_32(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/* External Variables: */ |
||||
/** Global indicating the maximum packet size of the default control endpoint located at address
|
||||
* 0 in the device. This value is set to the value indicated in the device descriptor in the user |
||||
* project once the USB interface is initialized into device mode. |
||||
* |
||||
* If space is an issue, it is possible to fix this to a static value by defining the control |
||||
* endpoint size in the \c FIXED_CONTROL_ENDPOINT_SIZE token passed to the compiler in the makefile |
||||
* via the -D switch. When a fixed control endpoint size is used, the size is no longer dynamically |
||||
* read from the descriptors at runtime and instead fixed to the given value. When used, it is |
||||
* important that the descriptor control endpoint size value matches the size given as the |
||||
* \c FIXED_CONTROL_ENDPOINT_SIZE token - it is recommended that the \c FIXED_CONTROL_ENDPOINT_SIZE token |
||||
* be used in the device descriptors to ensure this. |
||||
* |
||||
* \note This variable should be treated as read-only in the user application, and never manually |
||||
* changed in value. |
||||
*/ |
||||
#if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__)) |
||||
extern uint8_t USB_Device_ControlEndpointSize; |
||||
#else |
||||
#define USB_Device_ControlEndpointSize FIXED_CONTROL_ENDPOINT_SIZE |
||||
#endif |
||||
|
||||
/* Function Prototypes: */ |
||||
/** Completes the status stage of a control transfer on a CONTROL type endpoint automatically,
|
||||
* with respect to the data direction. This is a convenience function which can be used to |
||||
* simplify user control request handling. |
||||
*/ |
||||
void Endpoint_ClearStatusStage(void); |
||||
|
||||
/** Spin-loops until the currently selected non-control endpoint is ready for the next packet of data
|
||||
* to be read or written to it. |
||||
* |
||||
* \note This routine should not be called on CONTROL type endpoints. |
||||
* |
||||
* \ingroup Group_EndpointRW_XMEGA |
||||
* |
||||
* \return A value from the \ref Endpoint_WaitUntilReady_ErrorCodes_t enum. |
||||
*/ |
||||
uint8_t Endpoint_WaitUntilReady(void); |
||||
|
||||
/* Disable C linkage for C++ Compilers: */ |
||||
#if defined(__cplusplus) |
||||
} |
||||
#endif |
||||
|
||||
#endif |
||||
|
||||
/** @} */ |
||||
|
@ -0,0 +1,37 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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. |
||||
*/ |
||||
|
||||
#define __INCLUDE_FROM_USB_DRIVER |
||||
#include "../USBMode.h" |
||||
|
||||
#if defined(USB_CAN_BE_HOST) |
||||
|
||||
#endif |
||||
|
@ -0,0 +1,37 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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. |
||||
*/ |
||||
|
||||
#define __INCLUDE_FROM_USB_DRIVER |
||||
#include "../USBMode.h" |
||||
|
||||
#if defined(USB_CAN_BE_HOST) |
||||
|
||||
#endif |
||||
|
@ -0,0 +1,37 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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. |
||||
*/ |
||||
|
||||
#define __INCLUDE_FROM_USB_DRIVER |
||||
#include "../USBMode.h" |
||||
|
||||
#if defined(USB_CAN_BE_HOST) |
||||
|
||||
#endif |
||||
|
@ -0,0 +1,83 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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. |
||||
*/ |
||||
|
||||
#if defined(TEMPLATE_FUNC_NAME) |
||||
|
||||
uint8_t TEMPLATE_FUNC_NAME (void* const Buffer, |
||||
uint16_t Length) |
||||
{ |
||||
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); |
||||
|
||||
if (!(Length)) |
||||
Endpoint_ClearOUT(); |
||||
|
||||
while (Length) |
||||
{ |
||||
uint8_t USB_DeviceState_LCL = USB_DeviceState; |
||||
|
||||
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) |
||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected; |
||||
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) |
||||
return ENDPOINT_RWCSTREAM_BusSuspended; |
||||
else if (Endpoint_IsSETUPReceived()) |
||||
return ENDPOINT_RWCSTREAM_HostAborted; |
||||
|
||||
if (Endpoint_IsOUTReceived()) |
||||
{ |
||||
while (Length && Endpoint_BytesInEndpoint()) |
||||
{ |
||||
TEMPLATE_TRANSFER_BYTE(DataStream); |
||||
TEMPLATE_BUFFER_MOVE(DataStream, 1); |
||||
Length--; |
||||
} |
||||
|
||||
Endpoint_ClearOUT(); |
||||
} |
||||
} |
||||
|
||||
while (!(Endpoint_IsINReady())) |
||||
{ |
||||
uint8_t USB_DeviceState_LCL = USB_DeviceState; |
||||
|
||||
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) |
||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected; |
||||
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) |
||||
return ENDPOINT_RWCSTREAM_BusSuspended; |
||||
} |
||||
|
||||
return ENDPOINT_RWCSTREAM_NoError; |
||||
} |
||||
|
||||
#undef TEMPLATE_BUFFER_OFFSET |
||||
#undef TEMPLATE_BUFFER_MOVE |
||||
#undef TEMPLATE_FUNC_NAME |
||||
#undef TEMPLATE_TRANSFER_BYTE |
||||
|
||||
#endif |
@ -0,0 +1,92 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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. |
||||
*/ |
||||
|
||||
#if defined(TEMPLATE_FUNC_NAME) |
||||
|
||||
uint8_t TEMPLATE_FUNC_NAME (const void* const Buffer, |
||||
uint16_t Length) |
||||
{ |
||||
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); |
||||
bool LastPacketFull = false; |
||||
|
||||
if (Length > USB_ControlRequest.wLength) |
||||
Length = USB_ControlRequest.wLength; |
||||
else if (!(Length)) |
||||
Endpoint_ClearIN(); |
||||
|
||||
while (Length || LastPacketFull) |
||||
{ |
||||
uint8_t USB_DeviceState_LCL = USB_DeviceState; |
||||
|
||||
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) |
||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected; |
||||
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) |
||||
return ENDPOINT_RWCSTREAM_BusSuspended; |
||||
else if (Endpoint_IsSETUPReceived()) |
||||
return ENDPOINT_RWCSTREAM_HostAborted; |
||||
else if (Endpoint_IsOUTReceived()) |
||||
break; |
||||
|
||||
if (Endpoint_IsINReady()) |
||||
{ |
||||
uint16_t BytesInEndpoint = Endpoint_BytesInEndpoint(); |
||||
|
||||
while (Length && (BytesInEndpoint < USB_Device_ControlEndpointSize)) |
||||
{ |
||||
TEMPLATE_TRANSFER_BYTE(DataStream); |
||||
TEMPLATE_BUFFER_MOVE(DataStream, 1); |
||||
Length--; |
||||
BytesInEndpoint++; |
||||
} |
||||
|
||||
LastPacketFull = (BytesInEndpoint == USB_Device_ControlEndpointSize); |
||||
Endpoint_ClearIN(); |
||||
} |
||||
} |
||||
|
||||
while (!(Endpoint_IsOUTReceived())) |
||||
{ |
||||
uint8_t USB_DeviceState_LCL = USB_DeviceState; |
||||
|
||||
if (USB_DeviceState_LCL == DEVICE_STATE_Unattached) |
||||
return ENDPOINT_RWCSTREAM_DeviceDisconnected; |
||||
else if (USB_DeviceState_LCL == DEVICE_STATE_Suspended) |
||||
return ENDPOINT_RWCSTREAM_BusSuspended; |
||||
} |
||||
|
||||
return ENDPOINT_RWCSTREAM_NoError; |
||||
} |
||||
|
||||
#undef TEMPLATE_BUFFER_OFFSET |
||||
#undef TEMPLATE_BUFFER_MOVE |
||||
#undef TEMPLATE_FUNC_NAME |
||||
#undef TEMPLATE_TRANSFER_BYTE |
||||
|
||||
#endif |
@ -0,0 +1,88 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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. |
||||
*/ |
||||
|
||||
#if defined(TEMPLATE_FUNC_NAME) |
||||
|
||||
uint8_t TEMPLATE_FUNC_NAME (TEMPLATE_BUFFER_TYPE const Buffer, |
||||
uint16_t Length, |
||||
uint16_t* const BytesProcessed) |
||||
{ |
||||
uint8_t* DataStream = ((uint8_t*)Buffer + TEMPLATE_BUFFER_OFFSET(Length)); |
||||
uint16_t BytesInTransfer = 0; |
||||
uint8_t ErrorCode; |
||||
|
||||
if ((ErrorCode = Endpoint_WaitUntilReady())) |
||||
return ErrorCode; |
||||
|
||||
if (BytesProcessed != NULL) |
||||
{ |
||||
Length -= *BytesProcessed; |
||||
TEMPLATE_BUFFER_MOVE(DataStream, *BytesProcessed); |
||||
} |
||||
|
||||
while (Length) |
||||
{ |
||||
if (!(Endpoint_IsReadWriteAllowed())) |
||||
{ |
||||
TEMPLATE_CLEAR_ENDPOINT(); |
||||
|
||||
if (BytesProcessed != NULL) |
||||
{ |
||||
*BytesProcessed += BytesInTransfer; |
||||
return ENDPOINT_RWSTREAM_IncompleteTransfer; |
||||
} |
||||
|
||||
#if !defined(INTERRUPT_CONTROL_ENDPOINT) |
||||
USB_USBTask(); |
||||
#endif |
||||
|
||||
if ((ErrorCode = Endpoint_WaitUntilReady())) |
||||
return ErrorCode; |
||||
} |
||||
else |
||||
{ |
||||
TEMPLATE_TRANSFER_BYTE(DataStream); |
||||
TEMPLATE_BUFFER_MOVE(DataStream, 1); |
||||
Length--; |
||||
BytesInTransfer++; |
||||
} |
||||
} |
||||
|
||||
return ENDPOINT_RWSTREAM_NoError; |
||||
} |
||||
|
||||
#undef TEMPLATE_FUNC_NAME |
||||
#undef TEMPLATE_BUFFER_TYPE |
||||
#undef TEMPLATE_TRANSFER_BYTE |
||||
#undef TEMPLATE_CLEAR_ENDPOINT |
||||
#undef TEMPLATE_BUFFER_OFFSET |
||||
#undef TEMPLATE_BUFFER_MOVE |
||||
|
||||
#endif |
@ -0,0 +1,77 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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. |
||||
*/ |
||||
|
||||
#define __INCLUDE_FROM_USB_DRIVER |
||||
#define __INCLUDE_FROM_USB_CONTROLLER_C |
||||
#include "../USBController.h" |
||||
|
||||
#if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)) |
||||
volatile uint8_t USB_CurrentMode = USB_MODE_None; |
||||
#endif |
||||
|
||||
#if !defined(USE_STATIC_OPTIONS) |
||||
volatile uint8_t USB_Options; |
||||
#endif |
||||
|
||||
void USB_Init( |
||||
#if defined(USB_CAN_BE_BOTH) |
||||
const uint8_t Mode |
||||
#endif |
||||
|
||||
#if (defined(USB_CAN_BE_BOTH) && !defined(USE_STATIC_OPTIONS)) |
||||
, |
||||
#elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) |
||||
void |
||||
#endif |
||||
|
||||
#if !defined(USE_STATIC_OPTIONS) |
||||
const uint8_t Options |
||||
#endif |
||||
) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
void USB_Disable(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
void USB_ResetInterface(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
#if defined(USB_CAN_BE_DEVICE) |
||||
static void USB_Init_Device(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
#endif |
@ -0,0 +1,359 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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
|
||||
* \brief USB Controller definitions for the AVR XMEGA microcontrollers. |
||||
* \copydetails Group_USBManagement_XMEGA |
||||
* |
||||
* \note This file should not be included directly. It is automatically included as needed by the USB driver |
||||
* dispatch header located in LUFA/Drivers/USB/USB.h. |
||||
*/ |
||||
|
||||
/** \ingroup Group_USBManagement
|
||||
* \defgroup Group_USBManagement_XMEGA USB Interface Management (XMEGA) |
||||
* \brief USB Controller definitions for the AVR XMEGA microcontrollers. |
||||
* |
||||
* Functions, macros, variables, enums and types related to the setup and management of the USB interface. |
||||
* |
||||
* @{ |
||||
*/ |
||||
|
||||
#ifndef __USBCONTROLLER_XMEGA_H__ |
||||
#define __USBCONTROLLER_XMEGA_H__ |
||||
|
||||
/* Includes: */ |
||||
#include "../../../../Common/Common.h" |
||||
#include "../USBMode.h" |
||||
#include "../Events.h" |
||||
#include "../USBTask.h" |
||||
#include "../USBInterrupt.h" |
||||
|
||||
#if defined(USB_CAN_BE_DEVICE) || defined(__DOXYGEN__) |
||||
#include "../Device.h" |
||||
#include "../Endpoint.h" |
||||
#include "../DeviceStandardReq.h" |
||||
#include "../EndpointStream.h" |
||||
#endif |
||||
|
||||
/* Enable C linkage for C++ Compilers: */ |
||||
#if defined(__cplusplus) |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/* Preprocessor Checks and Defines: */ |
||||
#if !defined(__INCLUDE_FROM_USB_DRIVER) |
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. |
||||
#endif |
||||
|
||||
#if !defined(F_USB) |
||||
#error F_USB is not defined. You must define F_USB to the frequency of the unprescaled USB controller clock in your project makefile. |
||||
#endif |
||||
|
||||
/* Public Interface - May be used in end-application: */ |
||||
/* Macros: */ |
||||
/** \name USB Controller Option Masks */ |
||||
//@{
|
||||
/** Regulator disable option mask for \ref USB_Init(). This indicates that the internal 3.3V USB data pad
|
||||
* regulator should be disabled and the AVR's VCC level used for the data pads. |
||||
* |
||||
* \note See USB AVR data sheet for more information on the internal pad regulator. |
||||
*/ |
||||
#define USB_OPT_REG_DISABLED (1 << 1) |
||||
|
||||
/** Regulator enable option mask for \ref USB_Init(). This indicates that the internal 3.3V USB data pad
|
||||
* regulator should be enabled to regulate the data pin voltages from the VBUS level down to a level within |
||||
* the range allowable by the USB standard. |
||||
* |
||||
* \note See USB AVR data sheet for more information on the internal pad regulator. |
||||
*/ |
||||
#define USB_OPT_REG_ENABLED (0 << 1) |
||||
|
||||
/** Manual PLL control option mask for \ref USB_Init(). This indicates to the library that the user application
|
||||
* will take full responsibility for controlling the AVR's PLL (used to generate the high frequency clock |
||||
* that the USB controller requires) and ensuring that it is locked at the correct frequency for USB operations. |
||||
*/ |
||||
#define USB_OPT_MANUAL_PLL (1 << 2) |
||||
|
||||
/** Automatic PLL control option mask for \ref USB_Init(). This indicates to the library that the library should
|
||||
* take full responsibility for controlling the AVR's PLL (used to generate the high frequency clock |
||||
* that the USB controller requires) and ensuring that it is locked at the correct frequency for USB operations. |
||||
*/ |
||||
#define USB_OPT_AUTO_PLL (0 << 2) |
||||
//@}
|
||||
|
||||
/** \name Endpoint/Pipe Type Masks */ |
||||
//@{
|
||||
/** Mask for a CONTROL type endpoint or pipe.
|
||||
* |
||||
* \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. |
||||
*/ |
||||
#define EP_TYPE_CONTROL 0x00 |
||||
|
||||
/** Mask for an ISOCHRONOUS type endpoint or pipe.
|
||||
* |
||||
* \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. |
||||
*/ |
||||
#define EP_TYPE_ISOCHRONOUS 0x01 |
||||
|
||||
/** Mask for a BULK type endpoint or pipe.
|
||||
* |
||||
* \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. |
||||
*/ |
||||
#define EP_TYPE_BULK 0x02 |
||||
|
||||
/** Mask for an INTERRUPT type endpoint or pipe.
|
||||
* |
||||
* \note See \ref Group_EndpointManagement and \ref Group_PipeManagement for endpoint/pipe functions. |
||||
*/ |
||||
#define EP_TYPE_INTERRUPT 0x03 |
||||
//@}
|
||||
|
||||
#if !defined(USB_STREAM_TIMEOUT_MS) || defined(__DOXYGEN__) |
||||
/** Constant for the maximum software timeout period of the USB data stream transfer functions
|
||||
* (both control and standard) when in either device or host mode. If the next packet of a stream |
||||
* is not received or acknowledged within this time period, the stream function will fail. |
||||
* |
||||
* This value may be overridden in the user project makefile as the value of the |
||||
* \ref USB_STREAM_TIMEOUT_MS token, and passed to the compiler using the -D switch. |
||||
*/ |
||||
#define USB_STREAM_TIMEOUT_MS 100 |
||||
#endif |
||||
|
||||
/* Inline Functions: */ |
||||
/** Determines if the VBUS line is currently high (i.e. the USB host is supplying power).
|
||||
* |
||||
* \note This function is not available on some AVR models which do not support hardware VBUS monitoring. |
||||
* |
||||
* \return Boolean \c true if the VBUS line is currently detecting power from a host, \c false otherwise. |
||||
*/ |
||||
static inline bool USB_VBUS_GetStatus(void) ATTR_WARN_UNUSED_RESULT ATTR_ALWAYS_INLINE; |
||||
static inline bool USB_VBUS_GetStatus(void) |
||||
{ |
||||
return 0; // TODO
|
||||
} |
||||
|
||||
/** Detaches the device from the USB bus. This has the effect of removing the device from any
|
||||
* attached host, ceasing USB communications. If no host is present, this prevents any host from |
||||
* enumerating the device once attached until \ref USB_Attach() is called. |
||||
*/ |
||||
static inline void USB_Detach(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_Detach(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/** Attaches the device to the USB bus. This announces the device's presence to any attached
|
||||
* USB host, starting the enumeration process. If no host is present, attaching the device |
||||
* will allow for enumeration once a host is connected to the device. |
||||
* |
||||
* This is inexplicably also required for proper operation while in host mode, to enable the |
||||
* attachment of a device to the host. This is despite the bit being located in the device-mode |
||||
* register and despite the datasheet making no mention of its requirement in host mode. |
||||
*/ |
||||
static inline void USB_Attach(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_Attach(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
/* Function Prototypes: */ |
||||
/** Main function to initialize and start the USB interface. Once active, the USB interface will
|
||||
* allow for device connection to a host when in device mode, or for device enumeration while in |
||||
* host mode. |
||||
* |
||||
* As the USB library relies on interrupts for the device and host mode enumeration processes, |
||||
* the user must enable global interrupts before or shortly after this function is called. In |
||||
* device mode, interrupts must be enabled within 500ms of this function being called to ensure |
||||
* that the host does not time out whilst enumerating the device. In host mode, interrupts may be |
||||
* enabled at the application's leisure however enumeration will not begin of an attached device |
||||
* until after this has occurred. |
||||
* |
||||
* Calling this function when the USB interface is already initialized will cause a complete USB |
||||
* interface reset and re-enumeration. |
||||
* |
||||
* \param[in] Mode This is a mask indicating what mode the USB interface is to be initialized to, a value |
||||
* from the \ref USB_Modes_t enum. |
||||
* |
||||
* \param[in] Options Mask indicating the options which should be used when initializing the USB |
||||
* interface to control the USB interface's behaviour. This should be comprised of |
||||
* a \c USB_OPT_REG_* mask to control the regulator, a \c USB_OPT_*_PLL mask to control the |
||||
* PLL, and a \c USB_DEVICE_OPT_* mask (when the device mode is enabled) to set the device |
||||
* mode speed. |
||||
* |
||||
* \note To reduce the FLASH requirements of the library if only device or host mode is required, |
||||
* the mode can be statically set in the project makefile by defining the token \c USB_DEVICE_ONLY |
||||
* (for device mode) or \c USB_HOST_ONLY (for host mode), passing the token to the compiler |
||||
* via the -D switch. If the mode is statically set, this parameter does not exist in the |
||||
* function prototype. |
||||
* \n\n |
||||
* |
||||
* \note To reduce the FLASH requirements of the library if only fixed settings are are required, |
||||
* the options may be set statically in the same manner as the mode (see the Mode parameter of |
||||
* this function). To statically set the USB options, pass in the \c USE_STATIC_OPTIONS token, |
||||
* defined to the appropriate options masks. When the options are statically set, this |
||||
* parameter does not exist in the function prototype. |
||||
* \n\n |
||||
* |
||||
* \note The mode parameter does not exist on devices where only one mode is possible, such as USB |
||||
* AVR models which only implement the USB device mode in hardware. |
||||
* |
||||
* \see \ref Group_Device for the \c USB_DEVICE_OPT_* masks. |
||||
*/ |
||||
void USB_Init( |
||||
#if defined(USB_CAN_BE_BOTH) || defined(__DOXYGEN__) |
||||
const uint8_t Mode |
||||
#endif |
||||
|
||||
#if (defined(USB_CAN_BE_BOTH) && !defined(USE_STATIC_OPTIONS)) || defined(__DOXYGEN__) |
||||
, |
||||
#elif (!defined(USB_CAN_BE_BOTH) && defined(USE_STATIC_OPTIONS)) |
||||
void |
||||
#endif |
||||
|
||||
#if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__) |
||||
const uint8_t Options |
||||
#endif |
||||
); |
||||
|
||||
/** Shuts down the USB interface. This turns off the USB interface after deallocating all USB FIFO
|
||||
* memory, endpoints and pipes. When turned off, no USB functionality can be used until the interface |
||||
* is restarted with the \ref USB_Init() function. |
||||
*/ |
||||
void USB_Disable(void); |
||||
|
||||
/** Resets the interface, when already initialized. This will re-enumerate the device if already connected
|
||||
* to a host, or re-enumerate an already attached device when in host mode. |
||||
*/ |
||||
void USB_ResetInterface(void); |
||||
|
||||
/* Global Variables: */ |
||||
#if (!defined(USB_HOST_ONLY) && !defined(USB_DEVICE_ONLY)) || defined(__DOXYGEN__) |
||||
/** Indicates the mode that the USB interface is currently initialized to, a value from the
|
||||
* \ref USB_Modes_t enum. |
||||
* |
||||
* \note This variable should be treated as read-only in the user application, and never manually |
||||
* changed in value. |
||||
* \n\n |
||||
* |
||||
* \note When the controller is initialized into UID auto-detection mode, this variable will hold the |
||||
* currently selected USB mode (i.e. \ref USB_MODE_Device or \ref USB_MODE_Host). If the controller |
||||
* is fixed into a specific mode (either through the \c USB_DEVICE_ONLY or \c USB_HOST_ONLY compile time |
||||
* options, or a limitation of the USB controller in the chosen device model) this will evaluate to |
||||
* a constant of the appropriate value and will never evaluate to \ref USB_MODE_None even when the |
||||
* USB interface is not initialized. |
||||
*/ |
||||
extern volatile uint8_t USB_CurrentMode; |
||||
#elif defined(USB_DEVICE_ONLY) |
||||
#define USB_CurrentMode USB_MODE_Device |
||||
#endif |
||||
|
||||
#if !defined(USE_STATIC_OPTIONS) || defined(__DOXYGEN__) |
||||
/** Indicates the current USB options that the USB interface was initialized with when \ref USB_Init()
|
||||
* was called. This value will be one of the \c USB_MODE_* masks defined elsewhere in this module. |
||||
* |
||||
* \note This variable should be treated as read-only in the user application, and never manually |
||||
* changed in value. |
||||
*/ |
||||
extern volatile uint8_t USB_Options; |
||||
#elif defined(USE_STATIC_OPTIONS) |
||||
#define USB_Options USE_STATIC_OPTIONS |
||||
#endif |
||||
|
||||
/* Enums: */ |
||||
/** Enum for the possible USB controller modes, for initialization via \ref USB_Init() and indication back to the
|
||||
* user application via \ref USB_CurrentMode. |
||||
*/ |
||||
enum USB_Modes_t |
||||
{ |
||||
USB_MODE_None = 0, /**< Indicates that the controller is currently not initialized in any specific USB mode. */ |
||||
USB_MODE_Device = 1, /**< Indicates that the controller is currently initialized in USB Device mode. */ |
||||
}; |
||||
|
||||
/* Private Interface - For use in library only: */ |
||||
#if !defined(__DOXYGEN__) |
||||
/* Function Prototypes: */ |
||||
#if defined(__INCLUDE_FROM_USB_CONTROLLER_C) |
||||
static void USB_Init_Device(void); |
||||
#endif |
||||
|
||||
/* Inline Functions: */ |
||||
static inline void USB_REG_On(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_REG_On(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
static inline void USB_REG_Off(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_REG_Off(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
static inline void USB_CLK_Freeze(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_CLK_Freeze(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
static inline void USB_CLK_Unfreeze(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_CLK_Unfreeze(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
static inline void USB_Controller_Enable(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_Controller_Enable(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
static inline void USB_Controller_Disable(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_Controller_Disable(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
static inline void USB_Controller_Reset(void) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_Controller_Reset(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
#endif |
||||
|
||||
/* Disable C linkage for C++ Compilers: */ |
||||
#if defined(__cplusplus) |
||||
} |
||||
#endif |
||||
|
||||
#endif |
||||
|
||||
/** @} */ |
||||
|
@ -0,0 +1,45 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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. |
||||
*/ |
||||
|
||||
#define __INCLUDE_FROM_USB_DRIVER |
||||
#include "../USBInterrupt.h" |
||||
|
||||
void USB_INT_DisableAllInterrupts(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
void USB_INT_ClearAllInterrupts(void) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
// TODO: USB ISR
|
||||
|
@ -0,0 +1,112 @@ |
||||
/*
|
||||
LUFA Library |
||||
Copyright (C) Dean Camera, 2011. |
||||
|
||||
dean [at] fourwalledcubicle [dot] com |
||||
www.lufa-lib.org |
||||
*/ |
||||
|
||||
/*
|
||||
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com) |
||||
|
||||
Permission to use, copy, modify, distribute, and sell this |
||||
software and its documentation for any purpose is hereby granted |
||||
without fee, 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
|
||||
* \brief USB Controller Interrupt definitions for the AVR XMEGA microcontrollers. |
||||
* |
||||
* This file contains definitions required for the correct handling of low level USB service routine interrupts |
||||
* from the USB controller. |
||||
* |
||||
* \note This file should not be included directly. It is automatically included as needed by the USB driver |
||||
* dispatch header located in LUFA/Drivers/USB/USB.h. |
||||
*/ |
||||
|
||||
#ifndef __USBINTERRUPT_XMEGA_H__ |
||||
#define __USBINTERRUPT_XMEGA_H__ |
||||
|
||||
/* Includes: */ |
||||
#include "../../../../Common/Common.h" |
||||
|
||||
/* Enable C linkage for C++ Compilers: */ |
||||
#if defined(__cplusplus) |
||||
extern "C" { |
||||
#endif |
||||
|
||||
/* Preprocessor Checks: */ |
||||
#if !defined(__INCLUDE_FROM_USB_DRIVER) |
||||
#error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead. |
||||
#endif |
||||
|
||||
/* Private Interface - For use in library only: */ |
||||
#if !defined(__DOXYGEN__) |
||||
/* Enums: */ |
||||
enum USB_Interrupts_t |
||||
{ |
||||
USB_INT_NONE = 0, // TODO
|
||||
}; |
||||
|
||||
/* Inline Functions: */ |
||||
static inline void USB_INT_Enable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_INT_Enable(const uint8_t Interrupt) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
static inline void USB_INT_Disable(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_INT_Disable(const uint8_t Interrupt) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
static inline void USB_INT_Clear(const uint8_t Interrupt) ATTR_ALWAYS_INLINE; |
||||
static inline void USB_INT_Clear(const uint8_t Interrupt) |
||||
{ |
||||
// TODO
|
||||
} |
||||
|
||||
static inline bool USB_INT_IsEnabled(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; |
||||
static inline bool USB_INT_IsEnabled(const uint8_t Interrupt) |
||||
{ |
||||
return false; // TODO
|
||||
} |
||||
|
||||
static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT; |
||||
static inline bool USB_INT_HasOccurred(const uint8_t Interrupt) |
||||
{ |
||||
return false; // TODO
|
||||
} |
||||
|
||||
/* Includes: */ |
||||
#include "../USBMode.h" |
||||
#include "../Events.h" |
||||
#include "../USBController.h" |
||||
|
||||
/* Function Prototypes: */ |
||||
void USB_INT_ClearAllInterrupts(void); |
||||
void USB_INT_DisableAllInterrupts(void); |
||||
#endif |
||||
|
||||
/* Disable C linkage for C++ Compilers: */ |
||||
#if defined(__cplusplus) |
||||
} |
||||
#endif |
||||
|
||||
#endif |
||||
|
Loading…
Reference in new issue