mmc: Import MMC/SDCard support from libusb

This commit is contained in:
Sebastian Huber
2015-03-16 22:10:36 +01:00
parent 024e064449
commit fc9e83bb68
21 changed files with 7140 additions and 53 deletions

View File

@@ -151,7 +151,7 @@ rtems_bsd_scsi_inquiry(union ccb *ccb, struct scsi_inquiry_data *inq_data)
rtems_bsd_ccb_callback,
BSD_SCSI_TAG,
(u_int8_t *) inq_data,
sizeof(*inq_data) - 1,
SHORT_INQUIRY_LENGTH,
FALSE,
0,
SSD_MIN_SIZE,
@@ -339,11 +339,11 @@ rtems_bsd_sim_attach_worker(rtems_media_state state, const char *src, char **des
}
sc = rtems_bsd_scsi_inquiry(&sim->ccb, &inq_data);
if (sc != RTEMS_SUCCESSFUL) {
if (sc == RTEMS_SUCCESSFUL) {
scsi_print_inquiry(&inq_data);
} else {
BSD_PRINTF("OOPS: inquiry failed\n");
goto error;
}
scsi_print_inquiry(&inq_data);
for (retries = 0; retries <= 3; ++retries) {
sc = rtems_bsd_scsi_test_unit_ready(&sim->ccb);
@@ -353,10 +353,14 @@ rtems_bsd_sim_attach_worker(rtems_media_state state, const char *src, char **des
}
if (sc != RTEMS_SUCCESSFUL) {
BSD_PRINTF("OOPS: test unit ready failed\n");
goto error;
}
sc = rtems_bsd_scsi_read_capacity(&sim->ccb, &block_count, &block_size);
for (retries = 0; retries <= 3; ++retries) {
sc = rtems_bsd_scsi_read_capacity(&sim->ccb, &block_count, &block_size);
if (sc == RTEMS_SUCCESSFUL) {
break;
}
}
if (sc != RTEMS_SUCCESSFUL) {
BSD_PRINTF("OOPS: read capacity failed\n");
goto error;

View File

@@ -0,0 +1,58 @@
/**
* @file
*
* @ingroup rtems_bsd_rtems
*
* @brief TODO.
*/
/*
* Copyright (c) 2011 embedded brains GmbH. All rights reserved.
*
* embedded brains GmbH
* Dornierstr. 4
* 82178 Puchheim
* Germany
* <info@embedded-brains.de>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <machine/rtems-bsd-kernel-space.h>
#include <rtems/bsd/sys/param.h>
#include <rtems/bsd/sys/types.h>
#include <sys/kernel.h>
int
config_intrhook_establish(struct intr_config_hook *hook)
{
(*hook->ich_func)(hook->ich_arg);
return (0);
}
void
config_intrhook_disestablish(struct intr_config_hook *hook)
{
/* Do nothing */
}