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

linuxÖÕ¶ËÉ豸uartÇý¶¯·ÖÎö

ÎÄÕÂÀ´Ô´£ºhttp://blog.chinaunix.net/u3/94284/showart_1982227.html
Ò»:Ç°ÑÔ
½Ó×ÅÇ°ÃæµÄÖն˿ØÖÆ̨·ÖÎö,½ÓÏÂÀ´·ÖÎöserialµÄÇý¶¯.ÔÚlinuxÖÐ,serialÒ²¶ÔÓ¦×ÅÖÕ¶Ë,ͨ³£±»³ÆΪ´®¿ÚÖÕ¶Ë.ÔÚshellÉÏ,ÎÒÃÇ¿´µ½µÄ/dev/ttyS*¾ÍÊÇ´®¿ÚÖÕ¶ËËù¶ÔÓ¦µÄÉ豸½Úµã.
ÔÚ·ÖÎö¾ßÌåµÄserialÇý¶¯Ö®Ç°.ÓбØÒªÏÈ·ÖÎöuartÇý¶¯¼Ü¹¹.uartÊÇUniversal Asynchronous Receiver and TransmitterµÄËõд.·­Òë³ÉÖÐÎļ´Îª”ͨÓÃÒì²½ÊÕ·¢Æ÷”.ËüÊÇ´®¿ÚÉ豸Çý¶¯µÄ·â×°²ã.
¶þ:uartÇý¶¯¼Ü¹¹¸Åò
ÈçÏÂͼËùʾ:
 
 
ÉÏͼÖкìÉ«²¿·Ý±êʶ¼´Îªuart²¿·ÝµÄ²Ù×÷.
´ÓÉÏͼ¿ÉÒÔ¿´µ½,uartÉ豸ÊǼÌtty_driverµÄÓÖÒ»²ã·â×°.ʵ¼ÊÉÏuart_driver¾ÍÊǶÔÓ¦tty_driver.ÔÚËüµÄ²Ù×÷º¯ÊýÖÐ,½«²Ù×÷תÈëuart_port.
ÔÚд²Ù×÷µÄʱºò,ÏȽ«Êý¾Ý·ÅÈëÒ»¸ö½Ð×öcirc_bufµÄ»·Ðλº´æÇø.È»ºóuart_port´Ó»º´æÇøÖÐÈ¡Êý¾Ý,½«ÆäдÈëµ½´®¿ÚÉ豸ÖÐ.
µ±uart_port´ÓserialÉ豸½ÓÊÕµ½Êý¾Ýʱ,»á½«É豸·ÅÈë¶ÔÓ¦line disciplineµÄ»º´æÇøÖÐ.
ÕâÑù.Óû§ÔÚ±àд´®¿ÚÇý¶¯µÄʱºò,Ö»ÏÈҪע²áÒ»¸öuart_driver.ËüµÄÖ÷Òª×÷ÓÃÊǶ¨ÒåÉ豸½ÚµãºÅ.È»ºó½«¶ÔÉ豸µÄ¸÷Ïî²Ù×÷·â×°ÔÚuart_port.Çý¶¯¹¤³Ìʦû±ØÒª¹ØÐÄÉϲãµÄÁ÷³Ì,Ö»Ðè°´Ó²¼þ¹æ·¶½«uart_portÖеĽӿں¯ÊýÍê³É¾Í¿ÉÒÔÁË.
 
Èý:uartÇý¶¯ÖÐÖØÒªµÄÊý¾Ý½á¹¹¼°Æä¹ØÁª
ÎÒÃÇ¿ÉÒÔ×Ô¼º¿¼ÂÇÏÂ,»ùÓÚÉÏÃæµÄ¼Ü¹¹´úÂëÓ¦¸ÃÒªÔõôд.Ê×ÏÈ¿¼ÂÇÒÔϼ¸µã:
1: Ò»¸öuart_driverͨ³£»á×¢²áÒ»¶ÎÉ豸ºÅ.¼´ÔÚÓû§¿Õ¼ä»á¿´µ½uart_driver¶ÔÓ¦Óжà¸öÉ豸½Úµã.ÀýÈç:
/dev/ttyS0  /dev/ttyS1
ÿ¸öÉ豸½ÚµãÊǶÔÓ¦Ò»¸ö¾ßÌåÓ²¼þµÄ,´ÓÉÏÃæµÄ¼Ü¹¹À´¿´,ÿ¸öÉ豸ÎļþÓ¦¸Ã¶ÔÓ¦Ò»¸öuart_port.
Ò²¾ÍÊÇ˵:uart_deviceÔõôͬ¶à¸öuart_port¹ØϵÆðÀ´?ÔõôȥÇø·Ö²Ù×÷µÄÊÇÄÄÒ»¸öÉ豸Îļþ?
 
2:ÿ¸öuart_port¶ÔÓ¦Ò»¸öcirc_buf,ËùÒÔuart_port±ØÐëÒªºÍÕâ¸ö»º´æÇø¹ØϵÆðÀ´
 
»ØÒättyÇý¶¯¼Ü¹¹ÖÐ.tty_driverÓÐÒ»¸ö½Ð³ÉÔ±Ö¸ÏòÒ»¸öÊý×é,¼´tty->ttys.ÿ¸öÉ豸Îļþ¶ÔÓ¦ÉèÊý×éÖеÄÒ»Ïî.¶øÕâ¸öÊý×éËù´úÂëµÄÊý¾Ý½á¹¹Îªtty_struct. ÏàÓ¦µÄtty_struct»á½«tty_driverºÍldisc¹ØÁªÆðÀ´.
ÄÇÔÚuartÇý¶¯ÖÐ,ÊÇ·ñÒ²¿ÉÓÃÏàͬµÄ·½Ê½À´´¦ÀíÄØ?
½«uartÇý¶¯³£ÓõÄÊý¾Ý½á¹¹±íʾÈçÏÂ:
 
 
½áºÏÉÏÃæÌá³öµÄÒÉÎÊ.¿ÉÒÔºÜÇå³þµÄ¿´¶®ÕâЩ½á¹¹µÄÉè¼Æ.
 
ËÄ:uart_driverµÄ×¢²á²Ù×÷
Uart_driver×¢²á¶ÔÓ¦µÄº¯ÊýΪ: uart_register_driver()´úÂëÈçÏÂ:
int uart_register_driver(struct uart_driver *drv)


Ïà¹ØÎĵµ£º

ÔÚlinuxÏÂʵÏÖweb qqµÄ×ÀÃ滯


´´½¨×ÀÃæͼ±ê
Ä¿Ç°½«ÍøÂçÓ¦ÓÃÀ©Õ¹µ½×ÀÃæÊÇÒ»¸öÇ÷ÊÆ£¬´æÔÚןܶà½â¾ö·½°¸£¬±¾ÎÄÒÔ Mozilla Prism ΪÀý£¬ÀàËƵķ½·¨Í¬ÑùÊÊÓÃÓÚ Google Chrome ¡£
1. µ½ Mozilla Prism µÄÍøÕ¾ÉÏÏÂÔØ Prism£¬µã»÷ Download Now Ö®ºó»áÌáʾÓÐÁ½ÖÖ£¬Ò»ÖÖÊÇÒÔ Mozilla Firefox À©Õ¹µÄ·½Ê½£¬ÊʺÏÒѾ­°²×°ÓÐ Firefox µÄÅóÓÑ£»Ò»Ö ......

perlÔÚlinuxÖÐÕÒ²»µ½½âÊÍÆ÷µÄÎÊÌâ

×î½ü¸Ð½Ó´¥perl£¬¸Ð¾õºÜ²»´í£¬´¦ÀíÎı¾·Ç³£·½±ã¡£Ç°½×¶ÎÓÃcȥͳ¼ÆһЩÎı¾£¬ÀÛµÄÒªËÀ£¬¶øÇÒ³ÌÐòÖл¹¾­³£³öbug£»¶øÓÃperlÔò²»Í¬£¬Ëü±ÜÃâµÄ¸´ÔÓµÄÊý¾Ý½á¹¹£¬ÕâÑù³ö´íµÄ¸ÅÂʾͺÜСÁË£¬¶øÇÒ±àд´úÂë¶ÌС¾«º·¡£Ç°Á½Ì콫perlÄõ½linuxÉÏÔËÐУ¬ËäÈ»Ìí¼ÓÁË#!/usr/local/bin/perl£¬µ«»¹ÊÇÌáʾÕÒ²»µ½½âÊÍÆ÷£ºbad interpreter¡£ÓôÃÆѽ¡ ......

Mr. ProcessµÄÒ»Éú£­LinuxÄں˵ÄÉç»áÊÓ½Ç (2)Æô¶¯

ÆäʵÕâ²ÅÓ¦¸ÃÊÇÕâһϵÁÐÎÄÕµĵÚÒ»½Ú£¬ÒòΪÕâƪÎÄÕ½²µÄÊÇÅ̹ſªÌìµØµÄÊ¡£»°ËµMr.
ProcessÊÇÒ»¸öÏÖ´úÈË£¬µ«ÊÇ£¬Ö»ÒªÊÇÈË£¬×ܸÃÓиö×æÏÈ¡£ÈËÃÇ×ÜÏëÖªµÀ×Ô¼º´ÓÄÄÀ´£¬È»ºó²Å¿ÉÒÔ¹ÀÃþËãÒ»ÏÂ×Ô¼º½«È¥ÏòºÎ·½¡£ËùÒÔÔÛÒ²ÒªÁ˽âÒ»ÏÂ
LinuxµÄÊÀ½çÀïÈËÀàµÄÆðÔ´¡£
ͼ1£º´ÓÉϵ絽BIOS
°´ÏµçÔ´¿ª¹ØµÄÄǸöÕæʵµÄÈ˾ÍÊÇLinuxÊÀ½çÀïµÄ ......

linux I2CÇý¶¯·ÖÎö

I2CÊÇPhillips¿ª·¢µÄ2ÏߵĴ®ÐÐ×ÜÏßЭÒ顣ͨ³£Ó¦ÓÃÔÚǶÈëʽϵͳÖÐÈò»Í¬µÄ×é¼þͨÐÅ£¬PCÖ÷°å¿ÉÒÔͨ¹ýI2CÀ´Ó벻ͬµÄ´«¸ÐÆ÷ͨÐÅ¡£ÕâЩ´«¸ÐÆ÷ͨ³£±¨¸æ·çÉÈËٶȣ¬´¦ÀíÆ÷ζȺÍÕû¸öÓ²¼þϵͳµÄÐÅÏ¢£¬Õâ¸öЭÒéÒ²¿ÉÒÔÓÃÔÚRAM chipsÉÏ£¬Ïò²Ù×÷ϵͳÌṩDIMMµÄÐÅÏ¢¡£
ÔÚ2.0ʱI2CµÄkernelÔ´Âë²»ÔÚÄÚºËÀïµÄ£¬2.4Äں˰üÀ¨ÁËÒ»µã¶ÔI2CµÄÖ§³Ö ......

linuxÃüÁîÖ®grep


ÏàÐÅg r e pÊÇU N I XºÍL I N U XÖÐʹÓÃ×î¹ã·ºµÄÃüÁîÖ®Ò»¡£g r e p£¨È«¾ÖÕýÔò±í´ïʽ°æ±¾£©ÔÊÐí¶ÔÎı¾Îļþ½øÐÐģʽ²éÕÒ¡£Èç¹ûÕÒµ½Æ¥Åäģʽ£¬ g r e p´òÓ¡°üº¬Ä£Ê½µÄËùÓÐÐС£g r e pÖ§³Ö»ù±¾ÕýÔò±í´ïʽ£¬Ò²Ö§³ÖÆäÀ©Õ¹¼¯¡£g r e pÓÐÈýÖÖ±äÐΣ¬¼´£º
G r e p£º ±ê×¼g r e pÃüÁ±¾Õ´󲿷Öƪ·ù¼¯ÖÐÌÖÂ۴˸ñʽ¡£
E g r e p£º ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ