diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2011-01-08 00:54:30 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2011-01-08 00:54:30 +0000 |
commit | d1261468875f4772898c4395880735784e651d91 (patch) | |
tree | dbddf66e710d20786ad91c845a998eb1ca571c9c /LUFA/Drivers/Misc/RingBuffer.h | |
parent | 1c74fd78bdd2362a1b6fd18a5a5d5bbbebc1d777 (diff) | |
download | lufa-d1261468875f4772898c4395880735784e651d91.tar.gz lufa-d1261468875f4772898c4395880735784e651d91.tar.bz2 lufa-d1261468875f4772898c4395880735784e651d91.zip |
The FAST_STREAM_TRANSFERS compile time option has been removed due to lack of use and low cost/benefit ratio.
Add GCC_FORCE_POINTER_ACCESS() macro use to the RingBuffer library header, to attempt to force GCC into producing more efficient code for manipulating the buffers.
Diffstat (limited to 'LUFA/Drivers/Misc/RingBuffer.h')
-rw-r--r-- | LUFA/Drivers/Misc/RingBuffer.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/LUFA/Drivers/Misc/RingBuffer.h b/LUFA/Drivers/Misc/RingBuffer.h index d9d3a8340..605f92c11 100644 --- a/LUFA/Drivers/Misc/RingBuffer.h +++ b/LUFA/Drivers/Misc/RingBuffer.h @@ -126,10 +126,10 @@ */
static inline void RingBuffer_InitBuffer(RingBuffer_t* Buffer, uint8_t* const DataPtr, const uint16_t Size)
{
+ GCC_FORCE_POINTER_ACCESS(Buffer);
+
ATOMIC_BLOCK(ATOMIC_RESTORESTATE)
- {
- GCC_FORCE_POINTER_ACCESS(Buffer);
-
+ {
Buffer->In = DataPtr;
Buffer->Out = DataPtr;
Buffer->Start = &DataPtr[0];
@@ -203,9 +203,11 @@ * \param[in,out] Buffer Pointer to a ring buffer structure to insert into.
* \param[in] Data Data element to insert into the buffer.
*/
- static inline void RingBuffer_Insert(RingBuffer_t* const Buffer,
+ static inline void RingBuffer_Insert(RingBuffer_t* Buffer,
const uint8_t Data)
{
+ GCC_FORCE_POINTER_ACCESS(Buffer);
+
*Buffer->In = Data;
if (++Buffer->In == Buffer->End)
@@ -227,8 +229,10 @@ *
* \return Next data element stored in the buffer.
*/
- static inline uint8_t RingBuffer_Remove(RingBuffer_t* const Buffer)
+ static inline uint8_t RingBuffer_Remove(RingBuffer_t* Buffer)
{
+ GCC_FORCE_POINTER_ACCESS(Buffer);
+
uint8_t Data = *Buffer->Out;
if (++Buffer->Out == Buffer->End)
|