block.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2006-2023, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2023-10-11 zmshahaha move from <rtdef.h>
  9. */
  10. #ifndef __BLOCK_H__
  11. #define __BLOCK_H__
  12. #include <rtdef.h>
  13. /* block device commands*/
  14. #define RT_DEVICE_CTRL_BLK_GETGEOME (RT_DEVICE_CTRL_BASE(Block) + 1) /**< get geometry information */
  15. #define RT_DEVICE_CTRL_BLK_SYNC (RT_DEVICE_CTRL_BASE(Block) + 2) /**< flush data to block device */
  16. #define RT_DEVICE_CTRL_BLK_ERASE (RT_DEVICE_CTRL_BASE(Block) + 3) /**< erase block on block device */
  17. #define RT_DEVICE_CTRL_BLK_AUTOREFRESH (RT_DEVICE_CTRL_BASE(Block) + 4) /**< block device : enter/exit auto refresh mode */
  18. #define RT_DEVICE_CTRL_BLK_PARTITION (RT_DEVICE_CTRL_BASE(Block) + 5) /**< get block device partition */
  19. /**
  20. * block device geometry structure
  21. */
  22. struct rt_device_blk_geometry
  23. {
  24. rt_uint64_t sector_count; /**< count of sectors */
  25. rt_uint32_t bytes_per_sector; /**< number of bytes per sector */
  26. rt_uint32_t block_size; /**< number of bytes to erase one block */
  27. };
  28. /**
  29. * sector arrange struct on block device
  30. */
  31. struct rt_device_blk_sectors
  32. {
  33. rt_uint64_t sector_begin; /**< begin sector */
  34. rt_uint64_t sector_end; /**< end sector */
  35. };
  36. #endif /* __BLOCK_H__ */