Changeset 0fe2ff1 in mainline


Ignore:
Timestamp:
2011-10-16T17:02:02Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
19746a96
Parents:
dab3112
Message:

ohci: Minor changes to root hub.

File:
1 edited

Legend:

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

    rdab3112 r0fe2ff1  
    108108static void create_serialized_hub_descriptor(rh_t *instance);
    109109static void rh_init_descriptors(rh_t *instance);
    110 static uint16_t create_interrupt_mask(rh_t *instance);
    111 static int get_status(rh_t *instance, usb_transfer_batch_t *request);
    112 static int get_descriptor(rh_t *instance, usb_transfer_batch_t *request);
    113 static int set_feature(rh_t *instance, usb_transfer_batch_t *request);
    114 static int clear_feature(rh_t *instance, usb_transfer_batch_t *request);
    115 static int set_feature_port(rh_t *instance, uint16_t feature, uint16_t port);
    116 static int clear_feature_port(rh_t *instance, uint16_t feature, uint16_t port);
     110static uint16_t create_interrupt_mask(const rh_t *instance);
     111static int get_status(const rh_t *instance, usb_transfer_batch_t *request);
     112static int get_descriptor(const rh_t *instance, usb_transfer_batch_t *request);
     113static int set_feature(const rh_t *instance, usb_transfer_batch_t *request);
     114static int clear_feature(const rh_t *instance, usb_transfer_batch_t *request);
     115static int set_feature_port(
     116    const rh_t *instance, uint16_t feature, uint16_t port);
     117static int clear_feature_port(
     118    const rh_t *instance, uint16_t feature, uint16_t port);
    117119static int control_request(rh_t *instance, usb_transfer_batch_t *request);
    118120static inline void interrupt_request(
     
    153155        instance->unfinished_interrupt_transfer = NULL;
    154156
    155 #ifdef OHCI_POWER_SWITCH_no
     157#if defined OHCI_POWER_SWITCH_no
    156158        /* Set port power mode to no power-switching. (always on) */
    157159        instance->registers->rh_desc_a |= RHDA_NPS_FLAG;
     160
    158161        /* Set to no over-current reporting */
    159162        instance->registers->rh_desc_a |= RHDA_NOCP_FLAG;
     163
    160164#elif defined OHCI_POWER_SWITCH_ganged
    161165        /* Set port power mode to no ganged power-switching. */
     
    163167        instance->registers->rh_desc_a &= ~RHDA_PSM_FLAG;
    164168        instance->registers->rh_status = RHS_CLEAR_GLOBAL_POWER;
     169
    165170        /* Set to global over-current */
    166171        instance->registers->rh_desc_a &= ~RHDA_NOCP_FLAG;
     
    174179        instance->registers->rh_desc_b &= (RHDB_PCC_MASK << RHDB_PCC_SHIFT);
    175180        instance->registers->rh_status = RHS_CLEAR_GLOBAL_POWER;
     181
    176182        /* Return control to per port state */
    177183        instance->registers->rh_desc_b |=
    178184                ((1 << (instance->port_count + 1)) - 1) << RHDB_PCC_SHIFT;
     185
    179186        /* Set per port over-current */
    180187        instance->registers->rh_desc_a &= ~RHDA_NOCP_FLAG;
     
    342349 * @return Mask of changes.
    343350 */
    344 uint16_t create_interrupt_mask(rh_t *instance)
     351uint16_t create_interrupt_mask(const rh_t *instance)
    345352{
    346353        assert(instance);
     
    372379 * @return error code
    373380 */
    374 int get_status(rh_t *instance, usb_transfer_batch_t *request)
     381int get_status(const rh_t *instance, usb_transfer_batch_t *request)
    375382{
    376383        assert(instance);
     
    418425 * @return Error code
    419426 */
    420 int get_descriptor(rh_t *instance, usb_transfer_batch_t *request)
     427int get_descriptor(const rh_t *instance, usb_transfer_batch_t *request)
    421428{
    422429        assert(instance);
     
    496503 * @return error code
    497504 */
    498 int set_feature_port(rh_t *instance, uint16_t feature, uint16_t port)
     505int set_feature_port(const rh_t *instance, uint16_t feature, uint16_t port)
    499506{
    500507        assert(instance);
     
    535542 * @return error code
    536543 */
    537 int clear_feature_port(rh_t *instance, uint16_t feature, uint16_t port)
     544int clear_feature_port(const rh_t *instance, uint16_t feature, uint16_t port)
    538545{
    539546        assert(instance);
     
    592599 * @return error code
    593600 */
    594 int set_feature(rh_t *instance, usb_transfer_batch_t *request)
     601int set_feature(const rh_t *instance, usb_transfer_batch_t *request)
    595602{
    596603        assert(instance);
     
    628635 * @return error code
    629636 */
    630 int clear_feature(rh_t *instance, usb_transfer_batch_t *request)
     637int clear_feature(const rh_t *instance, usb_transfer_batch_t *request)
    631638{
    632639        assert(instance);
     
    635642        const usb_device_request_setup_packet_t *setup_request =
    636643            (usb_device_request_setup_packet_t *) request->setup_buffer;
     644
    637645        request->transfered_size = 0;
     646
    638647        switch (setup_request->request_type)
    639648        {
     
    647656                /*
    648657                 * Chapter 11.16.2 specifies that only C_HUB_LOCAL_POWER and
    649                  * C_HUB_OVER_CURRENT are supported. C_HUB_OVER_CURRENT is represented
    650                  * by OHCI RHS_OCIC_FLAG. C_HUB_LOCAL_POWER is not supported
     658                 * C_HUB_OVER_CURRENT are supported.
     659                 * C_HUB_OVER_CURRENT is represented by OHCI RHS_OCIC_FLAG.
     660                 * C_HUB_LOCAL_POWER is not supported
    651661                 * as root hubs do not support local power status feature.
    652662                 * (OHCI pg. 127) */
     
    720730                    "additional data\n");
    721731                return clear_feature(instance, request);
     732
    722733        case USB_DEVREQ_SET_FEATURE:
    723734                usb_log_debug2("Processing request without "
Note: See TracChangeset for help on using the changeset viewer.