X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=board%2Fcm-bf548%2Fvideo.c;h=b098615d4c04a2f71e611a08f6e0d87a8efca07f;hb=316328f59d5bb64ed8ab70b68edb434cae70ee58;hp=078734269d744be5b514e2dbef179efab08a9c3f;hpb=cb95c7a935ab9b52dac5d08e5ba4007c5a480f97;p=u-boot diff --git a/board/cm-bf548/video.c b/board/cm-bf548/video.c index 078734269d..b098615d4c 100644 --- a/board/cm-bf548/video.c +++ b/board/cm-bf548/video.c @@ -11,20 +11,23 @@ #include #include #include +#include +#include +#include #include #include #include #include -int gunzip(void *, int, unsigned char *, unsigned long *); - -#ifdef CONFIG_VIDEO +#include +#include +#include #define DMA_SIZE16 2 #include -#include +#include EASYLOGO_HEADER #define LCD_X_RES 480 /*Horizontal Resolution */ #define LCD_Y_RES 272 /* Vertical Resolution */ @@ -153,61 +156,55 @@ void Init_PPI(void) void Init_DMA(void *dst) { - #if defined(CONFIG_DEB_DMA_URGENT) - *pEBIU_DDRQUE |= DEB2_URGENT; + bfin_write_EBIU_DDRQUE(bfin_read_EBIU_DDRQUE() | DEB2_URGENT); #endif - *pDMA12_START_ADDR = dst; + bfin_write_DMA12_START_ADDR(dst); /* X count */ - *pDMA12_X_COUNT = (LCD_X_RES * LCD_BPP) / DMA_BUS_SIZE; - *pDMA12_X_MODIFY = DMA_BUS_SIZE / 8; + bfin_write_DMA12_X_COUNT((LCD_X_RES * LCD_BPP) / DMA_BUS_SIZE); + bfin_write_DMA12_X_MODIFY(DMA_BUS_SIZE / 8); /* Y count */ - *pDMA12_Y_COUNT = LCD_Y_RES; - *pDMA12_Y_MODIFY = DMA_BUS_SIZE / 8; + bfin_write_DMA12_Y_COUNT(LCD_Y_RES); + bfin_write_DMA12_Y_MODIFY(DMA_BUS_SIZE / 8); /* DMA Config */ - *pDMA12_CONFIG = WDSIZE_32 | /* 32 bit DMA */ + bfin_write_DMA12_CONFIG( + WDSIZE_32 | /* 32 bit DMA */ DMA2D | /* 2D DMA */ - FLOW_AUTO; /* autobuffer mode */ + FLOW_AUTO /* autobuffer mode */ + ); } void Init_Ports(void) { - *pPORTF_MUX = 0x00000000; - *pPORTF_FER |= 0xFFFF; /* PPI0..15 */ - - *pPORTG_MUX &= - ~(PORT_x_MUX_0_MASK | PORT_x_MUX_1_MASK | PORT_x_MUX_2_MASK | - PORT_x_MUX_3_MASK | PORT_x_MUX_4_MASK); - *pPORTG_FER |= PG0 | PG1 | PG2 | PG3 | PG4; /* CLK, FS1, FS2, PPI16..17 */ - + const unsigned short pins[] = { + P_PPI0_D0, P_PPI0_D1, P_PPI0_D2, P_PPI0_D3, P_PPI0_D4, + P_PPI0_D5, P_PPI0_D6, P_PPI0_D7, P_PPI0_D8, P_PPI0_D9, + P_PPI0_D10, P_PPI0_D11, P_PPI0_D12, P_PPI0_D13, P_PPI0_D14, + P_PPI0_D15, P_PPI0_D16, P_PPI0_D17, #if !defined(CONFIG_VIDEO_RGB666) - *pPORTD_MUX &= - ~(PORT_x_MUX_0_MASK | PORT_x_MUX_1_MASK | PORT_x_MUX_2_MASK | - PORT_x_MUX_3_MASK | PORT_x_MUX_4_MASK | PORT_x_MUX_5_MASK); - *pPORTD_MUX |= - (PORT_x_MUX_0_FUNC_4 | PORT_x_MUX_1_FUNC_4 | PORT_x_MUX_2_FUNC_4 | - PORT_x_MUX_3_FUNC_4 | PORT_x_MUX_4_FUNC_4 | PORT_x_MUX_5_FUNC_4); - *pPORTD_FER |= PD0 | PD1 | PD2 | PD3 | PD4 | PD5; /* PPI18..23 */ + P_PPI0_D18, P_PPI0_D19, P_PPI0_D20, P_PPI0_D21, P_PPI0_D22, + P_PPI0_D23, #endif + P_PPI0_CLK, P_PPI0_FS1, P_PPI0_FS2, 0, + }; + peripheral_request_list(pins, "lcd"); - *pPORTE_FER &= ~PE3; /* DISP */ - *pPORTE_DIR_SET = PE3; - *pPORTE_SET = PE3; - + gpio_request(GPIO_PE3, "lcd-disp"); + gpio_direction_output(GPIO_PE3, 1); } void EnableDMA(void) { - *pDMA12_CONFIG |= DMAEN; + bfin_write_DMA12_CONFIG(bfin_read_DMA12_CONFIG() | DMAEN); } void DisableDMA(void) { - *pDMA12_CONFIG &= ~DMAEN; + bfin_write_DMA12_CONFIG(bfin_read_DMA12_CONFIG() & ~DMAEN); } /* enable and disable PPI functions */ @@ -232,6 +229,12 @@ int video_init(void *dst) return 0; } +void video_stop(void) +{ + DisablePPI(); + DisableDMA(); +} + static void dma_bitblit(void *dst, fastimage_t *logo, int x, int y) { if (dcache_status()) @@ -280,14 +283,6 @@ static void dma_bitblit(void *dst, fastimage_t *logo, int x, int y) } -void video_putc(const char c) -{ -} - -void video_puts(const char *s) -{ -} - int drv_video_init(void) { int error, devices = 1; @@ -303,16 +298,27 @@ int drv_video_init(void) printf("Failed to alloc FB memory\n"); return -1; } + #ifdef EASYLOGO_ENABLE_GZIP unsigned char *data = EASYLOGO_DECOMP_BUFFER; unsigned long src_len = EASYLOGO_ENABLE_GZIP; - if (gunzip(data, bfin_logo.size, bfin_logo.data, &src_len)) { + error = gunzip(data, bfin_logo.size, bfin_logo.data, &src_len); + bfin_logo.data = data; +#elif defined(EASYLOGO_ENABLE_LZMA) + unsigned char *data = EASYLOGO_DECOMP_BUFFER; + SizeT lzma_len = bfin_logo.size; + error = lzmaBuffToBuffDecompress(data, &lzma_len, + bfin_logo.data, EASYLOGO_ENABLE_LZMA); + bfin_logo.data = data; +#else + error = 0; +#endif + + if (error) { puts("Failed to decompress logo\n"); free(dst); return -1; } - bfin_logo.data = data; -#endif memset(dst + ACTIVE_VIDEO_MEM_OFFSET, bfin_logo.data[0], fbmem_size - ACTIVE_VIDEO_MEM_OFFSET); @@ -328,12 +334,8 @@ int drv_video_init(void) strcpy(videodev.name, "video"); videodev.ext = DEV_EXT_VIDEO; /* Video extensions */ videodev.flags = DEV_FLAGS_SYSTEM; /* No Output */ - videodev.putc = video_putc; /* 'putc' function */ - videodev.puts = video_puts; /* 'puts' function */ error = stdio_register(&videodev); return (error == 0) ? devices : error; } - -#endif