Commit Graph

234 Commits

Author SHA1 Message Date
William Wilgus 684565b8f3 USB fix red for device without HAVE_USB_POWER again.
Change-Id: I3122d532cbb8d5b5cb9040f08707c1514bc1b18e
2021-10-31 21:36:21 -04:00
William Wilgus d72a0ed65d Use USB events for storing plugin_menu state
use usb connected callback to cancel menu reentry after USB plug/unplug

Change-Id: I8267deed6e8ada94ca527392f56f50ef22def1d7
2021-10-31 12:42:24 -04:00
William Wilgus 7a6737f471 USB Events fix red on devices without HAVE_USB_POWER
Change-Id: I112e6379d4bed019d7e047e5802f104e250d926e
2021-10-31 12:30:27 -04:00
William Wilgus 894a9d9063 USB add Insertion and Extraction callback events
We have this nice event library laying around probably a few more places
we could use event callbacks

Change-Id: I9180fa9d78788d161f2587110644ca3e08df6f50
2021-10-31 12:02:38 -04:00
Solomon Peachy 3ba2f6e5c7 Nuke all TCC77x targets: iAudio 7, Sansa C100, M200(v1-3), Logik DAX
They were never finished, never saw any release ever, and haven't
compiled for the better part of a decade.  Given their HW capabilities [1],
they are not worth trying to fix.

[1] 1-2MB RAM, ~256MB onboard flash, no expandability

Change-Id: I7b2a5806d687114c22156bb0458d4a10a9734190
2021-04-26 07:41:51 -04:00
Solomon Peachy b5e6c30a61 USB: Reset poweroff timer for all USB events
Without this, if a device is left plugged in and idle, unplugging it will
trigger an immediate shutdown.

Change-Id: I65caaa0c1473562ec5d0bb776b01d4d222d69965
2020-12-24 00:40:01 -05:00
Solomon Peachy 0400a391d3 usb: increase the stack size.
It's not large enough on some targets.

(this will be revisited when the USB insertion prompt stuff is moved
 out of the USB helper and over to the main thread)

Change-Id: Iefed2cdf2fbb4ce92569fc5cacbdb479b7d24e61
2020-11-17 06:58:46 -05:00
Solomon Peachy 9c68c69cf0 FS13257: Fix inconsistent defaults in the USB mode selection
Change-Id: I44894d13f070313ad326ce68018556573e35aad9
2020-11-16 17:11:38 +00:00
Solomon Peachy 03cd773051 ibasso: Hopefully hack usb into building again.
Change-Id: I6f369d60319704ab4d2c18b80ba6e78902630790
2020-11-13 20:04:04 -05:00
Solomon Peachy 60f581e8f5 usb: Add ability to prompt user about what to do upon usb insertion
v3: Add in config option
 v4: Bugfixes
 v5: Force a redraw upon exiting
 v6: keypress-in-chargeonly mode enables mass storage (and vice versa)
 v7: Fix bootloader builds
 v8: Update manual, and have bootloader respect keypresses
 v9: Change default to mass storage (ie no change in behavior)

 todo:
  * test-build dx50/dx90
  * Switch from yes/no to proper menu?
  * prevent WPS progress bar from drawing over us

Change-Id: I82e0ccb08497b7a5aa756ce77f1332ee963703a7

...

Change-Id: I7946cf240b18a4fa8ace5e25e1eb6e97b8b12d7c
2020-11-13 16:44:01 -05:00
William Wilgus 611c18704c FuzePlus USB+screen dump overflows usbstack
Bump USB stack by 128 bytes

adds USB_EXTRA_STACK

Change-Id: I12839edbe889c878482081cf59fc6540384673ac
2020-11-02 21:38:13 -05:00
Solomon Peachy 658026e626 [4/4] Remove HAVE_LCD_BITMAP, as it's now the only choice.
Note:  I left behind lcd_bitmap in features.txt, because removing it
would require considerable work in the manual and the translations.

Change-Id: Ia8ca7761f610d9332a0d22a7d189775fb15ec88a
2020-07-24 21:20:13 +00:00
Solomon Peachy 092c340a20 [1/4] Remove SH support and all archos targets
This removes all code specific to SH targets

Change-Id: I7980523785d2596e65c06430f4638eec74a06061
2020-07-24 21:20:13 +00:00
Solomon Peachy 0662793ca0 Add cleaned-up xDuoo X3 support
Cleaned up, rebased, and forward-ported from the xvortex fork.

(original credit to vsoftster@gmail.com)

Change-Id: Ibcc023a0271ea81e901450a88317708c2683236d
Signed-off-by: Solomon Peachy <pizza@shaftnet.org>
2018-07-28 10:56:31 -04:00
Michael Sevakis e4a46c8d88 Fix a few missed things in 16454efc (and hopefully clear the red).
Change-Id: I2ce88e4c41e6e08efbfbdf261122318dfb0f8b0f
2017-10-26 16:32:53 -04:00
Michael Sevakis 6db80020b4 Do some housekeeping with fat.h and SECTOR_SIZE
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
2017-03-12 22:05:44 -04:00
Amaury Pouly 761e7987c8 usb: finally get rid of USE_ROCKBOX_USB in Sansa bootloader, use bootloader usb
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
2015-01-08 22:30:22 +01:00
Amaury Pouly 3aebdfa642 usb: make usb_release_exclusive_storage private
Change-Id: I0383760b7d8e67cc99bbe4e4979bca92ef436c8d
Reviewed-on: http://gerrit.rockbox.org/1098
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2015-01-08 16:45:41 +01:00
Amaury Pouly dc127f213c Clarify usb_powered() and fix some code.
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>
2015-01-08 16:45:32 +01:00
Amaury Pouly 66690ca987 Get rid of USE_ROCKBOX_USB
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>
2015-01-08 16:07:12 +01:00
Michael Sevakis 7738660eff USB: Detect charging-only mode upon cable insert, not host detect.
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
2013-05-22 02:28:31 -04:00
Bertrik Sikken 575d00e3b7 Remove redundant assigment of variable to itself
Change-Id: Ibecd8c869280a55a0716e631f44ab556f7dbd8b5
2013-03-24 16:24:40 +01:00
Amaury Pouly 775ab07d5e usb: add support for hardware handled SET ADDR/CONFIG
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
2012-12-07 13:37:26 +01:00
Jens Arnold 449167b7a9 Undo f695681 (r30433). USB hardware must be initialized first.
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().
2012-05-20 10:56:40 +02:00
Amaury Pouly 279e90e654 usb: fix another typo
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31601 a1c6a512-1295-4272-9138-f99709370657
2012-01-07 18:09:23 +00:00
Amaury Pouly eb3e1756cf usb: fix typo in DEBUGF
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31600 a1c6a512-1295-4272-9138-f99709370657
2012-01-07 18:08:28 +00:00
Frank Gevaerts 57f8ae847c Move some variable declarations to inside #ifdef USB_FULL_INIT, to avoid 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
2012-01-04 22:07:09 +00:00
Frank Gevaerts 4fcffcbdf3 Reorganise USB initialisation to not depend on a specific enumeration 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
2012-01-04 21:55:09 +00:00
Rafaël Carré c003d6c332 fix r31502: USBOTG_AS3525v2 doesn't exist anymore
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31504 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 20:20:54 +00:00
Rafaël Carré 568c441fd8 usb-target.h: remove
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31498 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 18:44:55 +00:00
Michael Sevakis 47bade1437 Simplify and neaten-up usb.c a bit. USB_INSERTED and USB_EXTRACTED are 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
2011-12-15 00:14:36 +00:00
Michael Sevakis bfd69f2aa1 Fix the real issue with AMS bootloader USB mode. A call to usb_enable was 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
2011-12-14 09:19:50 +00:00
Rafaël Carré 8a7482dd89 Fix typo in comment
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31034 a1c6a512-1295-4272-9138-f99709370657
2011-11-20 17:57:24 +00:00
Thomas Martitz 1645c148e3 Simulate usb plugging on the sim better using sim_tasks.
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
2011-11-17 18:40:00 +00:00
Amaury Pouly 320c3c2ca9 usb: add forgotten break in usb switch, this could lead to unwanted code 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
2011-10-27 10:35:45 +00:00
Amaury Pouly 9d9de73693 usb: only declare usb_mmc_countdown on target which don't use the usb stack
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30733 a1c6a512-1295-4272-9138-f99709370657
2011-10-08 13:00:04 +00:00
Michael Sevakis c222f38c03 Remove obsolete USB_DETECT_BY_DRV define throughout.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30549 a1c6a512-1295-4272-9138-f99709370657
2011-09-14 16:42:43 +00:00
Amaury Pouly f695681d50 usb: make sure device init happens *after* queue/thread creation
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
2011-09-05 11:37:12 +00:00
Frank Gevaerts bf34cdfacb Add a 100ms delay before calling disk_mount_all(). Some players (especially 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
2011-08-15 14:36:23 +00:00
Michael Giacomelli e8c79d65e1 The gigabeat S needs special casing so that you can still hold vol down to 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
2011-05-16 21:10:31 +00:00
Michael Giacomelli 84b4c46d74 Enter USB charging mode on devices that support it if any key is held down 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
2011-05-16 20:27:14 +00:00
Thomas Martitz cc889e9d60 Change the thread api a bit.
* 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
2011-03-05 17:48:06 +00:00
Michael Sparmann 1b5e31ed43 iPod Classic CE-ATA Support (Part 2 of 4: Remove on-stack sector buffers, 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
2011-02-27 22:44:54 +00:00
Michael Sevakis b15aa47c56 All kernel objects in code shared amongs targets (core, plugins, codecs) 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
2011-02-14 11:27:45 +00:00
Michael Sevakis 088aaac985 USB: Thread must remember that a host has been detected since the POWERED 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
2011-01-29 00:22:42 +00:00
Michael Sevakis b4fa66d7c7 Big oops. Should be broadcasting SYS_USB_DISCONNECTED _after_ remouting disks.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29150 a1c6a512-1295-4272-9138-f99709370657
2011-01-28 04:01:34 +00:00
Michael Sevakis a3591827ad Fix colors from r29084. Had some things in the wrong preprocessor blocks.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29085 a1c6a512-1295-4272-9138-f99709370657
2011-01-18 14:35:56 +00:00
Michael Sevakis 453550a687 Try to get some control over #ifdef hell in usb.c by refactoring and inline 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
2011-01-18 14:10:06 +00:00
Michael Sevakis 0ecb0fe6b1 One change in r29068 wasn't right. Clarify comments on why it's the way it is. :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29070 a1c6a512-1295-4272-9138-f99709370657
2011-01-17 13:12:22 +00:00
Michael Sevakis 05f6f3419a Add a higher level USB detection that prevents fraudulent bus resets from 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
2011-01-17 12:24:41 +00:00