]>
git.ipfire.org Git - people/ms/u-boot.git/blob - cpu/bf537/video.c
3 * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
5 * Wolfgang Denk, wd@denx.de
7 * Aubrey Li, aubrey.li@analog.com
9 * See file CREDITS for list of people who contributed to this
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
31 #include <asm/blackfin.h>
33 #include <linux/types.h>
37 #define NTSC_FRAME_ADDR 0x06000000
40 /* NTSC OUTPUT SIZE 720 * 240 */
44 int is_vblank_line(const int line
)
47 * This array contains a single bit for each line in
50 if ((line
<= 18) || (line
>= 264 && line
<= 281) || (line
== 528))
56 int NTSC_framebuffer_init(char *base_address
)
58 const int NTSC_frames
= 1;
59 const int NTSC_lines
= 525;
60 char *dest
= base_address
;
61 int frame_num
, line_num
;
63 for (frame_num
= 0; frame_num
< NTSC_frames
; ++frame_num
) {
64 for (line_num
= 1; line_num
<= NTSC_lines
; ++line_num
) {
69 if (is_vblank_line(line_num
))
72 if (line_num
> 266 || line_num
< 3)
76 code
= SystemCodeMap
[offset
].EAV
;
77 write_dest_byte((char)(code
>> 24) & 0xff);
78 write_dest_byte((char)(code
>> 16) & 0xff);
79 write_dest_byte((char)(code
>> 8) & 0xff);
80 write_dest_byte((char)(code
) & 0xff);
82 /* Output horizontal blanking */
83 for (i
= 0; i
< 67 * 2; ++i
) {
84 write_dest_byte(0x80);
85 write_dest_byte(0x10);
89 code
= SystemCodeMap
[offset
].SAV
;
90 write_dest_byte((char)(code
>> 24) & 0xff);
91 write_dest_byte((char)(code
>> 16) & 0xff);
92 write_dest_byte((char)(code
>> 8) & 0xff);
93 write_dest_byte((char)(code
) & 0xff);
95 /* Output empty horizontal data */
96 for (i
= 0; i
< 360 * 2; ++i
) {
97 write_dest_byte(0x80);
98 write_dest_byte(0x10);
103 return dest
- base_address
;
106 void fill_frame(char *Frame
, int Value
)
116 /* fill odd and even frames */
117 for (OddLine
= 22, EvenLine
= 285; OddLine
< 263; OddLine
++, EvenLine
++) {
118 OddPtr32
= (int *)((Frame
+ (OddLine
* 1716)) + 276);
119 EvenPtr32
= (int *)((Frame
+ (EvenLine
* 1716)) + 276);
120 for (i
= 0; i
< 360; i
++, OddPtr32
++, EvenPtr32
++) {
126 for (m
= 0; m
< VERTICAL
; m
++) {
127 data
= (int *)u_boot_logo
.data
;
128 for (OddLine
= (22 + m
), EvenLine
= (285 + m
);
129 OddLine
< (u_boot_logo
.height
* VERTICAL
) + (22 + m
);
130 OddLine
+= VERTICAL
, EvenLine
+= VERTICAL
) {
131 OddPtr32
= (int *)((Frame
+ ((OddLine
) * 1716)) + 276);
133 (int *)((Frame
+ ((EvenLine
) * 1716)) + 276);
134 for (i
= 0; i
< u_boot_logo
.width
/ 2; i
++) {
135 /* enlarge one pixel to m x n */
136 for (n
= 0; n
< HORIZONTAL
; n
++) {
138 *EvenPtr32
++ = *data
;
146 void video_putc(const char c
)
150 void video_puts(const char *s
)
154 static int video_init(void)
157 NTSCFrame
= (char *)NTSC_FRAME_ADDR
;
158 NTSC_framebuffer_init(NTSCFrame
);
159 fill_frame(NTSCFrame
, BLUE
);
161 *pPPI_CONTROL
= 0x0082;
162 *pPPI_FRAME
= 0x020D;
164 *pDMA0_START_ADDR
= NTSCFrame
;
165 *pDMA0_X_COUNT
= 0x035A;
166 *pDMA0_X_MODIFY
= 0x0002;
167 *pDMA0_Y_COUNT
= 0x020D;
168 *pDMA0_Y_MODIFY
= 0x0002;
169 *pDMA0_CONFIG
= 0x1015;
170 *pPPI_CONTROL
= 0x0083;
174 int drv_video_init(void)
176 int error
, devices
= 1;
180 video_init(); /* Video initialization */
182 memset(&videodev
, 0, sizeof(videodev
));
184 strcpy(videodev
.name
, "video");
185 videodev
.ext
= DEV_EXT_VIDEO
; /* Video extensions */
186 videodev
.flags
= DEV_FLAGS_OUTPUT
; /* Output only */
187 videodev
.putc
= video_putc
; /* 'putc' function */
188 videodev
.puts
= video_puts
; /* 'puts' function */
190 error
= device_register(&videodev
);
192 return (error
== 0) ? devices
: error
;