女友小芸被教练猛烈进出视频 ,欧美videosdesexo吹潮,敌伦交换一区二区三区,CHINESEFREE高潮抽搐

二維碼
微世推網(wǎng)

掃一掃關(guān)注

當(dāng)前位置: 首頁 » 快聞?lì)^條 » 科技資訊 » 正文

Linux內(nèi)核中斷之獲取中斷號(hào)

放大字體  縮小字體 發(fā)布日期:2022-02-25 22:01:42    作者:田世偉    瀏覽次數(shù):708
導(dǎo)讀

Linux內(nèi)核中可使用platform_get_irq()函數(shù)獲取dts文件中設(shè)置得中斷號(hào)。函數(shù)原型:int platform_get_irq(struct platform_device *dev, unsigned int num)定義文件:drivers\\base\\platform.c一、調(diào)用流程中斷號(hào)獲取函

Linux內(nèi)核中可使用platform_get_irq()函數(shù)獲取dts文件中設(shè)置得中斷號(hào)。

函數(shù)原型:int platform_get_irq(struct platform_device *dev, unsigned int num)

定義文件:drivers\base\platform.c

一、調(diào)用流程

中斷號(hào)獲取函數(shù)platform_get_irq()調(diào)用流程如下:

platform_get_irq()-> of_irq_get()-> of_irq_parse_one() ## 解析dts中中斷相關(guān)屬性,填充結(jié)構(gòu)體of_phandle_args中得args[]參數(shù) irq_create_of_mapping()-> of_phandle_args_to_fwspec() ## 將of_phandle_args->args[]賦值給fwspec->param[],給translate使用 irq_create_fwspec_mapping()-> irq_domain_translate()-> ## 獲取中斷號(hào)和中斷觸發(fā)類型 translate()-> ## 對(duì)應(yīng)某個(gè)版本得gic處理函數(shù)

rk3399使用得是GICv3,對(duì)應(yīng)irq_domain->name。

文件:drivers/irqchip/irq-gic-v3.c。

translate()函數(shù)實(shí)現(xiàn)如下:

static const struct irq_domain_ops gic_irq_domain_ops = { .translate = gic_irq_domain_translate, ## .translate得實(shí)現(xiàn)函數(shù) ...};static int gic_irq_domain_translate(struct irq_domain *d, struct irq_fwspec *fwspec, unsigned long *hwirq, unsigned int *type){ ... switch (fwspec->param[0]) { case 0: *hwirq = fwspec->param[1] + 32; ## 中斷號(hào) break; case 1: *hwirq = fwspec->param[1] + 16; ## 中斷號(hào) break; case GIC_IRQ_TYPE_LPI: *hwirq = fwspec->param[1]; ## 中斷號(hào) break; default: return -EINVAL; } *type = fwspec->param[2] & IRQ_TYPE_SENSE_MASK; ## 中斷觸發(fā)類型 ...}二、應(yīng)用舉例

以RockPI 4A單板Debian系統(tǒng)Linux 4.4內(nèi)核中得獲取HDMI中斷號(hào)為例。

1、查找中斷號(hào)

從手冊(cè)“Rockchip RK3399 TRM V1.3 Part1.pdf”中,可以查到HDMI_IRQ中斷號(hào),即55。

RK3399 中斷

2、dts配置

文件:arch/arm64/boot/dts/rockchip/rk3399.dtsi

hdmi: hdmi等ff940000 { compatible = "rockchip,rk3399-dw-hdmi"; ... interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH 0>; ... }

hdmi使用得是GIC_SPI中斷,按照gic_irq_domain_translate()函數(shù)中處理,需要將中斷號(hào)55減去32,得到dts中得中斷號(hào)23。

注:interrupts = <中斷類型 中斷號(hào) 中斷觸發(fā)類型 中斷分區(qū)(對(duì)應(yīng)哪個(gè)CPU cluster,PPI類型中斷特有)>

3、驅(qū)動(dòng)函數(shù)

文件:drivers\gpu\drm\rockchip\dw_hdmi-rockchip.c

static int dw_hdmi_rockchip_bind(struct device *dev, struct device *master, void *data){ ... irq = platform_get_irq(pdev, 0); ...}

此時(shí),irq返回值為55。

后續(xù)會(huì)介紹GIC和中斷注冊(cè)等實(shí)現(xiàn)函數(shù)。

 
(文/田世偉)
免責(zé)聲明
本文僅代表發(fā)布者:田世偉個(gè)人觀點(diǎn),本站未對(duì)其內(nèi)容進(jìn)行核實(shí),請(qǐng)讀者僅做參考,如若文中涉及有違公德、觸犯法律的內(nèi)容,一經(jīng)發(fā)現(xiàn),立即刪除,需自行承擔(dān)相應(yīng)責(zé)任。涉及到版權(quán)或其他問題,請(qǐng)及時(shí)聯(lián)系我們刪除處理郵件:weilaitui@qq.com。
 

Copyright?2015-2025 粵公網(wǎng)安備 44030702000869號(hào)

粵ICP備16078936號(hào)

微信

關(guān)注
微信

微信二維碼

WAP二維碼

客服

聯(lián)系
客服

聯(lián)系客服:

24在線QQ: 770665880

客服電話: 020-82301567

E_mail郵箱: weilaitui@qq.com

微信公眾號(hào): weishitui

韓瑞 小英 張澤

工作時(shí)間:

周一至周五: 08:00 - 24:00

反饋

用戶
反饋