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 11 #ifndef __BLOCK_H__ 12 #define __BLOCK_H__ 13 14 #include <rtdef.h> 15 16 /* block device commands*/ 17 #define RT_DEVICE_CTRL_BLK_GETGEOME (RT_DEVICE_CTRL_BASE(Block) + 1) /**< get geometry information */ 18 #define RT_DEVICE_CTRL_BLK_SYNC (RT_DEVICE_CTRL_BASE(Block) + 2) /**< flush data to block device */ 19 #define RT_DEVICE_CTRL_BLK_ERASE (RT_DEVICE_CTRL_BASE(Block) + 3) /**< erase block on block device */ 20 #define RT_DEVICE_CTRL_BLK_AUTOREFRESH (RT_DEVICE_CTRL_BASE(Block) + 4) /**< block device : enter/exit auto refresh mode */ 21 #define RT_DEVICE_CTRL_BLK_PARTITION (RT_DEVICE_CTRL_BASE(Block) + 5) /**< get block device partition */ 22 23 /** 24 * block device geometry structure 25 */ 26 struct rt_device_blk_geometry 27 { 28 rt_uint64_t sector_count; /**< count of sectors */ 29 rt_uint32_t bytes_per_sector; /**< number of bytes per sector */ 30 rt_uint32_t block_size; /**< number of bytes to erase one block */ 31 }; 32 33 /** 34 * sector arrange struct on block device 35 */ 36 struct rt_device_blk_sectors 37 { 38 rt_uint64_t sector_begin; /**< begin sector */ 39 rt_uint64_t sector_end; /**< end sector */ 40 }; 41 42 #endif /* __BLOCK_H__ */ 43