{"id":213775,"date":"2014-02-25T11:02:03","date_gmt":"2014-02-25T07:02:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=213775"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=213775","title":{"rendered":"<span class=\"post_title\">\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0434\u043b\u044f LCD \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u043f\u043e\u0434 embedded linux<\/span>"},"content":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f linux \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u0446\u0432\u0435\u0442\u043d\u043e\u0433\u043e \u0434\u0438\u0441\u043f\u043b\u0435\u044f 320\u0445240 \u043e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f Newhavendisplays, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e NHD-5.7-320240WFB-CTXI-T1 \u043f\u043e\u0434 embedded linux. \u0418\u0434\u0435\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0441\u043e\u0437\u0440\u0435\u043b\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043f\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e framebufer(FB) \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u043c\u043d\u043e\u0433\u043e, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435. \u041c\u043e\u0434\u0443\u043b\u044c \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043f\u043e\u0434 \u0441\u0430\u043c\u043e\u0435 \u043d\u043e\u0432\u043e\u0435 \u044f\u0434\u0440\u043e(2.6.30), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e, \u0447\u0442\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445 FB \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u0441 \u0442\u0435\u0445 \u043f\u043e\u0440. \u041d\u043e, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u043c\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0443\u0440\u043e\u0432\u043d\u044f \u044f\u0434\u0440\u0430 linux. \u041d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044e, \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0449\u0435 \u0438 \u0438\u0437\u044f\u0449\u043d\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f. <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/bb2\/e11\/475\/bb2e11475d3dd1002c56f188c932a100.jpg\"\/> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/6b2\/278\/4da\/6b22784da00350740c2fd3e098c37e34.jpg\"\/><\/p>\n<p>  <a name=\"habracut\"><\/a><\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u0438\u0441\u0442\u043e\u0440\u0438\u044f<\/b><\/p>\n<p>  \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u0441\u0442\u043e\u044f\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0434\u0440\u0430\u0439\u0432\u0435\u0440, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u0441\u0442\u0432 \u0442\u0438\u043f\u0430 QT embedded, \u0447\u0442\u043e\u0431\u044b \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0438\u0442\u043e\u0433\u0435 \u0441\u043e\u043e\u0440\u0443\u0434\u0438\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043c\u0435\u043d\u044e\u0448\u043a\u0443 \u0441 \u0438\u043a\u043e\u043d\u043a\u0430\u043c\u0438 \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u043c \u0434\u043b\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0441 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c. \u041f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u043e\u0439 \u0441\u043b\u0443\u0436\u0438\u043b\u0430 \u043f\u043b\u0430\u0442\u043a\u0430 \u043d\u0430 AT91SAM9G45, a \u0442\u043e\u0447\u043d\u0435\u0435 <a href=\"http:\/\/www.armdevs.com\/IPC-SAM9G45.html\">www.armdevs.com\/IPC-SAM9G45.html<\/a><br \/>  \u0421\u0442\u0440\u0438\u043c\u0438\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u043d\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c. AT91SAM9G45 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0439 \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 LCD \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u043e\u0439 DMA \u0438 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u043d\u043e\u0439 \u0448\u0438\u043d\u043e\u0439, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438\u043b\u0438\u0447\u043d\u043e\u0439 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0438 \u0434\u043b\u044f \u0432\u0438\u0434\u0435\u043e, \u043d\u043e \u0443\u0432\u044b, \u0445\u0430\u0440\u0434\u0432\u0430\u0440\u043d\u043e \u043e\u043d \u043d\u0435 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c \u0441 SSD1963. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0431\u044b\u043b\u043e \u043f\u0440\u0438\u043d\u044f\u0442\u043e \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0437\u0430\u044e\u0437\u0430\u0442\u044c \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u0446\u0435\u043b\u0438 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 GPIO \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043a\u0430\u043a \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0443\u044e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0443\u044e \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0443. <\/p>\n<p>  <b>\u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 SSD1963<\/b><\/p>\n<p>  \u0418\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435 \u0440\u0438\u0441\u0443\u043d\u043a\u0430 \u0438\u0437 \u0434\u0430\u0442\u0430\u0448\u0438\u0442\u0430 \u0434\u0438\u0441\u043f\u043b\u0435\u044f:<\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/845\/377\/030\/8453770308dad4952e14a7b56c9df89d.png\"\/><\/p>\n<p>  \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u043d\u0430\u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0442 \u043f\u0438\u043d\u044b DB0 \u2013 DB7. \u042d\u0442\u043e 8-\u0431\u0438\u0442\u043d\u0430\u044f \u0448\u0438\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0438 \u043f\u0438\u043d\u044b DC, RD, WR, CS, RES \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 SSD1963.<br \/>  \u0427\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0444\u043e\u0440\u043c\u0430\u0442\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0434\u0430\u043d\u043d\u044b\u0439 \u0434\u0438\u0441\u043f\u043b\u0435\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 888. \u0427\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442: 8 \u0431\u0430\u0439\u0442 \u2013 Red, 8 \u0431\u0430\u0439\u0442 \u2013 Green, 8 \u0431\u0430\u0439\u0442 \u2013 Blue. \u0415\u0449\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0447\u0430\u0441\u0442\u043e \u0432 \u0434\u0438\u0441\u043f\u043b\u0435\u044f\u0445 \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u0442\u044c \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b 555, 565, \u0438 \u0442.\u0434., \u043d\u043e \u044d\u0442\u043e \u043d\u0435 \u043d\u0430\u0448 \u0441\u043b\u0443\u0447\u0430\u0439. \u0424\u043e\u0440\u043c\u0430\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d \u043d\u0430 \u0440\u0438\u0441\u0443\u043d\u043a\u0435. <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/0aa\/11e\/a63\/0aa11ea63534ab5a6fb02e81dbc3bc77.png\"\/><\/p>\n<p>  \u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c, \u043a\u0430\u043a \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u0430\u0439\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0430 \u0448\u0438\u043d\u0443, \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0438\u043d\u043e\u0432 CS \u0438 WR \u0438\u0437 1 \u0432 0. \u0410 \u043f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0431\u0430\u0439\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d, \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 CS \u0438 WR \u0438\u0437 0 \u0432 1, \u0447\u0442\u043e, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0431\u0430\u0439\u0442\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 SSD1963. \u0411\u043e\u043b\u0435\u0435 \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u043e \u043e\u0441\u0446\u0438\u043b\u043b\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u0438\u0433\u043d\u0430\u043b\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0434\u0430\u0442\u0430\u0448\u0438\u0442\u0435 \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440. <a href=\"http:\/\/www.newhavendisplay.com\/app_notes\/SSD1963.pdf\">www.newhavendisplay.com\/app_notes\/SSD1963.pdf<\/a><\/p>\n<p>  \u0412 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u043f\u0438\u0448\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0430\u043c\u0438 GPIO \u043f\u0438\u043d\u043e\u0432:  <\/p>\n<pre><code class=\"cpp\">static unsigned int nhd_data_pin_config[] = {     AT91_PIN_PE13, AT91_PIN_PE14, AT91_PIN_PE17, AT91_PIN_PE18,     AT91_PIN_PE19, AT91_PIN_PE20, AT91_PIN_PE21, AT91_PIN_PE22 };  static unsigned int nhd_gpio_pin_config[] = {     AT91_PIN_PE0, \/\/ RESET     AT91_PIN_PE2, \/\/ DC     AT91_PIN_PE5, \/\/ CLK     AT91_PIN_PE6,  \/\/ RD     AT91_PIN_PE1  \/\/ WR }; <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u0431\u0430\u0439\u0442\u043e\u0432 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443 \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434:<\/p>\n<pre><code class=\"cpp\">static void nhd_write_data(int command, unsigned short value) {     int i;     at91_set_gpio_output(AT91_PIN_PE12, 1); \/\/R\/D      for (i=0; i&lt;ARRAY_SIZE(nhd_data_pin_config); i++)         at91_set_gpio_output(nhd_data_pin_config[i], (value&gt;&gt;i)&0x01);      if (command)         at91_set_gpio_output(AT91_PIN_PE10, 0); \/\/D\/C     else         at91_set_gpio_output(AT91_PIN_PE10, 1); \/\/D\/C      at91_set_gpio_output(AT91_PIN_PE11, 0); \/\/WR     at91_set_gpio_output(AT91_PIN_PE26, 0); \/\/CS     at91_set_gpio_output(AT91_PIN_PE26, 1); \/\/CS     at91_set_gpio_output(AT91_PIN_PE11, 1); \/\/WR } <\/code><\/pre>\n<p>  \u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u0430 LCD \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043a\u0430\u043a \u043a\u043e\u043c\u043c\u0430\u043d\u0434\u044b (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0434\u0438\u0441\u043f\u043b\u0435\u044f), \u0442\u0430\u043a \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439.<\/p>\n<p>  <b>\u0424\u0440\u0435\u0439\u043c\u0431\u0443\u0444\u0435\u0440 \u043c\u043e\u0434\u0435\u043b\u044c \u044f\u0434\u0440\u0430<\/b><\/p>\n<p>  \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, linux \u044f\u0434\u0440\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u2013 char drivers, block drivers, usb drivers \u0438 \u0442. \u0434. Framebuffer driver \u0442\u0430\u043a\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432 \u043b\u0438\u043d\u0443\u043a\u0441\u043e\u0432\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0440\u0435\u043f\u0440\u0435\u0437\u0435\u043d\u0442\u0430\u0446\u0438\u0438 FB \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <i>struct fb_info<\/i> \u0432 <i>linux\/fb.h<\/i>. \u041a\u0441\u0442\u0430\u0442\u0438, \u044d\u0442\u043e\u0442 \u0445\u0435\u0434\u0435\u0440 \u0444\u0430\u0439\u043b \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u043b\u044e\u0431\u0438\u0442\u0435\u043b\u044f\u043c \u044e\u043c\u043e\u0440\u0430 \u0432 \u043a\u043e\u0434\u0435 linux \u044f\u0434\u0440\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0434\u0435\u0444\u0430\u0439\u043d \u2014 <br \/>  <i>#define STUPID_ACCELF_TEXT_SHIT<\/i>. \u0414\u0443\u043c\u0430\u044e, \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0441\u0430\u043c\u043e \u0437\u0430 \u0441\u0435\u0431\u044f. \u041d\u043e, \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 <i>fb_info<\/i>. \u041d\u0430\u0441 \u0431\u0443\u0434\u0443\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0442\u044c \u0434\u0432\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u2013 <i>fb_var_screeninfo<\/i> \u0438 <i>fb_fix_screeninfo<\/i>. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0438\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u0438\u0441\u043f\u043b\u0435\u044f.<\/p>\n<pre><code class=\"cpp\">static struct fb_fix_screeninfo ssd1963_fix __initdata = {     .id          = &quot;SSD1963&quot;,     .type        = FB_TYPE_PACKED_PIXELS,     .visual      = FB_VISUAL_TRUECOLOR,     .accel       = FB_ACCEL_NONE,     .line_length = 320 * 4, };  static struct fb_var_screeninfo ssd1963_var __initdata = {     .xres        = 320,     .yres        = 240,     .xres_virtual    = 320,     .yres_virtual    = 240,     .width        = 320,     .height        = 240,     .bits_per_pixel = 32,     .transp              = {24, 8, 0},     .red         = {16, 8, 0},     .green         = {8, 8, 0},     .blue         = {0, 8, 0},     .activate     = FB_ACTIVATE_NOW,     .vmode     = FB_VMODE_NONINTERLACED, }; <\/code><\/pre>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0434 \u043f\u0438\u043a\u0441\u0435\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043e 4 \u0431\u0430\u0439\u0442\u0430: 8-Red, 8-Green, 8-Blue, 8-Transparent<br \/>  \u041f\u043e\u044f\u0441\u043d\u044e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043f\u043e\u043b\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440:<\/p>\n<p>  <i>.type <\/i>\u2013 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u044f \u0431\u0438\u0442\u043e\u0432, \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438. Packed pixels \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0431\u0430\u0439\u0442\u044b (\u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 8888 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u0434\u0438\u043d \u0437\u0430 \u0434\u0440\u0443\u0433\u0438\u043c).<\/p>\n<p>  <i>.visual <\/i>\u2013 \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u0446\u0432\u0435\u0442\u0430 \u0434\u0438\u0441\u043f\u043b\u0435\u044f. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e truecolor \u2013 \u0433\u043b\u0443\u0431\u0438\u043d\u0430 \u0446\u0432\u0435\u0442\u0430 24bit<\/p>\n<p>  <i>.accel <\/i>\u2013 \u0445\u0430\u0440\u0434\u0432\u0430\u0440\u043d\u0430\u044f \u0430\u043a\u0441\u0435\u043b\u0435\u0440\u0430\u0446\u0438\u044f<\/p>\n<p>  <i>.transp, red, green, blue<\/i> \u2013 \u043a\u0430\u043a \u0440\u0430\u0437 \u0438 \u0437\u0430\u0434\u0430\u044e\u0442 \u043d\u0430\u0448 8,8,8,8 \u0444\u043e\u0440\u043c\u0430\u0442 \u0432 \u0432\u0438\u0434\u0435 \u0442\u0440\u0435\u0445 \u043f\u043e\u043b\u0435\u0439 \u2013 <i>offset, length<\/i> \u0438 <i>msb_right<\/i>. <\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0430\u0448 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0432 \u044f\u0434\u0440\u0435, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u0435\u0449\u0435 \u0434\u0432\u0435 \u0441\u0443\u0449\u043d\u043e\u0441\u0442\u0438 \u2013 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e(device) \u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440(driver). \u041e\u043f\u0438\u0448\u0435\u043c FB \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e(<i>struct ssd1963<\/i>), \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0430\u0448\u0435\u0439 \u0432\u0438\u0434\u0435\u043e \u043f\u0430\u043c\u044f\u0442\u0438 (<i>struct ss1963_page<\/i>):<\/p>\n<pre><code class=\"cpp\">struct ssd1963_page {     unsigned short x;     unsigned short y;     unsigned long *buffer;     unsigned short len;     int must_update; };  struct ssd1963 {     struct device *dev;     struct fb_info *info;     unsigned int pages_count;     struct ssd1963_page *pages; };  struct platform_driver ssd1963_driver = {     .probe = ssd1963_probe,     .remove = ssd1963_remove,     .driver = { .name = &quot;ssd1963&quot; } }; <\/code><\/pre>\n<p>  <b>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/b><\/p>\n<p>  \u041a\u0430\u043a \u0438 \u0434\u043b\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u044f\u0434\u0440\u0430 \u043b\u0438\u043d\u0443\u043a\u0441, \u043e\u043f\u0438\u0448\u0435\u043c \u043f\u0430\u0440\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 init\/remove. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 init. Framebuffer \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043a\u0430\u043a <i>platform_driver<\/i>:<\/p>\n<pre><code class=\"cpp\">static int __init ssd1963_init(void) {     int ret = 0;     ret = platform_driver_register(&ssd1963_driver);     if (ret) {         pr_err(&quot;%s: unable to platform_driver_register\\n&quot;, __func__);     }     return ret; } module_init(ssd1963_init); <\/code><\/pre>\n<p>  Platform driver \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e probe \u0434\u043b\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0432\u0441\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u2013 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u044e \u043f\u0430\u043c\u044f\u0442\u0438, \u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432, \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440 \u0438 \u0442.\u0434. \u041f\u0440\u0438\u0432\u0435\u0434\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i>ssd1963_probe<\/i>:<\/p>\n<pre><code class=\"cpp\">static int __init ssd1963_probe(struct platform_device *dev) {     int ret = 0;     struct ssd1963 *item;     struct fb_info *info;              \/\/ Allocating memory for ssd1663 device     item = kzalloc(sizeof(struct ssd1963), GFP_KERNEL);     if (!item) {         dev_err(&dev-&gt;dev,             &quot;%s: unable to kzalloc for ssd1963\\n&quot;, __func__);         ret = -ENOMEM;         goto out;     }     item-&gt;dev = &dev-&gt;dev;     dev_set_drvdata(&dev-&gt;dev, item);      \/\/ Initializing fb_info struct using kernel framebuffer API     info = framebuffer_alloc(sizeof(struct ssd1963), &dev-&gt;dev);     if (!info) {         ret = -ENOMEM;         dev_err(&dev-&gt;dev,             &quot;%s: unable to framebuffer_alloc\\n&quot;, __func__);         goto out_item;     }     item-&gt;info = info;      \/\/Here  info-&gt;par pointer is commonly used to store private data            \/\/ In our case, we can use it to store pointer to ssd1963 device      info-&gt;par = item;     info-&gt;dev = &dev-&gt;dev;     info-&gt;fbops = &ssd1963_fbops;     info-&gt;flags = FBINFO_FLAG_DEFAULT;     info-&gt;fix = ssd1963_fix;     info-&gt;var = ssd1963_var;      ret = ssd1963_video_alloc(item);     if (ret) {         dev_err(&dev-&gt;dev,             &quot;%s: unable to ssd1963_video_alloc\\n&quot;, __func__);         goto out_info;     }     info-&gt;screen_base = (char __iomem *)item-&gt;info-&gt;fix.smem_start;     ret = ssd1963_pages_alloc(item);     if (ret &lt; 0) {         dev_err(&dev-&gt;dev,             &quot;%s: unable to ssd1963_pages_init\\n&quot;, __func__);         goto out_video;     }      info-&gt;fbdefio = &ssd1963_defio;     fb_deferred_io_init(info);      ret = register_framebuffer(info);     if (ret &lt; 0) {         dev_err(&dev-&gt;dev,             &quot;%s: unable to register_frambuffer\\n&quot;, __func__);         goto out_pages;     }      ssd1963_setup(item);     ssd1963_update_all(item);     return ret;  out_pages:     ssd1963_pages_free(item); out_video:     ssd1963_video_free(item); out_info:     framebuffer_release(info); out_item:     kfree(item); out:     return ret; } <\/code><\/pre>\n<p>  \u041d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0435\u0432 \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e:<br \/>   \u2014 \u0412\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c \u043f\u043e\u0434 \u043d\u0430\u0448\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e <i>ssd1963<\/i><br \/>   \u2014 \u0412\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u044c \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0441\u0442\u0440\u0443\u043a\u0440\u0443\u0440\u0443 <i>fb_info<\/i>, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e(<i>framebuffer_alloc<\/i>), \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043d\u043e\u0433\u0438\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043d\u0430\u043c \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u0430 \u0437\u0430\u0442\u0435\u043c \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430, \u043a\u0430\u043a <i> fb_var_screeninfo, fb_fix_screeninfo<\/i> \u0438 <i>fb_ops<\/i>, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0436\u0435. <br \/>   \u2014 \u0412\u044b\u0434\u0435\u043b\u044f\u0435\u0442 \u043f\u0430\u043c\u044f\u0442\u044c \u043f\u043e\u0434 \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u044b\u0439 \u0431\u0443\u0444\u0435\u0440 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u0438\u0441\u0438 user-space \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438.<br \/>   \u2014 \u0412\u044b\u0434\u0435\u043b\u044f\u0435\u043c <i>ssd1963_page<\/i> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 \u0444\u0440\u0435\u0439\u043c\u0431\u0443\u0444\u0435\u0440\u0430. \u041a\u0430\u0436\u0434\u0430\u044f <i>ssd1963_page<\/i> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0430\u0434\u0440\u0435\u0441 \u043d\u0430\u0447\u0430\u043b\u0430 \u0431\u0443\u0444\u0435\u0440\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u043e \u043e\u0442\u043d\u043e\u0448\u0435\u043d\u0438\u044e \u043a \u043e\u0431\u0449\u0435\u043c\u0443 \u0431\u0443\u0444\u0435\u0440\u0443 FB, \u0441\u0434\u0432\u0438\u0433 \u043f\u043e \u0445, \u0441\u0434\u0432\u0438\u0433 \u043f\u043e y, \u0438 \u0434\u043b\u0438\u043d\u0443 \u0431\u0443\u0444\u0435\u0440\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0435\u043c\u043a\u043e\u0441\u0442\u044c \u0444\u0440\u0435\u0439\u043c\u0431\u0443\u0444\u0435\u0440\u0430 = <i>line_length*height = 320*4*240 = 307200<\/i> \u0431\u0430\u0439\u0442. \u0414\u043b\u044f \u0442\u0430\u043a\u043e\u0439 \u0435\u043c\u043a\u043e\u0441\u0442\u0438 \u0431\u0443\u0444\u0435\u0440\u0430 \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f line_length*height\/PAGE_SIZE = 307200\/4096 = 75 \u0441\u0442\u0440\u0430\u043d\u0438\u0446. \u041e\u0442\u043c\u0435\u0442\u0438\u043c, \u043a\u0430\u043a \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u043b\u0430\u0433\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 FB. \u041f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430\u043c \u043f\u0440\u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 ssd1963_copy \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0437\u0436\u0435:<\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/1b6\/5a7\/ffd\/1b65a7ffd5e587bbb8142f9b3bb86025.jpg\" width=\"600\" height=\"300\"\/><\/p>\n<p>   \u2014 \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448 FB \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435(<i>register_framebuffer<\/i>) \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 (<i>fb_deferred_io_init<\/i>), \u0434\u0435\u0442\u0430\u043b\u044c\u043d\u0435\u0439 \u043e\u0431 \u044d\u0442\u043e\u043c \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u201c\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0444\u0440\u0435\u0439\u043c\u0431\u0443\u0444\u0435\u0440\u043e\u043c\u201d.<br \/>   \u2014 <i>ssd1963_setup<\/i> \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 GPIO \u043d\u0430 AT91SAM9G45 CPU \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 LCD \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043d\u0430\u0431\u043e\u0440\u0430 \u0437\u0430\u0433\u0430\u0434\u043e\u0447\u043d\u044b\u0445 \u0431\u0430\u0439\u0442 \u0432 \u0445\u0435\u043a\u0441\u0435 \u0432\u0437\u044f\u0442 \u0438\u0437 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 SSD1963, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0430\u0441\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438:<\/p>\n<pre><code class=\"cpp\"> void  ssd1963_setup(struct ssd1963 *item) {     nhd_init_gpio_regs(); \/\/initializations of pins in  nhd_data-gpio_pin_config     at91_set_gpio_output(AT91_PIN_PE27, 0); \/\/RESET     udelay(5);         at91_set_gpio_output(AT91_PIN_PE27, 1); \/\/RESET     udelay(100);     nhd_write_data(NHD_COMMAND, 0x01);  \/\/Software Reset             ...     nhd_write_to_register(0xe0, 0x03);    \/\/LOCK PLL     nhd_write_data(NHD_COMMAND, 0xb0);  \/\/SET LCD MODE TFT 18Bits     nhd_write_data(NHD_DATA, 0x0c);   \/\/SET MODE 24 bits & hsync+Vsync+DEN             \u2026  }  <\/code><\/pre>\n<p>   \u2014 <i>ssd1963_update_all<\/i> \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442 \u0444\u043b\u0430\u0433 <i>must_update=1<\/i> \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0438 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u0443\u0435\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u0432 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0437\u043e\u0432\u0430 <i>schedule_delayed_work(&#038;item-&gt;info-&gt;deferred_work, fbdefio-&gt;delay);<\/i><\/p>\n<p>  \u0418\u0442\u0430\u043a, \u0441 init \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c, \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 remove \u0432\u0441\u0435 \u043a\u0443\u0434\u0430 \u043f\u0440\u043e\u0449\u0435, \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c, \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c FB \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u044f\u0434\u0440\u0443:<\/p>\n<pre><code class=\"cpp\">static int ssd1963_remove(struct platform_device *device) {     struct fb_info *info = platform_get_drvdata(device);     struct ssd1963 *item = (struct ssd1963 *)info-&gt;par;     if (info) {         unregister_framebuffer(info);         ssd1963_pages_free(item);         ssd1963_video_free(item);         framebuffer_release(info);         kfree(item);     }     return 0; } <\/code><\/pre>\n<p>  <b>\u041e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441 \u0444\u0440\u0435\u0439\u043c\u0431\u0443\u0444\u0435\u0440\u043e\u043c<\/b><\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 <i>fb_ops<\/i>:<\/p>\n<pre><code class=\"cpp\">static struct fb_ops ssd1963_fbops = {     .owner        = THIS_MODULE,     .fb_read      = fb_sys_read,     .fb_write     = ssd1963_write,     .fb_fillrect  = ssd1963_fillrect,      .fb_copyarea  = ssd1963_copyarea,     .fb_imageblit = ssd1963_imageblit,     .fb_setcolreg    = ssd1963_setcolreg,     .fb_blank    = ssd1963_blank, }; <\/code><\/pre>\n<p>  \u042f \u043d\u0435 \u043f\u0440\u0438\u0432\u043e\u0436\u0443 \u0437\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043b\u044e\u0431\u043e\u043f\u044b\u0442\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0441\u043c\u043e\u0436\u0435\u0442 \u043d\u0430\u0439\u0442\u0438 \u0438\u0445 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043c\u043e\u0434\u0443\u043b\u044f \u043b\u0438\u0431\u043e \u0432 \u043b\u044e\u0431\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0435 \u0432 \u043a\u043e\u0434\u0435 \u044f\u0434\u0440\u0430 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 <i>drivers\/video<\/i>. \u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u0434\u043e\u0433\u0430\u0434\u0430\u043b\u0438\u0441\u044c, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 fb_ops \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0442\u044c \u043d\u0430\u0448 \u0434\u0440\u0430\u0439\u0432\u0435\u0440. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u044f\u0434\u0440\u0430 \u0447\u0430\u0441\u0442\u0438\u0447\u043d\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0438\u043b\u0438 \u043d\u0430\u043c \u0440\u0430\u0431\u043e\u0442\u0443, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 FB, \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u0441\u0443\u0444\u0438\u043a\u0441<i> sys_<\/i> \u0438\u043b\u0438 <i>fb_sys<\/i>, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 <i>fb_sys_read<\/i>. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0448\u0443 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0438\u0437 <i>fb_ops<\/i> (<i>ssd1963_read, ssd1963_write<\/i> \u0438 \u0434\u0440.) \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0430\u0448\u0435\u0439 \u0438\u043c\u043f\u0440\u043e\u0432\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0432\u0438\u0434\u0435\u043e \u043f\u0430\u043c\u044f\u0442\u0438, \u043a\u043e\u0433\u0434\u0430 \u0432 \u044d\u0442\u043e\u043c \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c. <\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>ssd1963_fillrect<\/i> \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:  <\/p>\n<pre><code class=\"cpp\">static void ssd1963_fillrect(struct fb_info *p, const struct fb_fillrect *rect) {     sys_fillrect(p, rect);     ssd1963_touch(p, rect-&gt;dx, rect-&gt;dy, rect-&gt;width, rect-&gt;height); } <\/code><\/pre>\n<p>  \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u0432\u044b\u0437\u043e\u0432 <i>fb_fillrect<\/i> \u043e\u0431\u043d\u043e\u0432\u0438\u0442 \u0432\u0438\u0434\u0435\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u044d\u043a\u0440\u0430\u043d\u0430, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c, \u043f\u043e\u043c\u0435\u0442\u0438\u0432 \u0438\u0445 \u0444\u043b\u0430\u0436\u043a\u043e\u043c <i>must_update<\/i>, \u0438 \u0437\u0430\u0442\u0435\u043c \u0432\u044b\u0437\u0432\u0430\u0432 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043c\u044f\u0442\u0438:<\/p>\n<pre><code class=\"cpp\">static void ssd1963_touch(struct fb_info *info, int x, int y, int w, int h) {     struct fb_deferred_io *fbdefio = info-&gt;fbdefio;     struct ssd1963 *item = (struct ssd1963 *)info-&gt;par;     int i, ystart, yend;     if (fbdefio) {         \/\/Touch the pages, so the deferred io will update them.         for (i=0; i&lt;item-&gt;pages_count; i++) {             ystart=item-&gt;pages[i].y;             yend=item-&gt;pages[i].y+(item-&gt;pages[i].len\/info-&gt;fix.line_length)+1;             if (!((y+h)&lt;ystart || y&gt;yend)) {                 item-&gt;pages[i].must_update=1;             }         }         \/\/Schedule the deferred IO to kick in after a delay.         schedule_delayed_work(&info-&gt;deferred_work, fbdefio-&gt;delay);     } } <\/code><\/pre>\n<p>  \u041e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043c\u044f\u0442\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0435(deferred context). User-space \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0449\u0435\u0435 \u0441 \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0439, \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0438\u0441\u0438 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0430\u0434\u0440\u0430 \u0432 \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043c\u044f\u0442\u044c, \u0447\u0442\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u043b\u043e\u0433\u0438\u0447\u043d\u043e. \u041e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432 <i>fb_info<\/i> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b <i>fb_deferred_io<\/i>:<\/p>\n<pre><code class=\"cpp\">static struct fb_deferred_io ssd1963_defio = {         .delay          = HZ \/ 20,         .deferred_io    = &ssd1963_update, };  <\/code><\/pre>\n<p>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f <i>ssd1963_update<\/i> c \u043f\u0440\u043e\u0442\u043e\u0442\u0438\u043f\u043e\u043c<br \/>  <i>void ssd1963_update(struct fb_info *info, struct list_head *pagelist);<\/i><br \/>  \u043d\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0432\u0441\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u044b\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u044b \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0438\u0441\u0438 user-space \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c, \u0438\u043b\u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430, \u0442\u0438\u043f\u0430 <i>fb_fillrect<\/i> \u0438 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0438\u043c\u0435\u0435\u0442 \u0432\u0438\u0434:<\/p>\n<pre><code class=\"cpp\">static void ssd1963_update(struct fb_info *info, struct list_head *pagelist) {     struct ssd1963 *item = (struct ssd1963 *)info-&gt;par;     struct page *page;     int i;      list_for_each_entry(page, pagelist, lru) {         item-&gt;pages[page-&gt;index].must_update=1;     }      \/\/Copy changed pages.     for (i=0; i&lt;item-&gt;pages_count; i++) {         if (item-&gt;pages[i].must_update) {             item-&gt;pages[i].must_update=0;             ssd1963_copy(item, i);         }     } } <\/code><\/pre>\n<p>  \u041d\u0430 \u0434\u0430\u043d\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435, \u0432\u044b \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0437\u0430\u0434\u0430\u043b\u0438\u0441\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u0447\u0442\u043e \u0434\u0435\u043b\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>ssd1963_copy<\/i>. \u041e\u043d\u0430 \u043a\u0430\u043a-\u0440\u0430\u0437-\u0442\u0430\u043a\u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0432\u0441\u044e \u201c\u0433\u0440\u044f\u0437\u043d\u0443\u044e\u201d \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u0437 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0432\u0438\u0434\u0435\u043e\u043f\u0430\u043c\u044f\u0442\u0438 \u043d\u0430 \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0443\u044e, 8-\u0431\u0438\u0442\u043d\u0443\u044e \u0448\u0438\u043d\u0443 \u043d\u0430 \u0431\u0430\u0437\u0435 GPIO.<\/p>\n<p>  <b>\u0424\u0443\u043d\u043a\u0446\u0438\u044f ssd1963_copy<\/b><\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0441\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0440\u0438\u0441\u0443\u043d\u043e\u043a, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u043e \u043a\u0430\u043a \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043d\u0430\u0448\u0438 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c\u0438 \u0434\u0438\u0441\u043f\u043b\u0435\u044f. \u0412\u0438\u0434\u0438\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e \u0432 <i>page[0]<\/i> \u0445\u0440\u0430\u043d\u0438\u0442\u0441\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0442\u0440\u0435\u0445 \u0432\u0435\u0440\u0445\u043d\u0438\u0445 \u043b\u0438\u043d\u0438\u0439 \u0434\u0438\u0441\u043f\u043b\u0435\u044f \u043f\u043e 320 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u0438 64 \u043f\u0438\u043a\u0441\u0435\u043b\u044f \u0434\u043b\u044f 4-\u0439 \u043b\u0438\u043d\u0438\u0438. \u0422\u0430\u043a\u0438\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0443 \u043d\u0430\u0441 75, \u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0441 \u0440\u0438\u0441\u0443\u043d\u043a\u0430, \u0438 \u043a\u0430\u043a \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, <i>page[5] <\/i>\u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a \u0436\u0435 \u2013 3 \u043b\u0438\u043d\u0438\u0438 \u043f\u043e 320 \u0438 \u043e\u0434\u043d\u0430 \u043f\u043e 64. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0430\u044f \u0438\u043d\u0434\u0435\u043a\u0441 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043a\u0430\u043a \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c <i>switch(index%5)<\/i> \u0438 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043e\u0444\u0441\u0435\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0435 \u0435\u0439 \u201c\u043e\u043a\u043d\u043e\u201d \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0434\u0438\u0441\u043f\u043b\u0435\u044f. \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0434\u043b\u0438\u043d\u043d\u0430\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u043b\u0438\u0448\u044c \u0435\u0435 \u0447\u0430\u0441\u0442\u044c:<\/p>\n<pre><code class=\"cpp\">static void ssd1963_copy(struct ssd1963 *item, unsigned int index) {     unsigned short x,y, startx, endx, starty, endy, offset;     unsigned long *buffer;     unsigned int len;     unsigned int count;      x = item-&gt;pages[index].x;     y = item-&gt;pages[index].y;     buffer = item-&gt;pages[index].buffer;     len = item-&gt;pages[index].len;      switch (index%5) {      case 0:         offset = 0;         startx = x;         starty = y;         endx   = 319;         endy   = y+2;         len    = 960;         nhd_set_window(startx, endx, starty, endy);         nhd_write_data(NHD_COMMAND, 0x2c);      for (count = 0; count &lt; len; count++) {         nhd_write_data(NHD_DATA,(unsigned char)((buffer[count+offset])&gt;&gt;16));        \/\/red         nhd_write_data(NHD_DATA,(unsigned char)((buffer[count+offset])&gt;&gt;8));        \/\/green         nhd_write_data(NHD_DATA,(unsigned char)(buffer[count+offset]));            \/\/blue     }      offset = len;      startx = x;     starty = y+3;     endx   = x+63;     endy   = y+3;     len       = 64;     nhd_set_window(startx, endx, starty, endy);     nhd_write_data(NHD_COMMAND, 0x2c);      for (count = 0; count &lt; len; count++) {         nhd_write_data(NHD_DATA,(unsigned char)((buffer[count+offset])&gt;&gt;16));        \/\/red         nhd_write_data(NHD_DATA,(unsigned char)((buffer[count+offset])&gt;&gt;8));        \/\/green         nhd_write_data(NHD_DATA,(unsigned char)(buffer[count+offset]));            \/\/blue     }     break;      case 1:     \u2026. <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044f <i>nhd_set_window<\/i> \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u0435\u0442 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0436\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0445 \u043d\u0430\u043c <i>nhd_write_data(NHD_COMMAND, \u2026); <\/i> \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u0438\u0441\u043f\u043b\u0435\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0434\u0430\u043d\u043d\u044b\u0445(\u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439). <br \/>  <i>nhd_write_data(NHD_COMMAND, 0x2c);<\/i> \u2014 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 LCD \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>  \u041d\u0443 \u0438 \u043d\u0430\u043f\u043e\u0441\u043b\u0435\u0434\u043e\u043a, \u0441\u043a\u0440\u0438\u043d\u0448\u043e\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b ts_calibrate \u0438\u0437 \u043f\u0430\u043a\u0435\u0442\u0430 tslib \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0441 \u0434\u0438\u0441\u043f\u043b\u0435\u0435\u043c. <br \/>  \u041a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u2014 \u043c\u043e\u0433\u0443 \u0432\u044b\u0441\u043b\u0430\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043c\u043e\u0434\u0443\u043b\u044f:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/7cb\/b51\/b5b\/7cbb51b5b70fce6695d46a46889e90a7.jpg\"\/> \t\t\t<\/p>\n<div class=\"clear\"><\/div>\n<\/p><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/213775\/\"> http:\/\/habrahabr.ru\/post\/213775\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\"> \t\t\t\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0445\u043e\u0447\u0443 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c \u043e\u043f\u044b\u0442\u043e\u043c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f linux \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 \u0434\u043b\u044f \u0446\u0432\u0435\u0442\u043d\u043e\u0433\u043e \u0434\u0438\u0441\u043f\u043b\u0435\u044f 320\u0445240 \u043e\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044f Newhavendisplays, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e NHD-5.7-320240WFB-CTXI-T1 \u043f\u043e\u0434 embedded linux. \u0418\u0434\u0435\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044e \u0441\u043e\u0437\u0440\u0435\u043b\u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0435 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u043f\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044e framebufer(FB) \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u043e\u0432 \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u043c\u043d\u043e\u0433\u043e, \u0442\u0435\u043c \u0431\u043e\u043b\u0435\u0435, \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435. \u041c\u043e\u0434\u0443\u043b\u044c \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u043f\u043e\u0434 \u0441\u0430\u043c\u043e\u0435 \u043d\u043e\u0432\u043e\u0435 \u044f\u0434\u0440\u043e(2.6.30), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u044e, \u0447\u0442\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445 FB \u043c\u043d\u043e\u0433\u043e \u0447\u0435\u0433\u043e \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u043e\u0441\u044c \u0441 \u0442\u0435\u0445 \u043f\u043e\u0440. \u041d\u043e, \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0441\u0442\u0430\u0442\u044c\u044f \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u043c\u0441\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u043e\u0439 \u0443\u0440\u043e\u0432\u043d\u044f \u044f\u0434\u0440\u0430 linux. \u041d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u044e, \u0447\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u043e\u0449\u0435 \u0438 \u0438\u0437\u044f\u0449\u043d\u0435\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0438 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442\u0441\u044f. <\/p>\n<p>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/bb2\/e11\/475\/bb2e11475d3dd1002c56f188c932a100.jpg\"\/> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/getpro\/habr\/post_images\/6b2\/278\/4da\/6b22784da00350740c2fd3e098c37e34.jpg\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-213775","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/213775","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=213775"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/213775\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=213775"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=213775"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=213775"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}