embkernel
 All Classes Functions Variables Typedefs Groups Pages
FsDrive.hpp
1 //------------------------------------------------------------------------------
2 //This file is part of embKernel.
3 //See license.txt for the full license governing this code.
4 //------------------------------------------------------------------------------
5 
6 #ifndef FS_DRIVE_HPP_
7 #define FS_DRIVE_HPP_
8 
9 #include "FsDefs.hpp"
10 #include "FsPartition.hpp"
11 #include "RtosInclude.hpp"
12 
13 class FsDrive {
14  friend class Fs;
15  friend class FsPartition;
16 
17 public:
18  FsDrive();
19  ~FsDrive();
20 
21 protected:
22  uint16_t mBytesPerSector;
23  uint32_t mSectorsCount;
24 
25 private:
26  RtosSemaphore mSema;
27 
28  bool mIsReady;
29 
30  void lock();
31  void unlock();
32 protected:
33  virtual bool init()=0;
34  virtual bool readBlocks(FsDefs::SECTOR* buffer, unsigned int blockNumber, unsigned int blockCount)=0;
35  virtual bool writeBlocks(const FsDefs::SECTOR* buffer, unsigned int blockNumber, unsigned int blockCount)=0;
36 
37 };
38 
39 #endif /* FS_DRIVE_HPP_ */