Ignore:
File:
1 edited

Legend:

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

    r721d4b6e rfaba839  
    5555#define GET_BULK_OUT(dev) ((dev)->pipes[BULK_OUT_EP].pipe)
    5656
    57 static usb_endpoint_description_t bulk_in_ep = {
     57static const usb_endpoint_description_t bulk_in_ep = {
    5858        .transfer_type = USB_TRANSFER_BULK,
    5959        .direction = USB_DIRECTION_IN,
     
    6363        .flags = 0
    6464};
    65 static usb_endpoint_description_t bulk_out_ep = {
     65static const usb_endpoint_description_t bulk_out_ep = {
    6666        .transfer_type = USB_TRANSFER_BULK,
    6767        .direction = USB_DIRECTION_OUT,
     
    7272};
    7373
    74 usb_endpoint_description_t *mast_endpoints[] = {
     74static const usb_endpoint_description_t *mast_endpoints[] = {
    7575        &bulk_in_ep,
    7676        &bulk_out_ep,
     
    106106}
    107107
     108/** Callback when a device is about to be removed.
     109 *
     110 * @param dev Representation of USB device.
     111 * @return Error code.
     112 */
     113static int usbmast_device_remove(usb_device_t *dev)
     114{
     115        //TODO: flush buffers, or whatever.
     116        //TODO: remove device
     117        return ENOTSUP;
     118}
     119
    108120/** Callback when new device is attached and recognized as a mass storage.
    109121 *
    110  * @param dev Representation of a the USB device.
     122 * @param dev Representation of USB device.
    111123 * @return Error code.
    112124 */
     
    128140
    129141        usb_log_info("Initializing mass storage `%s'.\n", dev->ddf_dev->name);
    130         usb_log_debug(" Bulk in endpoint: %d [%zuB].\n",
    131             dev->pipes[BULK_IN_EP].pipe->endpoint_no,
    132             (size_t) dev->pipes[BULK_IN_EP].descriptor->max_packet_size);
     142        usb_log_debug("Bulk in endpoint: %d [%zuB].\n",
     143            dev->pipes[BULK_IN_EP].pipe.endpoint_no,
     144            dev->pipes[BULK_IN_EP].pipe.max_packet_size);
    133145        usb_log_debug("Bulk out endpoint: %d [%zuB].\n",
    134             dev->pipes[BULK_OUT_EP].pipe->endpoint_no,
    135             (size_t) dev->pipes[BULK_OUT_EP].descriptor->max_packet_size);
     146            dev->pipes[BULK_OUT_EP].pipe.endpoint_no,
     147            dev->pipes[BULK_OUT_EP].pipe.max_packet_size);
    136148
    137149        usb_log_debug("Get LUN count...\n");
     
    288300                return;
    289301        }
    290 
    291         comm_buf = as_get_mappable_page(comm_size);
    292         if (comm_buf == NULL) {
     302       
     303        (void) async_share_out_finalize(callid, &comm_buf);
     304        if (comm_buf == AS_MAP_FAILED) {
    293305                async_answer_0(callid, EHANGUP);
    294306                return;
    295307        }
    296 
    297         (void) async_share_out_finalize(callid, comm_buf);
    298 
     308       
    299309        mfun = (usbmast_fun_t *) ((ddf_fun_t *)arg)->driver_data;
    300310
     
    336346
    337347/** USB mass storage driver ops. */
    338 static usb_driver_ops_t usbmast_driver_ops = {
     348static const usb_driver_ops_t usbmast_driver_ops = {
    339349        .device_add = usbmast_device_add,
     350        .device_rem = usbmast_device_remove,
    340351        .device_gone = usbmast_device_gone,
    341352};
    342353
    343354/** USB mass storage driver. */
    344 static usb_driver_t usbmast_driver = {
     355static const usb_driver_t usbmast_driver = {
    345356        .name = NAME,
    346357        .ops = &usbmast_driver_ops,
Note: See TracChangeset for help on using the changeset viewer.