{"id":25,"date":"2025-08-09T12:26:46","date_gmt":"2025-08-09T04:26:46","guid":{"rendered":"https:\/\/lyuke.top\/wordpress\/?p=25"},"modified":"2025-08-09T12:35:47","modified_gmt":"2025-08-09T04:35:47","slug":"%e5%9f%ba%e4%ba%8erk3568%e7%9a%84%e5%a4%9a%e5%8a%9f%e8%83%bd%e8%a7%a6%e6%8e%a7%e5%ba%94%e7%94%a8%e7%b3%bb%e7%bb%9f%e5%bc%80%e5%8f%91%e5%ae%9e%e8%b7%b5","status":"publish","type":"post","link":"https:\/\/lyuke.top\/wordpress\/index.php\/2025\/08\/09\/%e5%9f%ba%e4%ba%8erk3568%e7%9a%84%e5%a4%9a%e5%8a%9f%e8%83%bd%e8%a7%a6%e6%8e%a7%e5%ba%94%e7%94%a8%e7%b3%bb%e7%bb%9f%e5%bc%80%e5%8f%91%e5%ae%9e%e8%b7%b5\/","title":{"rendered":"\u57fa\u4e8eRK3568\u7684\u591a\u529f\u80fd\u89e6\u63a7\u5e94\u7528\u7cfb\u7edf\u5f00\u53d1\u5b9e\u8df5"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"%E5%89%8D%E8%A8%80\">\u524d\u8a00<\/h2>\n\n\n\n<p>Github\u4ed3\u5e93\u5730\u5740\uff1a<a href=\"https:\/\/github.com\/Amireux0013\/RK3568_dmeo\">https:\/\/github.com\/Amireux0013\/RK3568_dmeo<\/a><\/p>\n\n\n\n<p>\u968f\u7740\u5d4c\u5165\u5f0f\u7cfb\u7edf\u5728\u5404\u884c\u5404\u4e1a\u7684\u5e7f\u6cdb\u5e94\u7528\uff0c\u57fa\u4e8eARM\u67b6\u6784\u7684\u9ad8\u6027\u80fd\u5f00\u53d1\u677f\u6210\u4e3a\u4e86\u5d4c\u5165\u5f0f\u5f00\u53d1\u7684\u4e3b\u6d41\u5e73\u53f0\u3002\u672c\u6587\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u4e00\u4e2a\u57fa\u4e8eRK3568\u5f00\u53d1\u677f\u7684\u591a\u529f\u80fd\u89e6\u63a7\u5e94\u7528\u7cfb\u7edf\u7684\u8bbe\u8ba1\u4e0e\u5b9e\u73b0\u8fc7\u7a0b\uff0c\u8be5\u7cfb\u7edf\u96c6\u6210\u4e86\u5199\u5b57\u677f\u3001\u56fe\u7247\u64ad\u653e\u5668\u548c\u97f3\u4e50\u64ad\u653e\u5668\u4e09\u5927\u529f\u80fd\u6a21\u5757\uff0c\u901a\u8fc7\u89e6\u6478\u5c4f\u5b9e\u73b0\u4eba\u673a\u4ea4\u4e92\u3002\u901a\u8fc7\u672c\u9879\u76ee\u7684\u5f00\u53d1\u5b9e\u8df5\uff0c\u5c55\u793a\u4e86\u5728\u5d4c\u5165\u5f0fLinux\u7cfb\u7edf\u5f00\u53d1\u3001\u8bbe\u5907\u9a71\u52a8\u64cd\u4f5c\u3001\u591a\u8fdb\u7a0b\u7ba1\u7406\u3001\u56fe\u5f62\u754c\u9762\u8bbe\u8ba1\u7b49\u65b9\u9762\u7684\u4e13\u4e1a\u6280\u80fd\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><div class='fancybox-wrapper lazyload-container-unload' data-fancybox='post-images' href='https:\/\/lyuke.top\/wordpress\/wp-content\/uploads\/2025\/08\/c34bf390bf12092f0f2cec592ee9046c-1024x768.jpeg'><img class=\"lazyload lazyload-style-1\" src=\"data:image\/svg+xml;base64,PCEtLUFyZ29uTG9hZGluZy0tPgo8c3ZnIHdpZHRoPSIxIiBoZWlnaHQ9IjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmZmZmMDAiPjxnPjwvZz4KPC9zdmc+\"  loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"768\" data-original=\"https:\/\/lyuke.top\/wordpress\/wp-content\/uploads\/2025\/08\/c34bf390bf12092f0f2cec592ee9046c-1024x768.jpeg\" src=\"data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAANSURBVBhXYzh8+PB\/AAffA0nNPuCLAAAAAElFTkSuQmCC\" alt=\"\" class=\"wp-image-26\"  sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E4%B8%80%E3%80%81%E7%B3%BB%E7%BB%9F%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1\">\u4e00\u3001\u7cfb\u7edf\u67b6\u6784\u8bbe\u8ba1<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1.1-%E7%A1%AC%E4%BB%B6%E5%B9%B3%E5%8F%B0\">1.1 \u786c\u4ef6\u5e73\u53f0<\/h3>\n\n\n\n<p>RK3568\u662f\u745e\u82af\u5fae\u63a8\u51fa\u7684\u4e00\u6b3e\u9ad8\u6027\u80fdARM Cortex-A55\u56db\u6838\u5904\u7406\u5668\uff0c\u4e3b\u9891\u9ad8\u8fbe2.0GHz\uff0c\u96c6\u6210\u4e86Mali-G52 GPU\uff0c\u652f\u63014K\u89c6\u9891\u7f16\u89e3\u7801\uff0c\u5177\u5907\u4e30\u5bcc\u7684\u5916\u8bbe\u63a5\u53e3\u3002\u672c\u9879\u76ee\u4f7f\u7528\u7684\u5f00\u53d1\u677f\u914d\u7f6e\u5982\u4e0b\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u5904\u7406\u5668\uff1aRK3568 (\u56db\u6838Cortex-A55\uff0c\u4e3b\u98912.0GHz)<\/li>\n\n\n\n<li>\u5185\u5b58\uff1a2GB LPDDR4<\/li>\n\n\n\n<li>\u5b58\u50a8\uff1a16GB eMMC + microSD\u5361\u6269\u5c55<\/li>\n\n\n\n<li>\u663e\u793a\uff1a7\u82f1\u5bf81024\u00d7600\u7535\u5bb9\u89e6\u6478\u5c4f<\/li>\n\n\n\n<li>\u97f3\u9891\uff1a\u5185\u7f6e\u97f3\u9891\u7f16\u89e3\u7801\u5668\uff0c\u652f\u6301\u626c\u58f0\u5668\u8f93\u51fa<\/li>\n\n\n\n<li>\u63a5\u53e3\uff1aUSB\u3001HDMI\u3001\u4ee5\u592a\u7f51\u3001GPIO\u7b49<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"1.2-%E8%BD%AF%E4%BB%B6%E6%9E%B6%E6%9E%84\">1.2 \u8f6f\u4ef6\u67b6\u6784<\/h3>\n\n\n\n<p>\u7cfb\u7edf\u91c7\u7528\u5206\u5c42\u8bbe\u8ba1\u601d\u60f3\uff0c\u81ea\u5e95\u5411\u4e0a\u5206\u4e3a\u4ee5\u4e0b\u51e0\u5c42\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u64cd\u4f5c\u7cfb\u7edf\u5c42<\/strong>\uff1a\u57fa\u4e8eLinux\u5185\u6838\u5b9a\u5236\uff0c\u63d0\u4f9b\u8bbe\u5907\u9a71\u52a8\u548c\u7cfb\u7edf\u670d\u52a1<\/li>\n\n\n\n<li><strong>\u8bbe\u5907\u9a71\u52a8\u5c42<\/strong>\uff1a\u5c01\u88c5LCD\u663e\u793a\u5c4f(\/dev\/fb0)\u548c\u89e6\u6478\u5c4f(\/dev\/input\/event2)\u7684\u5e95\u5c42\u64cd\u4f5c<\/li>\n\n\n\n<li><strong>\u57fa\u7840\u529f\u80fd\u5c42<\/strong>\uff1a\u5b9e\u73b0\u56fe\u5f62\u7ed8\u5236\u3001BMP\u56fe\u7247\u89e3\u6790\u3001\u89e6\u6478\u4e8b\u4ef6\u5904\u7406\u7b49\u57fa\u7840\u529f\u80fd<\/li>\n\n\n\n<li><strong>\u5e94\u7528\u529f\u80fd\u5c42<\/strong>\uff1a\u5b9e\u73b0\u5199\u5b57\u677f\u3001\u56fe\u7247\u64ad\u653e\u5668\u548c\u97f3\u4e50\u64ad\u653e\u5668\u4e09\u4e2a\u529f\u80fd\u6a21\u5757<\/li>\n\n\n\n<li><strong>\u7528\u6237\u754c\u9762\u5c42<\/strong>\uff1a\u63d0\u4f9b\u56fe\u5f62\u5316\u83dc\u5355\u548c\u4ea4\u4e92\u754c\u9762<\/li>\n<\/ol>\n\n\n\n<p>\u7cfb\u7edf\u91c7\u7528\u591a\u8fdb\u7a0b\u67b6\u6784\uff0c\u4e3b\u8fdb\u7a0b\u8d1f\u8d23\u83dc\u5355\u663e\u793a\u548c\u529f\u80fd\u5207\u6362\uff0c\u5404\u529f\u80fd\u6a21\u5757\u5728\u72ec\u7acb\u7684\u5b50\u8fdb\u7a0b\u4e2d\u8fd0\u884c\uff0c\u63d0\u9ad8\u4e86\u7cfb\u7edf\u7684\u7a33\u5b9a\u6027\u548c\u6a21\u5757\u5316\u7a0b\u5ea6\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E4%BA%8C%E3%80%81%E5%BA%95%E5%B1%82%E9%A9%B1%E5%8A%A8%E5%BC%80%E5%8F%91\">\u4e8c\u3001\u5e95\u5c42\u9a71\u52a8\u5f00\u53d1<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2.1-lcd%E9%A9%B1%E5%8A%A8%E6%93%8D%E4%BD%9C\">2.1 LCD\u9a71\u52a8\u64cd\u4f5c<\/h3>\n\n\n\n<p>\u5728\u5d4c\u5165\u5f0fLinux\u7cfb\u7edf\u4e2d\uff0cLCD\u663e\u793a\u901a\u5e38\u901a\u8fc7\u5e27\u7f13\u51b2\u8bbe\u5907\u6765\u5b9e\u73b0\u3002\u672c\u9879\u76ee\u76f4\u63a5\u64cd\u4f5c\/dev\/fb0\u8bbe\u5907\u6587\u4ef6\uff0c\u5b9e\u73b0\u5bf9\u663e\u793a\u5c4f\u7684\u63a7\u5236\u3002\u4ee5\u4e0b\u662fLCD\u521d\u59cb\u5316\u548c\u64cd\u4f5c\u7684\u6838\u5fc3\u4ee3\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/**\n * @brief \u6253\u5f00LCD\u5c4f\u5e55\u9a71\u52a8\n * @return \u6210\u529f\u8fd4\u56de\u6587\u4ef6\u63cf\u8ff0\u7b26, \u5931\u8d25\u8fd4\u56de-1\n *\/<\/em>\n<strong>int<\/strong> <strong>lcd_open<\/strong>(<strong>void<\/strong>)\n{\n    <strong>int<\/strong> lcd_fd = open(\"\/dev\/fb0\", O_RDWR);\n    <strong>if<\/strong> (lcd_fd == -1)\n    {\n        perror(\"open \/dev\/fb0 failed\");\n        <strong>return<\/strong> -1;\n    }\n    <strong>return<\/strong> lcd_fd;\n}\n<\/code><\/pre>\n\n\n\n<p>\u901a\u8fc7\u5bf9\u5e27\u7f13\u51b2\u533a\u7684\u76f4\u63a5\u8bfb\u5199\uff0c\u5b9e\u73b0\u4e86\u9ad8\u6548\u7684\u56fe\u5f62\u663e\u793a\u3002\u5728RK3568\u5e73\u53f0\u4e0a\uff0cLCD\u5206\u8fa8\u7387\u4e3a1024\u00d7600\uff0c\u6bcf\u4e2a\u50cf\u7d20\u5360\u75284\u5b57\u8282(ARGB\u683c\u5f0f)\uff0c\u56e0\u6b64\u5e27\u7f13\u51b2\u533a\u5927\u5c0f\u4e3a1024\u00d7600\u00d74\u5b57\u8282\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"2.2-%E8%A7%A6%E6%91%B8%E5%B1%8F%E9%A9%B1%E5%8A%A8%E6%93%8D%E4%BD%9C\">2.2 \u89e6\u6478\u5c4f\u9a71\u52a8\u64cd\u4f5c<\/h3>\n\n\n\n<p>\u89e6\u6478\u5c4f\u901a\u8fc7Linux\u8f93\u5165\u5b50\u7cfb\u7edf\u63d0\u4f9b\u7684\u4e8b\u4ef6\u63a5\u53e3(\/dev\/input\/event2)\u8fdb\u884c\u64cd\u4f5c\u3002\u7cfb\u7edf\u901a\u8fc7\u8bfb\u53d6\u8f93\u5165\u4e8b\u4ef6\uff0c\u83b7\u53d6\u89e6\u6478\u5750\u6807\u548c\u89e6\u6478\u72b6\u6001\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/**\n * @brief \u6253\u5f00\u89e6\u6478\u5c4f\u9a71\u52a8\n * @return \u6210\u529f\u8fd4\u56de\u6587\u4ef6\u63cf\u8ff0\u7b26, \u5931\u8d25\u8fd4\u56de-1\n *\/<\/em>\n<strong>int<\/strong> <strong>ts_open<\/strong>(<strong>void<\/strong>)\n{\n    <strong>int<\/strong> ts_fd = open(\"\/dev\/input\/event2\", O_RDWR);\n    <strong>if<\/strong> (ts_fd == -1)\n    {\n        perror(\"open \/dev\/input\/event2 failed\");\n        <strong>return<\/strong> -1;\n    }\n    <strong>return<\/strong> ts_fd;\n}\n\n<em>\/**\n * @brief \u83b7\u53d6\u89e6\u6478\u5c4f\u5750\u6807 \n * @param ts_fd \u89e6\u6478\u5c4f\u6587\u4ef6\u63cf\u8ff0\u7b26\n * @param x     \u7528\u4e8e\u5b58\u50a8x\u5750\u6807\u7684\u6307\u9488\n * @param y     \u7528\u4e8e\u5b58\u50a8y\u5750\u6807\u7684\u6307\u9488\n *\/<\/em>\n<strong>void<\/strong> <strong>get_xy<\/strong>(<strong>int<\/strong> ts_fd, <strong>int<\/strong> *x, <strong>int<\/strong> *y)\n{\n    <strong>struct<\/strong> <strong>input_event<\/strong> <strong>ts_buf<\/strong>;\n    <strong>int<\/strong> got_x = 0, got_y = 0;\n    <strong>while<\/strong> (1)\n    {\n        bzero(&amp;ts_buf, <strong>sizeof<\/strong>(ts_buf));\n        read(ts_fd, &amp;ts_buf, <strong>sizeof<\/strong>(ts_buf));\n        <strong>if<\/strong> (ts_buf.type == EV_ABS &amp;&amp; ts_buf.code == ABS_X)\n        {\n            *x = ts_buf.value;\n            got_x = 1;\n        }\n        <strong>if<\/strong> (ts_buf.type == EV_ABS &amp;&amp; ts_buf.code == ABS_Y)\n        {\n            *y = ts_buf.value;\n            got_y = 1;\n        }\n        <strong>if<\/strong> (ts_buf.type == EV_KEY &amp;&amp; ts_buf.code == BTN_TOUCH &amp;&amp; ts_buf.value == 0)\n        {\n            <strong>if<\/strong> (got_x &amp;&amp; got_y) <strong>break<\/strong>;\n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u91cc\u5b9e\u73b0\u4e86\u5bf9Linux\u8f93\u5165\u4e8b\u4ef6\u7684\u7cbe\u786e\u89e3\u6790\uff0c\u901a\u8fc7\u5224\u65ad\u4e8b\u4ef6\u7c7b\u578b(type)\u3001\u4e8b\u4ef6\u4ee3\u7801(code)\u548c\u4e8b\u4ef6\u503c(value)\uff0c\u51c6\u786e\u83b7\u53d6\u89e6\u6478\u5750\u6807\u548c\u89e6\u6478\u72b6\u6001\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E4%B8%89%E3%80%81%E5%9B%BE%E5%BD%A2%E6%98%BE%E7%A4%BA%E6%8A%80%E6%9C%AF\">\u4e09\u3001\u56fe\u5f62\u663e\u793a\u6280\u672f<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3.1-bmp%E5%9B%BE%E7%89%87%E8%A7%A3%E6%9E%90%E4%B8%8E%E6%98%BE%E7%A4%BA\">3.1 BMP\u56fe\u7247\u89e3\u6790\u4e0e\u663e\u793a<\/h3>\n\n\n\n<p>\u5728\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u56fe\u7247\u663e\u793a\u662f\u4e00\u4e2a\u5e38\u89c1\u9700\u6c42\u3002\u672c\u9879\u76ee\u5b9e\u73b0\u4e86BMP\u683c\u5f0f\u56fe\u7247\u7684\u89e3\u6790\u548c\u663e\u793a\u529f\u80fd\uff0c\u76f4\u63a5\u64cd\u4f5c\u50cf\u7d20\u6570\u636e\uff0c\u65e0\u9700\u4f9d\u8d56\u7b2c\u4e09\u65b9\u56fe\u5f62\u5e93\uff0c\u63d0\u9ad8\u4e86\u7cfb\u7edf\u6548\u7387\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/**\n * @brief \u5728\u6307\u5b9a\u4f4d\u7f6e\u663e\u793aBMP\u56fe\u7247 \n * @param bmp_path \u56fe\u7247\u8def\u5f84\n * @param x0, y0   \u663e\u793a\u7684\u8d77\u59cb\u5750\u6807\n * @param lcd_fd   LCD\u6587\u4ef6\u63cf\u8ff0\u7b26\n * @return \u6210\u529f\u8fd4\u56de0, \u5931\u8d25\u8fd4\u56de-1\n *\/<\/em>\n<strong>int<\/strong> <strong>show_bmp<\/strong>(<strong>const<\/strong> <strong>char<\/strong> *bmp_path, <strong>int<\/strong> x0, <strong>int<\/strong> y0, <strong>int<\/strong> lcd_fd)\n{\n    <strong>int<\/strong> bmp_fd = open(bmp_path, O_RDONLY);\n    <strong>if<\/strong> (bmp_fd == -1)\n    {\n        printf(\"open bmp %s error\\n\", bmp_path);\n        <strong>return<\/strong> -1;\n    }\n\n    <strong>unsigned<\/strong> <strong>char<\/strong> head&#91;54] = {0};\n    read(bmp_fd, head, 54);\n\n    <strong>int<\/strong> w = *((<strong>int<\/strong> *)&amp;head&#91;18]);\n    <strong>int<\/strong> h = *((<strong>int<\/strong> *)&amp;head&#91;22]);\n\n    <em>\/\/ \u8ba1\u7b97\u6bcf\u884c\u9700\u8981\u8865\u9f50\u7684\u5b57\u8282\u6570<\/em>\n    <strong>int<\/strong> line_padding = (4 - (w * 3) % 4) % 4;\n    <strong>int<\/strong> line_size = w * 3 + line_padding;\n    \n    <em>\/\/ \u8bfb\u53d6BMP\u50cf\u7d20\u6570\u636e<\/em>\n    <strong>unsigned<\/strong> <strong>char<\/strong> *bmp_data = malloc(line_size * h);\n    <strong>if<\/strong> (bmp_data == NULL) {\n        printf(\"malloc for bmp_data failed\\n\");\n        close(bmp_fd);\n        <strong>return<\/strong> -1;\n    }\n    lseek(bmp_fd, 54, SEEK_SET);\n    read(bmp_fd, bmp_data, line_size * h);\n    close(bmp_fd);\n\n    <em>\/\/ \u8f6c\u6362\u4e3aLCD\u50cf\u7d20\u683c\u5f0f<\/em>\n    <strong>int<\/strong> *lcd_buf = malloc(w * h * 4); \n    <strong>if<\/strong>(lcd_buf == NULL) {\n        printf(\"malloc for lcd_buf failed\\n\");\n        free(bmp_data);\n        <strong>return<\/strong> -1;\n    }\n    <strong>for<\/strong> (<strong>int<\/strong> y = 0; y &lt; h; y++)\n    {\n        <strong>for<\/strong> (<strong>int<\/strong> x = 0; x &lt; w; x++)\n        {\n            <strong>unsigned<\/strong> <strong>char<\/strong> b = bmp_data&#91;y * line_size + x * 3];\n            <strong>unsigned<\/strong> <strong>char<\/strong> g = bmp_data&#91;y * line_size + x * 3 + 1];\n            <strong>unsigned<\/strong> <strong>char<\/strong> r = bmp_data&#91;y * line_size + x * 3 + 2];\n            lcd_buf&#91;y * w + x] = (0x00 &lt;&lt; 24) | (r &lt;&lt; 16) | (g &lt;&lt; 8) | b;\n        }\n    }\n    free(bmp_data);\n    \n    <em>\/\/ \u5199\u5165LCD\u5e27\u7f13\u51b2\u533a<\/em>\n    lseek(lcd_fd, 0, SEEK_SET);\n    <strong>for<\/strong> (<strong>int<\/strong> y = 0; y &lt; h; y++)\n    {\n        <strong>if<\/strong> ((y0 + y) &gt;= 600) <strong>continue<\/strong>; \n        <strong>for<\/strong> (<strong>int<\/strong> x = 0; x &lt; w; x++)\n        {\n            <strong>if<\/strong> ((x0 + x) &gt;= 1024) <strong>continue<\/strong>;\n            lseek(lcd_fd, (1024 * (y0 + y) + (x0 + x)) * 4, SEEK_SET);\n            write(lcd_fd, &amp;lcd_buf&#91;(h - 1 - y) * w + x], 4);\n        }\n    }\n    \n    free(lcd_buf);\n    lseek(lcd_fd, 0, SEEK_SET); \n\n    <strong>return<\/strong> 0;\n}\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6bb5\u4ee3\u7801\u5c55\u793a\u4e86\u5bf9BMP\u6587\u4ef6\u683c\u5f0f\u7684\u6df1\u5165\u7406\u89e3\uff0c\u5305\u62ec\u6587\u4ef6\u5934\u89e3\u6790\u3001\u50cf\u7d20\u6570\u636e\u8bfb\u53d6\u3001\u989c\u8272\u683c\u5f0f\u8f6c\u6362\u548c\u663e\u793a\u4f4d\u7f6e\u8ba1\u7b97\u7b49\u3002\u7279\u522b\u6ce8\u610f\u7684\u662f\uff0cBMP\u56fe\u7247\u50cf\u7d20\u6570\u636e\u662f\u4ece\u4e0b\u5230\u4e0a\u3001\u4ece\u5de6\u5230\u53f3\u5b58\u50a8\u7684\uff0c\u800cLCD\u663e\u793a\u662f\u4ece\u4e0a\u5230\u4e0b\u3001\u4ece\u5de6\u5230\u53f3\uff0c\u56e0\u6b64\u5728\u663e\u793a\u65f6\u9700\u8981\u8fdb\u884c\u5750\u6807\u8f6c\u6362\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"3.2-%E5%9F%BA%E6%9C%AC%E5%9B%BE%E5%BD%A2%E7%BB%98%E5%88%B6\">3.2 \u57fa\u672c\u56fe\u5f62\u7ed8\u5236<\/h3>\n\n\n\n<p>\u9664\u4e86\u663e\u793aBMP\u56fe\u7247\u5916\uff0c\u7cfb\u7edf\u8fd8\u5b9e\u73b0\u4e86\u57fa\u672c\u56fe\u5f62\u7ed8\u5236\u529f\u80fd\uff0c\u5982\u70b9\u548c\u77e9\u5f62\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><em>\/**\n * @brief \u7ed8\u5236\u4e00\u4e2a\u5b9e\u5fc3\u77e9\u5f62\n *\/<\/em>\n<strong>void<\/strong> <strong>draw_rect<\/strong>(<strong>int<\/strong> lcd_fd, <strong>int<\/strong> x0, <strong>int<\/strong> y0, <strong>int<\/strong> w, <strong>int<\/strong> h, <strong>int<\/strong> color)\n{\n    <strong>int<\/strong> *rect_buf = malloc(w * h * 4);\n    <strong>if<\/strong> (!rect_buf) <strong>return<\/strong>;\n    \n    <strong>for<\/strong>(<strong>int<\/strong> i = 0; i &lt; w * h; i++) {\n        rect_buf&#91;i] = color;\n    }\n\n    <strong>for<\/strong> (<strong>int<\/strong> y = 0; y &lt; h; y++) {\n        <strong>if<\/strong> (y0 + y &gt;= 600) <strong>break<\/strong>;\n        lseek(lcd_fd, (1024 * (y0 + y) + x0) * 4, SEEK_SET);\n        write(lcd_fd, &amp;rect_buf&#91;y * w], w * 4);\n    }\n\n    free(rect_buf);\n}\n\n<em>\/\/ \u7ed8\u5236\u70b9\u51fd\u6570<\/em>\n<strong>void<\/strong> <strong>draw_point<\/strong>(<strong>int<\/strong> lcd_fd, <strong>int<\/strong> x, <strong>int<\/strong> y, <strong>int<\/strong> d)\n{\n    <strong>int<\/strong> color = 0x00FF0000; <em>\/\/ \u7ea2\u8272<\/em>\n    <strong>for<\/strong> (<strong>int<\/strong> m = y - d; m &lt;= y + d; m++)\n    {\n        <strong>for<\/strong> (<strong>int<\/strong> n = x - d; n &lt; x + d; n++)\n        {\n            <strong>if<\/strong> (m &gt;= 0 &amp;&amp; m &lt; 600 &amp;&amp; n &gt;= 0 &amp;&amp; n &lt; 1024)\n            {\n                lseek(lcd_fd, (1024 * m + n) * 4, SEEK_SET);\n                write(lcd_fd, &amp;color, 4);\n            }\n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u4e9b\u51fd\u6570\u901a\u8fc7\u76f4\u63a5\u64cd\u4f5c\u5e27\u7f13\u51b2\u533a\uff0c\u5b9e\u73b0\u4e86\u9ad8\u6548\u7684\u56fe\u5f62\u7ed8\u5236\u3002\u7279\u522b\u662f\u5728\u7ed8\u5236\u77e9\u5f62\u65f6\uff0c\u91c7\u7528\u4e86\u4e00\u6b21\u6027\u751f\u6210\u50cf\u7d20\u7f13\u51b2\u533a\uff0c\u7136\u540e\u6279\u91cf\u5199\u5165\u7684\u65b9\u5f0f\uff0c\u63d0\u9ad8\u4e86\u7ed8\u5236\u6548\u7387\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E5%9B%9B%E3%80%81%E5%8A%9F%E8%83%BD%E6%A8%A1%E5%9D%97%E5%AE%9E%E7%8E%B0\">\u56db\u3001\u529f\u80fd\u6a21\u5757\u5b9e\u73b0<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4.1-%E5%86%99%E5%AD%97%E6%9D%BF%E6%A8%A1%E5%9D%97\">4.1 \u5199\u5b57\u677f\u6a21\u5757<\/h3>\n\n\n\n<p>\u5199\u5b57\u677f\u6a21\u5757\u5b9e\u73b0\u4e86\u4e00\u4e2a\u7b80\u5355\u7684\u89e6\u6478\u7ed8\u56fe\u529f\u80fd\uff0c\u7528\u6237\u53ef\u4ee5\u5728\u5c4f\u5e55\u4e0a\u7528\u624b\u6307\u7ed8\u5236\u56fe\u5f62\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>void<\/strong> <strong>run_drawing_pad<\/strong>(<strong>int<\/strong> lcd_fd, <strong>int<\/strong> ts_fd){\n    printf(\"\u542f\u52a8 &#91;\u5199\u5b57\u677f] \u529f\u80fd...\\n\");\n\n    <em>\/\/ \u521d\u59cb\u5316\u767d\u8272\u80cc\u666f<\/em>\n    <strong>int<\/strong> white_buf&#91;1024 * 600];\n    <strong>for<\/strong> (<strong>int<\/strong> i = 0; i &lt; 1024 * 600; i++)\n    {\n        white_buf&#91;i] = 0X00FFFFFF;\n    }\n    lseek(lcd_fd, 0, SEEK_SET);\n    write(lcd_fd, white_buf, <strong>sizeof<\/strong>(white_buf));\n\n    <em>\/\/ \u5728\u53f3\u4e0a\u89d2\u753b\u4e00\u4e2a\u9000\u51fa\u6309\u94ae<\/em>\n    <strong>int<\/strong> gray_color = 0x00808080;\n    <strong>for<\/strong> (<strong>int<\/strong> y = 0; y &lt; 40; y++) {\n        <strong>for<\/strong> (<strong>int<\/strong> x = 984; x &lt; 1024; x++) {\n            white_buf&#91;1024 * y + x] = gray_color;\n        }\n    }\n    lseek(lcd_fd, 0, SEEK_SET);\n    write(lcd_fd, white_buf, <strong>sizeof<\/strong>(white_buf));\n    \n    flush_ts_events(ts_fd);\n\n    <em>\/\/ \u5904\u7406\u89e6\u6478\u4e8b\u4ef6<\/em>\n    <strong>struct<\/strong> <strong>input_event<\/strong> <strong>ts_buf<\/strong>;\n    <strong>int<\/strong> x = -1, y = -1;\n    <strong>int<\/strong> is_touching = 0; \n\n    <strong>while<\/strong> (1)\n    {\n        read(ts_fd, &amp;ts_buf, <strong>sizeof<\/strong>(ts_buf));\n        <strong>switch<\/strong>(ts_buf.type)\n        {\n            <strong>case<\/strong> EV_ABS: \n                <strong>if<\/strong> (ts_buf.code == ABS_X) {\n                    x = ts_buf.value;\n                } <strong>else<\/strong> <strong>if<\/strong> (ts_buf.code == ABS_Y) {\n                    y = ts_buf.value;\n                }\n                <strong>break<\/strong>;\n            \n            <strong>case<\/strong> EV_KEY: \n                <strong>if<\/strong> (ts_buf.code == BTN_TOUCH) {\n                    <strong>if<\/strong> (ts_buf.value == 1) { \n                        is_touching = 1;\n                    } <strong>else<\/strong> <strong>if<\/strong> (ts_buf.value == 0) { \n                        is_touching = 0;\n                        <em>\/\/ \u68c0\u67e5\u662f\u5426\u70b9\u51fb\u4e86\u9000\u51fa\u533a\u57df<\/em>\n                        <strong>if<\/strong> (x &gt; 984 &amp;&amp; y &lt; 40) {\n                            <strong>return<\/strong>;\n                        }\n                    }\n                }\n                <strong>break<\/strong>;\n\n            <strong>case<\/strong> EV_SYN: \n                <strong>if<\/strong> (ts_buf.code == SYN_REPORT) {\n                    <strong>if<\/strong> (is_touching) {\n                        <strong>if<\/strong> (x &gt;= 0 &amp;&amp; y &gt;= 0) {\n                            draw_point(lcd_fd, x, y, 5);\n                        }\n                    }\n                }\n                <strong>break<\/strong>;\n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6bb5\u4ee3\u7801\u5c55\u793a\u4e86\u5bf9Linux\u8f93\u5165\u4e8b\u4ef6\u7684\u7cbe\u786e\u5904\u7406\uff0c\u901a\u8fc7\u533a\u5206\u4e0d\u540c\u7c7b\u578b\u7684\u4e8b\u4ef6(EV_ABS\u3001EV_KEY\u3001EV_SYN)\uff0c\u5b9e\u73b0\u4e86\u89e6\u6478\u7ed8\u56fe\u529f\u80fd\u3002\u7279\u522b\u662f\u5bf9SYN_REPORT\u4e8b\u4ef6\u7684\u5904\u7406\uff0c\u786e\u4fdd\u4e86\u7ed8\u56fe\u7684\u5b9e\u65f6\u6027\u548c\u6d41\u7545\u6027\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4.2-%E5%9B%BE%E7%89%87%E6%92%AD%E6%94%BE%E5%99%A8%E6%A8%A1%E5%9D%97\">4.2 \u56fe\u7247\u64ad\u653e\u5668\u6a21\u5757<\/h3>\n\n\n\n<p>\u56fe\u7247\u64ad\u653e\u5668\u6a21\u5757\u5b9e\u73b0\u4e86\u81ea\u52a8\u5faa\u73af\u64ad\u653eBMP\u56fe\u7247\u7684\u529f\u80fd\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>void<\/strong> <strong>run_slideshow<\/strong>(<strong>int<\/strong> lcd_fd, <strong>int<\/strong> ts_fd)\n{\n    printf(\"\u542f\u52a8 &#91;\u5faa\u73af\u5207\u6362\u56fe\u7247] \u529f\u80fd...\\n\");\n    <strong>char<\/strong> bmp_path&#91;5]&#91;15] = {\"1.bmp\", \"dog.bmp\", \"small.bmp\", \"school1.bmp\", \"school2.bmp\"};\n    <strong>int<\/strong> i = 0;\n\n    fd_set rdfs;\n    <strong>struct<\/strong> <strong>timeval<\/strong> <strong>tv<\/strong>;\n    \n    flush_ts_events(ts_fd);\n\n    <strong>while<\/strong> (1)\n    {\n        show_bmp(bmp_path&#91;i], 0, 0, lcd_fd);\n        i = (i + 1) % 5;\n\n        tv.tv_sec = 1;\n        tv.tv_usec = 0;\n        \n        FD_ZERO(&amp;rdfs);\n        FD_SET(ts_fd, &amp;rdfs);\n\n        <strong>int<\/strong> ret = select(ts_fd + 1, &amp;rdfs, NULL, NULL, &amp;tv);\n        <strong>if<\/strong> (ret &gt; 0 &amp;&amp; FD_ISSET(ts_fd, &amp;rdfs))\n        {\n            printf(\"\u68c0\u6d4b\u5230\u89e6\u6478\uff0c\u9000\u51fa\u56fe\u7247\u5faa\u73af\u3002\\n\");\n            <strong>break<\/strong>; \n        }\n    }\n}\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6bb5\u4ee3\u7801\u5c55\u793a\u4e86\u5bf9select\u7cfb\u7edf\u8c03\u7528\u7684\u7075\u6d3b\u5e94\u7528\uff0c\u5b9e\u73b0\u4e86\u5b9a\u65f6\u5207\u6362\u56fe\u7247\u548c\u89e6\u6478\u68c0\u6d4b\u7684\u53cc\u91cd\u529f\u80fd\u3002\u901a\u8fc7\u8bbe\u7f6e\u8d85\u65f6\u65f6\u95f4\u4e3a1\u79d2\uff0c\u7cfb\u7edf\u6bcf\u79d2\u81ea\u52a8\u5207\u6362\u4e00\u6b21\u56fe\u7247\uff0c\u540c\u65f6\u76d1\u542c\u89e6\u6478\u4e8b\u4ef6\uff0c\u4e00\u65e6\u68c0\u6d4b\u5230\u89e6\u6478\uff0c\u7acb\u5373\u9000\u51fa\u64ad\u653e\u6a21\u5f0f\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"4.3-%E9%9F%B3%E4%B9%90%E6%92%AD%E6%94%BE%E5%99%A8%E6%A8%A1%E5%9D%97\">4.3 \u97f3\u4e50\u64ad\u653e\u5668\u6a21\u5757<\/h3>\n\n\n\n<p>\u97f3\u4e50\u64ad\u653e\u5668\u6a21\u5757\u662f\u7cfb\u7edf\u4e2d\u6700\u590d\u6742\u7684\u90e8\u5206\uff0c\u5b83\u901a\u8fc7\u8c03\u7528\u5916\u90e8\u7a0b\u5e8fmplayer\u5b9e\u73b0MP3\u97f3\u4e50\u64ad\u653e\uff0c\u5e76\u901a\u8fc7\u547d\u540d\u7ba1\u9053(FIFO)\u5b9e\u73b0\u4e0emplayer\u7684\u901a\u4fe1\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>void<\/strong> <strong>run_music_player<\/strong>(<strong>int<\/strong> lcd_fd, <strong>int<\/strong> ts_fd)\n{\n    printf(\"\u542f\u52a8 &#91;\u97f3\u4e50\u64ad\u653e\u5668] \u529f\u80fd...\\n\");\n    show_bmp(\".\/music_pic.bmp\", 0, 0, lcd_fd);\n    \n    unlink(\"pipe\"); \n    <strong>if<\/strong> (mkfifo(\"pipe\", 0666) == -1) {\n        perror(\"mkfifo failed\");\n        <strong>return<\/strong>;\n    }\n\n    <strong>int<\/strong> music_vol = 100;\n    <strong>int<\/strong> x, y;\n    <strong>pid_t<\/strong> mplayer_pid = -1; \n\n    flush_ts_events(ts_fd); \n\n    <strong>while<\/strong> (1)\n    {\n        mplayer_pid = fork();\n        <strong>if<\/strong> (mplayer_pid == 0) \n        {\n            printf(\"\u5b50\u8fdb\u7a0b(mplayer)\u542f\u52a8\u4e2d, PID: %d\\n\", getpid());\n            execlp(\"mplayer\", \"mplayer\", \"-slave\", \"-quiet\", \"-input\", \"file=.\/pipe\", \"-ao\", \"alsa:device=hw=0.0\", music_name&#91;music_num], NULL);\n            perror(\"execlp mplayer failed\");\n            exit(1);\n        }\n        <strong>else<\/strong> <strong>if<\/strong> (mplayer_pid &gt; 0) \n        {\n            printf(\"\u7236\u8fdb\u7a0b(\u63a7\u5236)\u8fd0\u884c\u4e2d, PID: %d, mplayer PID: %d\\n\", getpid(), mplayer_pid);\n            usleep(500000); \n            <strong>int<\/strong> pipe_fd = open(\".\/pipe\", O_WRONLY);\n            <strong>if<\/strong> (pipe_fd == -1)\n            {\n                perror(\"open pipe failed\");\n                kill(mplayer_pid, SIGKILL); \n                <strong>break<\/strong>;\n            }\n\n            <strong>int<\/strong> should_exit_player = 0;\n            <strong>while<\/strong> (!should_exit_player)\n            {\n                get_xy(ts_fd, &amp;x, &amp;y);\n                printf(\"\u89e6\u6478\u5750\u6807: (%d, %d)\\n\", x, y);\n                \n                <em>\/\/ \u5904\u7406\u5404\u79cd\u89e6\u6478\u63a7\u5236<\/em>\n                <em>\/\/ \u6682\u505c\/\u64ad\u653e<\/em>\n                <strong>if<\/strong> (x &gt; 297 &amp;&amp; x &lt; 402 &amp;&amp; y &gt; 194 &amp;&amp; y &lt; 317)\n                {\n                    printf(\"\u6307\u4ee4: \u6682\u505c\/\u64ad\u653e\\n\");\n                    send_pcm(pipe_fd, \"pause\\n\");\n                }\n                <em>\/\/ \u5176\u4ed6\u63a7\u5236\u4ee3\u7801...<\/em>\n            }\n            close(pipe_fd);\n            <strong>if<\/strong> (should_exit_player) <strong>break<\/strong>;\n        }\n    }\n    unlink(\"pipe\"); \n}\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6bb5\u4ee3\u7801\u5c55\u793a\u4e86\u5bf9\u8fdb\u7a0b\u63a7\u5236\u3001\u8fdb\u7a0b\u95f4\u901a\u4fe1\u548c\u5916\u90e8\u7a0b\u5e8f\u8c03\u7528\u7684\u6df1\u5165\u7406\u89e3\u3002\u901a\u8fc7fork()\u521b\u5efa\u5b50\u8fdb\u7a0b\u8fd0\u884cmplayer\uff0c\u901a\u8fc7\u547d\u540d\u7ba1\u9053\u53d1\u9001\u63a7\u5236\u547d\u4ee4\uff0c\u5b9e\u73b0\u4e86\u5bf9\u97f3\u4e50\u64ad\u653e\u7684\u7cbe\u786e\u63a7\u5236\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E4%BA%94%E3%80%81%E5%A4%9A%E8%BF%9B%E7%A8%8B%E7%AE%A1%E7%90%86\">\u4e94\u3001\u591a\u8fdb\u7a0b\u7ba1\u7406<\/h2>\n\n\n\n<p>\u7cfb\u7edf\u91c7\u7528\u591a\u8fdb\u7a0b\u67b6\u6784\uff0c\u4e3b\u8fdb\u7a0b\u8d1f\u8d23\u83dc\u5355\u663e\u793a\u548c\u529f\u80fd\u5207\u6362\uff0c\u5404\u529f\u80fd\u6a21\u5757\u5728\u72ec\u7acb\u7684\u5b50\u8fdb\u7a0b\u4e2d\u8fd0\u884c\u3002\u8fd9\u79cd\u8bbe\u8ba1\u63d0\u9ad8\u4e86\u7cfb\u7edf\u7684\u7a33\u5b9a\u6027\u548c\u6a21\u5757\u5316\u7a0b\u5ea6\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>int<\/strong> <strong>main<\/strong>()\n{\n    <strong>int<\/strong> lcd_fd = lcd_open();\n    <strong>if<\/strong> (lcd_fd &lt; 0) <strong>return<\/strong> -1;\n\n    <strong>int<\/strong> ts_fd = ts_open();\n    <strong>if<\/strong> (ts_fd &lt; 0) {\n        close(lcd_fd);\n        <strong>return<\/strong> -1;\n    }\n\n    <strong>while<\/strong> (1)\n    {\n        draw_main_menu(lcd_fd);\n\n        <strong>int<\/strong> x, y;\n        get_xy(ts_fd, &amp;x, &amp;y);\n        printf(\"\u4e3b\u83dc\u5355\u89e6\u6478\u5750\u6807: (%d, %d)\\n\", x, y);\n\n        <strong>pid_t<\/strong> pid = -1;\n        \n        <em>\/\/ \u5199\u5b57\u677f\u529f\u80fd<\/em>\n        <strong>if<\/strong> (x &gt; 112 &amp;&amp; x &lt; 412 &amp;&amp; y &gt; 100 &amp;&amp; y &lt; 280) {\n            pid = fork();\n            <strong>if<\/strong> (pid == 0) { \n                run_drawing_pad(lcd_fd, ts_fd);\n                exit(0); \n            }\n        }\n        <em>\/\/ \u56fe\u7247\u64ad\u653e\u5668\u529f\u80fd<\/em>\n        <strong>else<\/strong> <strong>if<\/strong> (x &gt; 612 &amp;&amp; x &lt; 912 &amp;&amp; y &gt; 100 &amp;&amp; y &lt; 280) {\n            pid = fork();\n            <strong>if<\/strong> (pid == 0) { \n                run_slideshow(lcd_fd, ts_fd);\n                exit(0); \n            }\n        }\n        <em>\/\/ \u97f3\u4e50\u64ad\u653e\u5668\u529f\u80fd<\/em>\n        <strong>else<\/strong> <strong>if<\/strong> (x &gt; 112 &amp;&amp; x &lt; 412 &amp;&amp; y &gt; 320 &amp;&amp; y &lt; 500) {\n            pid = fork();\n            <strong>if<\/strong> (pid == 0) { \n                run_music_player(lcd_fd, ts_fd);\n                exit(0); \n            }\n        }\n        <em>\/\/ \u9000\u51fa\u7a0b\u5e8f<\/em>\n        <strong>else<\/strong> <strong>if<\/strong> (x &gt; 612 &amp;&amp; x &lt; 912 &amp;&amp; y &gt; 320 &amp;&amp; y &lt; 500) {\n            printf(\"\u7a0b\u5e8f\u9000\u51fa\u3002\\n\");\n            <strong>break<\/strong>; \n        }\n\n        <em>\/\/ \u7b49\u5f85\u5b50\u8fdb\u7a0b\u9000\u51fa<\/em>\n        <strong>if<\/strong> (pid &gt; 0) {\n            wait(NULL); \n            printf(\"\u5b50\u8fdb\u7a0b\u5df2\u9000\u51fa, \u8fd4\u56de\u4e3b\u83dc\u5355\u3002\\n\");\n        } <strong>else<\/strong> <strong>if<\/strong> (pid == -1 &amp;&amp; (x &gt; 112 &amp;&amp; x &lt; 912)) { \n             perror(\"fork failed\");\n        }\n    }\n\n    <em>\/\/ \u6e05\u5c4f\u5e76\u5173\u95ed\u8bbe\u5907<\/em>\n    draw_rect(lcd_fd, 0, 0, 1024, 600, 0x00000000);\n    close(lcd_fd);\n    close(ts_fd);\n\n    <strong>return<\/strong> 0;\n}\n<\/code><\/pre>\n\n\n\n<p>\u8fd9\u6bb5\u4ee3\u7801\u5c55\u793a\u4e86\u5bf9\u591a\u8fdb\u7a0b\u7f16\u7a0b\u7684\u6df1\u5165\u7406\u89e3\uff0c\u901a\u8fc7fork()\u521b\u5efa\u5b50\u8fdb\u7a0b\uff0c\u901a\u8fc7wait()\u7b49\u5f85\u5b50\u8fdb\u7a0b\u9000\u51fa\uff0c\u5b9e\u73b0\u4e86\u529f\u80fd\u6a21\u5757\u7684\u72ec\u7acb\u8fd0\u884c\u548c\u8d44\u6e90\u56de\u6536\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E5%85%AD%E3%80%81%E6%8A%80%E6%9C%AF%E9%9A%BE%E7%82%B9%E4%B8%8E%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88\">\u516d\u3001\u6280\u672f\u96be\u70b9\u4e0e\u89e3\u51b3\u65b9\u6848<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"6.1-%E5%B8%A7%E7%BC%93%E5%86%B2%E5%8C%BA%E6%93%8D%E4%BD%9C%E4%BC%98%E5%8C%96\">6.1 \u5e27\u7f13\u51b2\u533a\u64cd\u4f5c\u4f18\u5316<\/h3>\n\n\n\n<p>\u5728\u5d4c\u5165\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u663e\u793a\u6027\u80fd\u662f\u4e00\u4e2a\u5173\u952e\u6307\u6807\u3002\u672c\u9879\u76ee\u901a\u8fc7\u4ee5\u4e0b\u65b9\u5f0f\u4f18\u5316\u4e86\u5e27\u7f13\u51b2\u533a\u64cd\u4f5c\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u6279\u91cf\u5199\u5165<\/strong>\uff1a\u5728\u7ed8\u5236\u77e9\u5f62\u7b49\u5927\u9762\u79ef\u56fe\u5f62\u65f6\uff0c\u5148\u5728\u5185\u5b58\u4e2d\u751f\u6210\u50cf\u7d20\u7f13\u51b2\u533a\uff0c\u7136\u540e\u4e00\u6b21\u6027\u5199\u5165\u5e27\u7f13\u51b2\u533a\uff0c\u51cf\u5c11\u4e86I\/O\u64cd\u4f5c\u6b21\u6570\u3002<\/li>\n\n\n\n<li><strong>\u5c40\u90e8\u66f4\u65b0<\/strong>\uff1a\u5728\u66f4\u65b0\u663e\u793a\u5185\u5bb9\u65f6\uff0c\u53ea\u66f4\u65b0\u53d8\u5316\u7684\u90e8\u5206\uff0c\u800c\u4e0d\u662f\u6574\u4e2a\u5c4f\u5e55\uff0c\u51cf\u5c11\u4e86\u6570\u636e\u4f20\u8f93\u91cf\u3002<\/li>\n\n\n\n<li><strong>\u5185\u5b58\u6620\u5c04<\/strong>\uff1a\u867d\u7136\u672c\u9879\u76ee\u4f7f\u7528\u4e86read\/write\u7cfb\u7edf\u8c03\u7528\u64cd\u4f5c\u5e27\u7f13\u51b2\u533a\uff0c\u4f46\u5728\u5b9e\u9645\u4ea7\u54c1\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528mmap\u5c06\u5e27\u7f13\u51b2\u533a\u6620\u5c04\u5230\u8fdb\u7a0b\u5730\u5740\u7a7a\u95f4\uff0c\u8fdb\u4e00\u6b65\u63d0\u9ad8\u6027\u80fd\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"6.2-%E8%A7%A6%E6%91%B8%E4%BA%8B%E4%BB%B6%E5%A4%84%E7%90%86\">6.2 \u89e6\u6478\u4e8b\u4ef6\u5904\u7406<\/h3>\n\n\n\n<p>\u89e6\u6478\u4e8b\u4ef6\u5904\u7406\u662f\u4ea4\u4e92\u7cfb\u7edf\u7684\u6838\u5fc3\u3002\u672c\u9879\u76ee\u5b9e\u73b0\u4e86\u5b8c\u6574\u7684\u89e6\u6478\u4e8b\u4ef6\u5904\u7406\u6d41\u7a0b\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u4e8b\u4ef6\u89e3\u6790<\/strong>\uff1a\u51c6\u786e\u89e3\u6790Linux\u8f93\u5165\u4e8b\u4ef6\uff0c\u533a\u5206\u4e0d\u540c\u7c7b\u578b\u7684\u4e8b\u4ef6(EV_ABS\u3001EV_KEY\u3001EV_SYN)\u3002<\/li>\n\n\n\n<li><strong>\u5750\u6807\u8f6c\u6362<\/strong>\uff1a\u5c06\u89e6\u6478\u5c4f\u5750\u6807\u7cfb\u8f6c\u6362\u4e3aLCD\u663e\u793a\u5750\u6807\u7cfb\u3002<\/li>\n\n\n\n<li><strong>\u4e8b\u4ef6\u7f13\u51b2\u533a\u6e05\u7a7a<\/strong>\uff1a\u5728\u529f\u80fd\u5207\u6362\u65f6\uff0c\u6e05\u7a7a\u89e6\u6478\u4e8b\u4ef6\u7f13\u51b2\u533a\uff0c\u907f\u514d\u6b8b\u7559\u4e8b\u4ef6\u5f71\u54cd\u65b0\u529f\u80fd\u7684\u4f7f\u7528\u3002<\/li>\n\n\n\n<li><strong>\u975e\u963b\u585e\u6a21\u5f0f<\/strong>\uff1a\u5728\u9700\u8981\u7684\u573a\u666f\u4e0b\uff0c\u4f7f\u7528\u975e\u963b\u585e\u6a21\u5f0f\u8bfb\u53d6\u89e6\u6478\u4e8b\u4ef6\uff0c\u63d0\u9ad8\u7cfb\u7edf\u54cd\u5e94\u6027\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"6.3-%E8%BF%9B%E7%A8%8B%E9%97%B4%E9%80%9A%E4%BF%A1\">6.3 \u8fdb\u7a0b\u95f4\u901a\u4fe1<\/h3>\n\n\n\n<p>\u5728\u97f3\u4e50\u64ad\u653e\u5668\u6a21\u5757\u4e2d\uff0c\u9700\u8981\u4e0e\u5916\u90e8\u7a0b\u5e8fmplayer\u8fdb\u884c\u901a\u4fe1\u3002\u672c\u9879\u76ee\u4f7f\u7528\u547d\u540d\u7ba1\u9053(FIFO)\u5b9e\u73b0\u4e86\u8fdb\u7a0b\u95f4\u901a\u4fe1\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u521b\u5efa\u547d\u540d\u7ba1\u9053<\/strong>\uff1a\u4f7f\u7528mkfifo\u521b\u5efa\u547d\u540d\u7ba1\u9053\u3002<\/li>\n\n\n\n<li><strong>\u53d1\u9001\u63a7\u5236\u547d\u4ee4<\/strong>\uff1a\u901a\u8fc7\u5411\u547d\u540d\u7ba1\u9053\u5199\u5165\u6587\u672c\u547d\u4ee4\uff0c\u63a7\u5236mplayer\u7684\u884c\u4e3a\u3002<\/li>\n\n\n\n<li><strong>\u8d44\u6e90\u6e05\u7406<\/strong>\uff1a\u5728\u9000\u51fa\u65f6\uff0c\u4f7f\u7528unlink\u5220\u9664\u547d\u540d\u7ba1\u9053\u6587\u4ef6\uff0c\u907f\u514d\u8d44\u6e90\u6cc4\u6f0f\u3002<\/li>\n<\/ol>\n\n\n\n<p>\u8fd9\u79cd\u65b9\u5f0f\u7b80\u5355\u9ad8\u6548\uff0c\u9002\u5408\u5d4c\u5165\u5f0f\u7cfb\u7edf\u7684\u8d44\u6e90\u9650\u5236\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E4%B8%83%E3%80%81%E9%A1%B9%E7%9B%AE%E4%BA%AE%E7%82%B9\">\u4e03\u3001\u9879\u76ee\u4eae\u70b9<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"7.1-%E6%97%A0%E4%BE%9D%E8%B5%96%E8%AE%BE%E8%AE%A1\">7.1 \u65e0\u4f9d\u8d56\u8bbe\u8ba1<\/h3>\n\n\n\n<p>\u672c\u9879\u76ee\u76f4\u63a5\u64cd\u4f5c\u5e95\u5c42\u8bbe\u5907\u9a71\u52a8\uff0c\u4e0d\u4f9d\u8d56\u7b2c\u4e09\u65b9\u56fe\u5f62\u5e93\u548c\u591a\u5a92\u4f53\u5e93(\u9664\u4e86mplayer)\uff0c\u5177\u6709\u4ee5\u4e0b\u4f18\u52bf\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u7cfb\u7edf\u8d44\u6e90\u5360\u7528\u4f4e<\/strong>\uff1a\u9002\u5408\u8d44\u6e90\u53d7\u9650\u7684\u5d4c\u5165\u5f0f\u7cfb\u7edf\u3002<\/li>\n\n\n\n<li><strong>\u542f\u52a8\u901f\u5ea6\u5feb<\/strong>\uff1a\u65e0\u9700\u52a0\u8f7d\u5927\u578b\u5e93\uff0c\u542f\u52a8\u65f6\u95f4\u77ed\u3002<\/li>\n\n\n\n<li><strong>\u5b9a\u5236\u6027\u5f3a<\/strong>\uff1a\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u9700\u6c42\u5b9a\u5236\u529f\u80fd\uff0c\u4e0d\u53d7\u7b2c\u4e09\u65b9\u5e93\u7684\u9650\u5236\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"7.2-%E6%A8%A1%E5%9D%97%E5%8C%96%E6%9E%B6%E6%9E%84\">7.2 \u6a21\u5757\u5316\u67b6\u6784<\/h3>\n\n\n\n<p>\u7cfb\u7edf\u91c7\u7528\u6a21\u5757\u5316\u8bbe\u8ba1\uff0c\u5404\u529f\u80fd\u6a21\u5757\u5728\u72ec\u7acb\u7684\u5b50\u8fdb\u7a0b\u4e2d\u8fd0\u884c\uff0c\u5177\u6709\u4ee5\u4e0b\u4f18\u52bf\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u7a33\u5b9a\u6027\u9ad8<\/strong>\uff1a\u4e00\u4e2a\u6a21\u5757\u7684\u5d29\u6e83\u4e0d\u4f1a\u5f71\u54cd\u5176\u4ed6\u6a21\u5757\u548c\u4e3b\u7a0b\u5e8f\u3002<\/li>\n\n\n\n<li><strong>\u53ef\u6269\u5c55\u6027\u5f3a<\/strong>\uff1a\u53ef\u4ee5\u65b9\u4fbf\u5730\u6dfb\u52a0\u65b0\u529f\u80fd\u6a21\u5757\uff0c\u800c\u4e0d\u5f71\u54cd\u73b0\u6709\u529f\u80fd\u3002<\/li>\n\n\n\n<li><strong>\u5f00\u53d1\u6548\u7387\u9ad8<\/strong>\uff1a\u4e0d\u540c\u6a21\u5757\u53ef\u4ee5\u7531\u4e0d\u540c\u5f00\u53d1\u8005\u5e76\u884c\u5f00\u53d1\uff0c\u63d0\u9ad8\u56e2\u961f\u6548\u7387\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"7.3-%E8%B5%84%E6%BA%90%E7%AE%A1%E7%90%86\">7.3 \u8d44\u6e90\u7ba1\u7406<\/h3>\n\n\n\n<p>\u7cfb\u7edf\u6ce8\u91cd\u8d44\u6e90\u7ba1\u7406\uff0c\u907f\u514d\u5185\u5b58\u6cc4\u6f0f\u548c\u8d44\u6e90\u6d6a\u8d39\uff1a<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>\u5185\u5b58\u5206\u914d\u4e0e\u91ca\u653e<\/strong>\uff1a\u6bcf\u6b21malloc\u540e\u90fd\u6709\u5bf9\u5e94\u7684free\uff0c\u907f\u514d\u5185\u5b58\u6cc4\u6f0f\u3002<\/li>\n\n\n\n<li><strong>\u6587\u4ef6\u63cf\u8ff0\u7b26\u7ba1\u7406<\/strong>\uff1a\u53ca\u65f6\u5173\u95ed\u4e0d\u518d\u4f7f\u7528\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26\uff0c\u907f\u514d\u8d44\u6e90\u8017\u5c3d\u3002<\/li>\n\n\n\n<li><strong>\u8fdb\u7a0b\u7ba1\u7406<\/strong>\uff1a\u4f7f\u7528wait\u7b49\u5f85\u5b50\u8fdb\u7a0b\u9000\u51fa\uff0c\u907f\u514d\u50f5\u5c38\u8fdb\u7a0b\u3002<\/li>\n\n\n\n<li><strong>\u4fe1\u53f7\u5904\u7406<\/strong>\uff1a\u5728\u9700\u8981\u7684\u573a\u666f\u4e0b\uff0c\u4f7f\u7528kill\u53d1\u9001\u4fe1\u53f7\u7ec8\u6b62\u5b50\u8fdb\u7a0b\u3002<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E4%B9%9D%E3%80%81%E6%80%BB%E7%BB%93\">\u516b\u3001\u603b\u7ed3<\/h2>\n\n\n\n<p>\u672c\u9879\u76ee\u5c55\u793a\u4e86\u5728\u5d4c\u5165\u5f0fLinux\u7cfb\u7edf\u4e0a\u5f00\u53d1\u591a\u529f\u80fd\u89e6\u63a7\u5e94\u7528\u7684\u5b8c\u6574\u8fc7\u7a0b\uff0c\u6db5\u76d6\u4e86\u8bbe\u5907\u9a71\u52a8\u64cd\u4f5c\u3001\u56fe\u5f62\u663e\u793a\u3001\u89e6\u6478\u63a7\u5236\u3001\u591a\u8fdb\u7a0b\u7ba1\u7406\u7b49\u591a\u4e2a\u6280\u672f\u9886\u57df\u3002\u901a\u8fc7\u76f4\u63a5\u64cd\u4f5c\u5e95\u5c42\u8bbe\u5907\u9a71\u52a8\uff0c\u5b9e\u73b0\u4e86\u9ad8\u6548\u7684\u56fe\u5f62\u663e\u793a\u548c\u89e6\u6478\u63a7\u5236\uff1b\u901a\u8fc7\u591a\u8fdb\u7a0b\u67b6\u6784\uff0c\u5b9e\u73b0\u4e86\u529f\u80fd\u6a21\u5757\u7684\u72ec\u7acb\u8fd0\u884c\u548c\u7a33\u5b9a\u6027\u4fdd\u969c\uff1b\u901a\u8fc7\u547d\u540d\u7ba1\u9053\u7b49IPC\u673a\u5236\uff0c\u5b9e\u73b0\u4e86\u4e0e\u5916\u90e8\u7a0b\u5e8f\u7684\u901a\u4fe1\u548c\u63a7\u5236\u3002<\/p>\n\n\n\n<p>\u8fd9\u4e9b\u6280\u672f\u5728\u5d4c\u5165\u5f0f\u7cfb\u7edf\u5f00\u53d1\u4e2d\u5177\u6709\u5e7f\u6cdb\u7684\u5e94\u7528\u4ef7\u503c\uff0c\u53ef\u4ee5\u7528\u4e8e\u5de5\u4e1a\u63a7\u5236\u3001\u667a\u80fd\u5bb6\u5c45\u3001\u533b\u7597\u8bbe\u5907\u7b49\u591a\u4e2a\u9886\u57df\u3002\u901a\u8fc7\u672c\u9879\u76ee\u7684\u5f00\u53d1\u5b9e\u8df5\uff0c\u4e0d\u4ec5\u638c\u63e1\u4e86\u5d4c\u5165\u5f0fLinux\u7cfb\u7edf\u5f00\u53d1\u7684\u6838\u5fc3\u6280\u80fd\uff0c\u8fd8\u79ef\u7d2f\u4e86\u4e30\u5bcc\u7684\u5b9e\u6218\u7ecf\u9a8c\uff0c\u4e3a\u672a\u6765\u66f4\u590d\u6742\u7684\u5d4c\u5165\u5f0f\u7cfb\u7edf\u5f00\u53d1\u5960\u5b9a\u4e86\u575a\u5b9e\u57fa\u7840\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"%E4%BD%9C%E8%80%85%E4%BF%A1%E6%81%AF\">\u4f5c\u8005\u4fe1\u606f<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f5c\u8005\uff1a\u5415\u73c2<\/li>\n\n\n\n<li>\u90ae\u7bb1\uff1aamireux.00@qq.com<\/li>\n\n\n\n<li>\u7248\u672c\uff1av2.1<\/li>\n\n\n\n<li>\u65e5\u671f\uff1a2025-06-12<\/li>\n\n\n\n<li>\u9879\u76ee\u96c6\u5408\u5730\u5740\uff1a<a href=\"https:\/\/lyuke.top\/mypoject\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/lyuke.top\/mypoject<\/a><\/li>\n\n\n\n<li>\u4e2a\u4eba\u7b80\u5386\u5730\u5740\uff1a<a href=\"https:\/\/jianli.lyuke.top\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/jianli.lyuke.top\/<\/a><\/li>\n\n\n\n<li>\u4e2a\u4eba\u4e3b\u9875\u5730\u5740\uff1a<a href=\"https:\/\/lyuke.top\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/lyuke.top\/<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 Github\u4ed3\u5e93\u5730\u5740\uff1ahttps:\/\/github.com\/Amireux0013\/RK3568_dme [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-25","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/lyuke.top\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/25","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lyuke.top\/wordpress\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lyuke.top\/wordpress\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lyuke.top\/wordpress\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lyuke.top\/wordpress\/index.php\/wp-json\/wp\/v2\/comments?post=25"}],"version-history":[{"count":4,"href":"https:\/\/lyuke.top\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/25\/revisions"}],"predecessor-version":[{"id":30,"href":"https:\/\/lyuke.top\/wordpress\/index.php\/wp-json\/wp\/v2\/posts\/25\/revisions\/30"}],"wp:attachment":[{"href":"https:\/\/lyuke.top\/wordpress\/index.php\/wp-json\/wp\/v2\/media?parent=25"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lyuke.top\/wordpress\/index.php\/wp-json\/wp\/v2\/categories?post=25"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lyuke.top\/wordpress\/index.php\/wp-json\/wp\/v2\/tags?post=25"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}