- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

# include/usb/msc_function.h

Go to the documentation of this file.

    00001
    00041 #ifndef USB_MSC_FUNC_H_INCLUDED
    00042 #define USB_MSC_FUNC_H_INCLUDED
    00043
    00049 #define MSC_MAX_SERIAL_LEN      20
    00050
    00051 struct block_device;
    00052
    00053 extern struct usb_func_iface *usb_msc_func_init(struct block_device *bdev);
    00054
    00055 extern void usb_msc_set_busy(struct usb_func_iface *iface, uint16_t asc,
    00056                 void (*queue_empty)(void *data), void *data);
    00057 extern void usb_msc_set_ready(struct usb_func_iface *iface);
    00058
    00059 static inline bool msc_serial_number_is_valid(const char *str, size_t max_len)
    00060 {
    00061         size_t  len;
    00062         char    c;
    00063
    00064         for (len = 0; len < max_len; len++) {
    00065                 c = str[len];
    00066                 if (c == 0)
    00067                         break;
    00068
    00069                 if ((c < '0' || c > '9') && (c < 'A' || c > 'F'))
    00070                         return false;
    00071         }
    00072
    00073         if (len < 12 || len == max_len || len > MSC_MAX_SERIAL_LEN)
    00074                 return false;
    00075
    00076         return true;
    00077 }
    00078
    00079 #endif /* USB_MSC_FUNC_H_INCLUDED */