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

LinuxÄÚºËͬ²½£¬½ø³Ì£¬Ïß³Ìͬ²½

°üÀ¨ÎÒ×Ô¼ºÔÚÄÚ£¬ºÜ¶àÈ˶ÔÄںˣ¬½ø³Ì£¬Ïß³Ìͬ²½¶¼²»ÊǺÜÇå³þ£¬ÏÂÃæÉÔ΢×ܽáһϣº
 
ÄÚºËͬ²½£º
Ö÷ÒªÊÇ·ÀÖ¹¶àºË´¦ÀíÆ÷ͬʱ·ÃÎÊÐÞ¸Äij¶Î´úÂ룬»òÕßÔÚ¶ÔÉ豸Çý¶¯³ÌÐò½øÐÐÁÙ½çÇø±£»¤¡£Ö÷ÒªÓÐһϼ¸ÖÖ·½Ê½£º
1. Mutex£¨»¥³â£©
Í·Îļþ£º
#include <linux/mutex.h>
³õʼ»¯·½·¨£º
DEFINE_MUTEX(name);»òÕß
void mutex_init(struct mutex *lock);
ʹÓ÷½·¨£º
void mutex_lock (struct mutex *lock);
Tries to lock the mutex, sleeps otherwise.
Caution: can't be interrupted, resulting in processes you cannot kill!
int mutex_lock_interruptible (struct mutex *lock);
Same, but can be interrupted. If interrupted, returns a non zero value and doesn't hold the lock. Test the return value!!! 
int mutex_trylock (struct mutex *lock);
Never waits. Returns a non zero value if the mutex is not available.int mutex_is_locked(struct mutex *lock);Just tells whether the mutex is locked or not.
void mutex_unlock (struct mutex *lock);
Releases the lock. Make sure you do it as quickly as possible!
 
2. Reader/writer semphopres ¶ÁдÐźÅÁ¿
Allow shared access by unlimited readers, or by only 1 writer. Writers get priority.
ÔÊÐíÓÐÏÞÊýÁ¿µÄ¶Á·ÃÎÊ£¬µ«ÊÇÖ»ÄÜÓÐÒ»¸öд·ÃÎÊ¡£
void init_rwsem (struct rw_semaphore *sem);
void down_read (struct rw_semaphore *sem);
int down_read_trylock (struct rw_semaphore *sem);
int up_read (struct rw_semaphore *sem);
void down_write (struct rw_semaphore *sem);


Ïà¹ØÎĵµ£º

ʵս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 Bluetooth±à³Ì(Áù) L2CAP±à³ÌʵÀý

ÀýÒ»£º·¢ËÍSignaling Packet£º
Signaling CommandÊÇ2¸öBluetoothʵÌåÖ®¼äµÄL2CAP²ãÃüÁî´«Êä¡£ËùÒÔµÃSignaling CommandʹÓÃCID 0x0001.
¶à¸öCommand¿ÉÒÔÔÚÒ»¸öC-frame£¨control frame£©Öз¢ËÍ¡£
 Èç¹ûÒªÖ±½Ó·¢ËÍSignaling Command.ÐèÒª½¨Á¢SOCK_RAWÀàÐ͵ÄL2CAPÁ¬½ÓSocket¡£ÕâÑù²ÅÓлú»á×Ô¼ºÌî³äCommand Code£¬Identi ......

µÚ2ÕÂ Linux°²×°

µÚ2Õ Linux°²×°Á˽âÁËLinuxµÄÀúÊ·ºÍ·¢Õ¹¹ý³Ì£¬¶ÁÕß´ó¸ÅÒѾ­¼±ÇеØÏëÒª°ÑLinux°²×°µ½×Ô¼ºµÄ¼ÆËã»úÉÏ¡£ÎÞËùη¾åµÄ¶ÁÕß¿ÉÄÜÒѾ­ÔÚÔĶÁ±¾ÕÂ֮ǰ¾Í×ö¹ýÕâÑùµÄ³¢ÊÔ¡£ÎÞÂÛÕâЩ³¢ÊÔ×îÖÕÊdzɹ¦»¹ÊÇʧ°Ü£¬¾Í´ÓÕâÀ↑ʼLinuxÖ®Âðɣ¡ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ