[2715978] | 1 | /*
|
---|
| 2 | * Copyright (c) 2011 Vojtech Horky
|
---|
[ff65e91] | 3 | * Copyright (c) 2011 Jiri Svoboda
|
---|
[2715978] | 4 | * All rights reserved.
|
---|
| 5 | *
|
---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
---|
| 7 | * modification, are permitted provided that the following conditions
|
---|
| 8 | * are met:
|
---|
| 9 | *
|
---|
| 10 | * - Redistributions of source code must retain the above copyright
|
---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
---|
| 12 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 13 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 14 | * documentation and/or other materials provided with the distribution.
|
---|
| 15 | * - The name of the author may not be used to endorse or promote products
|
---|
| 16 | * derived from this software without specific prior written permission.
|
---|
| 17 | *
|
---|
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | /** @addtogroup drvusbmast
|
---|
| 31 | * @{
|
---|
| 32 | */
|
---|
| 33 | /**
|
---|
| 34 | * @file
|
---|
| 35 | * Main routines of USB mass storage driver.
|
---|
| 36 | */
|
---|
[ff65e91] | 37 | #include <as.h>
|
---|
| 38 | #include <async.h>
|
---|
[4802dd7] | 39 | #include <bd_srv.h>
|
---|
[ff65e91] | 40 | #include <macros.h>
|
---|
[7d521e24] | 41 | #include <usb/dev/driver.h>
|
---|
[2715978] | 42 | #include <usb/debug.h>
|
---|
| 43 | #include <usb/classes/classes.h>
|
---|
| 44 | #include <usb/classes/massstor.h>
|
---|
| 45 | #include <errno.h>
|
---|
| 46 | #include <str_error.h>
|
---|
[89d3f3c7] | 47 | #include "cmdw.h"
|
---|
| 48 | #include "bo_trans.h"
|
---|
[6430ac6] | 49 | #include "scsi_ms.h"
|
---|
[7190bbc] | 50 | #include "usbmast.h"
|
---|
[2715978] | 51 |
|
---|
| 52 | #define NAME "usbmast"
|
---|
| 53 |
|
---|
[9871bca] | 54 | static const usb_endpoint_description_t bulk_in_ep = {
|
---|
[2715978] | 55 | .transfer_type = USB_TRANSFER_BULK,
|
---|
| 56 | .direction = USB_DIRECTION_IN,
|
---|
| 57 | .interface_class = USB_CLASS_MASS_STORAGE,
|
---|
| 58 | .interface_subclass = USB_MASSSTOR_SUBCLASS_SCSI,
|
---|
| 59 | .interface_protocol = USB_MASSSTOR_PROTOCOL_BBB,
|
---|
| 60 | .flags = 0
|
---|
| 61 | };
|
---|
[9871bca] | 62 | static const usb_endpoint_description_t bulk_out_ep = {
|
---|
[2715978] | 63 | .transfer_type = USB_TRANSFER_BULK,
|
---|
| 64 | .direction = USB_DIRECTION_OUT,
|
---|
| 65 | .interface_class = USB_CLASS_MASS_STORAGE,
|
---|
| 66 | .interface_subclass = USB_MASSSTOR_SUBCLASS_SCSI,
|
---|
| 67 | .interface_protocol = USB_MASSSTOR_PROTOCOL_BBB,
|
---|
| 68 | .flags = 0
|
---|
| 69 | };
|
---|
| 70 |
|
---|
[b803845] | 71 | static const usb_endpoint_description_t *mast_endpoints[] = {
|
---|
[2715978] | 72 | &bulk_in_ep,
|
---|
| 73 | &bulk_out_ep,
|
---|
| 74 | NULL
|
---|
| 75 | };
|
---|
| 76 |
|
---|
[2aceec5] | 77 | static int usbmast_fun_create(usbmast_dev_t *mdev, unsigned lun);
|
---|
[ff65e91] | 78 | static void usbmast_bd_connection(ipc_callid_t iid, ipc_call_t *icall,
|
---|
| 79 | void *arg);
|
---|
| 80 |
|
---|
[135486d] | 81 | static int usbmast_bd_open(bd_srvs_t *, bd_srv_t *);
|
---|
[4802dd7] | 82 | static int usbmast_bd_close(bd_srv_t *);
|
---|
| 83 | static int usbmast_bd_read_blocks(bd_srv_t *, aoff64_t, size_t, void *, size_t);
|
---|
[dd8b6a8] | 84 | static int usbmast_bd_sync_cache(bd_srv_t *, aoff64_t, size_t);
|
---|
[4802dd7] | 85 | static int usbmast_bd_write_blocks(bd_srv_t *, aoff64_t, size_t, const void *, size_t);
|
---|
| 86 | static int usbmast_bd_get_block_size(bd_srv_t *, size_t *);
|
---|
| 87 | static int usbmast_bd_get_num_blocks(bd_srv_t *, aoff64_t *);
|
---|
| 88 |
|
---|
| 89 | static bd_ops_t usbmast_bd_ops = {
|
---|
| 90 | .open = usbmast_bd_open,
|
---|
| 91 | .close = usbmast_bd_close,
|
---|
| 92 | .read_blocks = usbmast_bd_read_blocks,
|
---|
[dd8b6a8] | 93 | .sync_cache = usbmast_bd_sync_cache,
|
---|
[4802dd7] | 94 | .write_blocks = usbmast_bd_write_blocks,
|
---|
| 95 | .get_block_size = usbmast_bd_get_block_size,
|
---|
| 96 | .get_num_blocks = usbmast_bd_get_num_blocks
|
---|
| 97 | };
|
---|
| 98 |
|
---|
| 99 | static usbmast_fun_t *bd_srv_usbmast(bd_srv_t *bd)
|
---|
| 100 | {
|
---|
[f73b291] | 101 | return (usbmast_fun_t *) bd->srvs->sarg;
|
---|
[4802dd7] | 102 | }
|
---|
| 103 |
|
---|
[3002434] | 104 | /** Callback when a device is removed from the system.
|
---|
| 105 | *
|
---|
| 106 | * @param dev Representation of USB device.
|
---|
| 107 | * @return Error code.
|
---|
| 108 | */
|
---|
| 109 | static int usbmast_device_gone(usb_device_t *dev)
|
---|
| 110 | {
|
---|
[c39e9fb] | 111 | usbmast_dev_t *mdev = usb_device_data_get(dev);
|
---|
[3002434] | 112 | assert(mdev);
|
---|
| 113 |
|
---|
| 114 | for (size_t i = 0; i < mdev->lun_count; ++i) {
|
---|
| 115 | const int rc = ddf_fun_unbind(mdev->luns[i]);
|
---|
| 116 | if (rc != EOK) {
|
---|
| 117 | usb_log_error("Failed to unbind LUN function %zu: "
|
---|
| 118 | "%s\n", i, str_error(rc));
|
---|
| 119 | return rc;
|
---|
| 120 | }
|
---|
| 121 | ddf_fun_destroy(mdev->luns[i]);
|
---|
| 122 | mdev->luns[i] = NULL;
|
---|
| 123 | }
|
---|
| 124 | free(mdev->luns);
|
---|
| 125 | return EOK;
|
---|
| 126 | }
|
---|
| 127 |
|
---|
[9871bca] | 128 | /** Callback when a device is about to be removed.
|
---|
| 129 | *
|
---|
| 130 | * @param dev Representation of USB device.
|
---|
| 131 | * @return Error code.
|
---|
| 132 | */
|
---|
| 133 | static int usbmast_device_remove(usb_device_t *dev)
|
---|
| 134 | {
|
---|
| 135 | //TODO: flush buffers, or whatever.
|
---|
[dcc10b8d] | 136 | //TODO: remove device
|
---|
[9871bca] | 137 | return ENOTSUP;
|
---|
| 138 | }
|
---|
| 139 |
|
---|
[2715978] | 140 | /** Callback when new device is attached and recognized as a mass storage.
|
---|
| 141 | *
|
---|
[9871bca] | 142 | * @param dev Representation of USB device.
|
---|
[2715978] | 143 | * @return Error code.
|
---|
| 144 | */
|
---|
[1a4ea01d] | 145 | static int usbmast_device_add(usb_device_t *dev)
|
---|
[2715978] | 146 | {
|
---|
| 147 | int rc;
|
---|
[2aceec5] | 148 | usbmast_dev_t *mdev = NULL;
|
---|
| 149 | unsigned i;
|
---|
[2715978] | 150 |
|
---|
[3e23316] | 151 | usb_endpoint_mapping_t *epm_in =
|
---|
| 152 | usb_device_get_mapped_ep_desc(dev, &bulk_in_ep);
|
---|
| 153 | usb_endpoint_mapping_t *epm_out =
|
---|
| 154 | usb_device_get_mapped_ep_desc(dev, &bulk_out_ep);
|
---|
| 155 | if (!epm_in || !epm_out || !epm_in->present || !epm_out->present) {
|
---|
| 156 | usb_log_error("Required EPs were not mapped.\n");
|
---|
| 157 | return ENOENT;
|
---|
| 158 | }
|
---|
| 159 |
|
---|
[ff65e91] | 160 | /* Allocate softstate */
|
---|
[065064e6] | 161 | mdev = usb_device_data_alloc(dev, sizeof(usbmast_dev_t));
|
---|
[2aceec5] | 162 | if (mdev == NULL) {
|
---|
[ff65e91] | 163 | usb_log_error("Failed allocating softstate.\n");
|
---|
[d6c953e9] | 164 | return ENOMEM;
|
---|
[2715978] | 165 | }
|
---|
[ff65e91] | 166 |
|
---|
[2aceec5] | 167 | mdev->usb_dev = dev;
|
---|
[ff65e91] | 168 |
|
---|
[7c69861] | 169 | usb_log_info("Initializing mass storage `%s'.\n",
|
---|
| 170 | usb_device_get_name(dev));
|
---|
[b77931d] | 171 | usb_log_debug("Bulk in endpoint: %d [%zuB].\n",
|
---|
[3e23316] | 172 | epm_in->pipe.endpoint_no, epm_in->pipe.max_packet_size);
|
---|
[2715978] | 173 | usb_log_debug("Bulk out endpoint: %d [%zuB].\n",
|
---|
[3e23316] | 174 | epm_out->pipe.endpoint_no, epm_out->pipe.max_packet_size);
|
---|
[2715978] | 175 |
|
---|
[239e7e10] | 176 | usb_log_debug("Get LUN count...\n");
|
---|
[87037cc9] | 177 | mdev->lun_count = usb_masstor_get_lun_count(mdev);
|
---|
| 178 | mdev->luns = calloc(mdev->lun_count, sizeof(ddf_fun_t*));
|
---|
| 179 | if (mdev->luns == NULL) {
|
---|
| 180 | rc = ENOMEM;
|
---|
| 181 | usb_log_error("Failed allocating luns table.\n");
|
---|
| 182 | goto error;
|
---|
| 183 | }
|
---|
[239e7e10] | 184 |
|
---|
[3cc55b47] | 185 | mdev->bulk_in_pipe = &epm_in->pipe;
|
---|
| 186 | mdev->bulk_out_pipe = &epm_out->pipe;
|
---|
[87037cc9] | 187 | for (i = 0; i < mdev->lun_count; i++) {
|
---|
[2aceec5] | 188 | rc = usbmast_fun_create(mdev, i);
|
---|
| 189 | if (rc != EOK)
|
---|
| 190 | goto error;
|
---|
[ff65e91] | 191 | }
|
---|
| 192 |
|
---|
[2aceec5] | 193 | return EOK;
|
---|
| 194 | error:
|
---|
[3002434] | 195 | /* Destroy functions */
|
---|
| 196 | for (size_t i = 0; i < mdev->lun_count; ++i) {
|
---|
| 197 | if (mdev->luns[i] == NULL)
|
---|
| 198 | continue;
|
---|
| 199 | const int rc = ddf_fun_unbind(mdev->luns[i]);
|
---|
| 200 | if (rc != EOK) {
|
---|
| 201 | usb_log_warning("Failed to unbind LUN function %zu: "
|
---|
| 202 | "%s.\n", i, str_error(rc));
|
---|
| 203 | }
|
---|
| 204 | ddf_fun_destroy(mdev->luns[i]);
|
---|
| 205 | }
|
---|
| 206 | free(mdev->luns);
|
---|
[2aceec5] | 207 | return rc;
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 | /** Create mass storage function.
|
---|
| 211 | *
|
---|
| 212 | * Called once for each LUN.
|
---|
| 213 | *
|
---|
| 214 | * @param mdev Mass storage device
|
---|
| 215 | * @param lun LUN
|
---|
| 216 | * @return EOK on success or negative error code.
|
---|
| 217 | */
|
---|
| 218 | static int usbmast_fun_create(usbmast_dev_t *mdev, unsigned lun)
|
---|
| 219 | {
|
---|
| 220 | int rc;
|
---|
| 221 | char *fun_name = NULL;
|
---|
| 222 | ddf_fun_t *fun = NULL;
|
---|
| 223 | usbmast_fun_t *mfun = NULL;
|
---|
| 224 |
|
---|
| 225 | if (asprintf(&fun_name, "l%u", lun) < 0) {
|
---|
| 226 | usb_log_error("Out of memory.\n");
|
---|
| 227 | rc = ENOMEM;
|
---|
| 228 | goto error;
|
---|
| 229 | }
|
---|
| 230 |
|
---|
[7c69861] | 231 | fun = usb_device_ddf_fun_create(mdev->usb_dev, fun_exposed, fun_name);
|
---|
[2aceec5] | 232 | if (fun == NULL) {
|
---|
| 233 | usb_log_error("Failed to create DDF function %s.\n", fun_name);
|
---|
| 234 | rc = ENOMEM;
|
---|
| 235 | goto error;
|
---|
| 236 | }
|
---|
| 237 |
|
---|
[5f6e25e] | 238 | /* Allocate soft state */
|
---|
[d95f02ff] | 239 | mfun = ddf_fun_data_alloc(fun, sizeof(usbmast_fun_t));
|
---|
[5f6e25e] | 240 | if (mfun == NULL) {
|
---|
| 241 | usb_log_error("Failed allocating softstate.\n");
|
---|
| 242 | rc = ENOMEM;
|
---|
| 243 | goto error;
|
---|
| 244 | }
|
---|
| 245 |
|
---|
[87037cc9] | 246 | mfun->ddf_fun = fun;
|
---|
[5f6e25e] | 247 | mfun->mdev = mdev;
|
---|
| 248 | mfun->lun = lun;
|
---|
| 249 |
|
---|
[135486d] | 250 | bd_srvs_init(&mfun->bds);
|
---|
| 251 | mfun->bds.ops = &usbmast_bd_ops;
|
---|
| 252 | mfun->bds.sarg = mfun;
|
---|
[4802dd7] | 253 |
|
---|
[2aceec5] | 254 | /* Set up a connection handler. */
|
---|
[56fd7cf] | 255 | ddf_fun_set_conn_handler(fun, usbmast_bd_connection);
|
---|
[2aceec5] | 256 |
|
---|
[0feaae4] | 257 | usb_log_debug("Inquire...\n");
|
---|
[6430ac6] | 258 | usbmast_inquiry_data_t inquiry;
|
---|
[2aceec5] | 259 | rc = usbmast_inquiry(mfun, &inquiry);
|
---|
[70c12d6] | 260 | if (rc != EOK) {
|
---|
[0feaae4] | 261 | usb_log_warning("Failed to inquire device `%s': %s.\n",
|
---|
[7c69861] | 262 | usb_device_get_name(mdev->usb_dev), str_error(rc));
|
---|
[ff65e91] | 263 | rc = EIO;
|
---|
| 264 | goto error;
|
---|
[70c12d6] | 265 | }
|
---|
| 266 |
|
---|
[2aceec5] | 267 | usb_log_info("Mass storage `%s' LUN %u: " \
|
---|
| 268 | "%s by %s rev. %s is %s (%s).\n",
|
---|
[7c69861] | 269 | usb_device_get_name(mdev->usb_dev),
|
---|
[2aceec5] | 270 | lun,
|
---|
[7b2c17c] | 271 | inquiry.product,
|
---|
| 272 | inquiry.vendor,
|
---|
| 273 | inquiry.revision,
|
---|
[6430ac6] | 274 | usbmast_scsi_dev_type_str(inquiry.device_type),
|
---|
[2aceec5] | 275 | inquiry.removable ? "removable" : "non-removable");
|
---|
[7a5c8b8f] | 276 |
|
---|
[71fa44c] | 277 | uint32_t nblocks, block_size;
|
---|
| 278 |
|
---|
[2aceec5] | 279 | rc = usbmast_read_capacity(mfun, &nblocks, &block_size);
|
---|
[71fa44c] | 280 | if (rc != EOK) {
|
---|
| 281 | usb_log_warning("Failed to read capacity, device `%s': %s.\n",
|
---|
[7c69861] | 282 | usb_device_get_name(mdev->usb_dev), str_error(rc));
|
---|
[ff65e91] | 283 | rc = EIO;
|
---|
| 284 | goto error;
|
---|
[71fa44c] | 285 | }
|
---|
| 286 |
|
---|
| 287 | usb_log_info("Read Capacity: nblocks=%" PRIu32 ", "
|
---|
| 288 | "block_size=%" PRIu32 "\n", nblocks, block_size);
|
---|
| 289 |
|
---|
[2aceec5] | 290 | mfun->nblocks = nblocks;
|
---|
| 291 | mfun->block_size = block_size;
|
---|
[f7a55f9] | 292 |
|
---|
[ff65e91] | 293 | rc = ddf_fun_bind(fun);
|
---|
[f7a55f9] | 294 | if (rc != EOK) {
|
---|
[ff65e91] | 295 | usb_log_error("Failed to bind DDF function %s: %s.\n",
|
---|
| 296 | fun_name, str_error(rc));
|
---|
| 297 | goto error;
|
---|
[f7a55f9] | 298 | }
|
---|
| 299 |
|
---|
[60c6fe0] | 300 | free(fun_name);
|
---|
[87037cc9] | 301 | mdev->luns[lun] = fun;
|
---|
[60c6fe0] | 302 |
|
---|
[ff65e91] | 303 | return EOK;
|
---|
[f7a55f9] | 304 |
|
---|
[ff65e91] | 305 | /* Error cleanup */
|
---|
| 306 | error:
|
---|
| 307 | if (fun != NULL)
|
---|
| 308 | ddf_fun_destroy(fun);
|
---|
[2aceec5] | 309 | if (fun_name != NULL)
|
---|
| 310 | free(fun_name);
|
---|
[ff65e91] | 311 | return rc;
|
---|
| 312 | }
|
---|
| 313 |
|
---|
| 314 | /** Blockdev client connection handler. */
|
---|
| 315 | static void usbmast_bd_connection(ipc_callid_t iid, ipc_call_t *icall,
|
---|
| 316 | void *arg)
|
---|
| 317 | {
|
---|
[2aceec5] | 318 | usbmast_fun_t *mfun;
|
---|
[4802dd7] | 319 |
|
---|
[56fd7cf] | 320 | mfun = (usbmast_fun_t *) ddf_fun_data_get((ddf_fun_t *)arg);
|
---|
[135486d] | 321 | bd_conn(iid, icall, &mfun->bds);
|
---|
[4802dd7] | 322 | }
|
---|
[ff65e91] | 323 |
|
---|
[4802dd7] | 324 | /** Open device. */
|
---|
[135486d] | 325 | static int usbmast_bd_open(bd_srvs_t *bds, bd_srv_t *bd)
|
---|
[4802dd7] | 326 | {
|
---|
| 327 | return EOK;
|
---|
| 328 | }
|
---|
[ff65e91] | 329 |
|
---|
[4802dd7] | 330 | /** Close device. */
|
---|
| 331 | static int usbmast_bd_close(bd_srv_t *bd)
|
---|
| 332 | {
|
---|
| 333 | return EOK;
|
---|
| 334 | }
|
---|
[ff65e91] | 335 |
|
---|
[4802dd7] | 336 | /** Read blocks from the device. */
|
---|
| 337 | static int usbmast_bd_read_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt, void *buf,
|
---|
| 338 | size_t size)
|
---|
| 339 | {
|
---|
| 340 | usbmast_fun_t *mfun = bd_srv_usbmast(bd);
|
---|
| 341 |
|
---|
| 342 | if (size < cnt * mfun->block_size)
|
---|
| 343 | return EINVAL;
|
---|
| 344 |
|
---|
| 345 | return usbmast_read(mfun, ba, cnt, buf);
|
---|
| 346 | }
|
---|
| 347 |
|
---|
[dd8b6a8] | 348 | /** Synchronize blocks to nonvolatile storage. */
|
---|
| 349 | static int usbmast_bd_sync_cache(bd_srv_t *bd, uint64_t ba, size_t cnt)
|
---|
| 350 | {
|
---|
| 351 | usbmast_fun_t *mfun = bd_srv_usbmast(bd);
|
---|
| 352 |
|
---|
| 353 | return usbmast_sync_cache(mfun, ba, cnt);
|
---|
| 354 | }
|
---|
| 355 |
|
---|
[4802dd7] | 356 | /** Write blocks to the device. */
|
---|
| 357 | static int usbmast_bd_write_blocks(bd_srv_t *bd, uint64_t ba, size_t cnt,
|
---|
| 358 | const void *buf, size_t size)
|
---|
| 359 | {
|
---|
| 360 | usbmast_fun_t *mfun = bd_srv_usbmast(bd);
|
---|
| 361 |
|
---|
| 362 | if (size < cnt * mfun->block_size)
|
---|
| 363 | return EINVAL;
|
---|
| 364 |
|
---|
| 365 | return usbmast_write(mfun, ba, cnt, buf);
|
---|
[2715978] | 366 | }
|
---|
| 367 |
|
---|
[4802dd7] | 368 | /** Get device block size. */
|
---|
| 369 | static int usbmast_bd_get_block_size(bd_srv_t *bd, size_t *rsize)
|
---|
| 370 | {
|
---|
| 371 | usbmast_fun_t *mfun = bd_srv_usbmast(bd);
|
---|
| 372 | *rsize = mfun->block_size;
|
---|
| 373 | return EOK;
|
---|
| 374 | }
|
---|
| 375 |
|
---|
| 376 | /** Get number of blocks on device. */
|
---|
| 377 | static int usbmast_bd_get_num_blocks(bd_srv_t *bd, aoff64_t *rnb)
|
---|
| 378 | {
|
---|
| 379 | usbmast_fun_t *mfun = bd_srv_usbmast(bd);
|
---|
| 380 | *rnb = mfun->nblocks;
|
---|
| 381 | return EOK;
|
---|
| 382 | }
|
---|
| 383 |
|
---|
| 384 |
|
---|
[2715978] | 385 | /** USB mass storage driver ops. */
|
---|
[9871bca] | 386 | static const usb_driver_ops_t usbmast_driver_ops = {
|
---|
[1a4ea01d] | 387 | .device_add = usbmast_device_add,
|
---|
[9871bca] | 388 | .device_rem = usbmast_device_remove,
|
---|
[3002434] | 389 | .device_gone = usbmast_device_gone,
|
---|
[2715978] | 390 | };
|
---|
| 391 |
|
---|
| 392 | /** USB mass storage driver. */
|
---|
[9871bca] | 393 | static const usb_driver_t usbmast_driver = {
|
---|
[2715978] | 394 | .name = NAME,
|
---|
| 395 | .ops = &usbmast_driver_ops,
|
---|
| 396 | .endpoints = mast_endpoints
|
---|
| 397 | };
|
---|
| 398 |
|
---|
| 399 | int main(int argc, char *argv[])
|
---|
| 400 | {
|
---|
[920d0fc] | 401 | log_init(NAME);
|
---|
[2715978] | 402 |
|
---|
| 403 | return usb_driver_main(&usbmast_driver);
|
---|
| 404 | }
|
---|
| 405 |
|
---|
| 406 | /**
|
---|
| 407 | * @}
|
---|
| 408 | */
|
---|