Linux kernel development Chapter1
1 linuxÄÚºË
²¢²»Çø·ÖÏ̺߳ͽø³Ì¡£¶ÔÓÚÄÚºËÀ´Ëµ£¬ËùÓеÄÏ̺߳ͽø³Ì¶¼Ò»Ñù£¬Ö»ÊÇÆäÖеÄһЩ¹²Ïí×ÊÔ´¶øÒÑ¡£
2 Äں˿ª·¢Ìص㣺
2.1 linuxÄں˿ª·¢²»ÄÜʹÓÃcº¯Êý¿â£¬ÒòΪc¿âÐèÒª²Ù×÷ϵͳµÄÖ§³Ö£¬¶øÇÒc¿âµÄ´óСºÍЧÂÊÒ²ÊÇÄں˿ª·¢Ëù²»ÄÜÈÝÈ̵ģ»
µ«ÊǴ󲿷Öc¿âº¯ÊýÔÚÄÚºËÖж¼ÊDZ»ÊµÏÖÁË¡£Ö»Òª°üº¬Äں˴úÂë
ÖÐÏàÓ¦µÄÍ·Îļþ£¬¾ÍÄܹ»Ê¹ÓÃÏàÓ¦µÄÀàËƺ¯Êý£»
2.2 linuxÄں˿ª·¢Ö»ÄÜʹÓÃGNU c±ê×¼£»
linuxÄں˲¢²»°²È«·ûºÏANSI C±ê×¼£¬Óõ½ÁËÐí¶àgccÌṩµÄÓïÑÔÀ©Õ¹²¿·Ö£º
2.2.1 ÄÚÁª£¨inline£©º¯Êý£¬gccÖ§³ÖÄÚÁªº¯Êý£¨ANSI CÔÚC99ÖÐÒ²¿ªÊ¼Ö§³Öinline£©¡£¶¨ÒåÒ»¸öÄÚÁªº¯ÊýµÄʱºò£¬ÒªÊ¹ÓÃstatic¹Ø¼ü
×Ö½øÐÐÏÞ¶¨ £¨ÎªÊ²Ã´ÐèÒªstatic¹Ø¼ü×Ö£¬²Î¿¼¡¶gccµÄÄÚÁªÖ§³Ö¡·£©£¬²¢ÇÒÄÚÁªº¯Êý³£ÔÚÍ·ÎļþÖж¨Òå¡£
2.2.2 ÄÚÁª»ã±à¡£gccÖ§³ÖÔÚcÓïÑÔ´úÂëÖÐǶÈë»ã±à´úÂë¡£
2.2.3 ·ÖÖ§ÉùÃ÷¡£¶ÔÓÚÌõ¼þÑ¡ÔñÓï¾ä£¬gccÄÚ½¨ÁËÒ»ÌõÖ¸ÁîÓÃÓÚÓÅ»¯¡£Èç¹ûÒ»¸öÌõ¼þΪÕæ»òΪ¼ÙµÄ¸ÅÂʱȽϴó£¬ÄÇô±àÒëÆ÷¾Í¿ÉÒÔ¸ù
¾Ý¸ÃÖ¸Áî¶ÔÌõ¼þ·Ö֧ѡÔñ½øÐÐÓÅ»¯¡£
Äں˰ÑÕâÌõÖ¸Áî·â×°³ÉÁ˺꣬±ÈÈçlikely()ºÍunlikyle()£¬ÒÔ·½±ãʹÓã¬ÀýÈ磺
&
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,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 ......
µÚÒ»²¿·Ö
1.ΪʲôʹÓÃshell
Ä¿Ç°Á÷ÐеÄLinux shell ±»³Æ֮ΪBASH¡£¶ÔÓÚÈκÎÏëÊʵ±¾«Í¨Ò»Ð©¹ÜÀí֪ʶµÄÈËÀ´Ëµ£¬ÕÆÎÕshell½Å±¾¶¼ÊÇ×î»ù±¾µÄ£»shell½Å±¾×ñѵäÐ͵ÄUNIXÕÜѧ£¬¼È°Ñ´óµÄ¸´ÔӵŤ³Ì·Ö³ÉС¹æÄ£µÄ×ÓÈÎÎñ£¬²¢ÇÒ°ÑÕâЩ²¿¼þºÍ¹¤¾ß×éºÏÆðÀ´¡£
ʲôʱºò²»Ê¹ÓÃshell£º
×ÊÔ´Ãܼ¯ÐÍÈÎÎñ£¬ÓÈÆäÊÇÐèÒª¿¼ÂÇЧ ......