Commit Graph

29 Commits (1bdc4b8046d5931544815bc01156168b0acd6da8)

Author SHA1 Message Date
neilt6 083ac31ad5 Added count argument to disk read/write
The count argument in disk_read() and disk_write() is now passed to the
FATFileSystem instance. This allows more efficient disk drivers to be
written that can read and write multiple sectors at a time.
2014-08-13 09:12:12 -06:00
kshoji 615b0d92bc Added USB Host MIDI support.
I've read, and accepted the Contributor Agreement.
http://mbed.org/users/kshoji/
2014-07-11 12:35:52 +09:00
0xc0170 b5afd80303 Removal of usbtest host for kinetis 2014-06-03 09:54:37 +01:00
0xc0170 081230ee9c spaces removal - USBHost 2014-05-29 15:16:53 +02:00
Donatien Garnier 876134ec22 Protection against concurrent access to USBHost
Fixed regression: Protection against concurrent access to USBHost using
locking class
Use Lock class within USBHost
2014-03-07 15:01:57 +00:00
Bogdan Marinescu 82ff30dd43 Merge pull request #157 from mazgch/master
fix debug output filter
2014-01-31 02:20:39 -08:00
mazgch 627c9d788a fix debug output filter 2014-01-31 11:12:55 +01:00
mazgch 5dea203d16 Fix for USBHost build issue 2013-12-16 11:10:10 +02:00
mazgch 44c2e02e51 - add support for MultiPort Serial Devices
- allow to configure the debug level of the USB stack
2013-12-09 22:04:21 +01:00
Bogdan Marinescu 6a5d7c654d Modifications for compatibility with GCC 2013-10-17 10:34:07 +03:00
Bogdan Marinescu 2f26d09606 Changed debugging macros in WANDongle and WANDongleSerialPort
Now they use "dbg.h" which is a part of USBHost, thus eliminating the
dependency on code from CellularModem.
2013-10-16 23:59:32 +03:00
Bogdan Marinescu aa209e3002 Remove USBSerialStream from USBHost
The code from USBSerialStream depends on some headers from CellularModem,
so remove it from USBHost.
2013-10-16 23:57:09 +03:00
Bogdan Marinescu d8c3822c4c Changed USBHostConf.h to better match the previous USBHost configuration. 2013-10-16 16:00:49 +03:00
Bogdan Marinescu 26ac4e5288 Remove "debugging LED" from USBHost.cpp 2013-10-16 15:55:04 +03:00
Bogdan Marinescu 1c088eed13 Moved USBSerialStream from the CellularModem library to USBHost
This removes any dependency on USB code from CellularModem.
2013-10-16 15:53:58 +03:00
Bogdan Marinescu 864d3ef195 Renamed USB3GModule to USBHost3GModule to keep the naming convention 2013-10-16 15:52:47 +03:00
Bogdan Marinescu a4da762016 Removed references to specific initializers from the code 2013-10-16 15:47:46 +03:00
Bogdan Marinescu ae2e7c3051 Refactored dongle initialization code
The code for dongle initialization (WANDongleInitializer.cpp) was removed from
this class, it will be added by each modem as needed.
2013-10-16 15:46:26 +03:00
Bogdan Marinescu a0d9973cab Initial import of USB3GModem in the USBHost library
In the future, USBHostConf.h should really reside in the project that
imports USBHost, not inside the USBHost library itself. Doing that now
though might break compatibility with projects that currently import
USBHost, so we need to figure out a better solution.
2013-10-16 15:45:25 +03:00
Michael Ammann 330e59fb85 make buffer big enough 2013-10-09 15:12:53 +03:00
Adam Green 2056ad025e usbhost: USBHost::fileControlBuf() handle alignment and endianness
Based on great feedback from Martin Kojtal on my previous commit, I
have modified my USBHost::fileControlBuf() change to be more portable.
    ddb3fbe826 (commitcomment-3988044)

The code now fills in the setupPacket byte array a byte at a time,
using bit shifts to extract lower and upper bytes from the 16-bit
values so that the code should work on big endian or little endian
machines.  I also removed the 2-byte alignment attribute from the
setupPacket array as it is no longer required.
2013-09-01 12:19:59 -07:00
Adam Green c0d7c3fb39 USBHost: Silence narrowing warning in USBHostMSD::inquiry
I changed the following initialization from:
    uint8_t cmd[6] = {0x12, (lun << 5) | evpd, page_code, 0, 36, 0};
to:
    uint8_t cmd[6] = {0x12, uint8_t((lun << 5) | evpd), page_code, 0, 36, 0};
This makes it clear to the compiler that we are Ok with the 32-bit
integer result from the shift and logical OR operation (after integral
promotions) being truncated down to a 8-bit unsigned value.  This is
safe as long as lun only has a value of 7 or lower.
2013-08-29 21:16:45 -07:00
Adam Green fb769b1566 USBHost: Don't pass NULL in for uint32_t parameters.
USBHostHub.cpp made a few calls to the USBHALHost::deviceDisconnected()
virtual method passing in NULL for the addr parameter which is actually
declared as uint32_t and not a pointer type.  Switching these calls
to pass in a 0 for this parameter silences GCC warnings about
incompatible types.
2013-08-29 21:12:12 -07:00
Adam Green 8281836df3 USBHost: Silence unused variable warnings.
I removed the initialization of some variables which were never used to
silence GCC warnings.

One of them had me removing the following line from
USBHostMouse::rxHandler():
    int len = int_in->getLengthTransferred();
The variable len is never used again in this method and it doesn't
appear that the int_in->getLengthTransferred() call has any side
effects which would require this extraneous call to remain in the code.
2013-08-29 21:07:43 -07:00
Adam Green ddb3fbe826 USBHost: Silence GCC warnings in USBHost.cpp
There are a few warnings thrown by GCC for this source file that I have
attempted to correct.  I would definitely appreciate feedback from
others on these changes:
* USBHost::usb_process() would attempt to write past the end of the
  deviceInited[] array in the following code snippet:
    if (i == MAX_DEVICE_CONNECTED) {
        USB_ERR("Too many device connected!!\r\n");
        deviceInited[i] = false;
  The i variable is guaranteed to index 1 item past then end of this
  array since it only contains MAX_DEVICE_CONNECTED elements.  I have
  removed the line which sets deviceInited[i] to false.  Two questions
  result though:
    1) What was the intent of this line of code and is it Ok that I
       just removed it or should it be replaced with something else?
    2) I see no where else that elements in the deviceInited array are
       set to false except when all are set to false in the usbThread()
       method.  Should there be code in DEVICE_DISCONNECTED_EVENT to
       do this as well?
* USBHost::transferCompleted(volatile uint32_t addr) was comparing addr
  to NULL, which is of pointer type.  GCC issues a warning on this
  since the types are different (void* being compared to uint32_t).  I
  switched it to just compare with 0 instead.
* There is a switch statement in USBHost::unqueueEndpoint() which
  is conditional on a ENDPOINT_TYPE enumeration but doesn't contain
  cases for all values in the enumeration.  I just added a default
  case to simply break on other values to silence this GCC warning and
  allow the code to continue working as it did before.  Is it Ok that
  this particular piece of code only handles these two particular
  cases?
* USBHost::fillControlBuf() was generating a warning about possible
  alignment issues when accessing the setupPacket byte array as 16-bit
  half words instead.  I changed the casting to silence the warnings
  and modified the declaration of the setupPacket field to make sure
  that it is at least 2-byte aligned for these 16-bit accesses.
2013-08-29 19:22:36 -07:00
Adam Green bfafd8a014 USBHost: Calling memcpy() instead of memset()?
The two following memcpy() calls in USBEndpoint::init() are passing in
a NULL pointer as the copy source location.

    memcpy(td_list_[0], 0, sizeof(HCTD));
    memcpy(td_list_[1], 0, sizeof(HCTD));

I suspect that these were meant to be memset() calls instead so I
switched them.  In one of the places that I found where this method is
called, USBHost::newEndpoint(), its passes in an array of HCTD objects
which have already been cleared with similar memset() calls.  I am
therefore pretty certain that these were meant to be memset() calls but
if all callers already guarantee that they are zeroed out then maybe
the memset()s can be removed from USBEndpoint::init() anyway.
2013-08-29 18:22:22 -07:00
Adam Green 8a6d5ebc34 USBHost: Updates to allow compilation with GCC_ARM
I updated a few things in the USBHost source code to get it to compile
with GCC:
* In USBHALHost.cpp, the usb_buf global variable was defined with two
  different aligmnent specifiers:
    static volatile __align(256) uint8_t usb_buf[TOTAL_SIZE] __attribute((section("AHBSRAM1"),aligned));  //256 bytes aligned!
  The first one was not accepted by GCC.  I removed the duplicate
  alignment specifier and updated the one in the existing __attribute
  property to force the desired 256 byte alignment.
* Removed the explicit use of the __packed property from structures
  and instead used the PACKED macro defined in the mbed SDK's
  toolchain.h header file.  This macro does the right thing for the
  various compilers supported by the mbed team.
* Updated USB_* message macros in dbg.h to place spaces around
  references to the 'x' macro parameter.  Without this, C++ 11
  compilation thought the x character was a string literal operator but
  it wasn't one it recognized.  Adding the spaces makes it easier to
  see the use of the parameter, fixes this compile time error, and
  doesn't add any extra space to the final output string since the
  compiler only concatenates the contents within the double quotes of
  the strings.

By the way, I build with the gnu++11 standard since I have had requests
for its support from gcc4mbed.  Some of the items fixed here might not
be errors when using older standards with GCC.

I built and tested a USBHostMSD sample with these updates using both
GCC and the online compiler.  I will test more of the host interfaces
before issuing a pull request containing this commit.
2013-08-29 12:48:20 -07:00
samux a498bff4a7 usbhost: fixed skip bits/max size conf descriptor 2013-03-18 14:54:08 +00:00
unknown 1c981f929a add USBHost library 2013-03-14 16:36:35 +00:00