1
0
Fork 0
forked from len0rd/rockbox

first part of usbstack patches -> show and use selection of usb stack mode only, if

a target supports both modes.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14916 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Christian Gmeiner 2007-09-30 12:25:06 +00:00
parent 6386dbe861
commit 0f5d9f9125
5 changed files with 27 additions and 39 deletions

View file

@ -516,12 +516,17 @@ int usbdriver_menuitem(void)
return false;
}
#if USBSTACK_CAPS == (CONTROLLER_DEVICE|CONTROLLER_HOST)
MENUITEM_SETTING(usbstack_mode, &global_settings.usb_stack_mode, NULL);
#endif
MENUITEM_FUNCTION(usbdriver, 0, ID2P(LANG_USBSTACK_DEVICE_DRIVER),
usbdriver_menuitem, 0, NULL, Icon_NOICON);
MAKE_MENU(usbstack_menu, ID2P(LANG_USBSTACK), 0, Icon_NOICON,
&usbstack_mode, &usbdriver);
#if USBSTACK_CAPS == (CONTROLLER_DEVICE|CONTROLLER_HOST)
&usbstack_mode,
#endif
&usbdriver);
/* USB STACK MENU */
/***********************************/
#endif

View file

@ -879,11 +879,19 @@ void settings_apply(void)
if (global_settings.colors_file)
read_color_theme_file();
#endif
#ifdef HAVE_USBSTACK
#if USBSTACK_CAPS == (CONTROLLER_DEVICE|CONTROLLER_HOST)
usb_controller_select(global_settings.usb_stack_mode);
#elif USBSTACK_CAPS == (CONTROLLER_DEVICE)
usb_controller_select(DEVICE);
#elif USBSTACK_CAPS == (CONTROLLER_HOST)
usb_controller_select(HOST);
#endif
usb_device_driver_bind(global_settings.usb_stack_device_driver);
#endif
#endif
}

View file

@ -22,7 +22,15 @@
#include <errno.h>
#define USB_STACK_MAX_SETTINGS_NAME 32*10 /* should be enough for > 10 driver names */
#define USB_STACK_MAX_SETTINGS_NAME 32*10 /* should be enough for > 10 driver names */
/* usb stack configuration */
#ifndef USBSTACK_CAPS
#define USBSTACK_CAPS 0 /* default: use no controller */
#endif
#define CONTROLLER_DEVICE (1 << 0)
#define CONTROLLER_HOST (1 << 1)
/*
* error codes
@ -30,7 +38,7 @@
#define ENOFREESLOT 1
#define EWRONGCONTROLLERTYPE 2
#define ENODRIVERFOUND 3
#define EHWCRITICAL 4
#define EHWCRITICAL 4
enum usb_controller_type {
DEVICE = 0,

View file

@ -1,31 +0,0 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2007 by Christian Gmeiner
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#ifndef _USBSTACK_CONFIG_H_
#define _USBSTACK_CONFIG_H_
/* default: use no controller */
#ifndef USBSTACK_CAPS
#define USBSTACK_CAPS 0
#endif
#define CONTROLLER_DEVICE (1 << 0)
#define CONTROLLER_HOST (1 << 1)
#endif /*_USBSTACK_CONFIG_H_*/

View file

@ -20,12 +20,10 @@
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include "usbstack.h"
#include "config.h"
#include "usbstack.h"
#include "usbstack/core.h"
#include "usbstack/config.h"
#include "usbstack/controller.h"
#include "usbstack/drivers/device/usb_serial.h"
#include "usbstack/drivers/device/usb_storage.h"