LinuxÄں˳£ÓÃÊý¾Ý½á¹¹ºÍ²Ù×÷
1. ǰÑÔ
±¾ÎĽéÉÜlinuxÄÚºËÖÐһЩ³£ÓõÄÊý¾Ý½á¹¹ºÍ²Ù×÷¡£
2. Ë«ÏòÁ´±í(list)
linuxÄÚºËÖеÄË«ÏòÁ´±íͨ¹ý½á¹¹ struct list_headÀ´½«¸÷¸ö½ÚµãÁ¬½ÓÆðÀ´£¬´Ë½á¹¹»á×÷ΪÁ´±íÔªËØ½á¹¹ÖеÄÒ»¸ö²ÎÊý£º
struct list_head {
struct list_head *next, *prev;
};
Á´±íÍ·µÄ³õʼ»¯£¬×¢Ò⣬½á¹¹ÖеÄÖ¸ÕëΪNULL²¢²»Êdzõʼ»¯£¬¶øÊÇÖ¸Ïò×ÔÉí²ÅÊdzõʼ»¯£¬Èç¹ûÖ»Êǰ´ÆÕͨÇé¿öϵÄÖÃΪNULL£¬¶ø²»ÊÇÖ¸Ïò×ÔÉí£¬ÏµÍ³»á±ÀÀ££¬ÕâÊÇÒ»¸öÈÝÒ×·¸µÄ´íÎó£º
#define LIST_HEAD_INIT(name) { &(name), &(name) }
#define LIST_HEAD(name) \
struct list_head name = LIST_HEAD_INIT(name)
#define INIT_LIST_HEAD(ptr) do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
×î³£ÓõÄÁ´±í²Ù×÷£º
²åÈëµ½Á´±íÍ·:
void list_add(struct list_head *new, struct list_head *head);
²åÈëµ½Á´±íβ:
void list_add_tail(struct list_head *new, struct list_head *head);
ɾ³ýÁ´±í½Úµã:
void list_del(struct list_head *entry);
½«½ÚµãÒÆ¶¯µ½ÁíÒ»Á´±í:
void list_move(struct list_head *list, struct list_head *head);
½«½ÚµãÒÆ¶¯µ½Á´±íβ:
void list_move_tail(struct list_head *list,struct list_head *head);
ÅжÏÁ´±íÊÇ·ñΪ¿Õ£¬·µ»Ø1Ϊ¿Õ£¬0·Ç¿Õ
int list_empty(struct list_head *head);
°ÑÁ½¸öÁ´±íÆ´½ÓÆðÀ´£º
void list_splice(struct list_head *list, struct list_head *head)£»
È¡µÃ½ÚµãÖ¸Õ룺
#define list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
±éÀúÁ´±íÖÐÿ¸ö½Úµã£º
#define list_for_each(pos, head) \
for (pos = (head)->next, prefetch(pos->next); pos != (head); \
pos = pos->next, prefetch(pos->next))
ÄæÏòÑ»·Á´±íÖÐÿ¸ö½Úµã£º
#define list_for_each_prev(pos, head) \
for (pos = (head)->prev, prefetch(pos->prev); pos != (head); \
pos = pos->prev, prefetch(pos->prev))
¾ÙÀý£º
LISH_HEAD(mylist);
&n
Ïà¹ØÎĵµ£º
1. HCI²ãÐÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI) ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈÐÒé ......
×ªÔØ×Ô:http://hi.baidu.com/aokikyon/blog/item/86d1640fb3b7ca226059f390.html
ÒÔÇ°Â½Â½ÐøÐøÐ´¹ýºÜ¶à¹ÒÔØNFSÏà¹ØµÄÄÚÈÝ£¬ÏÖÔÚ°ÑËûÃÇÕûÀíһϣ¬¿´ÆðÀ´·½±ãЩ¡£
֮ǰʹÓÃcramfs»òyaffs×÷Ϊ¸ùÎļþϵͳ£¬¿ª·¢ÆðÀ´ºÜ²»·½±ã£¬ÐèÒªÐÞ¸ÄÒ»µãÎļþ¶¼ÒªÖØÐÂÉÕдnand£¬ÔÚ¿ª·¢Ê±ÍƼö¹ÒÔØÐéÄâ»úϵÄnfs·ÖÇø×÷Ϊ¸ùÎļþϵͳ¡£
......
The new USB "On-The-Go" (OTG) capabilities are not yet widely
understood, or even generally available. The most visible feature of
OTG is that it defines the behavior of intelligent "Dual-Role" USB
devices, such as cameras or wireless handsets, which act either as USB
host or ......
gccµÄ±àÒë¹ý³Ì·ÖΪËIJ½£¬·Ö±ðΪ£º
(1)Ô¤±àÒë (Pre-Processing)
(2)±àÒë (Compiling)
(3)»ã±à (Assembling)
(4)Á´½Ó (Linking)
ÒÔhello.cΪÀý˵Ã÷£º
#include<stdio.h>
int main(void)
{
printf("Hello World!");
return 0;
}
(1)Ô¤±àÒë½×¶Î (Pre-Processing)
&nbs ......
×î½ü£¬¿ªÊ¼ÑжÁÒ»ÏÂLinuxµÄÄں˴úÂ룬¸ÕÒ»¿ªÊ¼£¬¾ÍÓÐÁîÈ˾ªÌ¾µÄ·¢ÏÖ£¬²»µÃ²»¸Ð̾Äں˴úÂëÉè¼ÆµÃÖ®ÃÀ£¡µ¥ÊÇ×î³£ÓõÄÁ´±íÒ²Éè¼ÆµÃ²»µÃ²»ÁîÈËÅå·þ£¡
1.1.Á´±ílist_head
include/linux/list.h
ºÜ¾µä£¬Á´±íÔÚÄÚºËÖкܳ£Óã¬ÀýÈç¹ÜÀí½ø³Ì£¬½ø³ÌµÄ¸÷¸ö״̬¶ÓÁж¼ÊÇʹÓÃÕâ¸öË«ÏòÁ ......