aboutsummaryrefslogtreecommitdiff
path: root/daemon/Fifo.h
diff options
context:
space:
mode:
authorJon Medhurst <tixy@linaro.org>2012-05-10 14:15:56 +0100
committerJon Medhurst <tixy@linaro.org>2012-05-16 14:22:59 +0100
commitd18974d3f05535eda819f2d0b92a9d49719b0f26 (patch)
treeee0d02ac702b3802b0f002a0f8edf2171d7e58c3 /daemon/Fifo.h
parent970700feed8c3523b06476ae340bf46f6d262550 (diff)
gator: Version 5.10DS-5.10
New gator release (build 1385) for ARM DS-5 v5.10 Signed-off-by: Jon Medhurst <tixy@linaro.org>
Diffstat (limited to 'daemon/Fifo.h')
-rw-r--r--daemon/Fifo.h74
1 files changed, 33 insertions, 41 deletions
diff --git a/daemon/Fifo.h b/daemon/Fifo.h
index 51e2bcd..548ba27 100644
--- a/daemon/Fifo.h
+++ b/daemon/Fifo.h
@@ -1,41 +1,33 @@
-/**
- * Copyright (C) ARM Limited 2010-2012. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef __FIFO_H__
-#define __FIFO_H__
-
-#include <semaphore.h>
-
-// Number of buffers allowed with large buffer mode
-#define FIFO_BUFFER_LIMIT 64
-
-class Fifo {
-public:
- Fifo(int numBuffers, int bufferSize);
- ~Fifo();
- int depth(void);
- int numReadToWriteBuffersFilled();
- int numWriteToReadBuffersFilled();
- int numReadToWriteBuffersEmpty() {return depth() - numReadToWriteBuffersFilled();}
- int numWriteToReadBuffersEmpty() {return depth() - numWriteToReadBuffersFilled();}
- char* start();
- char* write(int length);
- char* read(int* length);
-
-private:
- int mNumBuffers;
- int mBufferSize;
- int mWriteCurrent;
- int mReadCurrent;
- sem_t mReadToWriteSem[FIFO_BUFFER_LIMIT];
- sem_t mWriteToReadSem[FIFO_BUFFER_LIMIT];
- char* mBuffer[FIFO_BUFFER_LIMIT];
- int mLength[FIFO_BUFFER_LIMIT];
-};
-
-#endif //__FIFO_H__
+/**
+ * Copyright (C) ARM Limited 2010-2012. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __FIFO_H__
+#define __FIFO_H__
+
+#include <semaphore.h>
+
+class Fifo {
+public:
+ Fifo(int singleBufferSize, int totalBufferSize);
+ ~Fifo();
+ int numBytesFilled();
+ bool isEmpty();
+ bool isFull();
+ bool willFill(int additional);
+ char* start();
+ char* write(int length);
+ char* read(int* length);
+
+private:
+ int mSingleBufferSize, mWrite, mRead, mReadCommit, mRaggedEnd, mWrapThreshold;
+ sem_t mWaitForSpaceSem, mWaitForDataSem;
+ char* mBuffer;
+ bool mEnd;
+};
+
+#endif //__FIFO_H__