×ðÁú¿­Ê±

ÔõÑùʹÓÃLinux DTSÓÅ»¯ÏµÍ³ÐÔÄÜ £¿

ÎÊÌ⣺ÔõÑùʹÓÃLinux DTSÓÅ»¯ÏµÍ³ÐÔÄÜ £¿

ÔÚLinuxϵͳÖУ¬×°±¸Ê÷Ô´£¨Device Tree Source£¬DTS£©±»ÆÕ±éÓÃÓÚÐÎòӲ¼þ×°±¸µÄÐÅÏ¢£¬°üÀ¨ÍâÉè¡¢×ÜÏߺÍÖÐÖ¹µÈ¡£Í¨¹ý¶ÔDTSµÄÓÅ»¯£¬¿ÉÒÔÌá¸ßϵͳÐÔÄܺ͹¦ºÄЧÂÊ¡£±¾ÎĽ«ÏÈÈÝÔõÑùʹÓÃLinux DTS¾ÙÐÐÓÅ»¯£¬²¢ÌṩһЩÏêϸµÄ´úÂëʾÀý¡£

Ò»¡¢Ã÷È·DTS

DTSÊÇÒ»ÖÖÐÎòӲ¼þ×°±¸ÐÅÏ¢µÄÊý¾Ý½á¹¹£¬Í¨³£ÒÔ.dts»òÕß.dtsi×÷ΪÎļþÀ©Õ¹Ãû¡£ËüÐÎòÁËÓ²¼þ×°±¸µÄÎïÀíÅþÁ¬ºÍÊôÐÔÐÅÏ¢£¬°üÀ¨×°±¸µÄÃû³Æ¡¢µØµã¡¢¼Ä´æÆ÷ÉèÖõÈ¡£Ê¹ÓÃDTSµÄÀûÒæÊÇ¿ÉÒÔ½«Ó²¼þÐÎòÓëÄں˴úÂëÍÑÀ룬¸üÈÝÒ×Ã÷È·ºÍά»¤¡£

¶þ¡¢ÓÅ»¯DTSÒÔÌáÉýϵͳÐÔÄÜ

ºÏ²¢×°±¸½Úµã£º½«¶à¸öÏàËƵÄ×°±¸½ÚµãºÏ²¢ÎªÒ»¸ö½Úµã£¬¿ÉÒÔïÔÌ­DTSµÄ¾ÞϸϢÕùÎöʱ¼ä£¬Ìá¸ßϵͳÆô¶¯µÄЧÂÊ¡£ÀýÈ磬½«ÏàͬÐͺŵĴ«¸ÐÆ÷ºÏ²¢ÎªÒ»¸ö½Úµã¡£

ʾÀý´úÂ룺

sensor@100 {
    compatible = "vendor,sensor-a";
    reg = <0x100>;
    ...
};

sensor@200 {
    compatible = "vendor,sensor-a";
    reg = <0x200>;
    ...
};

µÇ¼ºó¸´ÖÆ

ºÏ²¢ºó£º

sensor@100 {
    compatible = "vendor,sensor-a";
    reg = <0x100 0x200>;
    ...
};

µÇ¼ºó¸´ÖÆ

ʹÓÃ×Ö·û´®ÊôÐÔ£º×èÖ¹ÔÚ×°±¸½ÚµãÖÐʹÓôó×ÚÊý×ÖÊôÐÔ£¬¿ÉÒÔʹÓÃ×Ö·û´®ÊôÐÔÀ´È¡´ú£¬¸üÒ׶ÁÇÒÀû±ãά»¤¡£

ʾÀý´úÂ룺

gpio-controller {
    #gpio-cells = <2>;
    gpio-controller,gpios = <&gpio1 18 GPIO_ACTIVE_LOW>,
                            <&gpio2 13 GPIO_ACTIVE_HIGH>;
};

µÇ¼ºó¸´ÖÆ

ˢкó£º

gpio-controller {
    gpio-cells = <2>;
    gpio-controller,pins = "gpio1_18", "gpio2_13";
};

µÇ¼ºó¸´ÖÆ

×èÖ¹Öظ´ÐÎòӲ¼þÐÅÏ¢£ºÔÚDTSÖÐÖ»¹Ü×èÖ¹ÔÚ²î±ð½ÚµãÖÐÖظ´ÐÎòÏàͬµÄÓ²¼þÐÅÏ¢£¬¿ÉÒÔ½«¹²ÏíµÄÐÅÏ¢ÌáÈ¡µ½Ò»¸ö¹«¹²½ÚµãÖС£

ʾÀý´úÂ룺

spi@1234 {
    compatible = "vendor,spi";
    ...
};

i2c@5678 {
    compatible = "vendor,i2c";
    ...
};

cs-gpio {
    compatible = "vendor,gpio";
    gpio-controller;
    #gpio-cells = <2>;
    ...
};

µÇ¼ºó¸´ÖÆ

ˢкó£º

gpio-controller {
    gpio-cells = <2>;
    ...
};

spi@1234 {
    compatible = "vendor,spi";
    ...
    cs-gpios = <&gpio-controller 1 2>;
};

i2c@5678 {
    compatible = "vendor,i2c";
    ...
    sda-gpios = <&gpio-controller 3>;
    scl-gpios = <&gpio-controller 4>;
};

µÇ¼ºó¸´ÖÆ

ʹÓÃincludeÓï¾ä£º½«Ò»Ð©¹«¹²µÄÓ²¼þÐÎòÐÅÏ¢´æ´¢ÔÚµ¥¶ÀµÄÎļþÖУ¬²¢Í¨¹ýincludeÓï¾äÒýÈ룬¿ÉÒÔÌá¸ß´úÂëµÄ¿É¶ÁÐÔºÍά»¤ÐÔ¡£

ʾÀý´úÂ룺

common.dtsi£º

/include/ "common.dtsi"

mcu: microcontroller {
    compatible = "vendor,mcu";
    ...
};

µÇ¼ºó¸´ÖÆ

board.dts£º

#include "common.dtsi"

board: mainboard {
    compatible = "vendor,board";
    ...
};

µÇ¼ºó¸´ÖÆ

ÓÅÒì×¢ÊÍ£ºÔÚDTSÖÐÌí¼ÓÏêϸºÍÇåÎúµÄ×¢ÊÍ£¬Àû±ãÔĶÁºÍÃ÷È·Ó²¼þÐÅÏ¢£¬×èÖ¹»ìÏýºÍ¹ýʧ¡£

ͨ¹ýÒÔÉÏÓÅ»¯ÒªÁ죬¿ÉÒÔÌá¸ßϵͳÐÔÄܺͽµµÍ¹¦ºÄÏûºÄ£¬Í¬Ê±Ê¹´úÂë¸üÒ×ά»¤ºÍÀ©Õ¹¡£

×ܽá

ͨ¹ý¶ÔLinux DTS¾ÙÐÐÓÅ»¯£¬¿ÉÒÔÌá¸ßϵͳÐÔÄܺͽµµÍ¹¦ºÄÏûºÄ¡£ÓÅ»¯µÄÒªº¦ÊǺϲ¢×°±¸½Úµã¡¢Ê¹ÓÃ×Ö·û´®ÊôÐÔ¡¢×èÖ¹Öظ´ÐÎòӲ¼þÐÅÏ¢¡¢Ê¹ÓÃincludeÓï¾äºÍÌí¼ÓÓÅÒì×¢ÊÍ¡£ÕâЩÓÅ»¯ÒªÁì²»µ«Ìá¸ßÁËϵͳЧÂÊ£¬Ò²ÔöÌíÁË´úÂëµÄ¿É¶ÁÐԺͿÉά»¤ÐÔ£¬ÓÐÀûÓÚϵͳµÄÎȹÌÔËÐкͿª·¢Î¬»¤¡£

Ï£Íû±¾ÎÄ¿ÉÒÔ×ÊÖú¶ÁÕ߸üºÃµØÃ÷È·²¢Ê¹ÓÃLinux DTS¾ÙÐÐϵͳÐÔÄÜÓÅ»¯£¬ÌáÉýϵͳµÄÕûÌåÐÔÄܺÍÓû§ÌåÑé¡£

ÒÔÉϾÍÊÇÔõÑùʹÓÃLinux DTSÓÅ»¯ÏµÍ³ÐÔÄÜ £¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿