/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id$ * * Copyright (C) 2008 by Maurus Cuelenaere * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ #include "config.h" #include "jz4740.h" #include "r61509.h" #include "lcd-target.h" #define PIN_CS_N (32*1+17) /* Chip select */ #define PIN_RESET_N (32*1+18) /* Reset */ #define LCD_PCLK (20000000) /* LCD PCLK */ #define my__gpio_as_lcd_16bit() \ do { \ REG_GPIO_PXFUNS(2) = 0x001cffff; \ REG_GPIO_PXSELC(2) = 0x001cffff; \ REG_GPIO_PXPES(2) = 0x001cffff; \ } while (0) #define SLEEP(x) for(i=0; i 0x1ff ) val = 0x1ff; /* CPM_LPCDR is too large, set it to 0x1ff */ __cpm_set_pixdiv(val); __cpm_start_lcd(); } void lcd_init_controller(void) { int i; _display_pin_init(); _set_lcd_bus(); _set_lcd_clock(); SLEEP(1000); _display_init(); } void lcd_set_target(short x, short y, short width, short height) { #if CONFIG_ORIENTATION == SCREEN_PORTRAIT SLCD_SEND_COMMAND(REG_RAM_HADDR_START, y); /* y_start */ SLCD_SEND_COMMAND(REG_RAM_HADDR_END, y+width-1); /* y_end */ SLCD_SEND_COMMAND(REG_RAM_VADDR_START, x); /* x_start */ SLCD_SEND_COMMAND(REG_RAM_VADDR_END, x+height-1); /* x_end */ #else SLCD_SEND_COMMAND(REG_RAM_HADDR_START, y); /* y_start */ SLCD_SEND_COMMAND(REG_RAM_HADDR_END, y+height-1); /* y_end */ SLCD_SEND_COMMAND(REG_RAM_VADDR_START, x); /* x_start */ SLCD_SEND_COMMAND(REG_RAM_VADDR_END, x+width-1); /* x_end */ #endif SLCD_SEND_COMMAND(REG_RAM_HADDR_SET, y); /* set cursor at x_start */ SLCD_SEND_COMMAND(REG_RAM_VADDR_SET, x); /* set cursor at y_start */ SLCD_SET_COMMAND(REG_RW_GRAM); /* write data to GRAM */ } void lcd_set_flip(bool yesno) { int i; __cpm_start_lcd(); #if CONFIG_ORIENTATION == SCREEN_PORTRAIT if(yesno) { SLCD_SEND_COMMAND(REG_ENTRY_MODE, (ENTRY_MODE_BGR | ENTRY_MODE_HWM)); } else { SLCD_SEND_COMMAND(REG_ENTRY_MODE, (ENTRY_MODE_BGR | ENTRY_MODE_VID | ENTRY_MODE_HID | ENTRY_MODE_HWM)); } #else if(yesno) { SLCD_SEND_COMMAND(REG_ENTRY_MODE, (ENTRY_MODE_BGR | ENTRY_MODE_HID | ENTRY_MODE_AM)); } else { SLCD_SEND_COMMAND(REG_ENTRY_MODE, (ENTRY_MODE_BGR | ENTRY_MODE_VID | ENTRY_MODE_AM)); } #endif DELAY; __cpm_stop_lcd(); } void lcd_on(void) { _display_on(); } void lcd_off(void) { _display_off(); } void lcd_set_contrast(int val) { (void)val; }