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

LinuxÄں˵Äͬ²½»úÖÆ

Ò»¡¢ÒýÑÔ
ÔÚÏÖ´ú²Ù×÷ϵͳÀͬһʱ¼ä¿ÉÄÜÓжà¸öÄÚºËÖ´ÐÐÁ÷ÔÚÖ´ÐУ¬Òò´ËÄÚºËÆäʵÏó¶à½ø³Ì¶àÏ̱߳à³ÌÒ»ÑùÒ²ÐèҪһЩͬ²½»úÖÆÀ´Í¬²½¸÷Ö´Ðе¥Ôª¶Ô¹²ÏíÊý¾ÝµÄ·ÃÎÊ¡£ÓÈÆäÊÇÔڶദÀíÆ÷ϵͳÉÏ£¬¸üÐèҪһЩͬ²½»úÖÆÀ´Í¬²½²»Í¬´¦ÀíÆ÷ÉϵÄÖ´Ðе¥Ôª¶Ô¹²ÏíµÄÊý¾ÝµÄ·ÃÎÊ¡£
ÔÚÖ÷Á÷µÄLinuxÄÚºËÖаüº¬Á˼¸ºõËùÓÐÏÖ´úµÄ²Ù×÷ϵͳ¾ßÓеÄͬ²½»úÖÆ£¬ÕâЩͬ²½»úÖÆ°üÀ¨£ºÔ­×Ó²Ù×÷¡¢ÐźÅÁ¿£¨semaphore£©¡¢¶ÁдÐźÅÁ¿£¨rw_semaphore£©¡¢spinlock¡¢BKL(Big Kernel Lock)¡¢rwlock¡¢brlock£¨Ö»°üº¬ÔÚ2.4ÄÚºËÖУ©¡¢RCU£¨Ö»°üº¬ÔÚ2.6ÄÚºËÖУ©ºÍseqlock£¨Ö»°üº¬ÔÚ2.6ÄÚºËÖУ©¡£
¶þ¡¢Ô­×Ó²Ù×÷
Ëùνԭ×Ó²Ù×÷£¬¾ÍÊǸòÙ×÷¾ø²»»áÔÚÖ´ÐÐÍê±ÏÇ°±»ÈκÎÆäËûÈÎÎñ»òʼþ´ò¶Ï£¬Ò²¾Í˵£¬ËüµÄ×îСµÄÖ´Ðе¥Î»£¬²»¿ÉÄÜÓбÈËü¸üСµÄÖ´Ðе¥Î»£¬Òò´ËÕâÀïµÄÔ­×Óʵ¼ÊÊÇʹÓÃÁËÎïÀíѧÀïµÄÎïÖÊ΢Á£µÄ¸ÅÄî¡£
Ô­×Ó²Ù×÷ÐèÒªÓ²¼þµÄÖ§³Ö£¬Òò´ËÊǼܹ¹Ïà¹ØµÄ£¬ÆäAPIºÍÔ­×ÓÀàÐ͵Ķ¨Ò嶼¶¨ÒåÔÚÄÚºËÔ´ÂëÊ÷µÄinclude/asm/atomic.hÎļþÖУ¬ËüÃǶ¼Ê¹Óûã±àÓïÑÔʵÏÖ£¬ÒòΪCÓïÑÔ²¢²»ÄÜʵÏÖÕâÑùµÄ²Ù×÷¡£
Ô­×Ó²Ù×÷Ö÷ÒªÓÃÓÚʵÏÖ×ÊÔ´¼ÆÊý£¬ºÜ¶àÒýÓüÆÊý(refcnt)¾ÍÊÇͨ¹ýÔ­×Ó²Ù×÷ʵÏֵġ£Ô­×ÓÀàÐͶ¨ÒåÈçÏ£º
typedef struct { volatile int counter; } atomic_t;
volatileÐÞÊÎ×ֶθæËßgcc²»Òª¶Ô¸ÃÀàÐ͵ÄÊý¾Ý×öÓÅ»¯´¦Àí£¬¶ÔËüµÄ·ÃÎʶ¼ÊǶÔÄÚ´æµÄ·ÃÎÊ£¬¶ø²»ÊǶԼĴæÆ÷µÄ·ÃÎÊ¡£
Ô­×Ó²Ù×÷API°üÀ¨£º
atomic_read(atomic_t * v);
¸Ãº¯Êý¶ÔÔ­×ÓÀàÐ͵ıäÁ¿½øÐÐÔ­×Ó¶Á²Ù×÷£¬Ëü·µ»ØÔ­×ÓÀàÐ͵ıäÁ¿vµÄÖµ¡£
atomic_set(atomic_t * v, int i);
¸Ãº¯ÊýÉèÖÃÔ­×ÓÀàÐ͵ıäÁ¿vµÄֵΪi¡£
void atomic_add(int i, atomic_t *v);
¸Ãº¯Êý¸øÔ­×ÓÀàÐ͵ıäÁ¿vÔö¼ÓÖµi¡£
atomic_sub(int i, atomic_t *v);
¸Ãº¯Êý´ÓÔ­×ÓÀàÐ͵ıäÁ¿vÖмõÈ¥i¡£
int atomic_sub_and_test(int i, atomic_t *v);
¸Ãº¯Êý´ÓÔ­×ÓÀàÐ͵ıäÁ¿vÖмõÈ¥i£¬²¢ÅжϽá¹ûÊÇ·ñΪ0£¬Èç¹ûΪ0£¬·µ»ØÕ棬·ñÔò·µ»Ø¼Ù¡£
void atomic_inc(atomic_t *v);
¸Ãº¯Êý¶ÔÔ­×ÓÀàÐͱäÁ¿vÔ­×ÓµØÔö¼Ó1¡£
void atomic_dec(atomic_t *v);
¸Ãº¯Êý¶ÔÔ­×ÓÀàÐ͵ıäÁ¿vÔ­×ӵؼõ1¡£
int atomic_dec_and_test(atomic_t *v);
¸Ãº¯Êý¶ÔÔ­×ÓÀàÐ͵ıäÁ¿vÔ­×ӵؼõ1£¬²¢ÅжϽá¹ûÊÇ·ñΪ0£¬Èç¹ûΪ0£¬·µ»ØÕ棬·ñÔò·µ»Ø¼Ù¡£
int atomic_inc_and_test(atomic_t *v);
¸Ãº¯Êý¶ÔÔ­×ÓÀàÐ͵ıäÁ¿vÔ­×ÓµØÔö¼Ó1£¬²¢ÅжϽá¹ûÊÇ·ñΪ0£¬Èç¹ûΪ0£¬·µ»ØÕ棬·ñÔò·µ»Ø¼Ù¡£
int atomic_add_negative(int i, atomic_t *v);
¸


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨Èý£© HCI²ã±à³Ì

1. HCI²ãЭÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI)  ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈЭÒé ......

ʵսLinux Bluetooth±à³Ì£¨ËÄ£© L2CAP²ã±à³Ì

£¨L2CAPЭÒé¼ò½é£¬L2CAPÔÚBlueZÖеÄʵÏÖÒÔ¼°L2CAP±à³Ì½Ó¿Ú£©
Ò»£ºL2CAPЭÒé¼ò½é£º
Logical Link Control and Adaptation Protocol(L2CAP)
Âß¼­Á¬½Ó¿ØÖƺÍÊÊÅäЭÒé (L2CAP) ΪÉϲãЭÒéÌṩÃæÏòÁ¬½ÓºÍÎÞÁ¬½ÓµÄÊý¾Ý·þÎñ£¬²¢Ìṩ¶àЭÒ鹦ÄܺͷָîÖØ×é²Ù×÷¡£L2CAP ³äÐíÉϲãЭÒéºÍÓ¦ÓÃÈí¼þ´«ÊäºÍ½ÓÊÕ×î´ó³¤¶ÈΪ 64K µÄ L2CAP Ê ......

Linux²Ù×÷ϵͳÏÂIPTablesÅäÖ÷½·¨Ïê½â


ÎÒÃÇÀ´ÅäÖÃÒ»¸öfilter±íµÄ·À»ðǽ ¡¡¡¡
1¡¢²é¿´±¾»ú¹ØÓÚIPTABLESµÄÉèÖÃÇé¿ö
[root@tp ~]# iptables -L -n
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source desti ......

25.2.1 LinuxÄÚºËUSBÇý¶¯¿ò¼Ü

25.2.1  LinuxÄÚºËUSBÇý¶¯¿ò¼Ü
ͼ25-2ÊÇLinuxÄں˴ÓÖ÷»úºÍÉ豸Á½¸ö½Ç¶È¹Û²ìUSB×ÜÏ߽ṹµÄʾÒâͼ¡£
´Óͼ25-2ÖпÉÒÔ¿´³ö£¬LinuxÄÚºËUSBÇý¶¯ÊÇ°´ÕÕÖ÷»úÇý¶¯ºÍÉ豸Çý¶¯Á½Ì×ÌåϵʵÏֵģ¬ÏÂÃæ½éÉÜÁ½Ì×ÌåϵµÄ½á¹¹ºÍÌص㡣
1£®»ù±¾½á¹¹
ͼ25-2µÄ×ó²àÊÇÖ÷»úÇý¶¯½á¹¹¡£Ö÷»úÇý¶¯µÄ×îµ×²ãÊÇUSBÖ÷»ú¿ØÖÆÆ÷£¬ÌṩÁËOHCI/EHCI/UHC ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ