Changes in / [5c2c459:c28b3a5] in mainline


Ignore:
Location:
uspace
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/root_hub.c

    r5c2c459 rc28b3a5  
    6161        .vendor_id = 0x16db,
    6262        .product_id = 0x0001,
    63         /// \TODO these values migt be different
    6463        .str_serial_number = 0,
    6564        .usb_spec_version = 0x110,
     
    119118static const uint32_t hub_clear_feature_by_writing_one_mask =
    120119   RHS_CLEAR_PORT_POWER;
    121    // 1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER;
    122120
    123121/**
     
    127125    RHS_LPSC_FLAG |
    128126    RHS_OCIC_FLAG;
    129     //(1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT) |
    130     //(1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
    131127
    132128/**
     
    135131static const uint32_t hub_set_feature_direct_mask =
    136132    RHS_SET_PORT_POWER;
    137     //(1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT);
    138133
    139134/**
     
    160155    RHPS_PRSC_FLAG;
    161156
    162 /*
    163 
    164     (1 << USB_HUB_FEATURE_PORT_CONNECTION) |
    165     (1 << USB_HUB_FEATURE_PORT_SUSPEND) |
    166     (1 << USB_HUB_FEATURE_PORT_OVER_CURRENT) |
    167     (1 << USB_HUB_FEATURE_PORT_POWER) |
    168     (1 << USB_HUB_FEATURE_C_PORT_CONNECTION) |
    169     (1 << USB_HUB_FEATURE_C_PORT_ENABLE) |
    170     (1 << USB_HUB_FEATURE_C_PORT_SUSPEND) |
    171     (1 << USB_HUB_FEATURE_C_PORT_OVER_CURRENT) |
    172     (1 << USB_HUB_FEATURE_C_PORT_RESET);
    173  */
    174157//note that USB_HUB_FEATURE_PORT_POWER bit is translated into
    175158//USB_HUB_FEATURE_PORT_LOW_SPEED for port set feature request
     
    179162 */
    180163static const uint32_t port_status_change_mask = RHPS_CHANGE_WC_MASK;
    181 /*    (1 << USB_HUB_FEATURE_C_PORT_CONNECTION) |
    182     (1 << USB_HUB_FEATURE_C_PORT_ENABLE) |
    183     (1 << USB_HUB_FEATURE_C_PORT_OVER_CURRENT) |
    184     (1 << USB_HUB_FEATURE_C_PORT_RESET) |
    185     (1 << USB_HUB_FEATURE_C_PORT_SUSPEND);
    186 */
    187164
    188165static int create_serialized_hub_descriptor(rh_t *instance);
     
    420397 * create answer to port status_request
    421398 *
    422  * Copy content of corresponding port status register to answer buffer.
     399 * Copy content of corresponding port status register to answer buffer. The
     400 * format of the port status register and port status data is the same (
     401 * see OHCI root hub and USB hub documentation).
    423402 *
    424403 * @param instance root hub instance
     
    431410        if (port < 1 || port > instance->port_count)
    432411                return EINVAL;
    433         uint32_t * uint32_buffer = (uint32_t*) request->data_buffer;
    434412        request->transfered_size = 4;
    435         uint32_buffer[0] = instance->registers->rh_port_status[port - 1];
     413        uint32_t data = instance->registers->rh_port_status[port - 1];
     414        memcpy(request->data_buffer,&data,4);
    436415#if 0
    437416        int i;
     
    450429 * create answer to port status_request
    451430 *
    452  * Copy content of hub status register to answer buffer.
     431 * This copies flags in hub status register into the buffer. The format of the
     432 * status register and status message is the same, according to USB hub
     433 * specification and OHCI root hub specification.
    453434 *
    454435 * @param instance root hub instance
     
    458439static int process_get_hub_status_request(rh_t *instance,
    459440    usb_transfer_batch_t * request) {
    460         uint32_t * uint32_buffer = (uint32_t*) request->data_buffer;
     441        //uint32_t * uint32_buffer = (uint32_t*) request->data_buffer;
    461442        request->transfered_size = 4;
    462443        //bits, 0,1,16,17
    463444        uint32_t mask = 1 | (1 << 1) | (1 << 16) | (1 << 17);
    464         uint32_buffer[0] = mask & instance->registers->rh_status;
     445        uint32_t data = mask & instance->registers->rh_status;
     446        //uint32_buffer[0] = mask & instance->registers->rh_status;
     447        memcpy(request->data_buffer,&data,4);
    465448
    466449        return EOK;
     
    516499            | (1 << (USB_HUB_FEATURE_C_HUB_OVER_CURRENT + 16));
    517500        bzero(bitmap, instance->interrupt_mask_size);
    518         if (instance->registers->rh_status & mask) {
     501        if ((instance->registers->rh_status & mask) !=0 ) {
    519502                bitmap[0] = 1;
    520503        }
     
    522505        mask = port_status_change_mask;
    523506        for (port = 1; port <= instance->port_count; ++port) {
    524                 if (mask & instance->registers->rh_port_status[port - 1]) {
     507                if ((mask & instance->registers->rh_port_status[port - 1]) != 0) {
    525508
    526509                        bitmap[(port) / 8] += 1 << (port % 8);
  • uspace/drv/usbhub/usbhub.c

    r5c2c459 rc28b3a5  
    6767    usb_hub_status_t status);
    6868
    69 static int usb_process_hub_power_change(usb_hub_info_t * hub_info,
     69static int usb_process_hub_local_power_change(usb_hub_info_t * hub_info,
    7070    usb_hub_status_t status);
    7171
     
    386386        int opResult;
    387387        if (usb_hub_is_status(status,USB_HUB_FEATURE_HUB_OVER_CURRENT)){
    388                 opResult = usb_hub_clear_feature(hub_info->control_pipe,
    389                     USB_HUB_FEATURE_HUB_LOCAL_POWER);
    390                 if (opResult != EOK) {
    391                         usb_log_error("cannot power off hub: %d\n",
    392                             opResult);
     388                //poweroff all ports
     389                unsigned int port;
     390                for(port = 1;port <= hub_info->port_count;++port){
     391                        opResult = usb_hub_clear_port_feature(
     392                            hub_info->control_pipe,port,
     393                            USB_HUB_FEATURE_PORT_POWER);
     394                        if (opResult != EOK) {
     395                                usb_log_warning(
     396                                    "cannot power off port %d;  %d\n",
     397                                    port, opResult);
     398                        }
    393399                }
    394400        } else {
    395                 opResult = usb_hub_set_feature(hub_info->control_pipe,
    396                     USB_HUB_FEATURE_HUB_LOCAL_POWER);
    397                 if (opResult != EOK) {
    398                         usb_log_error("cannot power on hub: %d\n",
    399                             opResult);
     401                //power all ports
     402                unsigned int port;
     403                for(port = 1;port <= hub_info->port_count;++port){
     404                        opResult = usb_hub_set_port_feature(
     405                            hub_info->control_pipe,port,
     406                            USB_HUB_FEATURE_PORT_POWER);
     407                        if (opResult != EOK) {
     408                                usb_log_warning(
     409                                    "cannot power off port %d;  %d\n",
     410                                    port, opResult);
     411                        }
    400412                }
    401413        }
     
    404416
    405417/**
    406  * process hub power change
    407  *
    408  * If the power has been lost, reestablish it.
    409  * If it was reestablished, re-power all ports.
     418 * process hub local power change
     419 *
     420 * This change is ignored.
    410421 * @param hub_info hub instance
    411422 * @param status hub status bitmask
    412423 * @return error code
    413424 */
    414 static int usb_process_hub_power_change(usb_hub_info_t * hub_info,
     425static int usb_process_hub_local_power_change(usb_hub_info_t * hub_info,
    415426    usb_hub_status_t status) {
    416427        int opResult = EOK;
    417         if (!usb_hub_is_status(status,USB_HUB_FEATURE_HUB_LOCAL_POWER)) {
    418                 //restart power on hub
    419                 opResult = usb_hub_set_feature(hub_info->control_pipe,
    420                     USB_HUB_FEATURE_HUB_LOCAL_POWER);
    421                 if (opResult != EOK) {
    422                         usb_log_error("cannot power on hub: %d\n",
    423                             opResult);
    424                 }
    425         } else {//power reestablished on hub- restart ports
    426                 size_t port;
    427                 for (port = 1; port <= hub_info->port_count; ++port) {
    428                         opResult = usb_hub_set_port_feature(
    429                             hub_info->control_pipe,
    430                             port, USB_HUB_FEATURE_PORT_POWER);
    431                         if (opResult != EOK) {
    432                                 usb_log_error("Cannot power on port %zu: %s.\n",
    433                                     port, str_error(opResult));
    434                         }
    435                 }
    436         }
    437         if(opResult!=EOK){
    438                 return opResult;//no feature clearing
    439         }
    440428        opResult = usb_hub_clear_feature(hub_info->control_pipe,
    441429            USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
     
    452440 *
    453441 * The change can be either in the over-current condition or
    454  * local-power lost condition.
     442 * local-power change.
    455443 * @param hub_info hub instance
    456444 */
     
    487475        if (
    488476            usb_hub_is_status(status,16+USB_HUB_FEATURE_C_HUB_LOCAL_POWER)) {
    489                 usb_process_hub_power_change(hub_info, status);
     477                usb_process_hub_local_power_change(hub_info, status);
    490478        }
    491479}
  • uspace/lib/drv/include/remote_pci.h

    r5c2c459 rc28b3a5  
    3636#define LIBDRV_REMOTE_PCI_H_
    3737
    38 remote_iface_t remote_pci_iface;
     38extern remote_iface_t remote_pci_iface;
    3939
    4040#endif
  • uspace/lib/drv/include/remote_usb.h

    r5c2c459 rc28b3a5  
    3636#define LIBDRV_REMOTE_USB_H_
    3737
    38 remote_iface_t remote_usb_iface;
     38extern remote_iface_t remote_usb_iface;
    3939
    4040#endif
  • uspace/lib/drv/include/remote_usbhc.h

    r5c2c459 rc28b3a5  
    3636#define LIBDRV_REMOTE_USBHC_H_
    3737
    38 remote_iface_t remote_usbhc_iface;
     38extern remote_iface_t remote_usbhc_iface;
    3939
    4040#endif
Note: See TracChangeset for help on using the changeset viewer.