2011-11-27 Sebastien Bourdeauducq <seb@tmplab.org>

PR 1972/bsps
	* milkymist_video/milkymist_video.h, milkymist_video/video.c: Adds an
	ioctl to implement selection of composite on any connector, S-Video
	and Component sources on the Milkymist One.
This commit is contained in:
Gedare Bloom
2011-11-27 17:33:00 +00:00
parent b8ee42cd81
commit 267357adba
3 changed files with 55 additions and 2 deletions

View File

@@ -1,3 +1,10 @@
2011-11-27 Sebastien Bourdeauducq <seb@tmplab.org>
PR 1972/bsps
* milkymist_video/milkymist_video.h, milkymist_video/video.c: Adds an
ioctl to implement selection of composite on any connector, S-Video
and Component sources on the Milkymist One.
2011-11-27 Sebastien Bourdeauducq <seb@tmplab.org>
PR 1970/bsps

View File

@@ -8,7 +8,7 @@
*
* $Id$
*
* COPYRIGHT (c) 2010 Sebastien Bourdeauducq
* COPYRIGHT (c) 2010, 2011 Sebastien Bourdeauducq
*/
#ifndef __MILKYMIST_VIDEO_H_
@@ -33,6 +33,16 @@ extern "C" {
#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,

View File

@@ -267,6 +267,37 @@ static void invalidate_caches(void)
);
}
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 @@ rtems_device_driver video_control(
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 @@ rtems_device_driver video_control(
sc = RTEMS_SUCCESSFUL;
break;
case VIDEO_SET_FORMAT:
set_format((int)a);
sc = RTEMS_SUCCESSFUL;
break;
default:
sc = RTEMS_UNSATISFIED;
break;