1 /* -------------------------------- Arctic Core ------------------------------
2 * Arctic Core - the open source AUTOSAR platform http://arccore.com
4 * Copyright (C) 2009 ArcCore AB <contact@arccore.com>
6 * This source code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by the
8 * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * -------------------------------- Arctic Core ------------------------------*/
16 #ifndef CIRQ_BUFFER_H_
17 #define CIRQ_BUFFER_H_
20 #include "Platform_Types.h"
23 /* The max number of elements in the list */
27 /* Size of the elements in the list */
29 /* List head and tail */
33 /* Buffer start/stop */
38 /* Dynamic implementation */
39 CirqBufferType *CirqBuffDynCreate( size_t size, size_t dataSize );
40 int CirqBuffDynDestroy(CirqBufferType *cPtr );
42 /* Static implementation */
43 CirqBufferType CirqBuffStatCreate(void *buffer, int maxCnt, size_t dataSize);
45 int CirqBuffPush( CirqBufferType *cPtr, void *dataPtr );
46 int CirqBuffPop(CirqBufferType *cPtr, void *dataPtr );
47 void *CirqBuff_PushLock( CirqBufferType *cPtr);
48 void *CirqBuff_PopLock(CirqBufferType *cPtr );
49 void CirqBuff_Init(CirqBufferType *cirqbuffer, void *buffer, int maxCnt, size_t dataSize);
51 static inline boolean CirqBuff_Empty(CirqBufferType *cPtr ) {
52 return (cPtr->currCnt == 0);
54 static inline void CirqBuff_PushRelease( CirqBufferType *cPtr) {
58 static inline void CirqBuff_PopRelease( CirqBufferType *cPtr) {
63 #endif /* CIRQ_BUFFER_H_ */