欧美性猛交xxxx免费看_牛牛在线视频国产免费_天堂草原电视剧在线观看免费_国产粉嫩高清在线观看_国产欧美日本亚洲精品一5区

0
  • 聊天消息
  • 系統(tǒng)消息
  • 評(píng)論與回復(fù)
登錄后你可以
  • 下載海量資料
  • 學(xué)習(xí)在線課程
  • 觀看技術(shù)視頻
  • 寫(xiě)文章/發(fā)帖/加入社區(qū)
會(huì)員中心
創(chuàng)作中心

完善資料讓更多小伙伴認(rèn)識(shí)你,還能領(lǐng)取20積分哦,立即完善>

3天內(nèi)不再提示

Linux clock子系統(tǒng)是什么

麥辣雞腿堡 ? 來(lái)源:嵌入式Linux充電站 ? 作者:Vincent ? 2023-09-27 14:25 ? 次閱讀

clock子系統(tǒng)

Linux時(shí)鐘子系統(tǒng)由CCF(common clock framework)框架管理, CCF向上給用戶提供了通用的時(shí)鐘接口,向下給驅(qū)動(dòng)開(kāi)發(fā)者提供硬件操作的接口 。各結(jié)構(gòu)體關(guān)系如下:

CCF框架比較簡(jiǎn)單,只有這幾個(gè)結(jié)構(gòu)體。CCF框架分為了consumer、ccf和provider三部分。

consumer

時(shí)鐘的使用者,clock子系統(tǒng)向consumer的提供通用的時(shí)鐘API接口,使其可以屏蔽底層硬件差異。提供給consumer操作的API如下:

struct clk *clk_get(struct device *dev, const char *id);
struct clk *devm_clk_get(struct device *dev, const char *id);
int clk_enable(struct clk *clk);//使能時(shí)鐘,不會(huì)睡眠
void clk_disable(struct clk *clk);//使能時(shí)鐘,不會(huì)睡眠
unsigned long clk_get_rate(struct clk *clk);
void clk_put(struct clk *clk);
long clk_round_rate(struct clk *clk, unsigned long rate);
int clk_set_rate(struct clk *clk, unsigned long rate);
int clk_set_parent(struct clk *clk, struct clk *parent);
struct clk *clk_get_parent(struct clk *clk);
int clk_prepare(struct clk *clk);
void clk_unprepare(struct clk *clk);
int clk_prepare_enable(struct clk *clk) //使能時(shí)鐘,可能會(huì)睡眠
void clk_disable_unprepare(struct clk *clk) //禁止時(shí)鐘,可能會(huì)睡眠
unsigned long clk_get_rate(struct clk *clk) //獲取時(shí)鐘頻率

consumer在使用這些API時(shí),必須先調(diào)用devm_clk_get()clk_get()獲取一個(gè)struct clk *指針句柄,后續(xù)都通過(guò)傳入該句柄來(lái)操作,struct clk相當(dāng)于實(shí)例化一個(gè)時(shí)鐘。

ccf

clock子系統(tǒng)的核心,用一個(gè)struct clk_core結(jié)構(gòu)體表示,每個(gè)注冊(cè)設(shè)備都對(duì)應(yīng)一個(gè)struct clk_core。

provider(時(shí)鐘的提供者)

struct clk_hw:表示一個(gè)具體的硬件時(shí)鐘。

struct clk_init_data:struct clk_hw結(jié)構(gòu)體成員,用于表示該時(shí)鐘下的初始化數(shù)據(jù),如時(shí)鐘名字name、操作函數(shù)ops等。

// include/linux/clk-provider.h
struct clk_hw{
 struct clk_core *core;
 struct clk *clk;
 const struct clk_init_data *init;
}

struct clk_init_data{
 const char *name;     //時(shí)鐘名字
 const struct clk_ops *ops;   //時(shí)鐘硬件操作函數(shù)集合
 const char *const *parent_names; //父時(shí)鐘名字
 const struct clk_parent_data *parent_data;
 const struct clk_hw **parent_hws;
 u8 num_parents;
 unsigned long flags;
}

struct clk_ops:時(shí)鐘硬件操作的函數(shù)集合,定義了操作硬件的回調(diào)函數(shù),consumer在調(diào)用clk_set_rate()等API時(shí)會(huì)調(diào)用到struct clk_ops具體指向的函數(shù),這個(gè)需要芯片廠商開(kāi)發(fā)clock驅(qū)動(dòng)時(shí)去實(shí)現(xiàn)。

//include/linux/clk-provider.h

struct clk_ops {
 int  (*prepare)(struct clk_hw *hw);
 void  (*unprepare)(struct clk_hw *hw);
 int  (*is_prepared)(struct clk_hw *hw);
 void  (*unprepare_unused)(struct clk_hw *hw);
 int  (*enable)(struct clk_hw *hw);
 void  (*disable)(struct clk_hw *hw);
 int  (*is_enabled)(struct clk_hw *hw);
 void  (*disable_unused)(struct clk_hw *hw);
 int  (*save_context)(struct clk_hw *hw);
 void  (*restore_context)(struct clk_hw *hw);
 unsigned long (*recalc_rate)(struct clk_hw *hw,
     unsigned long parent_rate);
 long  (*round_rate)(struct clk_hw *hw, unsigned long rate,
     unsigned long *parent_rate);
 int  (*determine_rate)(struct clk_hw *hw,
       struct clk_rate_request *req);
 int  (*set_parent)(struct clk_hw *hw, u8 index);
 u8  (*get_parent)(struct clk_hw *hw);
 int  (*set_rate)(struct clk_hw *hw, unsigned long rate,
        unsigned long parent_rate);
 int  (*set_rate_and_parent)(struct clk_hw *hw,
        unsigned long rate,
        unsigned long parent_rate, u8 index);
 unsigned long (*recalc_accuracy)(struct clk_hw *hw,
        unsigned long parent_accuracy);
 int  (*get_phase)(struct clk_hw *hw);
 int  (*set_phase)(struct clk_hw *hw, int degrees);
 int  (*get_duty_cycle)(struct clk_hw *hw,
       struct clk_duty *duty);
 int  (*set_duty_cycle)(struct clk_hw *hw,
       struct clk_duty *duty);
 int  (*init)(struct clk_hw *hw);
 void  (*terminate)(struct clk_hw *hw);
 void  (*debug_init)(struct clk_hw *hw, struct dentry *dentry);
};

struct clk_ops中每個(gè)函數(shù)功能在include/linux/clk-provider.h都有具體的說(shuō)明,在開(kāi)發(fā)clock驅(qū)動(dòng)時(shí),這些函數(shù)并不需要全部實(shí)現(xiàn)。

聲明:本文內(nèi)容及配圖由入駐作者撰寫(xiě)或者入駐合作網(wǎng)站授權(quán)轉(zhuǎn)載。文章觀點(diǎn)僅代表作者本人,不代表電子發(fā)燒友網(wǎng)立場(chǎng)。文章及其配圖僅供工程師學(xué)習(xí)之用,如有內(nèi)容侵權(quán)或者其他違規(guī)問(wèn)題,請(qǐng)聯(lián)系本站處理。 舉報(bào)投訴
  • 接口
    +關(guān)注

    關(guān)注

    33

    文章

    8706

    瀏覽量

    151987
  • Linux
    +關(guān)注

    關(guān)注

    87

    文章

    11350

    瀏覽量

    210476
  • 子系統(tǒng)
    +關(guān)注

    關(guān)注

    0

    文章

    110

    瀏覽量

    12462
收藏 人收藏

    評(píng)論

    相關(guān)推薦

    Linux下輸入子系統(tǒng)上報(bào)觸摸屏坐標(biāo)

    ??在 Linux 中,輸入子系統(tǒng)是由輸入子系統(tǒng)設(shè)備驅(qū)動(dòng)層、輸入子系統(tǒng)核心層(Input Core)和輸入子系統(tǒng)事件處理層(Event Ha
    的頭像 發(fā)表于 09-25 08:56 ?2555次閱讀
    <b class='flag-5'>Linux</b>下輸入<b class='flag-5'>子系統(tǒng)</b>上報(bào)觸摸屏坐標(biāo)

    Linux clock子系統(tǒng)及驅(qū)動(dòng)實(shí)例

    Linux驅(qū)動(dòng)中,操作時(shí)鐘只需要簡(jiǎn)單調(diào)用內(nèi)核提供的通用接口即可,clock驅(qū)動(dòng)通常是由芯片廠商開(kāi)發(fā)的,在Linux啟動(dòng)時(shí)clock驅(qū)動(dòng)就已經(jīng)初始化完成。
    發(fā)表于 05-31 16:10 ?914次閱讀
    <b class='flag-5'>Linux</b> <b class='flag-5'>clock</b><b class='flag-5'>子系統(tǒng)</b>及驅(qū)動(dòng)實(shí)例

    Linux reset子系統(tǒng)及驅(qū)動(dòng)實(shí)例

    上篇講了Linux clock驅(qū)動(dòng),今天說(shuō)說(shuō)Linux的reset驅(qū)動(dòng)。
    發(fā)表于 05-31 16:16 ?1219次閱讀
    <b class='flag-5'>Linux</b> reset<b class='flag-5'>子系統(tǒng)</b>及驅(qū)動(dòng)實(shí)例

    Linux LED子系統(tǒng)詳解

    Linux LED子系統(tǒng)詳解
    的頭像 發(fā)表于 06-10 10:37 ?1594次閱讀
    <b class='flag-5'>Linux</b> LED<b class='flag-5'>子系統(tǒng)</b>詳解

    如何使用Linux內(nèi)核中的input子系統(tǒng)

    的 input 子系統(tǒng)下提供的 API 函數(shù)接口,完成設(shè)備的注冊(cè)即可。在本章節(jié)中我們來(lái)學(xué)習(xí)一下如何使用 Linux內(nèi)核中的 input 子系統(tǒng)。
    發(fā)表于 12-29 07:20

    基于Linux內(nèi)核輸入子系統(tǒng)的驅(qū)動(dòng)研究

    Linux因其完全開(kāi)放的特性和穩(wěn)定優(yōu)良的性能深受歡迎,當(dāng)推出了內(nèi)核輸入子系統(tǒng)后,更方便了嵌入式領(lǐng)域的驅(qū)動(dòng)開(kāi)放。介紹了Linux的設(shè)備驅(qū)動(dòng)基礎(chǔ),詳細(xì)闡述了基于Linux內(nèi)核輸入
    發(fā)表于 09-12 16:38 ?23次下載

    Linux內(nèi)核輸入子系統(tǒng)的驅(qū)動(dòng)研究

    Linux內(nèi)核輸入子系統(tǒng)的驅(qū)動(dòng)研究
    發(fā)表于 10-31 14:41 ?14次下載
    <b class='flag-5'>Linux</b>內(nèi)核輸入<b class='flag-5'>子系統(tǒng)</b>的驅(qū)動(dòng)研究

    Linux時(shí)間子系統(tǒng)之一:clock source(時(shí)鐘源)

    clock source用于為linux內(nèi)核提供一個(gè)時(shí)間基線,如果你用linux的date命令獲取當(dāng)前時(shí)間,內(nèi)核會(huì)讀取當(dāng)前的clock source,轉(zhuǎn)換并返回合適的時(shí)間單位給用戶空間
    發(fā)表于 05-10 14:36 ?2012次閱讀

    詳細(xì)了解Linux設(shè)備模型中的input子系統(tǒng)

    linux輸入子系統(tǒng)linux input subsystem)從上到下由三層實(shí)現(xiàn),分別為:輸入子系統(tǒng)事件處理層(EventHandler)、輸入
    發(fā)表于 05-12 09:04 ?1072次閱讀
    詳細(xì)了解<b class='flag-5'>Linux</b>設(shè)備模型中的input<b class='flag-5'>子系統(tǒng)</b>

    Windows 子系統(tǒng)助力 Linux 2.0

    Windows 子系統(tǒng)助力 Linux 2.0
    的頭像 發(fā)表于 01-04 11:17 ?697次閱讀

    Linux系統(tǒng)中NFC子系統(tǒng)架構(gòu)分析

    目前在Linux系統(tǒng)中,每個(gè)廠家都使用不同的方式實(shí)現(xiàn)NFC驅(qū)動(dòng),然后自己在應(yīng)用層上面做適配。但是Linux也已經(jīng)推出NFC子系統(tǒng),很多廠家也逐步在統(tǒng)一。
    發(fā)表于 01-04 14:01 ?2168次閱讀

    PTP Clock Manager for Linux Message Log 手冊(cè)

    PTP Clock Manager for Linux Message Log 手冊(cè)
    發(fā)表于 01-30 18:55 ?0次下載
    PTP <b class='flag-5'>Clock</b> Manager for <b class='flag-5'>Linux</b> Message Log 手冊(cè)

    PTP Clock Manager for Linux Message Log 手冊(cè)

    PTP Clock Manager for Linux Message Log 手冊(cè)
    發(fā)表于 07-03 20:29 ?2次下載
    PTP <b class='flag-5'>Clock</b> Manager for <b class='flag-5'>Linux</b> Message Log 手冊(cè)

    Linux reset子系統(tǒng)有什么功能

    Linux reset子系統(tǒng) reset子系統(tǒng)非常簡(jiǎn)單,與clock子系統(tǒng)非常類似,但在驅(qū)動(dòng)實(shí)現(xiàn)上,reset驅(qū)動(dòng)更簡(jiǎn)單。 因?yàn)?/div>
    的頭像 發(fā)表于 09-27 14:06 ?814次閱讀
    <b class='flag-5'>Linux</b> reset<b class='flag-5'>子系統(tǒng)</b>有什么功能

    時(shí)鐘子系統(tǒng)clock驅(qū)動(dòng)實(shí)例

    clock驅(qū)動(dòng)實(shí)例 clock驅(qū)動(dòng)在時(shí)鐘子系統(tǒng)中屬于provider,provider是時(shí)鐘的提供者,即具體的clock驅(qū)動(dòng)。 clock驅(qū)
    的頭像 發(fā)表于 09-27 14:39 ?861次閱讀
    時(shí)鐘<b class='flag-5'>子系統(tǒng)</b>中<b class='flag-5'>clock</b>驅(qū)動(dòng)實(shí)例