设为首页 加入收藏

TOP

2. [mmc subsystem] mmc core数据结构和宏定义说明(一)
2019-08-27 07:19:47 】 浏览:123
Tags:mmc subsystem core 数据结构 定义 说明

一、host相关

1、struct mmc_host

struct mmc_host是mmc core由host controller抽象出来的结构体,用于代表一个mmc host控制器。

  • 数据结构如下:
struct mmc_host {
    struct device       *parent;   // 对应的host controller的device
    struct device       class_dev;   // mmc_host的device结构体,会挂在class/mmc_host下
    int         index;   // 该host的索引号
    const struct mmc_host_ops *ops; // 该host的操作集,由host controller设置,后面说明
    unsigned int        f_min;   // 该host支持的最低频率
    unsigned int        f_max;   // 该host支持的最大频率
    unsigned int        f_init;   // 该host使用的初始化频率
    u32         ocr_avail;   // 该host可用的ocr值(电压相关)
    u32         ocr_avail_sdio; /* SDIO-specific OCR */
    u32         ocr_avail_sd;   /* SD-specific OCR */
    u32         ocr_avail_mmc;  /* MMC-specific OCR */
    struct notifier_block   pm_notify;
    u32         max_current_330;   // 3.3V时的最大电流
    u32         max_current_300;   // 3.0V时的最大电流
    u32         max_current_180;   // 1.8V时的最大电流
    u32         caps;       /* Host capabilities */   // host属性
    u32         caps2;      /* More host capabilities */   // host属性2
    mmc_pm_flag_t       pm_caps;    /* supported pm features */   // 电源管理属性

        /////////////////////////////////////////////////////// 以下是和clock相关的成员
    int         clk_requests;   /* internal reference counter */
    unsigned int        clk_delay;  /* number of MCI clk hold cycles */
    bool            clk_gated;  /* clock gated */
    struct delayed_work clk_gate_work; /* delayed clock gate */
    unsigned int        clk_old;    /* old clock value cache */
    spinlock_t      clk_lock;   /* lock for clk fields */
    struct mutex        clk_gate_mutex; /* mutex for clock gating */
    struct device_attribute clkgate_delay_attr;
    unsigned long           clkgate_delay;

    /* host specific block data */   
        ////////////////////////////////////////////////////// 和块相关的成员
    unsigned int        max_seg_size;   /* see blk_queue_max_segment_size */
    unsigned short      max_segs;   /* see blk_queue_max_segments */
    unsigned short      unused;
    unsigned int        max_req_size;   /* maximum number of bytes in one req */
    unsigned int        max_blk_size;   /* maximum size of one mmc block */
    unsigned int        max_blk_count;  /* maximum number of blocks in one req */
    unsigned int        max_discard_to; /* max. discard timeout in ms */

    /* private data */
    spinlock_t      lock;       /* lock for claim and bus ops */   // host的bus使用的锁
    struct mmc_ios      ios;        /* current io bus settings */   // io setting,后续说明
    u32         ocr;        /* the current OCR setting */   // 当前使用的ocr的值

    /* group bitfields together to minimize padding */
    unsigned int        use_spi_crc:1;
    unsigned int        claimed:1;  /* host exclusively claimed */   // host是否已经被占用
    unsigned int        bus_dead:1; /* bus has been released */   // host的bus是否处于激活状态

    int         rescan_disable; /* disable card detection */   // 禁止rescan的标识,禁止搜索card
    int         rescan_entered; /* used with nonremovable devices */   // 是否已经rescan过的标识,对应不可移除的设备只能rescan一次

    struct mmc_card     *card;      /* device attached to this host */   // 和该host绑定在一起的card

    wait_queue_head_t   wq;
    struct task_struct  *claimer;   /* task that has host claimed */   // 该host的占有者进程
    struct task_struct  *suspend_task;
    int         claim_cnt;  /* "claim" nesting count */   // 占有者进程对该host的占用计数

    struct delayed_work detect;   // 检测卡槽变化的工作
    struct wake_lock    detect_wake_lock;   // 检测卡槽变化的工作使用的锁
    const char      *wlock_name;   // 锁名称
    int         detect_change;  /* card detect flag */ // 需要检测卡槽变化的标识
    struct mmc_slot     slot;   // 卡槽的结构体

    const struct mmc_bus_ops *bus_ops;  /* current bus driver */   // host的mmc总线的操作集,后面说明
    unsigned int        bus_refs;   /* reference counter */   // host的mmc总线的使用计数
    unsigned int        bus_resume_flags;   // host的mmc总线的resume标识

    mmc_pm_flag_t       pm_flags;   /* requested pm features */

#ifdef CONFIG_REGULATOR
    bool            regulator_enabled; /* regulator state */   // 代表regulator(LDO)的状态
#endif
    struct mmc_
首页 上一页 1 2 3 4 5 6 下一页 尾页 1/6/6
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇6. [mmc subsystem] mmc core(第.. 下一篇STM32学习笔记(二):GPIO口工作..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目