diff --git a/m1/patches/rtems/milkymist-videoformat.patch b/m1/patches/rtems/milkymist-videoformat.patch new file mode 100644 index 0000000..f8f1473 --- /dev/null +++ b/m1/patches/rtems/milkymist-videoformat.patch @@ -0,0 +1,117 @@ +Date: Fri, 25 Nov 2011 16:22:29 +0100 +From: S?bastien Bourdeauducq +To: "Milkymist One, Milkymist SoC and Flickernoise developers' list" + +Subject: [Milkymist-devel] RTEMS patch for video formats + +[-- Attachment #1 --] +[-- Type: text/plain, Encoding: 7bit, Size: 0.5K --] + +Hi, + +The attached patch implements RTEMS driver support for different video +formats. + +S-Video and Component are untested, because I do not have suitable +sources. However, when using these modes, feeding the composite signal +into the Y input gives a greyscale picture, so they likely work. + +I'm also sending a screenshot of the new video input settings dialog. +When in composite mode, I'm planning to add keyboard shortcuts to +switch between the 3 inputs live. + +S. + +Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_video/milkymist_video.h +=================================================================== +--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_video/milkymist_video.h 2011-08-01 10:48:40.000000000 -0300 ++++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_video/milkymist_video.h 2011-11-26 01:09:16.000000000 -0300 +@@ -8,7 +8,7 @@ + * + * $Id: milkymist_video.h,v 1.1 2011/08/01 13:48:40 joel Exp $ + * +- * COPYRIGHT (c) 2010 Sebastien Bourdeauducq ++ * COPYRIGHT (c) 2010, 2011 Sebastien Bourdeauducq + */ + + #ifndef __MILKYMIST_VIDEO_H_ +@@ -33,6 +33,16 @@ + #define VIDEO_SET_REGISTER 0x5609 + #define VIDEO_GET_REGISTER 0x560a + ++#define VIDEO_SET_FORMAT 0x560b ++ ++enum { ++ VIDEO_FORMAT_CVBS6 = 0, ++ VIDEO_FORMAT_CVBS5, ++ VIDEO_FORMAT_CVBS4, ++ VIDEO_FORMAT_SVIDEO, ++ VIDEO_FORMAT_COMPONENT, ++}; ++ + rtems_device_driver video_initialize( + rtems_device_major_number major, + rtems_device_minor_number minor, +Index: rtems/c/src/lib/libbsp/lm32/shared/milkymist_video/video.c +=================================================================== +--- rtems.orig/c/src/lib/libbsp/lm32/shared/milkymist_video/video.c 2011-08-01 10:48:40.000000000 -0300 ++++ rtems/c/src/lib/libbsp/lm32/shared/milkymist_video/video.c 2011-11-26 01:09:16.000000000 -0300 +@@ -267,6 +267,37 @@ + ); + } + ++static void set_format(int format) ++{ ++ switch(format) { ++ case VIDEO_FORMAT_CVBS6: ++ write_reg(0x00, 0x00); ++ write_reg(0xc3, 0x05); ++ write_reg(0xc4, 0x80); ++ break; ++ case VIDEO_FORMAT_CVBS5: ++ write_reg(0x00, 0x00); ++ write_reg(0xc3, 0x0d); ++ write_reg(0xc4, 0x80); ++ break; ++ case VIDEO_FORMAT_CVBS4: ++ write_reg(0x00, 0x00); ++ write_reg(0xc3, 0x04); ++ write_reg(0xc4, 0x80); ++ break; ++ case VIDEO_FORMAT_SVIDEO: ++ write_reg(0x00, 0x06); ++ write_reg(0xc3, 0xd5); ++ write_reg(0xc4, 0x80); ++ break; ++ case VIDEO_FORMAT_COMPONENT: ++ write_reg(0x00, 0x09); ++ write_reg(0xc3, 0x45); ++ write_reg(0xc4, 0x8d); ++ break; ++ } ++} ++ + rtems_device_driver video_control( + rtems_device_major_number major, + rtems_device_minor_number minor, +@@ -333,7 +364,7 @@ + break; + + case VIDEO_SET_REGISTER: +- write_reg(((unsigned int )a & 0xffff0000) >> 16, ++ write_reg(((unsigned int)a & 0xffff0000) >> 16, + (unsigned int)a & 0x0000ffff); + sc = RTEMS_SUCCESSFUL; + break; +@@ -342,6 +373,11 @@ + sc = RTEMS_SUCCESSFUL; + break; + ++ case VIDEO_SET_FORMAT: ++ set_format((int)a); ++ sc = RTEMS_SUCCESSFUL; ++ break; ++ + default: + sc = RTEMS_UNSATISFIED; + break; diff --git a/m1/patches/rtems/series b/m1/patches/rtems/series index 9545037..12082a9 100644 --- a/m1/patches/rtems/series +++ b/m1/patches/rtems/series @@ -5,3 +5,4 @@ coremsgsubmit-race.patch milkymist-new-uart.patch fix-sysconf-includes.patch milkymist-map-sysfreq.patch +milkymist-videoformat.patch