RT-Thread RTOS 1.2.0
An open source embedded real-time operating system
载入中...
搜索中...
未找到
blk.h
浏览该文件的文档.
1/*
2 * Copyright (c) 2006-2022, RT-Thread Development Team
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 *
6 * Change Logs:
7 * Date Author Notes
8 * 2023-02-25 GuEe-GUI first version
9 */
10
11#ifndef __BLK_H__
12#define __BLK_H__
13
14#include <rthw.h>
15#include <rtthread.h>
16#include <drivers/classes/block.h>
17
18struct rt_dm_ida;
19struct rt_blk_device;
20struct rt_blk_disk_ops;
21
23{
25
26 const struct rt_blk_disk_ops *ops;
27#ifdef RT_USING_DM
28 struct rt_dm_ida *ida;
29#endif
30
34#define RT_BLK_DISK_MAGIC 0xbdaabdaa
36
38#define RT_BLK_PARTITION_NONE (-1)
39#define RT_BLK_PARTITION_MAX (RT_UINT32_MAX >> 1)
42
45};
46
48{
49 rt_ssize_t (*read)(struct rt_blk_disk *disk, rt_off_t sector, void *buffer,
50 rt_size_t sector_count);
51 rt_ssize_t (*write)(struct rt_blk_disk *disk, rt_off_t sector, const void *buffer,
52 rt_size_t sector_count);
53 rt_err_t (*getgeome)(struct rt_blk_disk *disk, struct rt_device_blk_geometry *geometry);
54 rt_err_t (*sync)(struct rt_blk_disk *disk);
55 rt_err_t (*erase)(struct rt_blk_disk *disk);
56 rt_err_t (*autorefresh)(struct rt_blk_disk *disk, rt_bool_t is_auto);
57 rt_err_t (*control)(struct rt_blk_disk *disk, struct rt_blk_device *blk, int cmd, void *args);
58};
59
60#ifndef __DFS_H__
61#include <dfs_fs.h>
62
76#else
77struct rt_blk_device;
78#endif /* __DFS_H__ */
79
82
86
87#endif /* __BLK_H__ */
rt_ssize_t rt_blk_disk_get_logical_block_size(struct rt_blk_disk *disk)
rt_err_t rt_hw_blk_disk_register(struct rt_blk_disk *disk)
rt_err_t rt_hw_blk_disk_unregister(struct rt_blk_disk *disk)
rt_ssize_t rt_blk_disk_get_capacity(struct rt_blk_disk *disk)
rt_err_t rt_blk_disk_probe_partition(struct rt_blk_disk *disk)
rt_base_t rt_ssize_t
rt_base_t rt_off_t
int rt_bool_t
rt_base_t rt_err_t
rt_ubase_t rt_size_t
struct rt_list_node rt_list_t
unsigned int rt_uint32_t
signed int rt_int32_t
struct dfs_partition partition
定义 blk.h:68
rt_list_t list
定义 blk.h:70
struct rt_device parent
定义 blk.h:65
struct rt_blk_disk * disk
定义 blk.h:71
rt_size_t sector_start
定义 blk.h:73
rt_size_t sector_count
定义 blk.h:74
rt_err_t(* autorefresh)(struct rt_blk_disk *disk, rt_bool_t is_auto)
定义 blk.h:56
rt_ssize_t(* read)(struct rt_blk_disk *disk, rt_off_t sector, void *buffer, rt_size_t sector_count)
定义 blk.h:49
rt_err_t(* erase)(struct rt_blk_disk *disk)
定义 blk.h:55
rt_err_t(* sync)(struct rt_blk_disk *disk)
定义 blk.h:54
rt_err_t(* control)(struct rt_blk_disk *disk, struct rt_blk_device *blk, int cmd, void *args)
定义 blk.h:57
rt_ssize_t(* write)(struct rt_blk_disk *disk, rt_off_t sector, const void *buffer, rt_size_t sector_count)
定义 blk.h:51
rt_err_t(* getgeome)(struct rt_blk_disk *disk, struct rt_device_blk_geometry *geometry)
定义 blk.h:53
rt_uint32_t parallel_io
定义 blk.h:32
rt_uint32_t read_only
定义 blk.h:31
struct rt_spinlock lock
定义 blk.h:43
rt_uint32_t removable
定义 blk.h:33
rt_int32_t max_partitions
定义 blk.h:40
const struct rt_blk_disk_ops * ops
定义 blk.h:26
struct rt_device parent
定义 blk.h:24
rt_uint32_t partitions
定义 blk.h:37
struct rt_semaphore usr_lock
定义 blk.h:44
rt_uint32_t __magic
定义 blk.h:35
rt_list_t part_nodes
定义 blk.h:41