Che-Liang Chiou | a2a5729 | 2011-10-20 23:04:22 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2011 The Chromium OS Authors. |
| 3 | * See file CREDITS for list of people who contributed to this |
| 4 | * project. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License as |
| 8 | * published by the Free Software Foundation; either version 2 of |
| 9 | * the License, or (at your option) any later version. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this program; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 19 | * MA 02111-1307 USA |
| 20 | */ |
| 21 | |
| 22 | #include <common.h> |
| 23 | #include <api_public.h> |
| 24 | #include <lcd.h> |
| 25 | #include <video_font.h> /* Get font width and height */ |
| 26 | |
| 27 | /* lcd.h needs BMP_LOGO_HEIGHT to calculate CONSOLE_ROWS */ |
| 28 | #if defined(CONFIG_LCD_LOGO) && !defined(CONFIG_LCD_INFO_BELOW_LOGO) |
| 29 | #include <bmp_logo.h> |
| 30 | #endif |
| 31 | |
| 32 | /* TODO(clchiou): add support of video device */ |
| 33 | |
| 34 | int display_get_info(int type, struct display_info *di) |
| 35 | { |
| 36 | if (!di) |
| 37 | return API_EINVAL; |
| 38 | |
| 39 | switch (type) { |
| 40 | default: |
| 41 | debug("%s: unsupport display device type: %d\n", |
| 42 | __FILE__, type); |
| 43 | return API_ENODEV; |
| 44 | #ifdef CONFIG_LCD |
| 45 | case DISPLAY_TYPE_LCD: |
| 46 | di->pixel_width = panel_info.vl_col; |
| 47 | di->pixel_height = panel_info.vl_row; |
| 48 | di->screen_rows = CONSOLE_ROWS; |
| 49 | di->screen_cols = CONSOLE_COLS; |
| 50 | break; |
| 51 | #endif |
| 52 | } |
| 53 | |
| 54 | di->type = type; |
| 55 | return 0; |
| 56 | } |
| 57 | |
| 58 | int display_draw_bitmap(ulong bitmap, int x, int y) |
| 59 | { |
| 60 | if (!bitmap) |
| 61 | return API_EINVAL; |
| 62 | #ifdef CONFIG_LCD |
| 63 | return lcd_display_bitmap(bitmap, x, y); |
| 64 | #else |
| 65 | return API_ENODEV; |
| 66 | #endif |
| 67 | } |
| 68 | |
| 69 | void display_clear(void) |
| 70 | { |
| 71 | #ifdef CONFIG_LCD |
| 72 | lcd_clear(); |
| 73 | #endif |
| 74 | } |