X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/70284d390f524e84e0539ad1e869366aaf94cf24..55aadf97d5d2bd86f2a0c3a53d4608c0cf96471e:/LUFA/Drivers/Misc/RingBuffer.h diff --git a/LUFA/Drivers/Misc/RingBuffer.h b/LUFA/Drivers/Misc/RingBuffer.h index 5c8c8403b..c95363871 100644 --- a/LUFA/Drivers/Misc/RingBuffer.h +++ b/LUFA/Drivers/Misc/RingBuffer.h @@ -66,7 +66,7 @@ * RingBuffer_t Buffer; * uint8_t BufferData[128]; * - * // Initialise the buffer with the created storage array + * // Initialize the buffer with the created storage array * RingBuffer_InitBuffer(&Buffer, BufferData, sizeof(BufferData)); * * // Insert some data into the buffer @@ -96,6 +96,11 @@ /* Includes: */ #include "../../Common/Common.h" + /* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + /* Type Defines: */ /** \brief Ring Buffer Management Structure. * @@ -125,8 +130,8 @@ { GCC_FORCE_POINTER_ACCESS(Buffer); - uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); - USB_INT_GlobalDisable(); + uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); + GlobalInterruptDisable(); Buffer->In = DataPtr; Buffer->Out = DataPtr; @@ -135,7 +140,7 @@ Buffer->Size = Size; Buffer->Count = 0; - USB_INT_SetGlobalEnableState(CurrentGlobalInt); + SetGlobalInterruptMask(CurrentGlobalInt); } /** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed @@ -155,12 +160,12 @@ { uint16_t Count; - uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); - USB_INT_GlobalDisable(); + uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); + GlobalInterruptDisable(); Count = Buffer->Count; - USB_INT_SetGlobalEnableState(CurrentGlobalInt); + SetGlobalInterruptMask(CurrentGlobalInt); return Count; } @@ -213,12 +218,12 @@ if (++Buffer->In == Buffer->End) Buffer->In = Buffer->Start; - uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); - USB_INT_GlobalDisable(); + uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); + GlobalInterruptDisable(); Buffer->Count++; - USB_INT_SetGlobalEnableState(CurrentGlobalInt); + SetGlobalInterruptMask(CurrentGlobalInt); } /** Removes an element from the ring buffer. @@ -240,12 +245,12 @@ if (++Buffer->Out == Buffer->End) Buffer->Out = Buffer->Start; - uint_reg_t CurrentGlobalInt = USB_INT_GetGlobalEnableState(); - USB_INT_GlobalDisable(); + uint_reg_t CurrentGlobalInt = GetGlobalInterruptMask(); + GlobalInterruptDisable(); Buffer->Count--; - USB_INT_SetGlobalEnableState(CurrentGlobalInt); + SetGlobalInterruptMask(CurrentGlobalInt); return Data; } @@ -261,6 +266,11 @@ return *Buffer->Out; } + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + #endif /** @} */