aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/USB/LowLevel/Endpoint.h
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-07-27 13:49:16 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-07-27 13:49:16 +0000
commit059307d89cbdd7a45170566f469eb9e02c20b3e1 (patch)
tree4c9f388ddff46e5cbe3afd4ce8b88eb258fb09ac /LUFA/Drivers/USB/LowLevel/Endpoint.h
parentbe2a7d45989f5f57b326589350a6ce5bbc835b5c (diff)
downloadlufa-059307d89cbdd7a45170566f469eb9e02c20b3e1.tar.gz
lufa-059307d89cbdd7a45170566f469eb9e02c20b3e1.tar.bz2
lufa-059307d89cbdd7a45170566f469eb9e02c20b3e1.zip
Use static inline intermediatary functions in Endpoint.h to handle the masking for the private endpoint configuration routine, instead of performing the masking in the Endpoint_ConfigureEndpoint() macro.
Diffstat (limited to 'LUFA/Drivers/USB/LowLevel/Endpoint.h')
-rw-r--r--LUFA/Drivers/USB/LowLevel/Endpoint.h50
1 files changed, 36 insertions, 14 deletions
diff --git a/LUFA/Drivers/USB/LowLevel/Endpoint.h b/LUFA/Drivers/USB/LowLevel/Endpoint.h
index dd49b8092..eb4b6161c 100644
--- a/LUFA/Drivers/USB/LowLevel/Endpoint.h
+++ b/LUFA/Drivers/USB/LowLevel/Endpoint.h
@@ -1293,14 +1293,23 @@
#define ENDPOINT_DETAILS_EP4 64, true
#endif
- #define Endpoint_ConfigureEndpoint(Number, Type, Direction, Size, Banks) \
- Endpoint_ConfigureEndpoint_Prv((Number), \
- (((Type) << EPTYPE0) | (Direction)), \
- ((1 << ALLOC) | (Banks) | \
- (__builtin_constant_p(Size) ? \
- Endpoint_BytesToEPSizeMask(Size) : \
- Endpoint_BytesToEPSizeMaskDynamic(Size))))
-
+ #define Endpoint_ConfigureEndpoint(Number, Type, Direction, Size, Banks) \
+ (__builtin_constant_p(Size) ? Endpoint_ConfigureEndpointStatic((Number), \
+ (Type), \
+ (Direction), \
+ Size, Banks) : \
+ Endpoint_ConfigureEndpointDynamic((Number), \
+ (Type), \
+ (Direction), \
+ Size, Banks))
+
+ /* Function Prototypes: */
+ void Endpoint_ClearEndpoints(void);
+ uint8_t Endpoint_BytesToEPSizeMaskDynamic(const uint16_t Size);
+ bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
+ const uint8_t UECFG0XData,
+ const uint8_t UECFG1XData);
+
/* 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)
@@ -1316,13 +1325,26 @@
return (MaskVal << EPSIZE0);
}
+
+ static inline bool Endpoint_ConfigureEndpointStatic(const uint8_t Number,
+ const uint8_t Type,
+ const uint8_t Direction,
+ const uint16_t Size,
+ const uint8_t Banks)
+ {
+ return Endpoint_ConfigureEndpoint_Prv(Number, (((Type) << EPTYPE0) | (Direction)),
+ ((1 << ALLOC) | Banks | Endpoint_BytesToEPSizeMask(Size)));
+ }
- /* Function Prototypes: */
- void Endpoint_ClearEndpoints(void);
- uint8_t Endpoint_BytesToEPSizeMaskDynamic(const uint16_t Size);
- bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number,
- const uint8_t UECFG0XData,
- const uint8_t UECFG1XData);
+ static inline bool Endpoint_ConfigureEndpointDynamic(const uint8_t Number,
+ const uint8_t Type,
+ const uint8_t Direction,
+ const uint16_t Size,
+ const uint8_t Banks)
+ {
+ return Endpoint_ConfigureEndpoint_Prv(Number, (((Type) << EPTYPE0) | (Direction)),
+ ((1 << ALLOC) | Banks | Endpoint_BytesToEPSizeMaskDynamic(Size)));
+ }
#endif
/* Disable C linkage for C++ Compilers: */