mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-07 13:45:03 -05:00
New port: FiiO M3K
Most credit goes to: Roman Skylarov Additional integration and refactoring by myself. *** COMPLETELY UNTESTED *** Change-Id: Ia64c36d92e0214c6b15f7a868df286f8113ea27b
This commit is contained in:
parent
4231c2c83f
commit
aabc8aca47
84 changed files with 2188 additions and 20 deletions
81
firmware/target/hosted/fiio/usb-fiio.c
Normal file
81
firmware/target/hosted/fiio/usb-fiio.c
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2018 by Marcin Bukat
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#include <sys/mount.h>
|
||||
#include <string.h>
|
||||
#include "config.h"
|
||||
#include "disk.h"
|
||||
#include "usb.h"
|
||||
#include "sysfs.h"
|
||||
#include "power.h"
|
||||
#include "power-fiio.h"
|
||||
|
||||
const char * const sysfs_usb_online =
|
||||
"/sys/class/power_supply/usb/online";
|
||||
|
||||
int usb_detect(void)
|
||||
{
|
||||
int present = 0;
|
||||
sysfs_get_int(sysfs_usb_online, &present);
|
||||
|
||||
return present ? USB_INSERTED : USB_EXTRACTED;
|
||||
}
|
||||
|
||||
void usb_enable(bool on)
|
||||
{
|
||||
if (on)
|
||||
{
|
||||
system ("insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/libcomposite.ko");
|
||||
system ("insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/usb_f_mass_storage.ko");
|
||||
system ("insmod /lib/modules/3.10.14/kernel/driver/usb/gadget/g_mass_storage.ko file=/dev/mmcblk0 removable=1");
|
||||
}
|
||||
else
|
||||
{
|
||||
system ("rmmod g_mass_storage");
|
||||
system ("rmmod usb_f_mass_storage");
|
||||
system ("rmmod libcomposite");
|
||||
}
|
||||
}
|
||||
|
||||
/* This is called by usb thread after usb extract in order to return
|
||||
* regular FS access
|
||||
*
|
||||
* returns the # of successful mounts
|
||||
*/
|
||||
int disk_mount_all(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* This is called by usb thread after all threads ACKs usb inserted message
|
||||
*
|
||||
* returns the # of successful unmounts
|
||||
*/
|
||||
int disk_unmount_all(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void usb_init_device(void)
|
||||
{
|
||||
system ("insmod /lib/modules/3.10.14/kernel/driver/staging/dwc2/dwc2.ko");
|
||||
usb_enable(true);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue