summaryrefslogtreecommitdiff
path: root/firmware/usb.c (follow)
Commit message (Collapse)AuthorAge
* Do some housekeeping with fat.h and SECTOR_SIZEMichael Sevakis2017-03-12
| | | | | | | | | | | | | | Many includes of fat.h are pointless. Some includes are just for SECTOR_SIZE. Add a file 'firmware/include/fs_defines.h' for that and to define tuneable values that were scattered amongst various headers. Remove some local definitions of SECTOR_SIZE since they have to be in agreement with the rest of the fs code anyway. (We'll see what's in fact pointless in a moment ;) Change-Id: I9ba183bf58bd87f5c45eba7bd675c7e2c1c18ed5
* usb: finally get rid of USE_ROCKBOX_USB in Sansa bootloader, use bootloader usbAmaury Pouly2015-01-08
| | | | | | | | For some reason, the bootloader and config files didn't define HAVE_BOOTLOADER_USB_MODE, also remove the special cases in usb.c which they implied. Change-Id: I68c29be7d03627e64cac4ff7678e0c211e087a8c
* usb: make usb_release_exclusive_storage privateAmaury Pouly2015-01-08
| | | | | | Change-Id: I0383760b7d8e67cc99bbe4e4979bca92ef436c8d Reviewed-on: http://gerrit.rockbox.org/1098 Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
* Clarify usb_powered() and fix some code.Amaury Pouly2015-01-08
| | | | | | | | | | Either by mistake or because its meaning changed, usb_powered() doesn't mean what the name suggest, so clarify its meaning by renaming it to usb_powered_only. So use of usb_powered() are replaced by usb_inserted() when it makes more sense. Change-Id: I112887e2d8560e84587bee5f55c826dde8c806d8 Reviewed-on: http://gerrit.rockbox.org/1097 Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
* Get rid of USE_ROCKBOX_USBAmaury Pouly2015-01-08
| | | | | | | | | | | Except for unfinished or experimental ports, it isthe case that USE_ROCKBOX_USB and HAVE_USBSTACK are both defined or both undefined. Furthermore, it is a leftover of some early developments on the USB stack and doesn't make sense anymore. Change-Id: Ic87a865b6bb4c7c9a8d45d1f0bb0f2fb536b8cad Reviewed-on: http://gerrit.rockbox.org/1091 Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
* USB: Detect charging-only mode upon cable insert, not host detect.Michael Sevakis2013-05-22
| | | | | | | | | | | | Letting go of the button before the host is detected allows storage mode to be entered even though a button was down when plugging. Sometimes the host would try several times and the button would have to be held down for several seconds to avoid a storage connection. The adjustment wasn't made when switching to setup request host detection. Change-Id: Iab3bced5bfb1478d4d9a7baab2a2a1144afaf437
* Remove redundant assigment of variable to itselfBertrik Sikken2013-03-24
| | | | Change-Id: Ibecd8c869280a55a0716e631f44ab556f7dbd8b5
* usb: add support for hardware handled SET ADDR/CONFIGAmaury Pouly2012-12-07
| | | | | | | | | | | | | | | | | | | | | | | Some USB controllers like the one of the Rockchip 27xx handle some requests in pure hardware. This is especially a problem for two of them: - SET ADDR which is used by our core to track the DEFAULT/ADDRESS state and is required for the drivers to work properly - SET CONFIG which is used by our core to initialise the drivers by calling init_connection() In these cases we need a way to notify the core that such requests happened. We do this by exporting two functions which directly notify the core about these requests and perform the necessary init steps required without doing the actual USB transfers. Special care is needed because these functions could be called from an interrupt handler. For this reason we still use the usb_queue and introduce new IDs so that they are processed in order and safely. No functional change is intended, both in the usbstack and on targets without such quirks. Change-Id: Ie42feffd4584e88bf37cff018b627f333dca1140
* Undo f695681 (r30433). USB hardware must be initialized first.Jens Arnold2012-05-20
| | | | | | This fixes flash/ MMC access on the Ondios when booting from ROM. Add a comment what to pay attention for in the target specific usb_init_device().
* usb: fix another typoAmaury Pouly2012-01-07
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31601 a1c6a512-1295-4272-9138-f99709370657
* usb: fix typo in DEBUGFAmaury Pouly2012-01-07
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31600 a1c6a512-1295-4272-9138-f99709370657
* Move some variable declarations to inside #ifdef USB_FULL_INIT, to avoid ↵Frank Gevaerts2012-01-04
| | | | | | warnings for bootloaders that don't have the full USB state machine git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31583 a1c6a512-1295-4272-9138-f99709370657
* Reorganise USB initialisation to not depend on a specific enumeration ↵Frank Gevaerts2012-01-04
| | | | | | | | | | sequence, by Bartosz Fabianowski, with minor tweaks by Michael Sevakis (FS#12497) FreeBSD apparently sends a SET_ADDRESS first, which confused our code. This patch fixes that, and also simplifies the connection handling a bit. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31582 a1c6a512-1295-4272-9138-f99709370657
* fix r31502: USBOTG_AS3525v2 doesn't exist anymoreRafaël Carré2011-12-31
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31504 a1c6a512-1295-4272-9138-f99709370657
* usb-target.h: removeRafaël Carré2011-12-31
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31498 a1c6a512-1295-4272-9138-f99709370657
* Simplify and neaten-up usb.c a bit. USB_INSERTED and USB_EXTRACTED are ↵Michael Sevakis2011-12-15
| | | | | | always used as events to indicate cable state. USB_HOSTED is posted to indicated that a host was detected. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31263 a1c6a512-1295-4272-9138-f99709370657
* Fix the real issue with AMS bootloader USB mode. A call to usb_enable was ↵Michael Sevakis2011-12-14
| | | | | | missing in usb.c when using the USB stack and USB_DETECT_BY_CORE was not enabled. Try to do it in a clean-ish way. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31245 a1c6a512-1295-4272-9138-f99709370657
* Fix typo in commentRafaël Carré2011-11-20
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31034 a1c6a512-1295-4272-9138-f99709370657
* Simulate usb plugging on the sim better using sim_tasks.Thomas Martitz2011-11-17
| | | | | | Now all threads need to ack the connection like on real target, dircache is unloaded and playback stops accordingly. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31009 a1c6a512-1295-4272-9138-f99709370657
* usb: add forgotten break in usb switch, this could lead to unwanted code ↵Amaury Pouly2011-10-27
| | | | | | being execute like USB_QUIT to be sent on hotswap ! git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30843 a1c6a512-1295-4272-9138-f99709370657
* usb: only declare usb_mmc_countdown on target which don't use the usb stackAmaury Pouly2011-10-08
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30733 a1c6a512-1295-4272-9138-f99709370657
* Remove obsolete USB_DETECT_BY_DRV define throughout.Michael Sevakis2011-09-14
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30549 a1c6a512-1295-4272-9138-f99709370657
* usb: make sure device init happens *after* queue/thread creationAmaury Pouly2011-09-05
| | | | | | Albeit unlikely, usb_init_devide() could cause de transfer completion before queue creation and the core would push onto a uninitialized queue ! git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30433 a1c6a512-1295-4272-9138-f99709370657
* Add a 100ms delay before calling disk_mount_all(). Some players (especially ↵Frank Gevaerts2011-08-15
| | | | | | some gigabeat Fs) seem to need a delay after disabling USB if we want disk access to work. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30316 a1c6a512-1295-4272-9138-f99709370657
* The gigabeat S needs special casing so that you can still hold vol down to ↵Michael Giacomelli2011-05-16
| | | | | | access its firmware partition. Additionally, the same logic should apply to firewire on the iPods. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29890 a1c6a512-1295-4272-9138-f99709370657
* Enter USB charging mode on devices that support it if any key is held down ↵Michael Giacomelli2011-05-16
| | | | | | during USB insert (except on Archos where certain keys need to be avoided and players like the iRiver H1x0 which do not charge over USB and the iAudios/AMSv2 which do not yet support USB fully). Update the manual to explain the new behavior. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29889 a1c6a512-1295-4272-9138-f99709370657
* Change the thread api a bit.Thomas Martitz2011-03-05
| | | | | | | * Remove THREAD_ID_CURRENT macro in favor of a thread_self() function, this allows thread functions to be simpler. * thread_self_entry() shortcut for kernel.c. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29521 a1c6a512-1295-4272-9138-f99709370657
* iPod Classic CE-ATA Support (Part 2 of 4: Remove on-stack sector buffers, ↵Michael Sparmann2011-02-27
| | | | | | and replace them with a single statically allocated sector buffer that's arbitrated amongst users) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29445 a1c6a512-1295-4272-9138-f99709370657
* All kernel objects in code shared amongs targets (core, plugins, codecs) ↵Michael Sevakis2011-02-14
| | | | | | should be declared SHAREDBSS_ATTR as any core could potentially touch them even though they seem only to involve threads on one core. The exception is target code for particular CPUs where proper allocation is fixed. playlist.c was a little odd too-- use one mutex for the current playlist and a separate one for created playlists (still pondering the necessity of more than one). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29305 a1c6a512-1295-4272-9138-f99709370657
* USB: Thread must remember that a host has been detected since the POWERED ↵Michael Sevakis2011-01-29
| | | | | | state is ambiguous when waiting for host. Storage access is not yet actually exclusive if not USB_INSERTED. usb_start_monitoring seems better posting USB_UNPOWERED only if USB_EXTRACTED, interpreting POWERED/INSERTED as POWERED. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29153 a1c6a512-1295-4272-9138-f99709370657
* Big oops. Should be broadcasting SYS_USB_DISCONNECTED _after_ remouting disks.Michael Sevakis2011-01-28
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29150 a1c6a512-1295-4272-9138-f99709370657
* Fix colors from r29084. Had some things in the wrong preprocessor blocks.Michael Sevakis2011-01-18
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29085 a1c6a512-1295-4272-9138-f99709370657
* Try to get some control over #ifdef hell in usb.c by refactoring and inline ↵Michael Sevakis2011-01-18
| | | | | | function use. SYS_USB_DISCONNECTED_ACK hasn't been doing anything useful for the USB thread; remove it. USB thread simply ignores that value. Observe only valid usb_state transitions. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29084 a1c6a512-1295-4272-9138-f99709370657
* One change in r29068 wasn't right. Clarify comments on why it's the way it ↵Michael Sevakis2011-01-17
| | | | | | is. :) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29070 a1c6a512-1295-4272-9138-f99709370657
* Add a higher level USB detection that prevents fraudulent bus resets from ↵Michael Sevakis2011-01-17
| | | | | | causing USB mode to be entered. Enable for SA9200 only at this time. Also, for SA9200, use the bus power GPIO rather than the 'connector inserted' GPIO to detect the cable. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29068 a1c6a512-1295-4272-9138-f99709370657
* Bootloader USB mode for PP502x. Enable only on GoGear SA9200 for the time ↵Michael Sevakis2011-01-15
| | | | | | being. Add HAVE_BOOTLOADER_USB_MODE to config if BOOTLOADER is defined to enable it. Clean up some kernel stuff a little to support it. Mess up a bunch of other stuff (hopefully not too badly). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29053 a1c6a512-1295-4272-9138-f99709370657
* Accept FS#11774 by Michael Hohmuth (with some own modifications to #ifdef ↵Frank Gevaerts2010-11-28
| | | | | | | | | | conditions) Unmount all filesystems before connecting USB. This ensures that all filehandles are closed, which avoids possible filesystem corruption git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28693 a1c6a512-1295-4272-9138-f99709370657
* Really fix yellow: Rename BMP_LINESIZE and BMP_BPP to get rid of the macro ↵Michael Sparmann2010-10-25
| | | | | | name collision git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28359 a1c6a512-1295-4272-9138-f99709370657
* Fix screendump on iPod Nano 2G by increasing the usb thread stack size and ↵Michael Sparmann2010-10-25
| | | | | | reducing the stack usage of FAT and storage functions git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28356 a1c6a512-1295-4272-9138-f99709370657
* AMSv2: fix bootloader build with USB enabledRafaël Carré2010-10-24
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28342 a1c6a512-1295-4272-9138-f99709370657
* as3525: bootloader USB modeRafaël Carré2010-06-18
| | | | | | | not working yet : an empty drive is detected won't link on fuzev1: drivers allocated in usb_storage.c are too large git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26905 a1c6a512-1295-4272-9138-f99709370657
* Put an #ifdef in the technically correct place. No functional change.Jens Arnold2010-06-05
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26599 a1c6a512-1295-4272-9138-f99709370657
* New USB charging system, part 2 - "Force" charging modeTorne Wuff2010-06-05
| | | | | | | Enable support for the "force" mode of USB charging. This should work on Gigabeat S and Nano2g (and any other future target which has a RB usb stack and supports charging) - if a host connection is not detected within 10 seconds of USB insertion, assume that the connected device is an AC charger and charge anyway, if the user has specified "force" as the mode. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26594 a1c6a512-1295-4272-9138-f99709370657
* Move c/h files implementing/defining standard library stuff into a new libc ↵Thomas Martitz2010-05-06
| | | | | | | | directory, also standard'ify some parts of the code base (almost entirely #include fixes). This is to a) to cleanup firmware/common and firmware/include a bit, but also b) for Rockbox as an application which should use the host system's c library and headers, separating makes it easy to exclude our files from the build. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25850 a1c6a512-1295-4272-9138-f99709370657
* Revert disabling of USB HID while in charging mode (introduced by r23322), inTomer Shalev2009-10-23
| | | | | | | | order to prevent having no interface at all when USB HID is disabled and the DAP is connected in charge-only mode (thanks for gevaerts for noticing). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23323 a1c6a512-1295-4272-9138-f99709370657
* FS#10704 - Make a configuration option to disable USB HID Tomer Shalev2009-10-23
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23322 a1c6a512-1295-4272-9138-f99709370657
* Fix redMichael Sparmann2009-10-20
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23286 a1c6a512-1295-4272-9138-f99709370657
* iPod Nano 2G USB support based on the S3C6400X datasheet. Disabled by ↵Michael Sparmann2009-10-20
| | | | | | default for now. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23285 a1c6a512-1295-4272-9138-f99709370657
* Fixed a confusing typoMichael Sparmann2009-10-13
| | | | git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23150 a1c6a512-1295-4272-9138-f99709370657
* M:Robe 500: Mostly complete USB driver, supports BULK mode currently and ↵Karl Kurbjun2009-06-08
| | | | | | gets about 2 MB/s writes vs 1.1 MB/s on the OF. Mostly tested against Linux, preliminary testing in Windows appears to work. There is currently a bug in the attach process where it only works once per boot that needs to be fixed. There are a few other minor M:Robe 500 changes as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21208 a1c6a512-1295-4272-9138-f99709370657