xref: /freebsd/sys/dev/usb/usb_msctest.h (revision 7d4b2b5834dba66732596d68d7f817d18affb67f)
102ac6454SAndrew Thompson /* $FreeBSD$ */
202ac6454SAndrew Thompson /*-
3718cf2ccSPedro F. Giffuni  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4718cf2ccSPedro F. Giffuni  *
57520b888SHans Petter Selasky  * Copyright (c) 2008-2022 Hans Petter Selasky.
602ac6454SAndrew Thompson  *
702ac6454SAndrew Thompson  * Redistribution and use in source and binary forms, with or without
802ac6454SAndrew Thompson  * modification, are permitted provided that the following conditions
902ac6454SAndrew Thompson  * are met:
1002ac6454SAndrew Thompson  * 1. Redistributions of source code must retain the above copyright
1102ac6454SAndrew Thompson  *    notice, this list of conditions and the following disclaimer.
1202ac6454SAndrew Thompson  * 2. Redistributions in binary form must reproduce the above copyright
1302ac6454SAndrew Thompson  *    notice, this list of conditions and the following disclaimer in the
1402ac6454SAndrew Thompson  *    documentation and/or other materials provided with the distribution.
1502ac6454SAndrew Thompson  *
1602ac6454SAndrew Thompson  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1702ac6454SAndrew Thompson  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1802ac6454SAndrew Thompson  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1902ac6454SAndrew Thompson  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2002ac6454SAndrew Thompson  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2102ac6454SAndrew Thompson  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2202ac6454SAndrew Thompson  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2302ac6454SAndrew Thompson  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2402ac6454SAndrew Thompson  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2502ac6454SAndrew Thompson  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2602ac6454SAndrew Thompson  * SUCH DAMAGE.
2702ac6454SAndrew Thompson  */
2802ac6454SAndrew Thompson 
2975973647SAndrew Thompson #ifndef _USB_MSCTEST_H_
3075973647SAndrew Thompson #define	_USB_MSCTEST_H_
3102ac6454SAndrew Thompson 
32d84a79e7SAndrew Thompson enum {
33d84a79e7SAndrew Thompson 	MSC_EJECT_STOPUNIT,
34d84a79e7SAndrew Thompson 	MSC_EJECT_REZERO,
35d84a79e7SAndrew Thompson 	MSC_EJECT_ZTESTOR,
362386d714SAndrew Thompson 	MSC_EJECT_CMOTECH,
372386d714SAndrew Thompson 	MSC_EJECT_HUAWEI,
38c5377460SNick Hibma 	MSC_EJECT_HUAWEI2,
39*7d4b2b58SMichael Paepcke 	MSC_EJECT_HUAWEI3,
40*7d4b2b58SMichael Paepcke 	MSC_EJECT_HUAWEI4,
41fb7a4d49SGleb Smirnoff 	MSC_EJECT_TCT,
42d84a79e7SAndrew Thompson };
43d84a79e7SAndrew Thompson 
44d84a79e7SAndrew Thompson int usb_iface_is_cdrom(struct usb_device *udev,
45d84a79e7SAndrew Thompson 	    uint8_t iface_index);
46d84a79e7SAndrew Thompson usb_error_t usb_msc_eject(struct usb_device *udev,
47d84a79e7SAndrew Thompson 	    uint8_t iface_index, int method);
48d46dc4adSHans Petter Selasky usb_error_t usb_msc_auto_quirk(struct usb_device *udev,
497520b888SHans Petter Selasky 	    uint8_t iface_index, const struct usb_attach_arg *uaa);
50e045de07SHans Petter Selasky usb_error_t usb_msc_read_10(struct usb_device *udev,
51e045de07SHans Petter Selasky 	    uint8_t iface_index, uint32_t lba, uint32_t blocks,
52e045de07SHans Petter Selasky 	    void *buffer);
53e045de07SHans Petter Selasky usb_error_t usb_msc_write_10(struct usb_device *udev,
54e045de07SHans Petter Selasky 	    uint8_t iface_index, uint32_t lba, uint32_t blocks,
55e045de07SHans Petter Selasky 	    void *buffer);
56e045de07SHans Petter Selasky usb_error_t usb_msc_read_capacity(struct usb_device *udev,
57e045de07SHans Petter Selasky 	    uint8_t iface_index, uint32_t *lba_last,
58e045de07SHans Petter Selasky 	    uint32_t *block_size);
59415bcd89SHans Petter Selasky usb_error_t usb_dymo_eject(struct usb_device *udev,
60415bcd89SHans Petter Selasky 	    uint8_t iface_index);
6102ac6454SAndrew Thompson 
6275973647SAndrew Thompson #endif					/* _USB_MSCTEST_H_ */
63