Guest User

Untitled

a guest
May 29th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. #ifndef __HAL_BLOCKDEV_HPP
  2. #define __HAL_BLOCKDEV_HPP
  3. #include <stdint.h>
  4. namespace MTGosHAL {
  5. class IDE {
  6. private:
  7. uint8_t existent; //Bitmap showing which of the up to 8 partitions are actually present.
  8. uint8_t num;
  9. int32_t numDevices;
  10. uint16_t baseport;
  11. uint32_t pstart[8], pend[8];
  12. IDE() {}
  13. public:
  14. IDE(uint16_t baseport, uint8_t num);
  15. auto getDriveCnt() -> int32_t;
  16. auto getDriveNumByName(const char *) -> int32_t;
  17. auto readSector(int32_t drv, uint64_t sectorNum, uint8_t *buf) -> void; //Has to be at least 512 bytes big!
  18. auto readSectors(int32_t drv, uint64_t sectorNum, uint32_t num, uint8_t *buf) -> void; //Has to be at least num*512 bytes big!
  19. };
  20. class BlockDevice {
  21. private:
  22. uint8_t numDevices;
  23. IDE ata0;
  24. IDE ata1;
  25. IDE ata2;
  26. IDE ata3;
  27. public:
  28. BlockDevice();
  29. ~BlockDevice();
  30. auto getDriveCnt() -> int32_t;
  31. auto getDriveNumByName(const char *) -> int32_t; //Returns -1 if device is not existent
  32. auto readSector(int32_t drv, uint64_t sectorNum, uint8_t *buf) -> void; //Has to be at least 512 bytes big!
  33. auto readSectors(int32_t drv, uint64_t sectorNum, uint32_t num, uint8_t *buf) -> void; //Has to be at least num*512 bytes big!
  34.  
  35. };
  36. }
  37.  
  38.  
  39. #endif /* end of include guard: __HAL_BLOCKDEV_HPP */
Advertisement
Add Comment
Please, Sign In to add comment