summaryrefslogtreecommitdiff
path: root/firmware/target/hosted
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted')
-rw-r--r--firmware/target/hosted/filesystem-hosted.h3
-rw-r--r--firmware/target/hosted/filesystem-unix.c6
-rw-r--r--firmware/target/hosted/filesystem-win32.c5
-rw-r--r--firmware/target/hosted/lcd-linuxfb.c24
-rw-r--r--firmware/target/hosted/samsungypr/lcd-ypr.c14
-rw-r--r--firmware/target/hosted/sdl/button-sdl.c2
6 files changed, 29 insertions, 25 deletions
diff --git a/firmware/target/hosted/filesystem-hosted.h b/firmware/target/hosted/filesystem-hosted.h
index b9c7ce648a..348a921f82 100644
--- a/firmware/target/hosted/filesystem-hosted.h
+++ b/firmware/target/hosted/filesystem-hosted.h
@@ -21,9 +21,6 @@
21#ifndef _FILESYSTEM_HOSTED_H_ 21#ifndef _FILESYSTEM_HOSTED_H_
22#define _FILESYSTEM_HOSTED_H_ 22#define _FILESYSTEM_HOSTED_H_
23 23
24#include "mv.h"
25
26int os_volume_path(IF_MV(int volume, ) char *buffer, size_t bufsize);
27void * os_lc_open(const char *ospath); 24void * os_lc_open(const char *ospath);
28 25
29#endif /* _FILESYSTEM_HOSTED_H_ */ 26#endif /* _FILESYSTEM_HOSTED_H_ */
diff --git a/firmware/target/hosted/filesystem-unix.c b/firmware/target/hosted/filesystem-unix.c
index f0d7de640d..4869d07263 100644
--- a/firmware/target/hosted/filesystem-unix.c
+++ b/firmware/target/hosted/filesystem-unix.c
@@ -33,6 +33,8 @@
33#include "pathfuncs.h" 33#include "pathfuncs.h"
34#include "string-extra.h" 34#include "string-extra.h"
35 35
36int os_volume_path(IF_MV(int volume, ) char *buffer, size_t bufsize);
37
36#define SAME_FILE_INFO(sb1p, sb2p) \ 38#define SAME_FILE_INFO(sb1p, sb2p) \
37 ((sb1p)->st_dev == (sb2p)->st_dev && (sb1p)->st_ino == (sb2p)->st_ino) 39 ((sb1p)->st_dev == (sb2p)->st_dev && (sb1p)->st_ino == (sb2p)->st_ino)
38 40
@@ -207,9 +209,9 @@ int os_opendir_and_fd(const char *osdirname, DIR **osdirpp, int *osfdp)
207} 209}
208 210
209/* do we really need this in the app? (in the sim, yes) */ 211/* do we really need this in the app? (in the sim, yes) */
210void volume_size(IF_MV(int volume,) unsigned long *sizep, unsigned long *freep) 212void volume_size(IF_MV(int volume,) sector_t *sizep, sector_t *freep)
211{ 213{
212 unsigned long size = 0, free = 0; 214 sector_t size = 0, free = 0;
213 char volpath[MAX_PATH]; 215 char volpath[MAX_PATH];
214 struct statfs fs; 216 struct statfs fs;
215 217
diff --git a/firmware/target/hosted/filesystem-win32.c b/firmware/target/hosted/filesystem-win32.c
index fac10d003b..ebb7f283ac 100644
--- a/firmware/target/hosted/filesystem-win32.c
+++ b/firmware/target/hosted/filesystem-win32.c
@@ -30,6 +30,7 @@
30#include "debug.h" 30#include "debug.h"
31#include "pathfuncs.h" 31#include "pathfuncs.h"
32#include "string-extra.h" 32#include "string-extra.h"
33#include "mv.h"
33 34
34#define SAME_FILE_INFO(lpInfo1, lpInfo2) \ 35#define SAME_FILE_INFO(lpInfo1, lpInfo2) \
35 ((lpInfo1)->dwVolumeSerialNumber == (lpInfo2)->dwVolumeSerialNumber && \ 36 ((lpInfo1)->dwVolumeSerialNumber == (lpInfo2)->dwVolumeSerialNumber && \
@@ -469,7 +470,9 @@ int os_modtime(const char *path, time_t modtime)
469 return 0; 470 return 0;
470} 471}
471 472
472void volume_size(IF_MV(int volume,) unsigned long *sizep, unsigned long *freep) 473int os_volume_path(IF_MV(int volume, ) char *buffer, size_t bufsize);
474
475void volume_size(IF_MV(int volume,) sector_t *sizep, sector_t *freep)
473{ 476{
474 ULARGE_INTEGER free = { .QuadPart = 0 }, 477 ULARGE_INTEGER free = { .QuadPart = 0 },
475 size = { .QuadPart = 0 }; 478 size = { .QuadPart = 0 };
diff --git a/firmware/target/hosted/lcd-linuxfb.c b/firmware/target/hosted/lcd-linuxfb.c
index 14c8c30f89..5dda5cf1cc 100644
--- a/firmware/target/hosted/lcd-linuxfb.c
+++ b/firmware/target/hosted/lcd-linuxfb.c
@@ -59,14 +59,21 @@ void lcd_init_device(void)
59 panicf("Cannot read framebuffer fixed information"); 59 panicf("Cannot read framebuffer fixed information");
60 } 60 }
61 61
62#if 0 62 if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
63 /* check resolution and framebuffer size */
64 if(vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT || vinfo.bits_per_pixel != LCD_DEPTH)
65 { 63 {
66 panicf("Unexpected framebuffer resolution: %dx%dx%d\n", vinfo.xres, 64 panicf("Cannot read framebuffer variable information");
67 vinfo.yres, vinfo.bits_per_pixel); 65 }
66
67 /* Make sure we match our desired bitdepth */
68 if (vinfo.bits_per_pixel != LCD_DEPTH || vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT) {
69 vinfo.bits_per_pixel = LCD_DEPTH;
70 vinfo.xres = LCD_WIDTH;
71 vinfo.yres = LCD_HEIGHT;
72 if (ioctl(fd, FBIOPUT_VSCREENINFO, &vinfo)) {
73 panicf("Cannot set framebuffer to %dx%dx%d",
74 vinfo.xres, vinfo.yres, vinfo.bits_per_pixel);
75 }
68 } 76 }
69#endif
70 /* Note: we use a framebuffer size of width*height*bbp. We cannot trust the 77 /* Note: we use a framebuffer size of width*height*bbp. We cannot trust the
71 * values returned by the driver for line_length */ 78 * values returned by the driver for line_length */
72 79
@@ -77,11 +84,6 @@ void lcd_init_device(void)
77 panicf("Cannot map framebuffer"); 84 panicf("Cannot map framebuffer");
78 } 85 }
79 86
80 if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
81 {
82 panicf("Cannot read framebuffer variable information");
83 }
84
85 memset(framebuffer, 0, finfo.smem_len); 87 memset(framebuffer, 0, finfo.smem_len);
86 88
87#ifdef HAVE_LCD_ENABLE 89#ifdef HAVE_LCD_ENABLE
diff --git a/firmware/target/hosted/samsungypr/lcd-ypr.c b/firmware/target/hosted/samsungypr/lcd-ypr.c
index b8db2eedd1..035abaeba7 100644
--- a/firmware/target/hosted/samsungypr/lcd-ypr.c
+++ b/firmware/target/hosted/samsungypr/lcd-ypr.c
@@ -66,17 +66,17 @@ void lcd_init_device(void)
66 exit(2); 66 exit(2);
67 } 67 }
68 68
69 /* Now we get the settable settings, and we set 16 bit bpp */ 69 /* Now we get the settable settings */
70 if (ioctl(dev_fd, FBIOGET_VSCREENINFO, &vinfo) == -1) { 70 if (ioctl(dev_fd, FBIOGET_VSCREENINFO, &vinfo) == -1) {
71 perror("Error reading variable information"); 71 perror("Error reading variable information");
72 exit(3); 72 exit(3);
73 } 73 }
74 74
75 vinfo.bits_per_pixel = LCD_DEPTH; 75 vinfo.bits_per_pixel = LCD_DEPTH; /* Explicitly set our desired depth */
76 76
77 if (ioctl(dev_fd, FBIOPUT_VSCREENINFO, &vinfo)) { 77 if (ioctl(dev_fd, FBIOPUT_VSCREENINFO, &vinfo)) {
78 perror("fbset(ioctl)"); 78 perror("fbset(ioctl)");
79 exit(4); 79 exit(4);
80 } 80 }
81 81
82 printf("%dx%d, %dbpp\n", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel); 82 printf("%dx%d, %dbpp\n", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel);
@@ -84,17 +84,17 @@ void lcd_init_device(void)
84 /* Figure out the size of the screen in bytes */ 84 /* Figure out the size of the screen in bytes */
85 screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8; 85 screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
86 if (screensize != FRAMEBUFFER_SIZE) { 86 if (screensize != FRAMEBUFFER_SIZE) {
87 exit(4);
88 perror("Display and framebuffer mismatch!\n"); 87 perror("Display and framebuffer mismatch!\n");
88 exit(5);
89 } 89 }
90 90
91 /* Map the device to memory */ 91 /* Map the device to memory */
92 dev_fb = mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, dev_fd, 0); 92 dev_fb = mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED, dev_fd, 0);
93 if ((int)dev_fb == -1) { 93 if ((int)dev_fb == -1) {
94 perror("Error: failed to map framebuffer device to memory"); 94 perror("Error: failed to map framebuffer device to memory");
95 exit(4); 95 exit(6);
96 } 96 }
97 printf("The framebuffer device was mapped to memory successfully.\n"); 97 printf("Framebuffer device successfully mapped into memory.\n");
98 98
99 /* Be sure to turn on display at startup */ 99 /* Be sure to turn on display at startup */
100 ioctl(dev_fd, FBIOBLANK, VESA_NO_BLANKING); 100 ioctl(dev_fd, FBIOBLANK, VESA_NO_BLANKING);
diff --git a/firmware/target/hosted/sdl/button-sdl.c b/firmware/target/hosted/sdl/button-sdl.c
index 1055d7e0b9..b5f3720a3b 100644
--- a/firmware/target/hosted/sdl/button-sdl.c
+++ b/firmware/target/hosted/sdl/button-sdl.c
@@ -340,7 +340,7 @@ static void button_event(int key, bool pressed)
340 } 340 }
341 return; 341 return;
342#endif 342#endif
343#ifdef HAVE_MULTIDRIVE 343#ifdef HAVE_HOTSWAP
344 case EXT_KEY: 344 case EXT_KEY:
345 if (!pressed) 345 if (!pressed)
346 sim_trigger_external(!storage_present(1)); 346 sim_trigger_external(!storage_present(1));