Ignore:
File:
1 edited

Legend:

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

    rb2387c2 r7d521e24  
    5757        .device_version = 0,
    5858        .length = sizeof (usb_standard_device_descriptor_t),
     59        /// \TODO this value is guessed
    5960        .max_packet_size = 8,
    6061        .vendor_id = 0x16db,
    6162        .product_id = 0x0001,
     63        /// \TODO these values migt be different
    6264        .str_serial_number = 0,
    6365        .usb_spec_version = 0x110,
     
    116118 */
    117119static const uint32_t hub_clear_feature_by_writing_one_mask =
    118     RHS_CLEAR_PORT_POWER;
     120   RHS_CLEAR_PORT_POWER;
     121   // 1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER;
    119122
    120123/**
     
    124127    RHS_LPSC_FLAG |
    125128    RHS_OCIC_FLAG;
     129    //(1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT) |
     130    //(1 << USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
    126131
    127132/**
     
    130135static const uint32_t hub_set_feature_direct_mask =
    131136    RHS_SET_PORT_POWER;
     137    //(1 << USB_HUB_FEATURE_C_HUB_OVER_CURRENT);
    132138
    133139/**
     
    154160    RHPS_PRSC_FLAG;
    155161
     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 */
    156174//note that USB_HUB_FEATURE_PORT_POWER bit is translated into
    157175//USB_HUB_FEATURE_PORT_LOW_SPEED for port set feature request
     
    161179 */
    162180static 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*/
    163187
    164188static int create_serialized_hub_descriptor(rh_t *instance);
     
    396420 * create answer to port status_request
    397421 *
    398  * Copy content of corresponding port status register to answer buffer. The
    399  * format of the port status register and port status data is the same (
    400  * see OHCI root hub and USB hub documentation).
     422 * Copy content of corresponding port status register to answer buffer.
    401423 *
    402424 * @param instance root hub instance
     
    409431        if (port < 1 || port > instance->port_count)
    410432                return EINVAL;
     433        uint32_t * uint32_buffer = (uint32_t*) request->data_buffer;
    411434        request->transfered_size = 4;
    412         uint32_t data = instance->registers->rh_port_status[port - 1];
    413         memcpy(request->data_buffer, &data, 4);
     435        uint32_buffer[0] = instance->registers->rh_port_status[port - 1];
    414436#if 0
    415437        int i;
     
    428450 * create answer to port status_request
    429451 *
    430  * This copies flags in hub status register into the buffer. The format of the
    431  * status register and status message is the same, according to USB hub
    432  * specification and OHCI root hub specification.
     452 * Copy content of hub status register to answer buffer.
    433453 *
    434454 * @param instance root hub instance
     
    438458static int process_get_hub_status_request(rh_t *instance,
    439459    usb_transfer_batch_t * request) {
    440         //uint32_t * uint32_buffer = (uint32_t*) request->data_buffer;
     460        uint32_t * uint32_buffer = (uint32_t*) request->data_buffer;
    441461        request->transfered_size = 4;
    442462        //bits, 0,1,16,17
    443463        uint32_t mask = 1 | (1 << 1) | (1 << 16) | (1 << 17);
    444         uint32_t data = mask & instance->registers->rh_status;
    445         //uint32_buffer[0] = mask & instance->registers->rh_status;
    446         memcpy(request->data_buffer, &data, 4);
     464        uint32_buffer[0] = mask & instance->registers->rh_status;
    447465
    448466        return EOK;
     
    467485
    468486        usb_hub_bm_request_type_t request_type = request_packet->request_type;
    469         if (buffer_size < 4) {
     487        if (buffer_size < 4/*request_packet->length*/) {///\TODO
    470488                usb_log_warning("requested more data than buffer size\n");
    471489                return EINVAL;
     
    498516            | (1 << (USB_HUB_FEATURE_C_HUB_OVER_CURRENT + 16));
    499517        bzero(bitmap, instance->interrupt_mask_size);
    500         if ((instance->registers->rh_status & mask) != 0) {
     518        if (instance->registers->rh_status & mask) {
    501519                bitmap[0] = 1;
    502520        }
     
    504522        mask = port_status_change_mask;
    505523        for (port = 1; port <= instance->port_count; ++port) {
    506                 if ((mask & instance->registers->rh_port_status[port - 1]) != 0) {
     524                if (mask & instance->registers->rh_port_status[port - 1]) {
    507525
    508526                        bitmap[(port) / 8] += 1 << (port % 8);
     
    677695            (instance->registers->rh_port_status[port - 1] | (1 << feature))
    678696            & (~port_clear_feature_valid_mask);
     697        /// \TODO any error?
     698
    679699        return EOK;
    680700}
     
    704724            & (~port_clear_feature_valid_mask))
    705725            | (1 << feature);
     726        /// \TODO any error?
    706727
    707728        return EOK;
     
    921942 * @return
    922943 */
    923 static int process_interrupt_mask_in_instance(rh_t *instance,
    924     usb_transfer_batch_t * request) {
     944static int process_interrupt_mask_in_instance(rh_t *instance, usb_transfer_batch_t * request) {
    925945        memcpy(request->data_buffer, instance->interrupt_buffer,
    926946            instance->interrupt_mask_size);
     
    942962 * @return
    943963 */
    944 static bool is_zeros(void *buffer, size_t size) {
     964static bool is_zeros(void * buffer, size_t size) {
    945965        if (!buffer) return true;
    946966        if (!size) return true;
Note: See TracChangeset for help on using the changeset viewer.