wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2000 |
| 3 | * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it |
| 4 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | |
| 24 | #ifndef _VIDEO_AD7177_H_ |
| 25 | #define _VIDEO_AD7177_H_ |
| 26 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 27 | /* #define VIDEO_DEBUG_DISABLE_COLORS 0 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 28 | |
| 29 | #define VIDEO_ENCODER_NAME "Analog Devices AD7177" |
| 30 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 31 | #define VIDEO_ENCODER_I2C_RATE 100000 /* Max rate is 100 kHz */ |
| 32 | #define VIDEO_ENCODER_CB_Y_CR_Y /* Use CB Y CR Y format... */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 33 | |
| 34 | #define VIDEO_MODE_YUYV /* The only mode supported by this encoder */ |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 35 | #undef VIDEO_MODE_RGB |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 36 | #define VIDEO_MODE_BPP 16 |
| 37 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 38 | #ifdef VIDEO_MODE_PAL |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 39 | #define VIDEO_ACTIVE_COLS 720 |
| 40 | #define VIDEO_ACTIVE_ROWS 576 |
| 41 | #define VIDEO_VISIBLE_COLS 640 |
| 42 | #define VIDEO_VISIBLE_ROWS 480 |
| 43 | #endif |
| 44 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 45 | #ifdef VIDEO_MODE_NTSC |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 46 | #define VIDEO_ACTIVE_COLS 720 |
| 47 | #define VIDEO_ACTIVE_ROWS 525 |
| 48 | #define VIDEO_VISIBLE_COLS 640 |
| 49 | #define VIDEO_VISIBLE_ROWS 400 |
| 50 | #endif |
| 51 | |
| 52 | static unsigned char |
| 53 | video_encoder_data[] = { |
| 54 | #ifdef VIDEO_MODE_NTSC |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 55 | 0x04, /* Mode Register 0 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 56 | #ifdef VIDEO_DEBUG_COLORBARS |
| 57 | 0xc2, |
| 58 | #else |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 59 | 0x42, /* Mode Register 1 */ |
| 60 | #endif /* VIDEO_DEBUG_COLORBARS */ |
| 61 | 0x16, /* Subcarrier Freq 0 */ |
| 62 | 0x7c, /* Subcarrier Freq 1 */ |
| 63 | 0xf0, /* Subcarrier Freq 2 */ |
| 64 | 0x21, /* Subcarrier Freq 3 */ |
| 65 | 0x00, /* Subcarrier phase */ |
| 66 | 0x02, /* Timing Register 0 */ |
| 67 | 0x00, /* Extended Captioning 0 */ |
| 68 | 0x00, /* Extended Captioning 1 */ |
| 69 | 0x00, /* Closed Captioning 0 */ |
| 70 | 0x00, /* Closed Captioning 1 */ |
| 71 | 0x00, /* Timing Register 1 */ |
| 72 | 0x08, /* Mode Register 2 */ |
| 73 | 0x00, /* Pedestal Register 0 */ |
| 74 | 0x00, /* Pedestal Register 1 */ |
| 75 | 0x00, /* Pedestal Register 2 */ |
| 76 | 0x00, /* Pedestal Register 3 */ |
| 77 | 0x08, /* Mode Register 3 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 78 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 79 | #endif /* VIDEO_MODE_NTSC */ |
| 80 | |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 81 | #ifdef VIDEO_MODE_PAL |
| 82 | #ifdef VIDEO_MODE_RGB_OUT |
| 83 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 84 | 0x69, /* Mode Register 0 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 85 | #ifdef VIDEO_DEBUG_COLORBARS |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 86 | 0xc0, /* Mode Register 1 (c0) */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 87 | #else |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 88 | 0x40, /* Mode Register 1 (c0) */ |
| 89 | #endif /* VIDEO_DEBUG_COLORBARS */ |
| 90 | 0xcb, /* Subcarrier Freq 0 */ |
| 91 | 0x8a, /* Subcarrier Freq 1 */ |
| 92 | 0x09, /* Subcarrier Freq 2 */ |
| 93 | 0x2a, /* Subcarrier Freq 3 */ |
| 94 | 0x00, /* Subcarrier phase */ |
| 95 | 0x02, /* Timing Register 0 */ |
| 96 | 0x00, /* Extended Captioning 0 */ |
| 97 | 0x00, /* Extended Captioning 1 */ |
| 98 | 0x00, /* Closed Captioning 0 */ |
| 99 | 0x00, /* Closed Captioning 1 */ |
| 100 | 0x00, /* Timing Register 1 */ |
| 101 | 0x28, /* Mode Register 2 */ |
| 102 | 0x00, /* Pedestal Register 0 */ |
| 103 | 0x00, /* Pedestal Register 1 */ |
| 104 | 0x00, /* Pedestal Register 2 */ |
| 105 | 0x00, /* Pedestal Register 3 */ |
| 106 | 0x08, /* Mode Register 3 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 107 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 108 | #else /* ! VIDEO_MODE_RGB_OUT */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 109 | |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 110 | 0x09, /* Mode Register 0 (was 01) */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 111 | #ifdef VIDEO_DEBUG_COLORBARS |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 112 | 0xd8, /* */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 113 | #else |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 114 | 0x59, /* Mode Register 1 (was 58) */ |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 115 | #endif /* VIDEO_DEBUG_COLORBARS */ |
| 116 | 0xcb, /* Subcarrier Freq 0 */ |
| 117 | 0x8a, /* Subcarrier Freq 1 */ |
| 118 | 0x09, /* Subcarrier Freq 2 */ |
| 119 | 0x2a, /* Subcarrier Freq 3 */ |
| 120 | 0x00, /* Subcarrier phase */ |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 121 | 0x02, /* Timing Register 0 (was a) */ |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 122 | 0x00, /* Extended Captioning 0 */ |
| 123 | 0x00, /* Extended Captioning 1 */ |
| 124 | 0x00, /* Closed Captioning 0 */ |
| 125 | 0x00, /* Closed Captioning 1 */ |
| 126 | 0x00, /* Timing Register 1 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 127 | #ifdef VIDEO_DEBUG_LOWPOWER |
| 128 | #ifdef VIDEO_DEBUG_DISABLE_COLORS |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 129 | 0x98, /* Mode Register 2 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 130 | #else |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 131 | 0x88, /* Mode Register 2 */ |
| 132 | #endif /* VIDEO_DEBUG_DISABLE_COLORS */ |
| 133 | #else /* ! VIDEO_DEBUG_LOWPOWER */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 134 | #ifdef VIDEO_DEBUG_DISABLE_COLORS |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 135 | 0x18, /* Mode Register 2 */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 136 | #else |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 137 | 0x08, /* Mode Register 2 */ |
| 138 | #endif /* VIDEO_DEBUG_DISABLE_COLORS */ |
| 139 | #endif /* VIDEO_DEBUG_LOWPOWER */ |
| 140 | 0x00, /* Pedestal Register 0 */ |
| 141 | 0x00, /* Pedestal Register 1 */ |
| 142 | 0x00, /* Pedestal Register 2 */ |
| 143 | 0x00, /* Pedestal Register 3 */ |
| 144 | 0x08 /* Mode Register 3 */ |
| 145 | #endif /* VIDEO_MODE_RGB_OUT */ |
| 146 | #endif /* VIDEO_MODE_PAL */ |
wdenk | fe8c280 | 2002-11-03 00:38:21 +0000 | [diff] [blame] | 147 | } ; |
| 148 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 149 | #endif /* _VIDEO_AD7177_H_ */ |