summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/android/dx50/lcd-dx50.c
diff options
context:
space:
mode:
authorUdo Schläpfer <rockbox-2014.10@desktopwarrior.net>2015-02-02 21:44:29 +0100
committerUdo Schläpfer <rockbox-2014.10@desktopwarrior.net>2015-02-02 21:57:55 +0100
commitdbabd0d9c34a33bc0c51243ec37f230d117db955 (patch)
tree46de348929ce739702a230a2587fdb5539585753 /firmware/target/hosted/android/dx50/lcd-dx50.c
parentcef17e3d59ad93f766e8ee23b1610540a33dfe5e (diff)
downloadrockbox-dbabd0d9c34a33bc0c51243ec37f230d117db955.tar.gz
rockbox-dbabd0d9c34a33bc0c51243ec37f230d117db955.zip
iBasso DX50/DX90: Major code cleanup and reorganization.
Reorganization - Separated iBasso devices from PLATFORM_ANDROID. These are now standlone hosted targets. Most device specific code is in the firmware/target/hosted/ibasso directory. - No dependency on Android SDK, only the Android NDK is needed. 32 bit Android NDK and Android API Level 16. - Separate implementation for each device where feasible. Code cleanup - Rewrite of existing code, from simple reformat to complete reimplementation. - New backlight interface, seperating backlight from touchscreen. - Rewrite of device button handler, removing unneeded code and fixing memory leaks. - New Debug messages interface logging to Android adb logcat (DEBUGF, panicf, logf). - Rewrite of lcd device handler, removing unneeded code and fixing memory leaks. - Rewrite of audiohw device handler/pcm interface, removing unneeded code and fixing memory leaks, enabling 44.1/48kHz pthreaded playback. - Rewrite of power and powermng, proper shutdown, using batterylog results (see http://gerrit.rockbox.org/r/#/c/1047/). - Rewrite of configure (Android NDK) and device specific config. - Rewrite of the Android NDK specific Makefile. Misc - All plugins/games/demos activated. - Update tinyalsa to latest from https://github.com/tinyalsa/tinyalsa. Includes - http://gerrit.rockbox.org/r/#/c/993/ - http://gerrit.rockbox.org/r/#/c/1010/ - http://gerrit.rockbox.org/r/#/c/1035/ Does not include http://gerrit.rockbox.org/r/#/c/1007/ due to new backlight interface and new option for hold switch, touchscreen, physical button interaction. Rockbox needs the iBasso DX50/DX90 loader for startup, see http://gerrit.rockbox.org/r/#/c/1099/ The loader expects Rockbox to be installed in /mnt/sdcard/.rockbox/. If /mnt/sdcard/ is accessed as USB mass storage device, Rockbox will exit gracefully and the loader will restart Rockbox on USB disconnect. Tested on iBasso DX50. Compiled (not tested) for iBasso DX90. Compiled (not tested) for PLATFORM_ANDROID. Change-Id: I5f5e22e68f5b4cf29c28e2b40b2c265f2beb7ab7
Diffstat (limited to 'firmware/target/hosted/android/dx50/lcd-dx50.c')
-rw-r--r--firmware/target/hosted/android/dx50/lcd-dx50.c120
1 files changed, 0 insertions, 120 deletions
diff --git a/firmware/target/hosted/android/dx50/lcd-dx50.c b/firmware/target/hosted/android/dx50/lcd-dx50.c
deleted file mode 100644
index 4d78baaf00..0000000000
--- a/firmware/target/hosted/android/dx50/lcd-dx50.c
+++ /dev/null
@@ -1,120 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id: lcd-bitmap.c 29248 2011-02-08 20:05:25Z thomasjfox $
9 *
10 * Copyright (C) 2011 Lorenzo Miori, Thomas Martitz
11 * Copyright (C) 2013 Lorenzo Miori
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
17 *
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
20 *
21 ****************************************************************************/
22
23#include <stdlib.h>
24#include <unistd.h>
25#include <stdio.h>
26#include <linux/fb.h>
27#include <sys/mman.h>
28#include <sys/ioctl.h>
29#include "config.h"
30#include "file.h"
31#include "debug.h"
32#include "system.h"
33#include "screendump.h"
34#include "lcd.h"
35#include "lcd-target.h"
36
37static int dev_fd = 0;
38fb_data *dev_fb = 0;
39
40#ifdef HAVE_LCD_SHUTDOWN
41void lcd_shutdown(void)
42{
43 printf("FB closed.");
44 munmap(dev_fb, FRAMEBUFFER_SIZE);
45 close(dev_fd);
46}
47#endif
48
49void lcd_init_device(void)
50{
51 size_t screensize;
52 struct fb_var_screeninfo vinfo;
53 struct fb_fix_screeninfo finfo;
54
55 /* Open the framebuffer device */
56 dev_fd = open("/dev/graphics/fb0", O_RDWR);
57 if (dev_fd == -1) {
58 perror("Error: cannot open framebuffer device");
59 exit(1);
60 }
61
62 /* Get the fixed properties */
63 if (ioctl(dev_fd, FBIOGET_FSCREENINFO, &finfo) == -1) {
64 perror("Error reading fixed information");
65 exit(2);
66 }
67
68
69 /* Now we get the settable settings, and we set 16 bit bpp */
70 if (ioctl(dev_fd, FBIOGET_VSCREENINFO, &vinfo) == -1) {
71 perror("Error reading variable information");
72 exit(3);
73 }
74 /* framebuffer does not fit the screen, a bug of iBassos Firmware, not rockbox.
75 cannot be solved with parameters */
76 vinfo.bits_per_pixel = LCD_DEPTH;
77 vinfo.xres = vinfo.xres_virtual = vinfo.width = LCD_WIDTH;
78 vinfo.yres = vinfo.yres_virtual = vinfo.height = LCD_HEIGHT;
79
80 if (ioctl(dev_fd, FBIOPUT_VSCREENINFO, &vinfo)) {
81 perror("fbset(ioctl)");
82 exit(4);
83 }
84
85 /* Figure out the size of the screen in bytes */
86 screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
87 if (screensize != FRAMEBUFFER_SIZE) {
88 exit(4);
89 perror("Display and framebuffer mismatch!\n");
90 }
91
92 /* Map the device to memory */
93 dev_fb = mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, dev_fd, 0);
94 if ((int)dev_fb == -1) {
95 perror("Error: failed to map framebuffer device to memory");
96 exit(4);
97 }
98
99 /* Be sure to turn on display at startup */
100 ioctl(dev_fd, FBIOBLANK, VESA_NO_BLANKING);
101#ifdef HAVE_LCD_ENABLE
102 lcd_set_active(true);
103#endif
104}
105
106#ifdef HAVE_LCD_ENABLE
107void lcd_enable(bool enable)
108 {
109 if (lcd_active() == enable)
110 return;
111
112 lcd_set_active(enable);
113
114 /* Turn on or off the display using Linux interface */
115 ioctl(dev_fd, FBIOBLANK, enable ? VESA_NO_BLANKING : VESA_POWERDOWN);
116
117 if (enable)
118 send_event(LCD_EVENT_ACTIVATION, NULL);
119}
120#endif