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>
23 int gunzip(void *, int, unsigned char *, unsigned long *);
27 #include <asm/mach-common/bits/ppi.h>
29 #define NTSC_FRAME_ADDR 0x06000000
32 /* NTSC OUTPUT SIZE 720 * 240 */
36 int is_vblank_line(const int line)
39 * This array contains a single bit for each line in
42 if ((line <= 18) || (line >= 264 && line <= 281) || (line == 528))
48 int NTSC_framebuffer_init(char *base_address)
50 const int NTSC_frames = 1;
51 const int NTSC_lines = 525;
52 char *dest = base_address;
53 int frame_num, line_num;
55 for (frame_num = 0; frame_num < NTSC_frames; ++frame_num) {
56 for (line_num = 1; line_num <= NTSC_lines; ++line_num) {
61 if (is_vblank_line(line_num))
64 if (line_num > 266 || line_num < 3)
68 code = system_code_map[offset].eav;
69 write_dest_byte((char)(code >> 24) & 0xff);
70 write_dest_byte((char)(code >> 16) & 0xff);
71 write_dest_byte((char)(code >> 8) & 0xff);
72 write_dest_byte((char)(code) & 0xff);
74 /* Output horizontal blanking */
75 for (i = 0; i < 67 * 2; ++i) {
76 write_dest_byte(0x80);
77 write_dest_byte(0x10);
81 code = system_code_map[offset].sav;
82 write_dest_byte((char)(code >> 24) & 0xff);
83 write_dest_byte((char)(code >> 16) & 0xff);
84 write_dest_byte((char)(code >> 8) & 0xff);
85 write_dest_byte((char)(code) & 0xff);
87 /* Output empty horizontal data */
88 for (i = 0; i < 360 * 2; ++i) {
89 write_dest_byte(0x80);
90 write_dest_byte(0x10);
95 return dest - base_address;
98 void fill_frame(char *Frame, int Value)
108 /* fill odd and even frames */
109 for (OddLine = 22, EvenLine = 285; OddLine < 263; OddLine++, EvenLine++) {
110 OddPtr32 = (int *)((Frame + (OddLine * 1716)) + 276);
111 EvenPtr32 = (int *)((Frame + (EvenLine * 1716)) + 276);
112 for (i = 0; i < 360; i++, OddPtr32++, EvenPtr32++) {
118 for (m = 0; m < VERTICAL; m++) {
119 data = (int *)u_boot_logo.data;
120 for (OddLine = (22 + m), EvenLine = (285 + m);
121 OddLine < (u_boot_logo.height * VERTICAL) + (22 + m);
122 OddLine += VERTICAL, EvenLine += VERTICAL) {
123 OddPtr32 = (int *)((Frame + ((OddLine) * 1716)) + 276);
125 (int *)((Frame + ((EvenLine) * 1716)) + 276);
126 for (i = 0; i < u_boot_logo.width / 2; i++) {
127 /* enlarge one pixel to m x n */
128 for (n = 0; n < HORIZONTAL; n++) {
130 *EvenPtr32++ = *data;
138 static void video_init(char *NTSCFrame)
140 NTSC_framebuffer_init(NTSCFrame);
141 fill_frame(NTSCFrame, BLUE);
143 bfin_write_PPI_CONTROL(0x0082);
144 bfin_write_PPI_FRAME(0x020D);
146 bfin_write_DMA0_START_ADDR(NTSCFrame);
147 bfin_write_DMA0_X_COUNT(0x035A);
148 bfin_write_DMA0_X_MODIFY(0x0002);
149 bfin_write_DMA0_Y_COUNT(0x020D);
150 bfin_write_DMA0_Y_MODIFY(0x0002);
151 bfin_write_DMA0_CONFIG(0x1015);
152 bfin_write_PPI_CONTROL(0x0083);
155 int drv_video_init(void)
159 video_init((void *)NTSC_FRAME_ADDR);
161 memset(&videodev, 0, sizeof(videodev));
162 strcpy(videodev.name, "video");
163 videodev.ext = DEV_EXT_VIDEO;
164 videodev.flags = DEV_FLAGS_SYSTEM;
166 return device_register(&videodev);