summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Gmeiner <christian.gmeiner@gmail.com>2007-09-30 12:25:06 +0000
committerChristian Gmeiner <christian.gmeiner@gmail.com>2007-09-30 12:25:06 +0000
commit0f5d9f9125e53ae62175469e78151ca4cb0be79a (patch)
treef2b1089fd8fe18eeabc36038cb0f8ae9e39c6429
parent6386dbe861bc3395dff1bca5b98e8cbe33ddc703 (diff)
downloadrockbox-0f5d9f9125e53ae62175469e78151ca4cb0be79a.tar.gz
rockbox-0f5d9f9125e53ae62175469e78151ca4cb0be79a.zip
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
-rw-r--r--apps/menus/settings_menu.c7
-rw-r--r--apps/settings.c12
-rw-r--r--firmware/export/usbstack.h12
-rw-r--r--firmware/usbstack/config.h31
-rw-r--r--firmware/usbstack/core/core.c4
5 files changed, 27 insertions, 39 deletions
diff --git a/apps/menus/settings_menu.c b/apps/menus/settings_menu.c
index bbc2505a51..9a4079f1d0 100644
--- a/apps/menus/settings_menu.c
+++ b/apps/menus/settings_menu.c
@@ -516,12 +516,17 @@ int usbdriver_menuitem(void)
516 return false; 516 return false;
517} 517}
518 518
519#if USBSTACK_CAPS == (CONTROLLER_DEVICE|CONTROLLER_HOST)
519MENUITEM_SETTING(usbstack_mode, &global_settings.usb_stack_mode, NULL); 520MENUITEM_SETTING(usbstack_mode, &global_settings.usb_stack_mode, NULL);
521#endif
520MENUITEM_FUNCTION(usbdriver, 0, ID2P(LANG_USBSTACK_DEVICE_DRIVER), 522MENUITEM_FUNCTION(usbdriver, 0, ID2P(LANG_USBSTACK_DEVICE_DRIVER),
521 usbdriver_menuitem, 0, NULL, Icon_NOICON); 523 usbdriver_menuitem, 0, NULL, Icon_NOICON);
522 524
523MAKE_MENU(usbstack_menu, ID2P(LANG_USBSTACK), 0, Icon_NOICON, 525MAKE_MENU(usbstack_menu, ID2P(LANG_USBSTACK), 0, Icon_NOICON,
524 &usbstack_mode, &usbdriver); 526#if USBSTACK_CAPS == (CONTROLLER_DEVICE|CONTROLLER_HOST)
527 &usbstack_mode,
528#endif
529 &usbdriver);
525/* USB STACK MENU */ 530/* USB STACK MENU */
526/***********************************/ 531/***********************************/
527#endif 532#endif
diff --git a/apps/settings.c b/apps/settings.c
index a020c18e1b..cacf3e5854 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -879,11 +879,19 @@ void settings_apply(void)
879 if (global_settings.colors_file) 879 if (global_settings.colors_file)
880 read_color_theme_file(); 880 read_color_theme_file();
881#endif 881#endif
882 882
883#ifdef HAVE_USBSTACK 883#ifdef HAVE_USBSTACK
884
885#if USBSTACK_CAPS == (CONTROLLER_DEVICE|CONTROLLER_HOST)
884 usb_controller_select(global_settings.usb_stack_mode); 886 usb_controller_select(global_settings.usb_stack_mode);
887#elif USBSTACK_CAPS == (CONTROLLER_DEVICE)
888 usb_controller_select(DEVICE);
889#elif USBSTACK_CAPS == (CONTROLLER_HOST)
890 usb_controller_select(HOST);
891#endif
892
885 usb_device_driver_bind(global_settings.usb_stack_device_driver); 893 usb_device_driver_bind(global_settings.usb_stack_device_driver);
886#endif 894#endif
887} 895}
888 896
889 897
diff --git a/firmware/export/usbstack.h b/firmware/export/usbstack.h
index bf1c2db5bf..4ad477ec97 100644
--- a/firmware/export/usbstack.h
+++ b/firmware/export/usbstack.h
@@ -22,7 +22,15 @@
22 22
23#include <errno.h> 23#include <errno.h>
24 24
25#define USB_STACK_MAX_SETTINGS_NAME 32*10 /* should be enough for > 10 driver names */ 25#define USB_STACK_MAX_SETTINGS_NAME 32*10 /* should be enough for > 10 driver names */
26
27/* usb stack configuration */
28#ifndef USBSTACK_CAPS
29#define USBSTACK_CAPS 0 /* default: use no controller */
30#endif
31
32#define CONTROLLER_DEVICE (1 << 0)
33#define CONTROLLER_HOST (1 << 1)
26 34
27/* 35/*
28 * error codes 36 * error codes
@@ -30,7 +38,7 @@
30#define ENOFREESLOT 1 38#define ENOFREESLOT 1
31#define EWRONGCONTROLLERTYPE 2 39#define EWRONGCONTROLLERTYPE 2
32#define ENODRIVERFOUND 3 40#define ENODRIVERFOUND 3
33#define EHWCRITICAL 4 41#define EHWCRITICAL 4
34 42
35enum usb_controller_type { 43enum usb_controller_type {
36 DEVICE = 0, 44 DEVICE = 0,
diff --git a/firmware/usbstack/config.h b/firmware/usbstack/config.h
deleted file mode 100644
index 8990934e56..0000000000
--- a/firmware/usbstack/config.h
+++ /dev/null
@@ -1,31 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Christian Gmeiner
11 *
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
14 *
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
17 *
18 ****************************************************************************/
19
20#ifndef _USBSTACK_CONFIG_H_
21#define _USBSTACK_CONFIG_H_
22
23/* default: use no controller */
24#ifndef USBSTACK_CAPS
25#define USBSTACK_CAPS 0
26#endif
27
28#define CONTROLLER_DEVICE (1 << 0)
29#define CONTROLLER_HOST (1 << 1)
30
31#endif /*_USBSTACK_CONFIG_H_*/
diff --git a/firmware/usbstack/core/core.c b/firmware/usbstack/core/core.c
index 0d2cfc67b9..f72b3bbed8 100644
--- a/firmware/usbstack/core/core.c
+++ b/firmware/usbstack/core/core.c
@@ -20,12 +20,10 @@
20#include <errno.h> 20#include <errno.h>
21#include <string.h> 21#include <string.h>
22#include <ctype.h> 22#include <ctype.h>
23#include "usbstack.h"
24
25#include "config.h" 23#include "config.h"
26 24
25#include "usbstack.h"
27#include "usbstack/core.h" 26#include "usbstack/core.h"
28#include "usbstack/config.h"
29#include "usbstack/controller.h" 27#include "usbstack/controller.h"
30#include "usbstack/drivers/device/usb_serial.h" 28#include "usbstack/drivers/device/usb_serial.h"
31#include "usbstack/drivers/device/usb_storage.h" 29#include "usbstack/drivers/device/usb_storage.h"