-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Supported buffer offset for memcpy in and out of buffers.
- Loading branch information
Showing
17 changed files
with
165 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,43 @@ | ||
#ifndef __BufferHal_h__ | ||
#define __BufferHal_h__ | ||
|
||
#include <map> | ||
#ifndef __BufferHal_h__ | ||
#define __BufferHal_h__ | ||
|
||
#include <map> | ||
#include <boost/interprocess/sync/interprocess_mutex.hpp> | ||
|
||
#include "BasicTypes.h" | ||
|
||
#include "BasicTypes.h" | ||
#include "Buffer/Types.h" | ||
|
||
constexpr SectorInfo DefaultSectorInfo({ 9, false, 9 }); | ||
|
||
class BufferHal | ||
{ | ||
public: | ||
public: | ||
BufferHal(); | ||
|
||
void PreInit(const U32 &maxBufferSizeInKB); | ||
|
||
public: | ||
bool AllocateBuffer(BufferType type, const U32 §orCount, Buffer &buffer); | ||
void DeallocateBuffer(const Buffer &buffer); | ||
|
||
U8* ToPointer(const Buffer &buffer); | ||
void Memcpy(U8* const dest, const Buffer &src); | ||
void Memcpy(const Buffer &dest, const U8* const src); | ||
|
||
public: | ||
bool SetSectorInfo(const SectorInfo §orInfo); | ||
SectorInfo GetSectorInfo() const; | ||
U32 ToByteIndexInTransfer(BufferType type, const U32 §orIndex); | ||
|
||
private: | ||
U32 _MaxBufferSizeInSector; | ||
U32 _CurrentFreeSizeInSector; | ||
U32 _CurrentBufferHandle; | ||
std::unique_ptr<std::map<U32, std::unique_ptr<U8[]>>> _AllocatedBuffers; | ||
constexpr SectorInfo DefaultSectorInfo({ 9, false, 9 }); | ||
|
||
class BufferHal | ||
{ | ||
public: | ||
public: | ||
BufferHal(); | ||
|
||
void PreInit(const U32 &maxBufferSizeInKB); | ||
|
||
public: | ||
bool AllocateBuffer(BufferType type, const U32 §orCount, Buffer &buffer); | ||
void DeallocateBuffer(const Buffer &buffer); | ||
|
||
U8* ToPointer(const Buffer &buffer); | ||
void Memcpy(U8* const dest, const Buffer &src, const tSectorOffset& bufferOffset, const tSectorCount& sectorCount); | ||
void Memcpy(const Buffer &dest, const tSectorOffset& bufferOffset, const U8* const src, const tSectorCount& sectorCount); | ||
|
||
public: | ||
bool SetSectorInfo(const SectorInfo §orInfo); | ||
SectorInfo GetSectorInfo() const; | ||
U32 ToByteIndexInTransfer(BufferType type, U32 offset); | ||
|
||
private: | ||
U32 _MaxBufferSizeInSector; | ||
U32 _CurrentFreeSizeInSector; | ||
U32 _CurrentBufferHandle; | ||
std::unique_ptr<std::map<U32, std::unique_ptr<U8[]>>> _AllocatedBuffers; | ||
SectorInfo _SectorInfo; | ||
|
||
boost::interprocess::interprocess_mutex _Mutex; | ||
}; | ||
|
||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,9 +28,4 @@ struct tSectorInPage | |
U8 _; | ||
}; | ||
|
||
struct tSectorCount | ||
{ | ||
U8 _; | ||
}; | ||
|
||
#endif |
Oops, something went wrong.