aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/Misc/RingBuffer.h
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-07-11 11:16:57 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-07-11 11:16:57 +0000
commitf152ff26c7902a848c798c56adb981861beaf2bf (patch)
tree2ffbab3935629dec6be738f73bf3db46d4a7b4b3 /LUFA/Drivers/Misc/RingBuffer.h
parentc029d72b9497ebf554c9d05ec58d48d7534b8a2f (diff)
downloadlufa-f152ff26c7902a848c798c56adb981861beaf2bf.tar.gz
lufa-f152ff26c7902a848c798c56adb981861beaf2bf.tar.bz2
lufa-f152ff26c7902a848c798c56adb981861beaf2bf.zip
Add missing function attributes to the RingBuffer driver to reduce the chances of invalid usage.
Fix duplicated LED driver functions in the Doxygen documentation.
Diffstat (limited to 'LUFA/Drivers/Misc/RingBuffer.h')
-rw-r--r--LUFA/Drivers/Misc/RingBuffer.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/LUFA/Drivers/Misc/RingBuffer.h b/LUFA/Drivers/Misc/RingBuffer.h
index 3547c52ef..64587e64c 100644
--- a/LUFA/Drivers/Misc/RingBuffer.h
+++ b/LUFA/Drivers/Misc/RingBuffer.h
@@ -127,6 +127,8 @@
* \param[out] Size Maximum number of bytes that can be stored in the underlying data array.
*/
static inline void RingBuffer_InitBuffer(RingBuffer_t* Buffer, uint8_t* const DataPtr, const uint16_t Size)
+ ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2);
+ static inline void RingBuffer_InitBuffer(RingBuffer_t* Buffer, uint8_t* const DataPtr, const uint16_t Size)
{
GCC_FORCE_POINTER_ACCESS(Buffer);
@@ -157,6 +159,7 @@
*
* \return Number of bytes currently stored in the buffer.
*/
+ static inline uint16_t RingBuffer_GetCount(RingBuffer_t* const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
static inline uint16_t RingBuffer_GetCount(RingBuffer_t* const Buffer)
{
uint16_t Count;
@@ -182,6 +185,7 @@
*
* \return Number of free bytes in the buffer.
*/
+ static inline uint16_t RingBuffer_GetFreeCount(RingBuffer_t* const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
static inline uint16_t RingBuffer_GetFreeCount(RingBuffer_t* const Buffer)
{
return (Buffer->Size - RingBuffer_GetCount(Buffer));
@@ -199,6 +203,7 @@
*
* \return Boolean \c true if the buffer contains no free space, false otherwise.
*/
+ static inline bool RingBuffer_IsEmpty(RingBuffer_t* const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
static inline bool RingBuffer_IsEmpty(RingBuffer_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == 0);
@@ -212,6 +217,7 @@
*
* \return Boolean \c true if the buffer contains no free space, false otherwise.
*/
+ static inline bool RingBuffer_IsFull(RingBuffer_t* const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
static inline bool RingBuffer_IsFull(RingBuffer_t* const Buffer)
{
return (RingBuffer_GetCount(Buffer) == Buffer->Size);
@@ -226,8 +232,8 @@
* \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* Buffer,
- const uint8_t Data)
+ static inline void RingBuffer_Insert(RingBuffer_t* Buffer, const uint8_t Data) ATTR_NON_NULL_PTR_ARG(1);
+ static inline void RingBuffer_Insert(RingBuffer_t* Buffer, const uint8_t Data)
{
GCC_FORCE_POINTER_ACCESS(Buffer);
@@ -254,6 +260,7 @@
*
* \return Next data element stored in the buffer.
*/
+ static inline uint8_t RingBuffer_Remove(RingBuffer_t* Buffer) ATTR_NON_NULL_PTR_ARG(1);
static inline uint8_t RingBuffer_Remove(RingBuffer_t* Buffer)
{
GCC_FORCE_POINTER_ACCESS(Buffer);
@@ -279,6 +286,7 @@
*
* \return Next data element stored in the buffer.
*/
+ static inline uint8_t RingBuffer_Peek(RingBuffer_t* const Buffer) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(1);
static inline uint8_t RingBuffer_Peek(RingBuffer_t* const Buffer)
{
return *Buffer->Out;