aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-07-14 08:30:33 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-07-14 08:30:33 +0000
commit77a9df36a77d2523dd2bc24fa17f9f04c6c175c5 (patch)
tree35110b2a3c524eb8829b7ca84c2b1851ad4a02fa /LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
parentb971dbbce82a1138dbf0c57e34df7b9a1e9a49d7 (diff)
downloadlufa-77a9df36a77d2523dd2bc24fa17f9f04c6c175c5.tar.gz
lufa-77a9df36a77d2523dd2bc24fa17f9f04c6c175c5.tar.bz2
lufa-77a9df36a77d2523dd2bc24fa17f9f04c6c175c5.zip
Update UC3 platform driver support to use the bitmasks defined in the header files over raw constants.
Start implementation of XMEGA platform drivers.
Diffstat (limited to 'LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h')
-rw-r--r--LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
index 3ed603de0..fd5adddb1 100644
--- a/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
+++ b/LUFA/Drivers/USB/Core/XMEGA/Endpoint_XMEGA.h
@@ -95,6 +95,23 @@
#define ENDPOINT_DETAILS_MAXEP 16
+ /* 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)
+ {
+ uint8_t MaskVal = 0;
+ uint16_t CheckBytes = 8;
+
+ while (CheckBytes < Bytes)
+ {
+ MaskVal++;
+ CheckBytes <<= 1;
+ }
+
+ return (MaskVal << USB_EP_SIZE_gp);
+ }
+
/* Function Prototypes: */
void Endpoint_ClearEndpoints(void);
bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
@@ -110,12 +127,12 @@
/** 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 // TODO
+ #define ENDPOINT_DIR_OUT false
/** 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 0 // TODO
+ #define ENDPOINT_DIR_IN true
//@}
/** \name Endpoint Bank Mode Masks */
@@ -125,14 +142,14 @@
* 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 // TODO
+ #define ENDPOINT_BANK_SINGLE 0
/** 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 0 // TODO
+ #define ENDPOINT_BANK_DOUBLE USB_EP_BANK_bm
//@}
#if (!defined(FIXED_CONTROL_ENDPOINT_SIZE) || defined(__DOXYGEN__))