Root/m1/patches/rtems/milkymist-videoformat.patch

Source at commit f6fd776f528905e346c7f1caec97945535c7ca43 created 8 years 4 months ago.
By Werner Almesberger, m1/patches/rtems/: Milkymist-specific patches are in upstream (update by Xiangfu)
1Date: Fri, 25 Nov 2011 16:22:29 +0100
2From: S?bastien Bourdeauducq <sebastien@milkymist.org>
3To: "Milkymist One, Milkymist SoC and Flickernoise developers' list"
4        <devel@lists.milkymist.org>
5Subject: [Milkymist-devel] RTEMS patch for video formats
6
7[-- Attachment #1 --]
8[-- Type: text/plain, Encoding: 7bit, Size: 0.5K --]
9
10Hi,
11
12The attached patch implements RTEMS driver support for different video
13formats.
14
15S-Video and Component are untested, because I do not have suitable
16sources. However, when using these modes, feeding the composite signal
17into the Y input gives a greyscale picture, so they likely work.
18
19I'm also sending a screenshot of the new video input settings dialog.
20When in composite mode, I'm planning to add keyboard shortcuts to
21switch between the 3 inputs live.
22
23S.
24
25Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_video/milkymist_video.h
26===================================================================
27--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_video/milkymist_video.h 2011-08-01 10:48:40.000000000 -0300
28+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_video/milkymist_video.h 2011-11-26 01:09:16.000000000 -0300
29@@ -8,7 +8,7 @@
30  *
31  * $Id: milkymist_video.h,v 1.1 2011/08/01 13:48:40 joel Exp $
32  *
33- * COPYRIGHT (c) 2010 Sebastien Bourdeauducq
34+ * COPYRIGHT (c) 2010, 2011 Sebastien Bourdeauducq
35  */
36 
37 #ifndef __MILKYMIST_VIDEO_H_
38@@ -33,6 +33,16 @@
39 #define VIDEO_SET_REGISTER 0x5609
40 #define VIDEO_GET_REGISTER 0x560a
41 
42+#define VIDEO_SET_FORMAT 0x560b
43+
44+enum {
45+ VIDEO_FORMAT_CVBS6 = 0,
46+ VIDEO_FORMAT_CVBS5,
47+ VIDEO_FORMAT_CVBS4,
48+ VIDEO_FORMAT_SVIDEO,
49+ VIDEO_FORMAT_COMPONENT,
50+};
51+
52 rtems_device_driver video_initialize(
53   rtems_device_major_number major,
54   rtems_device_minor_number minor,
55Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_video/video.c
56===================================================================
57--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_video/video.c 2011-08-01 10:48:40.000000000 -0300
58+++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_video/video.c 2011-11-26 01:09:16.000000000 -0300
59@@ -267,6 +267,37 @@
60   );
61 }
62 
63+static void set_format(int format)
64+{
65+ switch(format) {
66+ case VIDEO_FORMAT_CVBS6:
67+ write_reg(0x00, 0x00);
68+ write_reg(0xc3, 0x05);
69+ write_reg(0xc4, 0x80);
70+ break;
71+ case VIDEO_FORMAT_CVBS5:
72+ write_reg(0x00, 0x00);
73+ write_reg(0xc3, 0x0d);
74+ write_reg(0xc4, 0x80);
75+ break;
76+ case VIDEO_FORMAT_CVBS4:
77+ write_reg(0x00, 0x00);
78+ write_reg(0xc3, 0x04);
79+ write_reg(0xc4, 0x80);
80+ break;
81+ case VIDEO_FORMAT_SVIDEO:
82+ write_reg(0x00, 0x06);
83+ write_reg(0xc3, 0xd5);
84+ write_reg(0xc4, 0x80);
85+ break;
86+ case VIDEO_FORMAT_COMPONENT:
87+ write_reg(0x00, 0x09);
88+ write_reg(0xc3, 0x45);
89+ write_reg(0xc4, 0x8d);
90+ break;
91+ }
92+}
93+
94 rtems_device_driver video_control(
95   rtems_device_major_number major,
96   rtems_device_minor_number minor,
97@@ -333,7 +364,7 @@
98       break;
99     
100     case VIDEO_SET_REGISTER:
101- write_reg(((unsigned int )a & 0xffff0000) >> 16,
102+ write_reg(((unsigned int)a & 0xffff0000) >> 16,
103         (unsigned int)a & 0x0000ffff);
104       sc = RTEMS_SUCCESSFUL;
105       break;
106@@ -342,6 +373,11 @@
107       sc = RTEMS_SUCCESSFUL;
108       break;
109     
110+ case VIDEO_SET_FORMAT:
111+ set_format((int)a);
112+ sc = RTEMS_SUCCESSFUL;
113+ break;
114+
115     default:
116       sc = RTEMS_UNSATISFIED;
117       break;
118

Archive Download this file

Branches:
master



interactive