aboutsummaryrefslogtreecommitdiffstats
path: root/Bootloaders/DFU/Config/LUFAConfig.h
blob: 59ae519e4c0032200fe29a49b29968fa22ad9e7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/*
             LUFA Library
     Copyright (C) Dean Camera, 2017.

  dean [at] fourwalledcubicle [dot] com
           www.lufa-lib.org
*/

/*
  Copyright 2017  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 disclaims 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 LUFA Library Configuration Header File
 *
 *  This header file is used to configure LUFA's compile time options,
 *  as an alternative to the compile time constants supplied through
 *  a makefile.
 *
 *  For information on what each token does, refer to the LUFA
 *  manual section "Summary of Compile Tokens".
 */

#ifndef _LUFA_CONFIG_H_
#define _LUFA_CONFIG_H_

	#if (ARCH == ARCH_AVR8)

		/* Non-USB Related Configuration Tokens: */
//		#define DISABLE_TERMINAL_CODES

		/* USB Class Driver Related Tokens: */
//		#define HID_HOST_BOOT_PROTOCOL_ONLY
//		#define HID_STATETABLE_STACK_DEPTH       {Insert Value Here}
//		#define HID_USAGE_STACK_DEPTH            {Insert Value Here}
//		#define HID_MAX_COLLECTIONS              {Insert Value Here}
//		#define HID_MAX_REPORTITEMS              {Insert Value Here}
//		#define HID_MAX_REPORT_IDS               {Insert Value Here}
//		#define NO_CLASS_DRIVER_AUTOFLUSH

		/* General USB Driver Related Tokens: */
//		#define ORDERED_EP_CONFIG
		#define USE_STATIC_OPTIONS               (USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)
		#define USB_DEVICE_ONLY
//		#define USB_HOST_ONLY
//		#define USB_STREAM_TIMEOUT_MS            {Insert Value Here}
//		#define NO_LIMITED_CONTROLLER_CONNECT
		#define NO_SOF_EVENTS

		/* USB Device Mode Driver Related Tokens: */
		#define USE_RAM_DESCRIPTORS
//		#define USE_FLASH_DESCRIPTORS
//		#define USE_EEPROM_DESCRIPTORS
		#define NO_INTERNAL_SERIAL
		#define FIXED_CONTROL_ENDPOINT_SIZE      32
		#define DEVICE_STATE_AS_GPIOR            0
		#define FIXED_NUM_CONFIGURATIONS         1
		#define CONTROL_ONLY_DEVICE
//		#define INTERRUPT_CONTROL_ENDPOINT
		#define NO_DEVICE_REMOTE_WAKEUP
		#define NO_DEVICE_SELF_POWER

		/* USB Host Mode Driver Related Tokens: */
//		#define HOST_STATE_AS_GPIOR              {Insert Value Here}
//		#define USB_HOST_TIMEOUT_MS              {Insert Value Here}
//		#define HOST_DEVICE_SETTLE_DELAY_MS	     {Insert Value Here}
//		#define NO_AUTO_VBUS_MANAGEMENT
//		#define INVERTED_VBUS_ENABLE_LINE

	#else

		#error Unsupported architecture for this LUFA configuration file.

	#endif
#endif
terruptManagement.c <i>(Makefile source module name: LUFA_SRC_PLATFORM)</i> * - LUFA/Platform/UC3/Exception.S <i>(Makefile source module name: LUFA_SRC_PLATFORM)</i> * * \section Sec_PlatformDrivers_UC3Interrupts_ModDescription Module Description * Interrupt controller driver for the AVR32 UC3 microcontrollers, for the configuration of interrupt * handlers within the device. * * Usage Example: * \code * #include <LUFA/Platform/UC3/InterruptManagement.h> * * ISR(USB_Group_IRQ_Handler) * { * // USB group handler code here * } * * void main(void) * { * INTC_Init(); * INTC_RegisterGroupHandler(INTC_IRQ_GROUP(AVR32_USBB_IRQ), AVR32_INTC_INT0, USB_Group_IRQ_Handler); * } * \endcode * * @{ */ #ifndef _UC3_INTERRUPT_MANAGEMENT_H_ #define _UC3_INTERRUPT_MANAGEMENT_H_ /* Includes: */ #include "../../Common/Common.h" /* Enable C linkage for C++ Compilers: */ #if defined(__cplusplus) extern "C" { #endif /* Private Interface - For use in library only: */ #if !defined(__DOXYGEN__) /* Type Defines: */ typedef void (*InterruptHandlerPtr_t)(void); /* External Variables: */ #if defined(__INCLUDE_FROM_INTMANAGEMENT_C) extern const void EVBA_Table; #endif extern InterruptHandlerPtr_t InterruptHandlers[AVR32_INTC_NUM_INT_GRPS]; extern const uint32_t Autovector_Table[]; #endif /* Public Interface - May be used in end-application: */ /* Macros: */ /** Converts a given interrupt index into its associated interrupt group. * * \param[in] IRQIndex Index of the interrupt request to convert. * * \return Interrupt group number associated with the interrupt index. */ #define INTC_IRQ_GROUP(IRQIndex) (IRQIndex / 32) /** Converts a given interrupt index into its associated interrupt line. * * \param[in] IRQIndex Index of the interrupt request to convert. * * \return Interrupt line number associated with the interrupt index. */ #define INTC_IRQ_LINE(IRQIndex) (IRQIndex % 32) /* Function Prototypes: */ /** Initializes the interrupt controller ready to handle interrupts. This must be called at the * start of the user program before any interrupts are registered or enabled. */ void INTC_Init(void); /** Retrieves the associated interrupt handler for the interrupt group currently being fired. This * is called directly from the exception handler routine before dispatching to the ISR. * * \param[in] InterruptLevel Priority level of the interrupt. * * \return Pointer to the associated interrupt handler function, or NULL if no handler set. */ InterruptHandlerPtr_t INTC_GetInterruptHandler(const uint_reg_t InterruptLevel); /* Inline Functions: */ /** Registers a handler for a given interrupt group. On the AVR32 UC3 devices, interrupts are grouped by * peripheral. To save on SRAM used, a single ISR handles all interrupt lines within a single group - to * determine the exact line that has interrupted within the group ISR handler, use \ref INTC_GetGroupInterrupts(). * * If multiple interrupts with the same group are registered, the last registered handler will become the * handler called for interrupts raised within that group. * * To obtain the group number of a specific interrupt index, use the \ref INTC_IRQ_GROUP() macro. * * \param[in] GroupNumber Group number of the interrupt group to register a handler for. * \param[in] InterruptLevel Priority level for the specified interrupt, a \c AVR32_INTC_INT* mask. * \param[in] Handler Address of the ISR handler for the interrupt group. */ static inline void INTC_RegisterGroupHandler(const uint16_t GroupNumber, const uint8_t InterruptLevel, const InterruptHandlerPtr_t Handler) ATTR_ALWAYS_INLINE; static inline void INTC_RegisterGroupHandler(const uint16_t GroupNumber, const uint8_t InterruptLevel, const InterruptHandlerPtr_t Handler) { InterruptHandlers[GroupNumber] = Handler; AVR32_INTC.ipr[GroupNumber] = Autovector_Table[InterruptLevel]; } /** Retrieves the pending interrupts for a given interrupt group. The result of this function should be masked * against interrupt request indexes converted to a request line number via the \ref INTC_IRQ_LINE() macro. To * obtain the group number of a given interrupt request, use the \ref INTC_IRQ_GROUP() macro. * * \param[in] GroupNumber Group number of the interrupt group to check. * * \return Mask of pending interrupt lines for the given interrupt group. */ static inline uint_reg_t INTC_GetGroupInterrupts(const uint16_t GroupNumber) ATTR_ALWAYS_INLINE; static inline uint_reg_t INTC_GetGroupInterrupts(const uint16_t GroupNumber) { return AVR32_INTC.irr[GroupNumber]; } /* Disable C linkage for C++ Compilers: */ #if defined(__cplusplus) } #endif #endif /** @} */