embkernel
 All Classes Functions Variables Typedefs Groups Pages
RtosBuffer.hpp
1 //------------------------------------------------------------------------------
2 //This file is part of embKernel.
3 //See license.txt for the full license governing this code.
4 //------------------------------------------------------------------------------
8 #ifndef RTOS_BUFFER_HPP_
9 #define RTOS_BUFFER_HPP_
10 
11 #include "RtosSyncObject.hpp"
12 #include <string.h>
13 
19 class RtosBuffer: public RtosSyncObject {
20 public:
21  RtosBuffer(int size);
22  ~RtosBuffer();
23 
24  uint8_t* mBuffer;
25 
26  int mIdxIn;
27  int mIdxOut;
28 
29  int write(const void* buffer, int len, Rtos::TICK tick);
30  int writeChunk(const void* buffer, int len, Rtos::TICK tick);
31  int writeFromInt(const void* buffer, int len);
32  int read(void* buffer, int len, Rtos::TICK tick);
33  int readChunk(void* buffer, int len, Rtos::TICK tick);
34  int readFromInt(void* buffer, int len);
35 
36 private:
37  void writeBuffer(const void* buffer, int len);
38  void readBuffer(void* buffer, int len);
39 
40 };
41 
42 #endif /* RTOS_BUFFER_HPP_ */
43