Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbmast/cmds.h

    r38c9505 r5203e256  
    5757} __attribute__((packed)) usb_massstor_csw_t;
    5858
    59 extern void usb_massstor_cbw_prepare(usb_massstor_cbw_t *, uint32_t, uint32_t,
    60     usb_direction_t, uint8_t, uint8_t, const uint8_t *);
     59static inline void usb_massstor_cbw_prepare(usb_massstor_cbw_t *cbw,
     60    uint32_t tag, uint32_t transfer_length, usb_direction_t dir,
     61    uint8_t lun, uint8_t cmd_len, uint8_t *cmd)
     62{
     63        cbw->dCBWSignature = uint32_host2usb(0x43425355);
     64        cbw->dCBWTag = tag;
     65        cbw->dCBWDataTransferLength = transfer_length;
     66
     67        cbw->bmCBWFlags = 0;
     68        if (dir == USB_DIRECTION_IN) {
     69                cbw->bmCBWFlags |= (1 << 7);
     70        }
     71
     72        /* Only lowest 4 bits. */
     73        cbw->bCBWLUN = lun & 0x0F;
     74
     75        /* Only lowest 5 bits. */
     76        cbw->bCBWBLength = cmd_len & 0x1F;
     77
     78        memcpy(cbw->CBWCB, cmd, cbw->bCBWBLength);
     79}
    6180
    6281#endif
Note: See TracChangeset for help on using the changeset viewer.