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_
22 /* The max number of elements in the list */
26 /* Size of the elements in the list */
28 /* List head and tail */
32 /* Buffer start/stop */
37 /* Dynamic implementation */
38 CirqBufferType *CirqBuffDynCreate( size_t size, size_t dataSize );
39 int CirqBuffDynDestroy(CirqBufferType *cPtr );
41 /* Static implementation */
42 CirqBufferType CirqBuffStatCreate(void *buffer, int maxCnt, size_t dataSize);
44 int CirqBuffPush( CirqBufferType *cPtr, void *dataPtr );
45 int CirqBuffPop(CirqBufferType *cPtr, void *dataPtr );
46 void *CirqBuff_PushLock( CirqBufferType *cPtr);
47 void *CirqBuff_PopLock(CirqBufferType *cPtr );
48 void CirqBuff_Init(CirqBufferType *cirqbuffer, void *buffer, int maxCnt, size_t dataSize);
50 static inline boolean CirqBuff_Empty(CirqBufferType *cPtr ) {
51 return (cPtr->currCnt == 0);
53 static inline void CirqBuff_PushRelease( CirqBufferType *cPtr) {
57 static inline void CirqBuff_PopRelease( CirqBufferType *cPtr) {
62 #endif /* CIRQ_BUFFER_H_ */