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.

pull/1469/head
Dean Camera 14 years ago
parent be2a7d4598
commit 059307d89c

@ -1294,12 +1294,21 @@
#endif #endif
#define Endpoint_ConfigureEndpoint(Number, Type, Direction, Size, Banks) \ #define Endpoint_ConfigureEndpoint(Number, Type, Direction, Size, Banks) \
Endpoint_ConfigureEndpoint_Prv((Number), \ (__builtin_constant_p(Size) ? Endpoint_ConfigureEndpointStatic((Number), \
(((Type) << EPTYPE0) | (Direction)), \ (Type), \
((1 << ALLOC) | (Banks) | \ (Direction), \
(__builtin_constant_p(Size) ? \ Size, Banks) : \
Endpoint_BytesToEPSizeMask(Size) : \ Endpoint_ConfigureEndpointDynamic((Number), \
Endpoint_BytesToEPSizeMaskDynamic(Size)))) (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: */ /* 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) ATTR_WARN_UNUSED_RESULT ATTR_CONST ATTR_ALWAYS_INLINE;
@ -1317,12 +1326,25 @@
return (MaskVal << EPSIZE0); return (MaskVal << EPSIZE0);
} }
/* Function Prototypes: */ static inline bool Endpoint_ConfigureEndpointStatic(const uint8_t Number,
void Endpoint_ClearEndpoints(void); const uint8_t Type,
uint8_t Endpoint_BytesToEPSizeMaskDynamic(const uint16_t Size); const uint8_t Direction,
bool Endpoint_ConfigureEndpoint_Prv(const uint8_t Number, const uint16_t Size,
const uint8_t UECFG0XData, const uint8_t Banks)
const uint8_t UECFG1XData); {
return Endpoint_ConfigureEndpoint_Prv(Number, (((Type) << EPTYPE0) | (Direction)),
((1 << ALLOC) | Banks | Endpoint_BytesToEPSizeMask(Size)));
}
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 #endif
/* Disable C linkage for C++ Compilers: */ /* Disable C linkage for C++ Compilers: */

Loading…
Cancel
Save