Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 1 | /* |
| 2 | * video.c - run splash screen on lcd |
| 3 | * |
| 4 | * Copyright (c) 2007-2008 Analog Devices Inc. |
| 5 | * |
| 6 | * Licensed under the GPL-2 or later. |
| 7 | */ |
| 8 | |
| 9 | #include <stdarg.h> |
| 10 | #include <common.h> |
| 11 | #include <config.h> |
| 12 | #include <malloc.h> |
| 13 | #include <asm/blackfin.h> |
Mike Frysinger | 22e6440 | 2010-06-02 19:30:01 -0400 | [diff] [blame] | 14 | #include <asm/portmux.h> |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 15 | #include <asm/mach-common/bits/dma.h> |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 16 | #include <spi.h> |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 17 | #include <linux/types.h> |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 18 | #include <stdio_dev.h> |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 19 | |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 20 | #include <asm/mach-common/bits/ppi.h> |
| 21 | #include <asm/mach-common/bits/timer.h> |
| 22 | |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 23 | #define LCD_X_RES 320 /* Horizontal Resolution */ |
| 24 | #define LCD_Y_RES 240 /* Vertical Resolution */ |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 25 | #define DMA_BUS_SIZE 16 |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 26 | |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 27 | #ifdef CONFIG_MK_BF527_EZKIT_REV_2_1 /* lq035q1 */ |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 28 | |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 29 | #if !defined(CONFIG_LQ035Q1_USE_RGB888_8_BIT_PPI) && \ |
| 30 | !defined(CONFIG_LQ035Q1_USE_RGB565_8_BIT_PPI) |
| 31 | # define CONFIG_LQ035Q1_USE_RGB565_8_BIT_PPI |
| 32 | #endif |
| 33 | |
| 34 | /* Interface 16/18-bit TFT over an 8-bit wide PPI using a |
| 35 | * small Programmable Logic Device (CPLD) |
| 36 | * http://blackfin.uclinux.org/gf/project/stamp/frs/?action=FrsReleaseBrowse&frs_package_id=165 |
| 37 | */ |
| 38 | |
| 39 | #ifdef CONFIG_LQ035Q1_USE_RGB565_8_BIT_PPI |
| 40 | #include <asm/bfin_logo_rgb565_230x230.h> |
| 41 | #define LCD_BPP 16 /* Bit Per Pixel */ |
| 42 | #define CLOCKS_PPIX 2 /* Clocks per pixel */ |
| 43 | #define CPLD_DELAY 3 /* RGB565 pipeline delay */ |
| 44 | #endif |
| 45 | |
| 46 | #ifdef CONFIG_LQ035Q1_USE_RGB888_8_BIT_PPI |
| 47 | #include <asm/bfin_logo_230x230.h> |
| 48 | #define LCD_BPP 24 /* Bit Per Pixel */ |
| 49 | #define CLOCKS_PPIX 3 /* Clocks per pixel */ |
| 50 | #define CPLD_DELAY 5 /* RGB888 pipeline delay */ |
| 51 | #endif |
| 52 | |
| 53 | /* |
| 54 | * HS and VS timing parameters (all in number of PPI clk ticks) |
| 55 | */ |
| 56 | |
| 57 | #define H_ACTPIX (LCD_X_RES * CLOCKS_PPIX) /* active horizontal pixel */ |
| 58 | #define H_PERIOD (336 * CLOCKS_PPIX) /* HS period */ |
| 59 | #define H_PULSE (2 * CLOCKS_PPIX) /* HS pulse width */ |
| 60 | #define H_START (7 * CLOCKS_PPIX + CPLD_DELAY) /* first valid pixel */ |
| 61 | |
| 62 | #define U_LINE 4 /* Blanking Lines */ |
| 63 | |
| 64 | #define V_LINES (LCD_Y_RES + U_LINE) /* total vertical lines */ |
| 65 | #define V_PULSE (2 * CLOCKS_PPIX) /* VS pulse width (1-5 H_PERIODs) */ |
| 66 | #define V_PERIOD (H_PERIOD * V_LINES) /* VS period */ |
| 67 | |
| 68 | #define ACTIVE_VIDEO_MEM_OFFSET ((U_LINE / 2) * LCD_X_RES * (LCD_BPP / 8)) |
| 69 | |
| 70 | /* |
| 71 | * LCD Modes |
| 72 | */ |
| 73 | #define LQ035_RL (0 << 8) /* Right -> Left Scan */ |
| 74 | #define LQ035_LR (1 << 8) /* Left -> Right Scan */ |
| 75 | #define LQ035_TB (1 << 9) /* Top -> Botton Scan */ |
| 76 | #define LQ035_BT (0 << 9) /* Botton -> Top Scan */ |
| 77 | #define LQ035_BGR (1 << 11) /* Use BGR format */ |
| 78 | #define LQ035_RGB (0 << 11) /* Use RGB format */ |
| 79 | #define LQ035_NORM (1 << 13) /* Reversal */ |
| 80 | #define LQ035_REV (0 << 13) /* Reversal */ |
| 81 | |
| 82 | #define LQ035_INDEX 0x74 |
| 83 | #define LQ035_DATA 0x76 |
| 84 | |
| 85 | #define LQ035_DRIVER_OUTPUT_CTL 0x1 |
| 86 | #define LQ035_SHUT_CTL 0x11 |
| 87 | |
| 88 | #define LQ035_DRIVER_OUTPUT_MASK (LQ035_LR | LQ035_TB | LQ035_BGR | LQ035_REV) |
| 89 | #define LQ035_DRIVER_OUTPUT_DEFAULT (0x2AEF & ~LQ035_DRIVER_OUTPUT_MASK) |
| 90 | |
| 91 | #define LQ035_SHUT (1 << 0) /* Shutdown */ |
| 92 | #define LQ035_ON (0 << 0) /* Shutdown */ |
| 93 | |
| 94 | #ifndef CONFIG_LQ035Q1_LCD_MODE |
| 95 | #define CONFIG_LQ035Q1_LCD_MODE (LQ035_NORM | LQ035_RL | LQ035_TB | LQ035_BGR) |
| 96 | #endif |
| 97 | |
| 98 | #else /* t350mcqb */ |
| 99 | #include <asm/bfin_logo_230x230.h> |
| 100 | |
| 101 | #define LCD_BPP 24 /* Bit Per Pixel */ |
| 102 | #define CLOCKS_PPIX 3 /* Clocks per pixel */ |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 103 | |
| 104 | /* HS and VS timing parameters (all in number of PPI clk ticks) */ |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 105 | #define H_ACTPIX (LCD_X_RES * CLOCKS_PPIX) /* active horizontal pixel */ |
| 106 | #define H_PERIOD (408 * CLOCKS_PPIX) /* HS period */ |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 107 | #define H_PULSE 90 /* HS pulse width */ |
| 108 | #define H_START 204 /* first valid pixel */ |
| 109 | |
| 110 | #define U_LINE 1 /* Blanking Lines */ |
| 111 | |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 112 | #define V_LINES (LCD_Y_RES + U_LINE) /* total vertical lines */ |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 113 | #define V_PULSE (3 * H_PERIOD) /* VS pulse width (1-5 H_PERIODs) */ |
| 114 | #define V_PERIOD (H_PERIOD * V_LINES) /* VS period */ |
| 115 | |
| 116 | #define ACTIVE_VIDEO_MEM_OFFSET (U_LINE * H_ACTPIX) |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 117 | #endif |
| 118 | |
| 119 | #define LCD_PIXEL_SIZE (LCD_BPP / 8) |
| 120 | #define DMA_SIZE16 2 |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 121 | |
| 122 | #define PPI_TX_MODE 0x2 |
| 123 | #define PPI_XFER_TYPE_11 0xC |
| 124 | #define PPI_PORT_CFG_01 0x10 |
| 125 | #define PPI_PACK_EN 0x80 |
| 126 | #define PPI_POLS_1 0x8000 |
| 127 | |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 128 | #ifdef CONFIG_MK_BF527_EZKIT_REV_2_1 |
| 129 | static struct spi_slave *slave; |
| 130 | static int lq035q1_control(unsigned char reg, unsigned short value) |
| 131 | { |
| 132 | int ret; |
| 133 | u8 regs[3] = {LQ035_INDEX, 0, 0}; |
| 134 | u8 data[3] = {LQ035_DATA, 0, 0}; |
| 135 | u8 dummy[3]; |
| 136 | |
| 137 | regs[2] = reg; |
| 138 | data[1] = value >> 8; |
| 139 | data[2] = value & 0xFF; |
| 140 | |
| 141 | if (!slave) { |
| 142 | /* FIXME: Verify the max SCK rate */ |
| 143 | slave = spi_setup_slave(CONFIG_LQ035Q1_SPI_BUS, |
| 144 | CONFIG_LQ035Q1_SPI_CS, 20000000, |
| 145 | SPI_MODE_3); |
| 146 | if (!slave) |
| 147 | return -1; |
| 148 | } |
| 149 | |
| 150 | if (spi_claim_bus(slave)) |
| 151 | return -1; |
| 152 | |
| 153 | ret = spi_xfer(slave, 24, regs, dummy, SPI_XFER_BEGIN | SPI_XFER_END); |
| 154 | ret |= spi_xfer(slave, 24, data, dummy, SPI_XFER_BEGIN | SPI_XFER_END); |
| 155 | |
| 156 | spi_release_bus(slave); |
| 157 | |
| 158 | return ret; |
| 159 | } |
| 160 | #endif |
| 161 | |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 162 | /* enable and disable PPI functions */ |
| 163 | void EnablePPI(void) |
| 164 | { |
| 165 | *pPPI_CONTROL |= PORT_EN; |
| 166 | } |
| 167 | |
| 168 | void DisablePPI(void) |
| 169 | { |
| 170 | *pPPI_CONTROL &= ~PORT_EN; |
| 171 | } |
| 172 | |
| 173 | void Init_Ports(void) |
| 174 | { |
Mike Frysinger | 22e6440 | 2010-06-02 19:30:01 -0400 | [diff] [blame] | 175 | const unsigned short pins[] = { |
| 176 | P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3, P_PPI0_D4, |
| 177 | P_PPI0_D5, P_PPI0_D6, P_PPI0_D7, P_PPI0_FS2, 0, |
| 178 | }; |
| 179 | peripheral_request_list(pins, "lcd"); |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | void Init_PPI(void) |
| 183 | { |
| 184 | |
| 185 | *pPPI_DELAY = H_START; |
| 186 | *pPPI_COUNT = (H_ACTPIX-1); |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 187 | *pPPI_FRAME = V_LINES; |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 188 | |
| 189 | /* PPI control, to be replaced with definitions */ |
| 190 | *pPPI_CONTROL = PPI_TX_MODE | /* output mode , PORT_DIR */ |
| 191 | PPI_XFER_TYPE_11 | /* sync mode XFR_TYPE */ |
| 192 | PPI_PORT_CFG_01 | /* two frame sync PORT_CFG */ |
| 193 | PPI_PACK_EN | /* packing enabled PACK_EN */ |
| 194 | PPI_POLS_1; /* faling edge syncs POLS */ |
| 195 | } |
| 196 | |
| 197 | void Init_DMA(void *dst) |
| 198 | { |
| 199 | *pDMA0_START_ADDR = dst; |
| 200 | |
| 201 | /* X count */ |
| 202 | *pDMA0_X_COUNT = H_ACTPIX / 2; |
| 203 | *pDMA0_X_MODIFY = DMA_BUS_SIZE / 8; |
| 204 | |
| 205 | /* Y count */ |
| 206 | *pDMA0_Y_COUNT = V_LINES; |
| 207 | *pDMA0_Y_MODIFY = DMA_BUS_SIZE / 8; |
| 208 | |
| 209 | /* DMA Config */ |
| 210 | *pDMA0_CONFIG = |
| 211 | WDSIZE_16 | /* 16 bit DMA */ |
| 212 | DMA2D | /* 2D DMA */ |
| 213 | FLOW_AUTO; /* autobuffer mode */ |
| 214 | } |
| 215 | |
| 216 | |
| 217 | void EnableDMA(void) |
| 218 | { |
| 219 | *pDMA0_CONFIG |= DMAEN; |
| 220 | } |
| 221 | |
| 222 | void DisableDMA(void) |
| 223 | { |
| 224 | *pDMA0_CONFIG &= ~DMAEN; |
| 225 | } |
| 226 | |
| 227 | |
| 228 | /* Init TIMER0 as Frame Sync 1 generator */ |
| 229 | void InitTIMER0(void) |
| 230 | { |
| 231 | *pTIMER_DISABLE |= TIMDIS0; /* disable Timer */ |
| 232 | SSYNC(); |
| 233 | *pTIMER_STATUS |= TIMIL0 | TOVF_ERR0 | TRUN0; /* clear status */ |
| 234 | SSYNC(); |
| 235 | |
| 236 | *pTIMER0_PERIOD = H_PERIOD; |
| 237 | SSYNC(); |
| 238 | *pTIMER0_WIDTH = H_PULSE; |
| 239 | SSYNC(); |
| 240 | |
| 241 | *pTIMER0_CONFIG = PWM_OUT | |
| 242 | PERIOD_CNT | |
| 243 | TIN_SEL | |
| 244 | CLK_SEL | |
| 245 | EMU_RUN; |
| 246 | SSYNC(); |
| 247 | } |
| 248 | |
| 249 | void EnableTIMER0(void) |
| 250 | { |
| 251 | *pTIMER_ENABLE |= TIMEN0; |
| 252 | SSYNC(); |
| 253 | } |
| 254 | |
| 255 | void DisableTIMER0(void) |
| 256 | { |
| 257 | *pTIMER_DISABLE |= TIMDIS0; |
| 258 | SSYNC(); |
| 259 | } |
| 260 | |
| 261 | |
| 262 | void InitTIMER1(void) |
| 263 | { |
| 264 | *pTIMER_DISABLE |= TIMDIS1; /* disable Timer */ |
| 265 | SSYNC(); |
| 266 | *pTIMER_STATUS |= TIMIL1 | TOVF_ERR1 | TRUN1; /* clear status */ |
| 267 | SSYNC(); |
| 268 | |
| 269 | |
| 270 | *pTIMER1_PERIOD = V_PERIOD; |
| 271 | SSYNC(); |
| 272 | *pTIMER1_WIDTH = V_PULSE; |
| 273 | SSYNC(); |
| 274 | |
| 275 | *pTIMER1_CONFIG = PWM_OUT | |
| 276 | PERIOD_CNT | |
| 277 | TIN_SEL | |
| 278 | CLK_SEL | |
| 279 | EMU_RUN; |
| 280 | SSYNC(); |
| 281 | } |
| 282 | |
| 283 | void EnableTIMER1(void) |
| 284 | { |
| 285 | *pTIMER_ENABLE |= TIMEN1; |
| 286 | SSYNC(); |
| 287 | } |
| 288 | |
| 289 | void DisableTIMER1(void) |
| 290 | { |
| 291 | *pTIMER_DISABLE |= TIMDIS1; |
| 292 | SSYNC(); |
| 293 | } |
| 294 | |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 295 | void EnableTIMER12(void) |
| 296 | { |
| 297 | *pTIMER_ENABLE |= TIMEN1 | TIMEN0; |
| 298 | SSYNC(); |
| 299 | } |
| 300 | |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 301 | int video_init(void *dst) |
| 302 | { |
| 303 | |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 304 | #ifdef CONFIG_MK_BF527_EZKIT_REV_2_1 |
| 305 | lq035q1_control(LQ035_SHUT_CTL, LQ035_ON); |
| 306 | lq035q1_control(LQ035_DRIVER_OUTPUT_CTL, (CONFIG_LQ035Q1_LCD_MODE & |
| 307 | LQ035_DRIVER_OUTPUT_MASK) | LQ035_DRIVER_OUTPUT_DEFAULT); |
| 308 | #endif |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 309 | Init_Ports(); |
| 310 | Init_DMA(dst); |
| 311 | EnableDMA(); |
| 312 | InitTIMER0(); |
| 313 | InitTIMER1(); |
| 314 | Init_PPI(); |
| 315 | EnablePPI(); |
| 316 | |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 317 | #ifdef CONFIG_MK_BF527_EZKIT_REV_2_1 |
| 318 | EnableTIMER12(); |
| 319 | #else |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 320 | /* Frame sync 2 (VS) needs to start at least one PPI clk earlier */ |
| 321 | EnableTIMER1(); |
| 322 | /* Add Some Delay ... */ |
| 323 | SSYNC(); |
| 324 | SSYNC(); |
| 325 | SSYNC(); |
| 326 | SSYNC(); |
| 327 | |
| 328 | /* now start frame sync 1 */ |
| 329 | EnableTIMER0(); |
Michael Hennerich | 10eafa1 | 2009-12-10 09:19:21 +0000 | [diff] [blame] | 330 | #endif |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 331 | |
| 332 | return 0; |
| 333 | } |
| 334 | |
| 335 | static void dma_bitblit(void *dst, fastimage_t *logo, int x, int y) |
| 336 | { |
| 337 | if (dcache_status()) |
| 338 | blackfin_dcache_flush_range(logo->data, logo->data + logo->size); |
| 339 | |
| 340 | bfin_write_MDMA_D0_IRQ_STATUS(DMA_DONE | DMA_ERR); |
| 341 | |
| 342 | /* Setup destination start address */ |
| 343 | bfin_write_MDMA_D0_START_ADDR(dst + ((x & -2) * LCD_PIXEL_SIZE) |
| 344 | + (y * LCD_X_RES * LCD_PIXEL_SIZE)); |
| 345 | /* Setup destination xcount */ |
| 346 | bfin_write_MDMA_D0_X_COUNT(logo->width * LCD_PIXEL_SIZE / DMA_SIZE16); |
| 347 | /* Setup destination xmodify */ |
| 348 | bfin_write_MDMA_D0_X_MODIFY(DMA_SIZE16); |
| 349 | |
| 350 | /* Setup destination ycount */ |
| 351 | bfin_write_MDMA_D0_Y_COUNT(logo->height); |
| 352 | /* Setup destination ymodify */ |
| 353 | bfin_write_MDMA_D0_Y_MODIFY((LCD_X_RES - logo->width) * LCD_PIXEL_SIZE + DMA_SIZE16); |
| 354 | |
| 355 | |
| 356 | /* Setup Source start address */ |
| 357 | bfin_write_MDMA_S0_START_ADDR(logo->data); |
| 358 | /* Setup Source xcount */ |
| 359 | bfin_write_MDMA_S0_X_COUNT(logo->width * LCD_PIXEL_SIZE / DMA_SIZE16); |
| 360 | /* Setup Source xmodify */ |
| 361 | bfin_write_MDMA_S0_X_MODIFY(DMA_SIZE16); |
| 362 | |
| 363 | /* Setup Source ycount */ |
| 364 | bfin_write_MDMA_S0_Y_COUNT(logo->height); |
| 365 | /* Setup Source ymodify */ |
| 366 | bfin_write_MDMA_S0_Y_MODIFY(DMA_SIZE16); |
| 367 | |
| 368 | |
| 369 | /* Enable source DMA */ |
| 370 | bfin_write_MDMA_S0_CONFIG(DMAEN | WDSIZE_16 | DMA2D); |
| 371 | SSYNC(); |
| 372 | bfin_write_MDMA_D0_CONFIG(WNR | DMAEN | WDSIZE_16 | DMA2D); |
| 373 | |
| 374 | while (bfin_read_MDMA_D0_IRQ_STATUS() & DMA_RUN); |
| 375 | |
| 376 | bfin_write_MDMA_S0_IRQ_STATUS(bfin_read_MDMA_S0_IRQ_STATUS() | DMA_DONE | DMA_ERR); |
| 377 | bfin_write_MDMA_D0_IRQ_STATUS(bfin_read_MDMA_D0_IRQ_STATUS() | DMA_DONE | DMA_ERR); |
| 378 | |
| 379 | } |
| 380 | |
| 381 | void video_putc(const char c) |
| 382 | { |
| 383 | } |
| 384 | |
| 385 | void video_puts(const char *s) |
| 386 | { |
| 387 | } |
| 388 | |
| 389 | int drv_video_init(void) |
| 390 | { |
| 391 | int error, devices = 1; |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 392 | struct stdio_dev videodev; |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 393 | |
| 394 | u8 *dst; |
| 395 | u32 fbmem_size = LCD_X_RES * LCD_Y_RES * LCD_PIXEL_SIZE + ACTIVE_VIDEO_MEM_OFFSET; |
| 396 | |
| 397 | dst = malloc(fbmem_size); |
| 398 | |
| 399 | if (dst == NULL) { |
| 400 | printf("Failed to alloc FB memory\n"); |
| 401 | return -1; |
| 402 | } |
| 403 | |
| 404 | #ifdef EASYLOGO_ENABLE_GZIP |
| 405 | unsigned char *data = EASYLOGO_DECOMP_BUFFER; |
| 406 | unsigned long src_len = EASYLOGO_ENABLE_GZIP; |
| 407 | if (gunzip(data, bfin_logo.size, bfin_logo.data, &src_len)) { |
| 408 | puts("Failed to decompress logo\n"); |
| 409 | free(dst); |
| 410 | return -1; |
| 411 | } |
| 412 | bfin_logo.data = data; |
| 413 | #endif |
| 414 | |
| 415 | memset(dst + ACTIVE_VIDEO_MEM_OFFSET, bfin_logo.data[0], fbmem_size - ACTIVE_VIDEO_MEM_OFFSET); |
| 416 | |
| 417 | dma_bitblit(dst + ACTIVE_VIDEO_MEM_OFFSET, &bfin_logo, |
| 418 | (LCD_X_RES - bfin_logo.width) / 2, |
| 419 | (LCD_Y_RES - bfin_logo.height) / 2); |
| 420 | |
| 421 | video_init(dst); /* Video initialization */ |
| 422 | |
| 423 | memset(&videodev, 0, sizeof(videodev)); |
| 424 | |
| 425 | strcpy(videodev.name, "video"); |
| 426 | videodev.ext = DEV_EXT_VIDEO; /* Video extensions */ |
| 427 | videodev.flags = DEV_FLAGS_SYSTEM; /* No Output */ |
| 428 | videodev.putc = video_putc; /* 'putc' function */ |
| 429 | videodev.puts = video_puts; /* 'puts' function */ |
| 430 | |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 431 | error = stdio_register(&videodev); |
Mike Frysinger | d9a5d11 | 2008-10-12 20:59:12 -0400 | [diff] [blame] | 432 | |
| 433 | return (error == 0) ? devices : error; |
| 434 | } |