Ëæ׿ÆËã»ú¡¢ÍøÂ硢ͨÐż¼ÊõµÄ·¢Õ¹£¬ÒÔ¼°¶àýÌåÊÓƵ¼¼ÊõµÄ²»¶ÏÍêÉÆ£¬»ùÓÚÍøÂçµÄµÚÈý´úÔ¶³ÌÍøÂçÊÓƵ¼à¿ØϵͳȡµÃÁ˳¤×ãµÄ·¢Õ¹¡£ÐÂÒ»´úµÄ¼à¿ØϵͳÒÔÍøÂçΪÒÀÍУ¬ÒÔÊý×ÖÊÓƵµÄѹËõ¡¢´«Êä¡¢´æ´¢ºÍ²¥·ÅΪºËÐÄ¡£ÏµÍ³²ÉÓÃǶÈëʽ¶àÈÎÎñ²Ù×÷ϵͳ¡¢¸ßЧµÄÊÓƵѹËõоƬºÍ¹¦ÄÜÇ¿´óµÄǶÈëʽ´¦ÀíÆ÷£¬½«ÊÓƵѹËõºÍ´«Êä´¦Àí¹¤×÷È«²¿ÄÚÖõ½Ð¾Æ¬ÉÏ£¬Ç°¶ËÉãÏñ»úËÍÀ´µÄÊÓƵÐźÅÊý×Ö»¯ºó¾¹ýѹËõ¡¢´ò°üµÈ¹ý³Ì±ä³É»ù±¾ÍøÂçÐÒéµÄÊÓƵÁ÷£¬Í¨¹ýÍøÂçµÄ´«Ê䣬ÊÓƵÁ÷·¢Ë͵½½ÓÊնˡ£ÊÓƵ½ÓÊն˿ÉÀûÓÃÈí¼þ½øÐнâÂ룬ÔÚPCÉϽøÐÐÏÔʾºÍ´¦Àí¡£
ϵͳӲ¼þƽ̨
±¾ÏµÍ³ÊÇÒÔPXA270Ϊ΢´¦ÀíÆ÷µÄARM¿ª·¢Æ½Ì¨×é³É¡£PXA270ÊÇÒ»¸ö32λ´¦ÀíÆ÷£¬¿ÉÔÚ312MHz¡¢416MHz¡¢520MHzºÍ624MHzÕâ4ÖÖ²»Í¬µÄʱÖÓƵÂÊÏÂÔËÐС£ÓÃÔÚ¸ßÐÔÄÜ¡¢µÍ¹¦ºÄ¡¢±ãЯ¡¢ÊÖ³ÖʽµÄÉ豸ÖС£Ëü¼ÓÈëÁËIntel Xscale¼¼Êõ£¬¾ßÓе÷½Ú¶¯Ì¬µçѹºÍƵÂÊÒÔ¼°ÍêÉƵĵçÔ´¹ÜÀí¹¦ÄÜ£¬ÌṩÁ˹¤Òµ½çÁìÏȵÄMIPS/mwÐÔÄÜ¡£Íâ½ÓÍø¿¨½Ó¿ÚÓë´¦ÀíÆ÷Ö±½ÓÁ¬½Ó£¬ÊµÏÖÒÔÌ«ÍøͨÐÅ£¬¿ÉÀûÓÃTFTPÐÒé¶ÔÄں˺͸ùÎļþϵͳµÄÓ³Ïñ½øÐпìËÙÏÂÔØ¡£ÓÐ3¸öUART·Ö±ðÊDZê×¼¡¢À¶ÑÀºÍÈ«¹¦ÄܵÄUART£¬¿ÉÒÔͨ¹ýÈ«¹¦ÄÜUARTÓëGPRS DTUÏàÁ¬½Ó½øÐÐÐźŴ«Êä¡£3¸öUSB½Ó¿Ú£¬¿ÉÒÔÓëUSBÉãÏñÍ·ÏàÁ¬½Ó½øÐÐͼÏñ²É¼¯¡£USBÉãÏñÍ·²ÉÓõÄÊÇÒÔOV511ΪоƬµÄÍøÑÛV2000ÉãÏñÍ·¡£
GPRS DTUÊÇÒ»¿î»ùÓÚGPRS ÍøÂçµÄÎÞÏßÊý¾Ý´«ÊäÖÕ¶ËÉ豸£¬Ìṩȫ͸Ã÷Êý¾ÝͨµÀ£¬ÍøÂ縲¸Ç·¶Î§¹ãÄÜʹÓÃÒƶ¯µç»°µÄµØ·½¾Í¿ÉÒÔʹÓÃÖ§³ÖÊý¾Ý͸Ã÷´«ÊäÓëÐÒéת»»£¬Ö§³Ö±¸ÓÃÊý¾ÝÖÐÐÄ£¬µã¶Ôµã»¥Á¬¹¦ÄÜ£¬Ö§³ÖÓÀÔ¶ÔÚÏß¡¢¿ÕÏÐÏÂÏߺͿÕÏеôµç3ÖÖ¹¤×÷·½Ê½£¬¾ßÓжÌÐź͵绰»½Ðѹ¦ÄÜ£¬Ö§³Ö¶ÏÏß×Ô¶¯ÖØÁ¬¹¦ÄÜ¡£
ϵͳ×ÜÌåÉè¼Æ
Õû¸ö¼à¿ØϵͳÖ÷ÒªÊÇÓÉARM¡¢GPRS DTU¡¢USBÉãÏñÍ·ºÍPC×é³É¡£ARM¿ª·¢°åÒÔLinux²Ù×÷ϵͳ±àдÇý¶¯£¬Í¨¹ýÖ¸Áîµ÷¶ÈÀûÓÃUSBÉãÏñÍ·½øÐÐͼÏñ²É¼¯£¬½«²É¼¯ºÃµÄͼÏñͨ¹ýGPRS DTU½øÐÐÎÞÏß´«Ê䣬PCÓëÒòÌØÍøÏàÁ¬½Ó£¬½ÓÊÕµ½GPRS DTU´«Êä¹ýÀ´µÄͼÏñ£¬Í¨¹ýVC++±àдÉÏλ»ú£¬¿ÉÒÔ¿´µ½¼à¿Øµã´«ÊäµÄͼÏñ¡£²Ù×÷ÈËÔ±¿ÉÒÔͨ¹ý¶ÌÐÅ»òµç»°¶Ô¼à¿Ø¶Ë½øÐпØÖÆ£¬¿ÉÒÔʹ¼à¿Ø¶ËËæʱ´¦ÓÚ¹¤×÷»ò¹Ø±Õ״̬£¬ÕâÑùÒ»À´²»½ö¿ÉÒÔËæÒâ¶Ô¼à¿Ø¶Ë½øÐпØÖÆ»¹¿ÉÒÔ½ÚÊ¡Á÷Á¿£¬¾¼Ãʵ»Ý£¬ÌرðÊÊÓÃÓÚһЩ¶Ô¶¯Ì¬Í¼ÏñÒªÇ󲻸ߵĻ·¾³£¬ÏµÍ³½á¹¹¿òͼÈçͼ1Ëùʾ¡£
ͼ1 ϵͳ½á¹¹¿òͼ
ϵͳÈí¼þÉè¼Æ
±¾ÏµÍ³²ÉÓÃLinuxΪ²Ù×÷ϵͳ£¬ËüÊÇÒ»¸ö¶àÓû§¡¢¶àÈÎÎñ²Ù×÷ϵͳ£»¾ßÓÐÁ¼ºÃµÄ¿ª·ÅÐÔ£¬×ñÑÊÀ½ç±ê×¼¹æ·¶£¬ÌرðÊÇ×ñÑ¿ª·Åϵͳ»¥Á¬(OSI£©¹ú¼Ê±ê×¼¡£¾ßÓÐÍêÉƵÄÄÚÖÃÍøÂç¡£LinuxÔÚͨÐźÍÍøÂ繦ÄÜ·½Ãæ¾ùÓÅÓÚÆäËû²Ù×÷ϵͳ¡£ÎªÓû§ÌṩÁËÇ¿´óÍêÉƵÄÍøÂ繦ÄÜ¡£¸ù¾Ý³ÌÐò¿ª·¢µÄÐèÒª¶ÔLinux²Ù×÷ϵͳ½øÐвüõÓë±àÒ룬½«ÖÆ×÷ºÃµÄLinux²Ù×÷ϵͳͨ¹ýJTAGÏÂÔص½ARM¿ª·¢°åÀ¾Í¿ÉÒÔʹÓÃarm-linux¶ÔARM¿ª·¢°å½øÐпØÖÆ¡£
ͼÏñµÄ²É¼¯ÊÇͨ¹ýARM-Linuxµ÷¶ÈVideo4LinuxºÍÓ°ÏñÉ豸Çý¶¯³ÌÐòÀ´½øÐÐÊÓƵ²¶»ñ¡£Video4LinuxÊÇLinuxÓ°ÏñϵͳÓëǶÈËʽӰÏñµÄ»ù´¡£¬ÊÇLinux ÄÚºËÀïÖ§³ÖÓ°ÏñÉ豸µÄÒ»×éAPI£¬LinuxÔÚ¶àýÌåÉϵÄÓ¦ÓÃÊÇÄ¿Ç°·Ç³£ÈÈÃŵÄÑо¿ÁìÓò£¬ÆäÖÐ×î¹Ø¼üµÄ¼¼ÊõÔòÊÇLinuxµÄVideo4Linux¡£ÔÚLinuxÄÚºËÖжÔVideo4Linux½øÐÐÅäÖã¬Èçͼ2Ëùʾ¡£ÅäÖúÃÒÔºóͨ¹ýbootloaderÏÂÔص½ARM-LinuxÀï¡£USBÉãÏñͷʹÓõÄÊÇOV511оƬµÄÍøÑÛV2000ÉãÏñÍ·¡£ÔÚLinux²Ù×÷ϵͳÀïÅäÖúÃOV511оƬµÄÇý¶¯£¬Èçͼ3Ëùʾ¡£
ͼ2 ÅäÖÃVideo for Linux
ͼ3 ÅäÖÃUSB OV511ÉãÏñÍ·
ͨ¹ýbootloaderÏÂÔص½ARM-LinuxÀÕâÑù¾Í¿ÉÒÔͨ¹ýUSBÉãÏñÍ·½øÐÐͼÏñ²É¼¯£¬Í¼Ïñ²É¼¯Á÷³ÌÈçͼ4Ëùʾ¡£
²É¼¯µ½µÄͼÏñΪBMP¸ñʽ£¬Í¼ÏñÌ«´ó²»ÀûÓÚÍøÂç´«Ê䣬ÐèÒª½øÐÐJPEGѹËõ£¬JPEGѹËõ¼¼ÊõÊ®·ÖÏȽø£¬ËüÓÃÓÐËðѹËõ·½Ê½È¥³ýÈßÓàµÄͼÏñÊý¾Ý£¬ÔÚ»ñµÃ½Ï¸ßµÄѹËõÂʵÄͬʱÄÜÕ¹ÏÖÊ®·Ö·á¸»Éú¶¯µÄͼÏñ£¬·Ç³£ÊʺÏÓÚÊÓƵÍøÂç´«Êä¡£»ù±¾µÄJPEGËã·¨ÓÉÒÔϲ½ÖèÍê³É£º£¨1£©Í¨¹ýÀëÉ¢ÓàÏұ任£¨DCT£©Ïû³ýÊý¾ÝÈßÓࣻ(2)ʹÓÃÁ¿»¯ÏµÊý¾ØÕó¶ÔÀëÉ¢ÓàÏұ仯ϵÊý½øÐÐÁ¿»¯£»(3)¶ÔÁ¿»¯ºóµÄϵÊý½øÐбàÂ룬ʹÆäìØ×îС£¬ìرàÂëͨ³£²ÉÓÃhuffman¿É±ä×Ö³¤±àÂë¡£²úÉúÓÐËðͼÏñѹËõµÄÔÒòÖ÷Òª·¢ÉúÔÚµÚ2²½¡£JPEG±ê×¼ÊÇÔڱ任±àÂëµÄ»ù´¡ÉÏ£¬×ÛºÏÓ¦ÓÃÁËDCTºÍ¹þ·òÂü±àÂë2ÖÖÊֶΣ¬´ïµ½Á˺ܺõÄͼÏñѹËõЧ¹û¡£»ùÓÚÀëÉ¢ÓàÏұ任DCTµÄ±àÂë·½·¨£¬ÊÇJPEGËã·¨µÄºËÐÄÄÚÈÝ[5]¡£ÔÚͼÏñ²É¼¯µÄʱºòÐèÒªÓõ½JPEG¿â£¬ËùÒÔÐèÒªÏÈ°²×°JPEG¿â¡£
ͼ4 ͼÏñ²É¼¯Á÷³Ìͼ
ÔÚ/usr/local/man/manlĿ¼Ï»áÉú³Écjpeg.l¡¢djpeg.l¡¢jpegtran.l¡¢rdjpgcom.l¡¢wrjpgcom.l¡¢snapscreenshop.lÁù¸öÎļþ£¬ÔÚ/usr/local/arm/3.4.3/arm-linux/libĿ¼Ï»áÉú³Élibjpeg.a¡¢libjpeg.la¡¢libjpeg.so¡¢ libjpeg.so.62¡¢libjpeg.so.0.0Îå¸öº¯Êý¿â£¬libjpeg.so.62¡¢libjpeg.so.0.0¾ÍÊÇÎÒÃÇÐèÒªµÄ¿â£¬½«Ëü¿½±´µ½arm-linuxÀÕâÑùARM¾ÍÖ§³ÖJPEGѹËõ¸ñʽµÄͼÏñ¡£Í¼ÏñѹËõµÄһЩÖØÒªº¯ÊýÈçÏ£º
²É¼¯µ½µÄͼÏñÈçͼ5Ëùʾ¡£Èç¹ûÒª½øÐÐÁ¬ÐøÖ¡µÄ²É¼¯ÓÉgrab_fd.framsÀ´È·¶¨ÐèÒª²É¼¯µÄÖ¡Êý£¬×î¶àÖ§³ÖÒ»´Î²É¼¯32Ö¡¡£
ͼ5 ²É¼¯µÄͼÏñ
GPRS DTUͨ¹ýÈ«¹¦ÄÜ´®¿ÚÓëARM¿ª·¢°åÏàÁ¬½Ó£¬ÔÚarm-linuxµÄÖ¸Áîµ÷¶ÈϽ«ARM²É¼¯µ½µÄͼÏñͨ¹ý´®¿ÚͨÐÅ´«Êäµ½GPRS DTU¡£arm-linuxÊÇͨ¹ýÉ豸Îļþ·ÃÎÊ´®¿ÚµÄ£¬ÔÚ·ÃÎʾßÌåµÄ´®Ðж˿Úʱ£¬Ö»Ðè´ò¿ªÏàÓ¦µÄÉ豸Îļþ¼´¿É¡£´®Ðж˿ÚPort1ºÍPort2¶ÔÓ¦µÄÉ豸Îļþ·Ö±ðΪ/dev/ttyS0ºÍ/dev/ttyS1¡£ÈôҪʹÓô®¿Ú½øÐÐͨÐűØÐëÔÚͨÐÅÁ½¶ËÉèÖúô®¿ÚµÄÊôÐÔ£¬°üÀ¨Êý¾Ý´«ÊäµÄ²¨ÌØÂÊ¡¢´«ÊäµÄÊý¾Ý¸ñʽ¡¢ÊÇ·ñÓÐÆæżУÑéλ¡¢Á÷¿Ø·½Ê½µÈ¡£ÔÚLinuxϽøÐд®¿ÚÉèÖã¬Éæ¼°Ò»¸öÖØÒªµÄÊý¾Ý½á¹¹struct termios£¬ÉèÖô®¿Ú²¨ÌØÂÊstruct termios Opt£¬ÉèÖô®¿ÚÊý¾Ýλ
´®¿ÚʹÓÃopenº¯ÊýÖ´Ðдò¿ª²Ù×÷£¬open( )º¯Êý´øÓÐÁ½¸ö²ÎÊý£¬ÆäÖвÎÊý1ΪҪ´ò¿ªµÄÉ豸ÎļþÃû£¬²ÎÊý2Ϊ´ò¿ª·½Ê½¡£ËüÃǵĺ¬ÒåÈçÏ¡£
O_RDWR:¼È¿É¶ÁÒ²¿Éд¡£
O_NOCTTY:¸æËßǶÈëʽLinux£¬¸Ã³ÌÐò²»Ïë³ÉΪ´Ë¶Ë¿ÚµÄ“¿ØÖÆÖն˔¡£Èç¹ûÓ¦ÓóÌÐò²»Ç¿µ÷ÕâÒ»µã£¬ÄÇôÈκÎÊäÈ붼»áÓ°Ïì³ÌÐòµÄÖ´ÐС£
O_NDELAY:±íʾ¸Ã³ÌÐò²»¹Ø×¢DCDÐźÅÏßËù´¦µÄ״̬£¬¼´²»¹Ü¶Ô¶ËÉ豸ÊÇÔÚÔËÐлòÊǹÒÆð¡£Èç¹û²»ÉèÖøñêÖ¾£¬Ôò³ÌÐò»á±»ÉèÖÃΪ˯Ãß״̬£¬Ö±µ½DCDÐźÅΪµÍΪֹ¡£
ʹÓÃclose(fd)ϵͳµ÷Óùرմ®¿Ú¡£¹Ø±ÕÒ»¸ö´®¿Úͨ³£»á½«DTRÐźÅÉèÖÃΪµÍµçƽ£¬Èç¹ûÍâ½ÓGPRS DTU£¬¾Í»á½«GPRS DTU¹ÒÆð¡£Ê¹ÓÃwrite( )º¯ÊýÏò´®¿ÚдÈëÊý¾Ý£¬writeµ÷ÓÃÈôÕýÈ·£¬·µ»Ø·¢Ë͵Ä×Ö½ÚÊý£¬·ñÔò·µ»Ø-1¡£´Ó´®¿Ú¶ÁÈ¡Êý¾ÝÈç¹ûÔÚÔʼÊý¾ÝµÄģʽ϶Զ˿ڽøÐвÙ×÷£¬read( )º¯Êýµ÷Óý«·µ»Ø´®ÐпÚÊäÈ뻺³åÇøËùÓеÄÊý¾Ý¡£Èç¹ûûÓÐÊý¾Ý£¬ÄÇô¸Ã½ø³Ì½«±»×èÈû£¬´¦Óڵȴý״̬£¬Ö±µ½Êý¾Ýµ½À´£¬»òÕßµ½Á˹涨ʱ¼äºÍ³öÏÖ´íÎóΪֹ¡£Í¨¹ýÈçÏ·½·¨£¬ÄÜʹread( )º¯Êýµ÷ÓÃÁ¢¼´·µ»Ø¡£
ϵͳµÄʵÏÖ
±¾ÏµÍ³¼à¿ØÖÐÐÄ·þÎñÆ÷²ÉÓÃPCʵÏÖ£¬Ê¹ÓÃWindows²Ù×÷ϵͳ£¬Ê¹ÓÃVC++±àдÉÏλ»ú³ÌÐò£¬ÀûÓÃTCP/IPͨÐÅ£¬ÊäÈë¼à¿Ø¶ËµÄIPµØÖ·ºó£¬ÉÏλ»ú¿ÉÒÔÓë¼à¿Ø¶ËͨÐÅ£¬½ÓÊÕµ½´«Êä¹ýÀ´µÄͼÏñ£¬Èçͼ6Ëùʾ¡£¸Ãϵͳ´ó¸Å3¡«5Ãë´«ÊäÒ»·ùͼÏñ¡£
ͼ6½ÓÊÕµ½µÄͼÏñ
±¾¼à¿Øϵͳ֧³Ö¶ÌÐź͵绰»½Ðѹ¦ÄÜ£¬Ò²¾ÍÊÇ˵ͨ¹ý¶ÌÐź͵绰²¦ºÅ¾Í¿ÉÒÔ¶Ô¼à¿Øϵͳ½øÐÐÔ¶³Ì¿ØÖÆ£¬Ê¹Æä½øÈ빤×÷״̬£¬½øÐÐÐÅÏ¢´«Êä¡£¾ßÓÐÁ¬½Óʱ»ú¿É¿Ø¹¦ÄÜ£¬Ö§³ÖÓÀÔ¶ÔÚÏß¡¢¿ÕÏÐÏÂÏߺͿÕÏеôµç3ÖÖ¹¤×÷·½Ê½¡£ÔÚ²»½øÐÐÊý¾Ý´«Êäʱ£¬¼à¿Øϵͳ¿ÉÒÔ½øÈëÏÂÏß״̬£¬´ó´ó½ÚÔ¼ÁËͨÐÅ·ÑÓ㬶øÔÚÐèÒªÖØпªÊ¼Êý¾Ý´«Êäʱ£¬¿ÉÒÔÓÃÊÖ»ú¸ø¼à¿Øϵͳ·¢ËͶÌÐÅ»ò´òµç»°½«Æ份ÐÑ£¬»Ö¸´ÓëÊý¾ÝÖÐÐĵÄÁ¬½Ó£¬Ò²¿ÉÒÔËæʱËæµØ·¢¶ÌÐŶԼà¿Øϵͳ½øÐÐÅäÖ㬷½±ã¹ÜÀí¡£
×÷ÕߣºÅí®x ÕÅÎÄÆÕ Ä²Óî·É ÖØÇìͨÐÅѧԺ À´Ô´£º»¥ÁªÍø