Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

LinuxÄÚºËÖеÄplatform»úÖÆ


 
LinuxÄÚºËÖеÄplatform»úÖÆ
´ÓLinux 2.6ÆðÒýÈëÁËÒ»Ì×еÄÇý¶¯¹ÜÀíºÍ×¢²á»úÖÆ£ºplatform_deviceºÍplatform_driver¡£LinuxÖд󲿷ֵÄÉ豸Çý¶¯£¬¶¼¿ÉÒÔʹÓÃÕâÌ×»úÖÆ£¬É豸ÓÃplatform_device±íʾ£¬Çý¶¯ÓÃplatform_driver½øÐÐ×¢²á¡£
Linux platform driver»úÖƺʹ«Í³µÄdevice driver »úÖÆ(ͨ¹ýdriver_registerº¯Êý½øÐÐ×¢²á)Ïà±È£¬Ò»¸öÊ®·ÖÃ÷ÏÔµÄÓÅÊÆÔÚÓÚplatform»úÖƽ«É豸±¾ÉíµÄ×ÊÔ´×¢²á½øÄںˣ¬ÓÉÄÚºËͳһ¹ÜÀí£¬ÔÚÇý¶¯³ÌÐòÖÐʹÓÃÕâЩ×ÊԴʱͨ¹ýplatform deviceÌṩµÄ±ê×¼½Ó¿Ú½øÐÐÉêÇ벢ʹÓá£ÕâÑùÌá¸ßÁËÇý¶¯ºÍ×ÊÔ´¹ÜÀíµÄ¶ÀÁ¢ÐÔ£¬²¢ÇÒÓµÓнϺõĿÉÒÆÖ²ÐԺͰ²È«ÐÔ(ÕâЩ±ê×¼½Ó¿ÚÊÇ°²È«µÄ)¡£platform»úÖƵı¾ÉíʹÓò¢²»¸´ÔÓ£¬ÓÉÁ½²¿·Ö×é³É£ºplatform_deviceºÍplatfrom_driver¡£Í¨¹ýplatform»úÖÆ¿ª·¢µ×²ãÉ豸Çý¶¯µÄ´óÖÂÁ÷³ÌÈçͼËùʾ¡£
ͼ platform»úÖÆ¿ª·¢Çý¶¯Á÷³Ì
platform_device½á¹¹ÌåÓÃÀ´ÃèÊöÉ豸µÄÃû³Æ¡¢×ÊÔ´ÐÅÏ¢µÈ¡£¸Ã½á¹¹±»¶¨ÒåÔÚinclude/linux/platform_device.hÖУ¬¶¨ÒåÔ­ÐÍÈçÏ£º
struct platform_device {
const char * name;    //¶¨Òåƽ̨É豸µÄÃû³Æ
int id;
struct device dev;
u32 num_resources;
struct resource * resource; //¶¨Òåƽ̨É豸µÄ×ÊÔ´¡£
};
ÏÂÃæÀ´¿´Ò»ÏÂplatform_device½á¹¹ÌåÖÐ×îÖØÒªµÄÒ»¸ö³ÉÔ±struct resource * resource¡£struct resource±»¶¨ÒåÔÚinclude/linux/ioport.hÖУ¬¶¨ÒåÔ­ÐÍÈçÏ£º
struct resource {
resource_size_t start;  //¶¨Òå×ÊÔ´µÄÆðʼµØÖ·
resource_size_t end;  //¶¨Òå×ÊÔ´µÄ½áÊøµØÖ·
const char *name;    //¶¨Òå×ÊÔ´µÄÃû³Æ
unsigned long flags; //¶¨Òå×ÊÔ´µÄÀàÐÍ£¬±ÈÈçMEM£¬IO£¬IRQ£¬DMAÀàÐÍ
struct resource *parent, *sibling, *child;  //×ÊÔ´Á´±íÖ¸Õë
};
ͨ¹ýµ÷Óú¯Êýplatform_add_devices£¨£©ÏòϵͳÖÐÌí¼Ó¸ÃÉ豸ÁË£¬¸Ãº¯ÊýÄÚ²¿µ÷ÓÃplatform_device_register( )½øÐÐÉ豸ע²á¡£Òª×¢ÒâµÄÊÇ£¬ÕâÀïµÄplatform_deviceÉ豸µÄ×¢²á¹ý³Ì±ØÐëÔÚÏàÓ¦É豸Çý¶¯¼ÓÔØ֮ǰ±»µ÷Ó㬼´Ö´ÐÐplatform_driver_register£¨£©Ö®Ç°£¬Ô­ÒòÊÇÇý¶¯×¢²áʱÐèҪƥÅäÄÚºËÖÐËùÓÐÒÑ×¢²áµÄÉ豸Ãû¡£
½ÓÏÂÀ´À´¿´platform_driver½á¹¹ÌåµÄÔ­ÐͶ¨Ò壬ÔÚinclude


Ïà¹ØÎĵµ£º

ÖпƺìÆ쿪ԴLinux½â¾ö·½°¸

2009Äê12ÔÂ29ÈÕ£¬Ì켫ÍøÖ÷°ìµÄÖ÷ÌâΪ“2010ÄêµÄ»ú»á”µÄÑÐÌֻᣬÔÚÖйشåÓ²Å̾ưɾÙÐС£À´×ÔÖпƺìÆì¡¢°Ë°Ù¿Í¡¢Ê±´úÒÚÐÅ¡¢¹ãͨÐÅ´ï¡¢360°²È«ÎÀÊ¿µÄר¼Ò²Î¼ÓÁËÕâ´Î»î¶¯¡£»áÉÏ£¬¼ÇÕßר·ÃÁËÖпƺìÆìÈí¼þ¼¼Êõ¹«Ë¾²úÆ·Êг¡²¿×ܼཪºì¡£
¡¡
¡¡Ì¸Æ𿪹ú²úÔ´Èí¼þ2009ÄêµÄ±íÏÖ£¬½ªºì½éÉÜ˵£º“LinuxÒѾ­ÈÕÇ÷³ÉÊì£¬Ê ......

ÍõÛóÍƼöµÄһЩLinux¹¤¾ß


Shell: bash¡£Ëü½áºÏÁË csh ºÍ ksh µÄÓŵ㣬²¢ÇÒÓÐ readline ¹¦ÄÜ£¬Äã¿ÉÒÔËæÒâ°ó¶¨×Ô¼ºµÄ¼üÅÌ¡£
±à¼­Æ÷£º VIM, Emacs¡£
³ÌÐò¿ª·¢£º GCC, make, ld, Scheme48, j2sdk, Perl, Python, Tcl/Tk ...
ÂÛÎÄ£¬»ÃµÆ¹¤¾ß£ºLaTeX, ConTeXt
»æͼ¹¤¾ß£ºMetaPost¡£Õâ¸öÓïÑÔÌ«Ç¿ÁË£¬ÒÔÖÁÓÚÎÒÖ»ÓÃËüÁË¡£Äã²»ÊìϤµÄ»°¿ÉÒÔÓÃxfig,dia À´ ......

linux ¶¨Ê±ÈÎÎñ crontab Ïêϸ½âÊÍ

cron ÊÇlinuxµÄÄÚÖ÷þÎñ£¬µ«Ëü²»×Ô¶¯ÆðÀ´£¬¿ÉÒÔÓÃÒÔϵķ½·¨Æô¶¯¡¢¹Ø±ÕÕâ¸ö·þÎñ£º 
ÒýÓÃ: 
/sbin/service crond start //Æô¶¯·þÎñ 
/sbin/service crond stop //¹Ø±Õ·þÎñ 
/sbin/service crond restart //ÖØÆô·þÎñ 
/sbin/service crond reload //ÖØÐÂÔØÈëÅäÖà
//============= ......

Ïê½âLinuxÄÚºË֮˫ÏòÑ­»·Á´±í(ת)

ÕªÒª: ±¾ÎÄÏê½âÁËÄÚºËÖÐÃæÏò¶ÔÏóµÄlist½á¹¹µÄÔ­Àí£¬ÒÔ¼°ÈçºÎÒÔlistΪÄÚǶ¶ÔÏóÀ´¹¹Ôì×Ô¼ºµÄÁ´±í½á¹¹£¬ÈçºÎ´ÓÄÚǶlist¶ÔÏó»ñµÃ×Ô¶¨ÒåµÄ¶ÔÏóÖ¸Õ룻̽ÌÖÁ˸÷ÖÖºê»òÕߺ¯ÊýµÄÏêϸʹÓ÷½·¨¼°ÔõÑùÒÔͨÓÃlist½á¹¹À´²Ù×÷×Ô¶¨Òå¶ÔÏó¡£
¹Ø¼ü×Ö:Ë«ÏòÑ­»·Á´±í£¬list£¬list_entry£¬typeof£¬containerof£¬list_for_each,list_for_each ......

linux c and asm ͬʱʹÓÃ

from: ¡¶×Ô¼º¶¯ÊÖд²Ù×÷ϵͳ¡·
1. ÖжÏÏòÁ¿±í ²é¿´ linux/init/main.c in http://lxr.linux.no/#linux+v2.6.32/init/main.c
2.
; [root@XXX XXX]# nasm -f elf foo.asm -o foo.o
; [root@XXX XXX]# gcc -c bar.c -o bar.o
; [root@XXX XXX]# ld -s foo.o bar.o -o foobar
; [root@XXX XXX]# ./foobar
; the 2nd on ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ