mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-11-09 21:22:39 -05:00
sonynwz: Properly support multidrive, with hotswap of the SD card
Change-Id: I7eb8efb0986a395d5ffbcc06a54bb680e0b59e9d
This commit is contained in:
parent
5f75c493e3
commit
6a94f1e995
5 changed files with 81 additions and 11 deletions
|
|
@ -169,3 +169,4 @@
|
||||||
#define HAVE_HOTSWAP
|
#define HAVE_HOTSWAP
|
||||||
#define HAVE_STORAGE_FLUSH
|
#define HAVE_STORAGE_FLUSH
|
||||||
#define MULTIDRIVE_DIR "/mnt/mmc"
|
#define MULTIDRIVE_DIR "/mnt/mmc"
|
||||||
|
#define MULTIDRIVE_DEV "/sys/block/mmcblk0"
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,6 @@
|
||||||
/* sqrt(240^2 + 320^2) / 2 = 200 */
|
/* sqrt(240^2 + 320^2) / 2 = 200 */
|
||||||
#define LCD_DPI 200
|
#define LCD_DPI 200
|
||||||
|
|
||||||
|
#define NWZ_HAS_SD
|
||||||
|
|
||||||
#include "sonynwzlinux.h"
|
#include "sonynwzlinux.h"
|
||||||
|
|
|
||||||
|
|
@ -13,4 +13,6 @@
|
||||||
/* sqrt(240^2 + 320^2) / 2 = 200 */
|
/* sqrt(240^2 + 320^2) / 2 = 200 */
|
||||||
#define LCD_DPI 200
|
#define LCD_DPI 200
|
||||||
|
|
||||||
|
#define NWZ_HAS_SD
|
||||||
|
|
||||||
#include "sonynwzlinux.h"
|
#include "sonynwzlinux.h"
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,6 @@
|
||||||
/* The number of bytes reserved for loadable plugins */
|
/* The number of bytes reserved for loadable plugins */
|
||||||
#define PLUGIN_BUFFER_SIZE 0x100000
|
#define PLUGIN_BUFFER_SIZE 0x100000
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define CONFIG_TUNER SI4700
|
#define CONFIG_TUNER SI4700
|
||||||
|
|
||||||
/* There is no hardware tone control */
|
/* There is no hardware tone control */
|
||||||
|
|
@ -105,8 +102,18 @@
|
||||||
/* Define this to the CPU frequency */
|
/* Define this to the CPU frequency */
|
||||||
#define CPU_FREQ 532000000
|
#define CPU_FREQ 532000000
|
||||||
|
|
||||||
|
#ifdef NWZ_HAS_SD
|
||||||
|
/* External SD card can be mounted */
|
||||||
|
#define CONFIG_STORAGE (STORAGE_HOSTFS|STORAGE_SD)
|
||||||
|
#define HAVE_MULTIDRIVE /* But _not_ CONFIG_STORAGE_MULTI */
|
||||||
|
#define NUM_DRIVES 2
|
||||||
|
#define HAVE_HOTSWAP
|
||||||
|
#define MULTIDRIVE_DIR "/mnt/media"
|
||||||
|
#define MULTIDRIVE_DEV "/sys/block/mmcblk1"
|
||||||
|
#else
|
||||||
/* No special storage */
|
/* No special storage */
|
||||||
#define CONFIG_STORAGE STORAGE_HOSTFS
|
#define CONFIG_STORAGE STORAGE_HOSTFS
|
||||||
|
#endif
|
||||||
#define HAVE_STORAGE_FLUSH
|
#define HAVE_STORAGE_FLUSH
|
||||||
|
|
||||||
/* Battery */
|
/* Battery */
|
||||||
|
|
|
||||||
|
|
@ -23,20 +23,24 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <ucontext.h>
|
#include <ucontext.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "font.h"
|
#include "font.h"
|
||||||
#include "logf.h"
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "backlight-target.h"
|
#include "backlight-target.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "adc.h"
|
#include "adc.h"
|
||||||
#include "power.h"
|
#include "power.h"
|
||||||
|
#include "mv.h"
|
||||||
#include "power-nwz.h"
|
#include "power-nwz.h"
|
||||||
#include <backtrace.h>
|
#include <backtrace.h>
|
||||||
#include <stdio.h>
|
|
||||||
|
#include "logf.h"
|
||||||
|
|
||||||
static const char **kern_mod_list;
|
static const char **kern_mod_list;
|
||||||
|
bool os_file_exists(const char *ospath);
|
||||||
|
|
||||||
void power_off(void)
|
void power_off(void)
|
||||||
{
|
{
|
||||||
|
|
@ -238,3 +242,57 @@ bool nwz_is_kernel_module_loaded(const char *name)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIG_STORAGE_MULTI
|
||||||
|
int hostfs_driver_type(int drive)
|
||||||
|
{
|
||||||
|
return drive > 0 ? STORAGE_SD_NUM : STORAGE_HOSTFS_NUM;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_STORAGE_MULTI */
|
||||||
|
|
||||||
|
#ifdef HAVE_HOTSWAP
|
||||||
|
bool hostfs_removable(IF_MD_NONVOID(int volume))
|
||||||
|
{
|
||||||
|
#ifdef HAVE_MULTIDRIVE
|
||||||
|
if (volume > 0)
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return false; /* internal: always present */
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hostfs_present(int volume)
|
||||||
|
{
|
||||||
|
#ifdef HAVE_MULTIDRIVE
|
||||||
|
if (volume > 0)
|
||||||
|
#if defined(MULTIDRIVE_DEV)
|
||||||
|
return os_file_exists(MULTIDRIVE_DEV);
|
||||||
|
#else
|
||||||
|
return true; // FIXME?
|
||||||
|
#endif
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return true; /* internal: always present */
|
||||||
|
}
|
||||||
|
#endif /* HAVE_HOTSWAP */
|
||||||
|
|
||||||
|
#ifdef HAVE_MULTIDRIVE
|
||||||
|
int volume_drive(int drive)
|
||||||
|
{
|
||||||
|
return drive;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_MULTIDRIVE */
|
||||||
|
|
||||||
|
#ifdef HAVE_HOTSWAP
|
||||||
|
bool volume_removable(IF_MV_NONVOID(int volume))
|
||||||
|
{
|
||||||
|
/* don't support more than one partition yet, so volume == drive */
|
||||||
|
return hostfs_removable(volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool volume_present(int volume)
|
||||||
|
{
|
||||||
|
/* don't support more than one partition yet, so volume == drive */
|
||||||
|
return hostfs_present(volume);
|
||||||
|
}
|
||||||
|
#endif /* HAVE_HOTSWAP */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue