LinuxÉ豸Çý¶¯¼òÎö dm9000Íø¿¨Çý¶¯
/*
*By Neil Chiao (neilchiao at gmail.com)
*תÔØÇë×¢Ã÷³ö´¦£ºneilengineer.cublog.cn
*±¾ÎIJ¿·ÖÄÚÈÝÀ´×ÔÍøÂç
*»¶Óµ½“ÐÂÐÇÍå(www.xinxingwan.com)”Ö¸µ¼
*/
1¡¢LinuxÍøÂçÉ豸Çý¶¯µÄÌåϵ½á¹¹
LinuxÍøÂçÇý¶¯³ÌÐòµÄÌåϵ½á¹¹¿É»®·ÖΪ4¸ö²ã´Î¡£LinuxÄÚºËÔ´´úÂëÖÐÌṩÁËÍøÂçÉ豸½Ó¿Ú¼°ÒÔÉϲã´ÎµÄ´úÂ룬Òò´ËÒÆÖ²Ìض¨ÍøÂçÓ²¼þµÄÇý¶¯³ÌÐòµÄÖ÷Òª¹¤×÷¾ÍÊÇÍê³ÉÉ豸Çý¶¯¹¦ÄܲãµÄÏàÓ¦´úÂ룬¸ù¾Ýµ×²ã¾ßÌåµÄÓ²¼þÌØÐÔ£¬¶¨ÒåÍøÂçÉ豸½Ó¿Ústruct net_deviceÀàÐ͵ĽṹÌå±äÁ¿£¬²¢ÊµÏÖÆäÖÐÏàÓ¦µÄ²Ù×÷º¯Êý¼°Öжϴ¦Àí³ÌÐò¡£
LinuxÖÐËùÓеÄÍøÂçÉ豸¶¼³éÏóΪһ¸öͳһµÄ½Ó¿Ú£¬¼´ÍøÂçÉ豸½Ó¿Ú£¬Í¨¹ýstruct net_deviceÀàÐ͵ĽṹÌå±äÁ¿±íʾÍøÂçÉ豸ÔÚÄÚºËÖеÄÔËÐÐÇé¿ö£¬ÕâÀï¼È°üÀ¨»Ø»·£¨loopback£©É豸£¬Ò²°üÀ¨Ó²¼þÍøÂçÉ豸½Ó¿Ú¡£ÄÚºËͨ¹ýÒÔdev_base<drives/net/space.c>ΪͷָÕëµÄÉ豸Á´±íÀ´¹ÜÀíËùÓеÄÍøÂçÉ豸¡£
net_deviceÊý¾Ý½á¹¹
struct net_device½á¹¹ÌåÊÇÕû¸öÍøÂçÇý¶¯½á¹¹µÄºËÐÄ£¬ÆäÖж¨ÒåÁ˺ܶ๩ÍøÂçÐÒé½Ó¿Ú²ãµ÷ÓÃÉ豸µÄ±ê×¼·½·¨£¬¸Ã½á¹¹ÔÚ<include/linux/netdevice.h>ÎļþÖж¨Ò壬ÏÂÃæÖ»ÁгöÆäÖÐÖ÷ÒªµÄ³ÉÔ±¡£
1£©È«¾ÖÐÅÏ¢¼°µ×²ãÓ²¼þÐÅÏ¢
name: ÍøÂçÉ豸Ãû³Æ£»
base_addr,irq: ÍøÂçÉ豸µÄI/O»ùµØÖ·£¬ÖжϺţ¬ifconfigÃüÁî¿ÉÏÔʾºÍÐ޸ģ»
hard_header_len: Ó²¼þÍ·µÄ³¤¶È£¬ÒÔÌ«ÍøÖÐֵΪ14£»
mtu: ×î´ó´«Êäµ¥Ôª£¬ÒÔÌ«ÍøÖÐֵΪ1500B£»
dev_addr[MAX_ADDR_LEN]: MACµØÖ·£¬ether_setup»á¶ÔÆä½øÐÐÕýÈ·µÄÉèÖã»
2£©Ö÷ÒªµÄ²Ù×÷·½·¨
int (*init)(struct net_device *dev); É豸³õʼ»¯ºÍÏòϵͳע²áµÄº¯Êý£¬½öµ÷ÓÃÒ»´Î£»
int (*open)(struct net_device *dev); É豸´ò¿ª½Ó¿Úº¯Êý£¬µ±ÓÃifconfig¼¤»îÍøÂçÉ豸ʱ±»µ÷Óã¬×¢²áËùÓõÄϵͳ×ÊÔ´£¨I/O¶Ë¿Ú£¬IRQ£¬DMAµÈ£©Í¬Ê±¼¤»îÓ²¼þ²¢Ôö¼ÓʹÓüÆÊý£»
int (*stop)(struct net_device *dev); Ö´ÐÐopen·½·¨µÄ·´²Ù×÷£»
*hard_start_xmit£» ³õʼ»¯Êý¾Ý°ü´«ÊäµÄº¯Êý£»
ÍøÂçÇý¶¯³ÌÐ
Ïà¹ØÎĵµ£º
Service Discovery Protocol(SDP)ÌṩһÖÖÄÜÁ¦£¬ÈÃÓ¦ÓóÌÐòÓз½·¨·¢ÏÖÄÄÖÖ·þÎñ¿ÉÓÃÒÔ¼°ÕâÖÖ·þÎñµÄÌØÐÔ¡£
·þÎñ·¢ÏÖÐÒé(SDP»òBluetooth SDP)ÔÚÀ¶ÑÀÐÒéÕ»ÖжÔÀ¶ÑÀ»·¾³ÖеÄÓ¦ÓóÌÐòÓÐÌØÊâµÄº¬Ò⣬·¢ÏÖÄĸö·þÎñÊÇ¿ÉÓõĺÍÈ·¶¨ÕâЩ¿ÉÓ÷þÎñµÄÌØÕ÷¡£SDP¶¨ÒåÁËbluetooth client·¢ÏÖ¿ÉÓÃbluetooth server·þÎñºÍËüÃǵÄÌØÕ÷µÄ·½·¨¡£ ......
1. ×î³£ÓõÄÃüÁîÁбí
ÏÂÃæÁгöÊ®¸öÔÚʹÓÃlinux¹ý³ÌÖÐʹÓÃƵÂÊ×î¸ßµÄÃüÁî¡£ÕâÀïÖ»×÷¼òµ¥½éÉÜ£¬¾ßÌåÓ÷¨Çë²Î¿¼ºóÃæÄÚÈÝ¡£
cat£¬ÏÔʾÎļþÄÚÈÝ¡£
cd£¬¸Ä±äĿ¼·¾¶¡£
cp£¬¸´ÖÆÎļþ¡£
find£¬²éÕÒÎļþ¡£
grep£¬ËÑË÷¡¢¹ýÂËÐÅÏ¢¡£
ls£¬ÁгöĿ¼ÐÅÏ¢¡£
more£¬·ÖÒ³ÏÔʾ¡£
rm£¬É¾³ýÎļþ»òĿ¼¡£
vi£¬µ÷ÓÃviÎı¾±à¼Æ÷ ......
Title: `º£·çµÄLinux¿ª·¢»·¾³½éÉÜ
tag: linux¿ª·¢ÈëÃÅ, ¿ª·¢»·¾³, samba, indent, SourceInsight, Winux
Îĵµ·¢²¼ÉùÃ÷: ÈκÎÈ˶¼¿ÉÒÔÕë¶Ô±¾Îĵµ×ÔÓÉתÌù£¬¿½±´£¬ÒýÓ㬼°Ð޸ĺóÔÙ·¢²¼£¬¶øÎÞÐè¹ýÎÊÎÒ±¾ÈË£¬Ö»Ï£ÍûÄܹ»ÁôÏÂÊôÓÚÔ×÷ÕßµÄһЩ°æȨÐÅÏ¢£¬Çë×ðÖØÔ×÷ÕßµÄÀͶ¯¡£
`º£·ç = ......
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "include/lua.hpp"
bool g_bQuit = false;
void ......