Commit graph

49 commits

Author SHA1 Message Date
Aidan MacDonald
ec164c389c usb: introduce new control request API
Change-Id: I6545d8985ab683c026f28f6a7c0e23b40d0a6506
2021-10-16 15:58:43 -04:00
Aidan MacDonald
672bbe434b usb: rename usb_drv_recv() to usb_recv_recv_nonblocking()
IMHO the current name is somewhat misleading:

- usb_drv_send() is blocking and we have usb_drv_send_nonblocking()
  for the non-blocking case. This inconsistent naming can only
  promote confusion. (And what would we call a blocking receive?)

- Other hardware abstraction APIs in Rockbox are usually blocking:
  storage, LCD, backlight, audio... in other words, blocking is the
  default expected behavior, with non-blocking calls being a rarity.

Change-Id: I05b41088d09eab582697674f4f06fdca0c8950af
2021-09-20 22:41:29 +01:00
Mihail Zenkov
d0d66f3aac usb-s3c6400x: prevent calling usb_enable(enable) twice on USB insert
First time we call usb_enable(enable) on USB_INSERTED event from usb_stack_enable()

Change-Id: I76f66517e1d571ee02553972a7de8414e6f340ba
2016-03-18 14:55:53 +01:00
Mihail Zenkov
4c6871cffa usb-s3c6400x: prevent lockup if usb extracted during data sending
Change-Id: I5e87a9c47defa90e15800666e8ab4608ef5de299
2016-03-18 14:02:17 +01:00
Cástor Muñoz
51389955fb usb-s3c6400x: fix broken build for LOGF_ENABLE
Change-Id: I4513425b887a0a79b03420ef82fd82bd90e7bafa
2016-02-16 21:42:43 +01:00
Cástor Muñoz
0b6647f2e9 usb-s3c6400x: set alignment for ep0_setup_pkt
Align USB_DEVBSS buffers to 32 (as other USB drivers are doing), this
could solve rare random memory corruption issues on iPod Classic.

Change-Id: I86a28e10415eabedab7bf4a534530900284f81e5
2016-02-14 14:51:13 +01:00
Cástor Muñoz
2d23c0310e iPod Classic: use uncached memory for USB driver
Change-Id: I0e72b4a452a17ec894c975dfee4baee878113ff8
2015-12-17 10:53:00 +01:00
Mihail Zenkov
02414bf286 Make sure the USB PHY is disabled after use. Patch by Mihail Zenkov who has
measured several milliamps power reduction from having the PHY disabled.

Change-Id: I29e55222eb50acf2023ac1113a90612029c580af
Reviewed-on: http://gerrit.rockbox.org/988
Reviewed-by: Michael Giacomelli <giac2000@hotmail.com>
Tested: Michael Giacomelli <giac2000@hotmail.com>
2014-09-28 21:07:45 +02:00
Rafaël Carré
c9c1349773 usb-s3c6400: merge the 2 drivers
Player-specific code remaining: usb_drv_(init,exit)

The iPods lack a MMU, so:
    - physical, virtual, and uncached addresses are identical
    - since we can't access uncached memory we discard caches when receiving data

Still not quite reliable on nano2g

Change-Id: Iebb79df64818b9ae3b68eccb8be8975ebd6c21ea
2012-04-28 16:01:57 -04:00
Rafaël Carré
7b28711f6c usb-s3c6400: store endpoint status per direction
Just as like all other drivers do
Confirmed to work on Nano2g
2012-01-16 18:29:38 -05:00
Michael Sparmann
d46afc629e Make USB work again on iPod Nano 2G and iPod Classic. Still not 100% stable on Nano 2G, and HID is still broken.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31516 a1c6a512-1295-4272-9138-f99709370657
2012-01-01 21:28:03 +00:00
Rafaël Carré
7b22ea0d37 usb-drv-as3525v2.c: merge in usb-s3c6400x.c
as3525v2 specific part is 400 LoC, ipod specific less than 300
(comments and whitespace included)

TODO: merge properly

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31509 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 21:22:48 +00:00
Rafaël Carré
fd5cb720c4 usb-s3c6400: use more complete functions from usb-drv-as3525v2
update copyright

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31508 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 21:18:10 +00:00
Rafaël Carré
12b70597a6 usb-s3c6400x: start factorization
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31506 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 20:38:44 +00:00
Rafaël Carré
cddb1cfb16 Remove USBOTG_AS3525v2
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31502 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 20:08:34 +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
Rafaël Carré
6fdc91e64f usb-s3c6400x: move usb_init_device
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31478 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 16:17:06 +00:00
Rafaël Carré
249218a5c2 usb-s3c6400x.c: move usb_detect and usb_enable
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31477 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 15:44:32 +00:00
Michael Sparmann
07605a659e usb-s3c6400x: Fix endpoints being enabled too late
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31469 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 01:54:58 +00:00
Michael Sparmann
0003018efe usb-s3c6400x: Fix some more confusion between DEPCTL_stall and DEPCTL_naksts
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31458 a1c6a512-1295-4272-9138-f99709370657
2011-12-28 21:16:12 +00:00
Michael Sevakis
09769827fe Swap red and yellow for green on r31339's cranky builds.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31340 a1c6a512-1295-4272-9138-f99709370657
2011-12-17 07:54:00 +00:00
Michael Sparmann
bb2ff25658 Un-break nano2g USB
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31309 a1c6a512-1295-4272-9138-f99709370657
2011-12-15 22:14:24 +00:00
Rafaël Carré
89aec97f3d usb-s3c6400: 0x10000000 (bit 28) is DEPCTL_setd0pid
fix another mistake introduced in r31222
usb-drv-as3525v2 additionally sets bit DEPCTL_usbactep in this function.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31266 a1c6a512-1295-4272-9138-f99709370657
2011-12-15 06:44:50 +00:00
Rafaël Carré
fc8d4b2552 usb-s3c6400: fix error introduced r31222
0x00200000 is DEPCTL_stall, not DEPCTL_naksts
the function names should have been a strong indication..

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31265 a1c6a512-1295-4272-9138-f99709370657
2011-12-15 06:38:28 +00:00
Rafaël Carré
b73dd01f2c usb-s3c6400: fix confusion between USB_DIR_IN and DIR_IN
usb_drv_request_endpoint() would return an endpoint with the other direction

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31248 a1c6a512-1295-4272-9138-f99709370657
2011-12-14 15:31:27 +00:00
Rafaël Carré
26b31f1a17 usb-s3c6400: make isr more clear
DIEPINT_timeout and DOEPINT_setup are the same bit
Use separate cases so the code is more clear

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31242 a1c6a512-1295-4272-9138-f99709370657
2011-12-14 06:30:16 +00:00
Rafaël Carré
3b00460701 usb-s3c6400: fix more index / endpoint number confusion
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31237 a1c6a512-1295-4272-9138-f99709370657
2011-12-14 00:30:16 +00:00
Rafaël Carré
1096cc08c0 usb-s3c6400: fix endpoint array traversal in interrupt handler
fix r31219

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31233 a1c6a512-1295-4272-9138-f99709370657
2011-12-13 22:13:15 +00:00
Rafaël Carré
9e8590ad23 usb-drv-as3525v2.c: simplify a lot
code, especially init sequence, is much more similar to usb-s3c6400x.c

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31231 a1c6a512-1295-4272-9138-f99709370657
2011-12-13 19:53:19 +00:00
Rafaël Carré
e4bee2b109 usb-s3c6400 : simplify
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31229 a1c6a512-1295-4272-9138-f99709370657
2011-12-13 08:12:19 +00:00
Rafaël Carré
89fa72f13f usb-s3c6400: merge DIEP* and DOEP* in a macro with an extra parameter
minor cosmetics / simplification

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31224 a1c6a512-1295-4272-9138-f99709370657
2011-12-13 06:17:57 +00:00
Rafaël Carré
c1d789acdb usb-s3c6400x.c: use defines instead of hardcoded bitfields
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31222 a1c6a512-1295-4272-9138-f99709370657
2011-12-13 05:13:22 +00:00
Rafaël Carré
bc943a06ba Move usb-s3c6400 register comments to usb-s3c6400.h
Use common defines in usb-s3c6400.c and usb-drv-as3525v2.c

No functional changes

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31220 a1c6a512-1295-4272-9138-f99709370657
2011-12-13 04:21:06 +00:00
Michael Sparmann
6229d623b0 Rework FS#12310 fix (r30906) for better readability. No functional change.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30953 a1c6a512-1295-4272-9138-f99709370657
2011-11-10 10:37:02 +00:00
Michael Sparmann
33d6bd61b5 usb-s3c6400x.c: Fix memory corruption bug (closes FS#12310)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30906 a1c6a512-1295-4272-9138-f99709370657
2011-11-06 00:56:26 +00:00
Michael Sparmann
052231748f usb-s3c6400x.c: Remove an unused variable
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30905 a1c6a512-1295-4272-9138-f99709370657
2011-11-06 00:04:52 +00:00
Michael Sevakis
12375d1d3a Merge functionality of wakeups and semaphores-- fewer APIs and object types. semaphore_wait takes a timeout now so codecs and plugins have to be made incompatible. Don't make semaphores for targets not using them.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29492 a1c6a512-1295-4272-9138-f99709370657
2011-03-02 08:49:38 +00:00
Michael Sparmann
40d640eb47 Fix yellow, already assign values for various S5L8702 defines
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28801 a1c6a512-1295-4272-9138-f99709370657
2010-12-12 00:59:59 +00:00
Michael Sparmann
70447b529c usb-s3c6400x.[ch], button-clickwheel.c: Move s5l8701-specific parts to where they belong, prepare for s5l8702
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28800 a1c6a512-1295-4272-9138-f99709370657
2010-12-12 00:52:02 +00:00
Michael Sparmann
986910175c iPod Nano 2G USB: Make sure the USB core is properly powered off on boot.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28261 a1c6a512-1295-4272-9138-f99709370657
2010-10-12 23:14:27 +00:00
Rafaël Carré
d2871ff853 usb-s3c6400x.c : don't hardcode USB_NUM_ENDPOINTS but use the define
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28036 a1c6a512-1295-4272-9138-f99709370657
2010-09-08 03:31:11 +00:00
Michael Sparmann
524035b772 Fix red: Revert the const correctness part, which opened a can of worms.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27780 a1c6a512-1295-4272-9138-f99709370657
2010-08-12 08:43:18 +00:00
Michael Sparmann
f3834a4626 emBIOS backports part one: Fix an annoying race condition in the Synopsys OTG driver, and a bit of const correctness.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27779 a1c6a512-1295-4272-9138-f99709370657
2010-08-12 08:35:43 +00:00
Bertrik Sikken
446445e916 ipod nano 2g: make functions/variables static where possible, add missing #includes
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27752 a1c6a512-1295-4272-9138-f99709370657
2010-08-08 10:49:32 +00:00
Thomas Martitz
50a6ca39ad Move c/h files implementing/defining standard library stuff into a new libc 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
2010-05-06 21:04:40 +00:00
Michael Sparmann
5b94d44cc0 Fix iPod Nano 2G USB:
1. Fix a copy paste bug (thanks for catching that one, liar)
2. Use a dummy DMA address for zero-length transfers as some devices seem to need this, and it can't hurt.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24263 a1c6a512-1295-4272-9138-f99709370657
2010-01-17 19:05:42 +00:00
Andree Buschmann
56d972ad57 Fix tabs
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24153 a1c6a512-1295-4272-9138-f99709370657
2010-01-03 10:19:43 +00:00
Michael Sparmann
ef6e1c4eaa Plumb an iPod Nano 2G battery leak that started spilling as soon as USB was used at least once until a reboot.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23335 a1c6a512-1295-4272-9138-f99709370657
2009-10-24 20:31:40 +00:00
Michael Sparmann
d03fe64dcf iPod Nano 2G USB support based on the S3C6400X datasheet. Disabled by default for now.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23285 a1c6a512-1295-4272-9138-f99709370657
2009-10-20 06:37:07 +00:00