]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/bf533-stamp/video.c
2 * BF533-STAMP splash driver
4 * Copyright (c) 2006-2008 Analog Devices Inc.
6 * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it
8 * Wolfgang Denk, wd@denx.de
10 * Licensed under the GPL-2 or later.
17 #include <asm/blackfin.h>
18 #include <asm/mach-common/bits/dma.h>
20 #include <linux/types.h>
21 #include <stdio_dev.h>
25 #include <asm/mach-common/bits/ppi.h>
27 #define NTSC_FRAME_ADDR 0x06000000
30 /* NTSC OUTPUT SIZE 720 * 240 */
34 int is_vblank_line(const int line
)
37 * This array contains a single bit for each line in
40 if ((line
<= 18) || (line
>= 264 && line
<= 281) || (line
== 528))
46 int NTSC_framebuffer_init(char *base_address
)
48 const int NTSC_frames
= 1;
49 const int NTSC_lines
= 525;
50 char *dest
= base_address
;
51 int frame_num
, line_num
;
53 for (frame_num
= 0; frame_num
< NTSC_frames
; ++frame_num
) {
54 for (line_num
= 1; line_num
<= NTSC_lines
; ++line_num
) {
59 if (is_vblank_line(line_num
))
62 if (line_num
> 266 || line_num
< 3)
66 code
= system_code_map
[offset
].eav
;
67 write_dest_byte((char)(code
>> 24) & 0xff);
68 write_dest_byte((char)(code
>> 16) & 0xff);
69 write_dest_byte((char)(code
>> 8) & 0xff);
70 write_dest_byte((char)(code
) & 0xff);
72 /* Output horizontal blanking */
73 for (i
= 0; i
< 67 * 2; ++i
) {
74 write_dest_byte(0x80);
75 write_dest_byte(0x10);
79 code
= system_code_map
[offset
].sav
;
80 write_dest_byte((char)(code
>> 24) & 0xff);
81 write_dest_byte((char)(code
>> 16) & 0xff);
82 write_dest_byte((char)(code
>> 8) & 0xff);
83 write_dest_byte((char)(code
) & 0xff);
85 /* Output empty horizontal data */
86 for (i
= 0; i
< 360 * 2; ++i
) {
87 write_dest_byte(0x80);
88 write_dest_byte(0x10);
93 return dest
- base_address
;
96 void fill_frame(char *Frame
, int Value
)
106 /* fill odd and even frames */
107 for (OddLine
= 22, EvenLine
= 285; OddLine
< 263; OddLine
++, EvenLine
++) {
108 OddPtr32
= (int *)((Frame
+ (OddLine
* 1716)) + 276);
109 EvenPtr32
= (int *)((Frame
+ (EvenLine
* 1716)) + 276);
110 for (i
= 0; i
< 360; i
++, OddPtr32
++, EvenPtr32
++) {
116 for (m
= 0; m
< VERTICAL
; m
++) {
117 data
= (int *)u_boot_logo
.data
;
118 for (OddLine
= (22 + m
), EvenLine
= (285 + m
);
119 OddLine
< (u_boot_logo
.height
* VERTICAL
) + (22 + m
);
120 OddLine
+= VERTICAL
, EvenLine
+= VERTICAL
) {
121 OddPtr32
= (int *)((Frame
+ ((OddLine
) * 1716)) + 276);
123 (int *)((Frame
+ ((EvenLine
) * 1716)) + 276);
124 for (i
= 0; i
< u_boot_logo
.width
/ 2; i
++) {
125 /* enlarge one pixel to m x n */
126 for (n
= 0; n
< HORIZONTAL
; n
++) {
128 *EvenPtr32
++ = *data
;
136 static void video_init(char *NTSCFrame
)
138 NTSC_framebuffer_init(NTSCFrame
);
139 fill_frame(NTSCFrame
, BLUE
);
141 bfin_write_PPI_CONTROL(0x0082);
142 bfin_write_PPI_FRAME(0x020D);
144 bfin_write_DMA0_START_ADDR(NTSCFrame
);
145 bfin_write_DMA0_X_COUNT(0x035A);
146 bfin_write_DMA0_X_MODIFY(0x0002);
147 bfin_write_DMA0_Y_COUNT(0x020D);
148 bfin_write_DMA0_Y_MODIFY(0x0002);
149 bfin_write_DMA0_CONFIG(0x1015);
150 bfin_write_PPI_CONTROL(0x0083);
153 void video_stop(void)
155 bfin_write_PPI_CONTROL(0);
156 bfin_write_DMA0_CONFIG(0);
159 int drv_video_init(void)
161 struct stdio_dev videodev
;
163 video_init((void *)NTSC_FRAME_ADDR
);
165 memset(&videodev
, 0, sizeof(videodev
));
166 strcpy(videodev
.name
, "video");
167 videodev
.ext
= DEV_EXT_VIDEO
;
169 return stdio_register(&videodev
);