Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset e6b32a8 in mainline


Ignore:
Timestamp:
2011-07-15T20:41:36Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
2aceec5
Parents:
7190bbc
Message:

Prepare for supporting multiple LUNs.

Location:
uspace/drv/bus/usb/usbmast
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbmast/bo_trans.c

    r7190bbc re6b32a8  
    5858 * @param tag           Command block wrapper tag (automatically compared
    5959 *                      with answer)
    60  * @param lun           LUN
    6160 * @param cmd           Command block
    6261 * @param cmd_size      Command block size in bytes
     
    6867 * @return              Error code
    6968 */
    70 static int usb_massstor_cmd(usbmast_fun_t *mfun, uint32_t tag, uint8_t lun,
    71     const void *cmd, size_t cmd_size, usb_direction_t ddir, void *dbuf,
    72     size_t dbuf_size, size_t *xferred_size)
     69static int usb_massstor_cmd(usbmast_fun_t *mfun, uint32_t tag, const void *cmd,
     70    size_t cmd_size, usb_direction_t ddir, void *dbuf, size_t dbuf_size,
     71    size_t *xferred_size)
    7372{
    7473        int rc;
     
    7978        /* Prepare CBW - command block wrapper */
    8079        usb_massstor_cbw_t cbw;
    81         usb_massstor_cbw_prepare(&cbw, tag, dbuf_size, ddir, lun, cmd_size,
    82             cmd);
     80        usb_massstor_cbw_prepare(&cbw, tag, dbuf_size, ddir, mfun->lun,
     81            cmd_size, cmd);
    8382
    8483        /* Send the CBW. */
     
    170169 * @param tag           Command block wrapper tag (automatically compared with
    171170 *                      answer)
    172  * @param lun           LUN
    173171 * @param cmd           CDB (Command Descriptor)
    174172 * @param cmd_size      CDB length in bytes
     
    179177 * @return Error code
    180178 */
    181 int usb_massstor_data_in(usbmast_fun_t *mfun, uint32_t tag, uint8_t lun,
    182     const void *cmd, size_t cmd_size, void *dbuf, size_t dbuf_size, size_t *proc_size)
    183 {
    184         return usb_massstor_cmd(mfun, tag, lun, cmd, cmd_size, USB_DIRECTION_IN,
     179int usb_massstor_data_in(usbmast_fun_t *mfun, uint32_t tag, const void *cmd,
     180    size_t cmd_size, void *dbuf, size_t dbuf_size, size_t *proc_size)
     181{
     182        return usb_massstor_cmd(mfun, tag, cmd, cmd_size, USB_DIRECTION_IN,
    185183            dbuf, dbuf_size, proc_size);
    186184}
     
    191189 * @param tag           Command block wrapper tag (automatically compared with
    192190 *                      answer)
    193  * @param lun           LUN
    194191 * @param cmd           CDB (Command Descriptor)
    195192 * @param cmd_size      CDB length in bytes
     
    200197 * @return Error code
    201198 */
    202 int usb_massstor_data_out(usbmast_fun_t *mfun, uint32_t tag, uint8_t lun,
    203     const void *cmd, size_t cmd_size, const void *data, size_t data_size,
    204     size_t *proc_size)
    205 {
    206         return usb_massstor_cmd(mfun, tag, lun, cmd, cmd_size, USB_DIRECTION_OUT,
     199int usb_massstor_data_out(usbmast_fun_t *mfun, uint32_t tag, const void *cmd,
     200    size_t cmd_size, const void *data, size_t data_size, size_t *proc_size)
     201{
     202        return usb_massstor_cmd(mfun, tag, cmd, cmd_size, USB_DIRECTION_OUT,
    207203            (void *) data, data_size, proc_size);
    208204}
  • uspace/drv/bus/usb/usbmast/bo_trans.h

    r7190bbc re6b32a8  
    4747#define BULK_OUT_EP 1
    4848
    49 extern int usb_massstor_data_in(usbmast_fun_t *, uint32_t, uint8_t,
    50     const void *, size_t, void *, size_t, size_t *);
    51 extern int usb_massstor_data_out(usbmast_fun_t *, uint32_t, uint8_t,
    52     const void *, size_t, const void *, size_t, size_t *);
     49extern int usb_massstor_data_in(usbmast_fun_t *, uint32_t, const void *,
     50    size_t, void *, size_t, size_t *);
     51extern int usb_massstor_data_out(usbmast_fun_t *, uint32_t, const void *,
     52    size_t, const void *, size_t, size_t *);
    5353extern int usb_massstor_reset(usbmast_fun_t *);
    5454extern void usb_massstor_reset_recovery(usbmast_fun_t *);
  • uspace/drv/bus/usb/usbmast/main.c

    r7190bbc re6b32a8  
    102102
    103103        msfun->usb_dev = dev;
     104        msfun->lun = 0;
    104105
    105106        fun = ddf_fun_create(dev->ddf_dev, fun_exposed, fun_name);
  • uspace/drv/bus/usb/usbmast/scsi_ms.c

    r7190bbc re6b32a8  
    7878        cdb.alloc_len = host2uint16_t_be(sizeof(inq_data));
    7979
    80         rc = usb_massstor_data_in(mfun, 0xDEADBEEF, 0, (uint8_t *) &cdb,
     80        rc = usb_massstor_data_in(mfun, 0xDEADBEEF, (uint8_t *) &cdb,
    8181            sizeof(cdb), &inq_data, sizeof(inq_data), &response_len);
    8282
     
    135135        cdb.alloc_len = min(size, SCSI_SENSE_DATA_MAX_SIZE);
    136136
    137         rc = usb_massstor_data_in(mfun, 0xDEADBEEF, 0, (uint8_t *) &cdb,
     137        rc = usb_massstor_data_in(mfun, 0xDEADBEEF, (uint8_t *) &cdb,
    138138            sizeof(cdb), buf, size, &data_len);
    139139
     
    172172        cdb.op_code = SCSI_CMD_READ_CAPACITY_10;
    173173
    174         rc = usb_massstor_data_in(mfun, 0xDEADBEEF, 0, (uint8_t *) &cdb,
     174        rc = usb_massstor_data_in(mfun, 0xDEADBEEF, (uint8_t *) &cdb,
    175175            sizeof(cdb), &data, sizeof(data), &data_len);
    176176
     
    220220        cdb.xfer_len = host2uint32_t_be(nblocks);
    221221
    222         rc = usb_massstor_data_in(mfun, 0xDEADBEEF, 0, (uint8_t *) &cdb,
     222        rc = usb_massstor_data_in(mfun, 0xDEADBEEF, (uint8_t *) &cdb,
    223223            sizeof(cdb), buf, nblocks * mfun->block_size, &data_len);
    224224
     
    265265        cdb.xfer_len = host2uint32_t_be(nblocks);
    266266
    267         rc = usb_massstor_data_out(mfun, 0xDEADBEEF, 0, (uint8_t *) &cdb,
     267        rc = usb_massstor_data_out(mfun, 0xDEADBEEF, (uint8_t *) &cdb,
    268268            sizeof(cdb), data, nblocks * mfun->block_size, &sent_len);
    269269
  • uspace/drv/bus/usb/usbmast/usbmast.h

    r7190bbc re6b32a8  
    4747        /** DDF function */
    4848        ddf_fun_t *ddf_fun;
     49        /** LUN */
     50        unsigned lun;
    4951        /** Total number of blocks. */
    5052        uint64_t nblocks;
Note: See TracChangeset for help on using the changeset viewer.