Changes in / [9a7e5b4:dcaf819] in mainline


Ignore:
Location:
uspace
Files:
2 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/hc.h

    r9a7e5b4 rdcaf819  
    4848#include "ohci_regs.h"
    4949#include "root_hub.h"
    50 #include "hw_struct/hcca.h"
    5150
    5251typedef struct hc {
  • uspace/drv/ohci/hw_struct/endpoint_descriptor.h

    r9a7e5b4 rdcaf819  
    3232 * @brief OHCI driver
    3333 */
    34 #ifndef DRV_OHCI_HW_STRUCT_ENDPOINT_DESCRIPTOR_H
    35 #define DRV_OHCI_HW_STRUCT_ENDPOINT_DESCRIPTOR_H
     34#ifndef DRV_OHCI_ENDPOINT_DESCRIPTOR_H
     35#define DRV_OHCI_ENDPOINT_DESCRIPTOR_H
    3636
    3737#include <stdint.h>
    38 
    39 #include "completion_codes.h"
    4038
    4139typedef struct ed {
  • uspace/drv/ohci/hw_struct/iso_transfer_descriptor.h

    r9a7e5b4 rdcaf819  
    3232 * @brief OHCI driver
    3333 */
    34 #ifndef DRV_OHCI_HW_STRUCT_ISO_TRANSFER_DESCRIPTOR_H
    35 #define DRV_OHCI_HW_STRUCT_ISO_TRANSFER_DESCRIPTOR_H
     34#ifndef DRV_OHCI_ISO_TRANSFER_DESCRIPTOR_H
     35#define DRV_OHCI_ISO_TRANSFER_DESCRIPTOR_H
    3636
    3737#include <stdint.h>
    38 
    39 #include "completion_codes.h"
    4038
    4139typedef struct itd {
  • uspace/drv/ohci/hw_struct/transfer_descriptor.h

    r9a7e5b4 rdcaf819  
    3232 * @brief OHCI driver
    3333 */
    34 #ifndef DRV_OHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
    35 #define DRV_OHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H
     34#ifndef DRV_OHCI_TRANSFER_DESCRIPTOR_H
     35#define DRV_OHCI_TRANSFER_DESCRIPTOR_H
    3636
    3737#include <stdint.h>
    38 
    39 #include "completion_codes.h"
    4038
    4139typedef struct td {
     
    6866 * @}
    6967 */
     68
  • uspace/drv/ohci/iface.c

    r9a7e5b4 rdcaf819  
    163163            usb_str_speed(speed), direction, size, max_packet_size, interval);
    164164        // TODO use real endpoint here!
    165         return usb_endpoint_manager_register_ep(&hc->ep_manager,NULL, 0);
     165        return usb_endpoint_manager_register_ep(&hc->ep_manager,
     166            address, endpoint, direction, NULL, 0);
    166167}
    167168/*----------------------------------------------------------------------------*/
  • uspace/drv/uhci-hcd/iface.c

    r9a7e5b4 rdcaf819  
    168168        if (ep == NULL)
    169169                return ENOMEM;
    170         ret = endpoint_init(ep, address, endpoint, direction,
    171             transfer_type, speed, max_packet_size);
     170        ret = endpoint_init(ep, transfer_type, speed, max_packet_size);
    172171        if (ret != EOK) {
    173172                free(ep);
     
    179178            usb_str_speed(speed), direction, size, max_packet_size, interval);
    180179
    181         ret = usb_endpoint_manager_register_ep(&hc->ep_manager, ep, size);
     180        ret = usb_endpoint_manager_register_ep(&hc->ep_manager,
     181            address, endpoint, direction, ep, size);
    182182        if (ret != EOK) {
    183183                endpoint_destroy(ep);
  • uspace/lib/usb/include/usb/host/endpoint.h

    r9a7e5b4 rdcaf819  
    4242
    4343typedef struct endpoint {
    44         usb_address_t address;
    45         usb_endpoint_t endpoint;
    46         usb_direction_t direction;
     44        link_t same_device_eps;
    4745        usb_transfer_type_t transfer_type;
    4846        usb_speed_t speed;
     
    5048        bool active;
    5149        unsigned toggle:1;
    52         link_t same_device_eps;
    5350} endpoint_t;
    5451
    55 int endpoint_init(endpoint_t *instance, usb_address_t address,
    56     usb_endpoint_t endpoint, usb_direction_t direction,
    57     usb_transfer_type_t type, usb_speed_t speed, size_t max_packet_size);
     52int endpoint_init(endpoint_t *instance, usb_transfer_type_t transfer_type,
     53    usb_speed_t speed, size_t max_packet_size);
    5854
    5955void endpoint_destroy(endpoint_t *instance);
     
    6561void endpoint_toggle_reset(link_t *ep);
    6662
    67 void endpoint_toggle_reset_filtered(link_t *ep, usb_endpoint_t epn);
    6863
    6964#endif
  • uspace/lib/usb/include/usb/host/usb_endpoint_manager.h

    r9a7e5b4 rdcaf819  
    6464
    6565int usb_endpoint_manager_register_ep(usb_endpoint_manager_t *instance,
     66    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
    6667    endpoint_t *ep, size_t data_size);
    6768
  • uspace/lib/usb/src/host/device_keeper.c

    r9a7e5b4 rdcaf819  
    128128                /* recipient is endpoint, value is zero (ENDPOINT_STALL) */
    129129                if (((data[0] & 0xf) == 1) && ((data[2] | data[3]) == 0)) {
    130                         while (current !=
    131                            &instance->devices[target.address].endpoints)
    132                         {
    133130                        /* endpoint number is < 16, thus first byte is enough */
    134                                 endpoint_toggle_reset_filtered(
    135                                     current, data[4]);
    136                                 current = current->next;
    137                         }
     131                        assert(!"NOT IMPLEMENTED!");
    138132                }
    139133        break;
  • uspace/lib/usb/src/host/endpoint.c

    r9a7e5b4 rdcaf819  
    3737#include <usb/host/endpoint.h>
    3838
    39 int endpoint_init(endpoint_t *instance, usb_address_t address,
    40     usb_endpoint_t endpoint, usb_direction_t direction,
    41     usb_transfer_type_t type, usb_speed_t speed, size_t max_packet_size)
     39int endpoint_init(endpoint_t *instance, usb_transfer_type_t transfer_type,
     40    usb_speed_t speed, size_t max_packet_size)
    4241{
    4342        assert(instance);
    44         instance->address = address;
    45         instance->endpoint = endpoint;
    46         instance->direction = direction;
    47         instance->transfer_type = type;
     43        link_initialize(&instance->same_device_eps);
     44        instance->transfer_type = transfer_type;
    4845        instance->speed = speed;
    4946        instance->max_packet_size = max_packet_size;
    5047        instance->toggle = 0;
    51         link_initialize(&instance->same_device_eps);
    5248        return EOK;
    5349}
     
    8076        instance->toggle = 0;
    8177}
    82 /*----------------------------------------------------------------------------*/
    83 void endpoint_toggle_reset_filtered(link_t *ep, usb_endpoint_t epn)
    84 {
    85         endpoint_t *instance =
    86             list_get_instance(ep, endpoint_t, same_device_eps);
    87         assert(instance);
    88         if (instance->endpoint == epn)
    89                 instance->toggle = 0;
    90 }
    9178/**
    9279 * @}
  • uspace/lib/usb/src/host/usb_endpoint_manager.c

    r9a7e5b4 rdcaf819  
    3535#define BUCKET_COUNT 7
    3636
    37 #define MAX_KEYS (3)
     37typedef struct {
     38        usb_address_t address;
     39        usb_endpoint_t endpoint;
     40        usb_direction_t direction;
     41} __attribute__((aligned (sizeof(unsigned long)))) id_t;
     42#define MAX_KEYS (sizeof(id_t) / sizeof(unsigned long))
    3843typedef struct {
     44        union {
     45                id_t id;
     46                unsigned long key[MAX_KEYS];
     47        };
    3948        link_t link;
    4049        size_t bw;
     
    5766        assert(item);
    5867        node_t *node = hash_table_get_instance(item, node_t, link);
    59         assert(node);
    60         assert(node->ep);
    61         bool match = true;
    62         switch (keys) {
    63         case 3:
    64                 match = match && (key[2] == node->ep->direction);
    65         case 2:
    66                 match = match && (key[1] == (unsigned long)node->ep->endpoint);
    67         case 1:
    68                 match = match && (key[0] == (unsigned long)node->ep->address);
    69                 break;
    70         default:
    71                 match = false;
    72         }
    73         return match;
     68        hash_count_t i = 0;
     69        for (; i < keys; ++i) {
     70                if (key[i] != node->key[i])
     71                        return false;
     72        }
     73        return true;
    7474}
    7575/*----------------------------------------------------------------------------*/
     
    142142/*----------------------------------------------------------------------------*/
    143143int usb_endpoint_manager_register_ep(usb_endpoint_manager_t *instance,
     144    usb_address_t address, usb_endpoint_t endpoint, usb_direction_t direction,
    144145    endpoint_t *ep, size_t data_size)
    145146{
     
    149150        assert(instance);
    150151
    151         unsigned long key[MAX_KEYS] =
    152             {ep->address, ep->endpoint, ep->direction};
     152        id_t id = {
     153                .address = address,
     154                .endpoint = endpoint,
     155                .direction = direction,
     156        };
    153157        fibril_mutex_lock(&instance->guard);
    154158
    155159        link_t *item =
    156             hash_table_find(&instance->ep_table, key);
     160            hash_table_find(&instance->ep_table, (unsigned long*)&id);
    157161        if (item != NULL) {
    158162                fibril_mutex_unlock(&instance->guard);
     
    171175        }
    172176
     177        node->id = id;
    173178        node->bw = bw;
    174179        node->ep = ep;
    175180        link_initialize(&node->link);
    176181
    177         hash_table_insert(&instance->ep_table, key, &node->link);
     182        hash_table_insert(&instance->ep_table,
     183            (unsigned long*)&id, &node->link);
    178184        instance->free_bw -= bw;
    179185        fibril_mutex_unlock(&instance->guard);
     
    186192{
    187193        assert(instance);
    188         unsigned long key[MAX_KEYS] = {address, endpoint, direction};
    189 
     194        id_t id = {
     195                .address = address,
     196                .endpoint = endpoint,
     197                .direction = direction,
     198        };
    190199        fibril_mutex_lock(&instance->guard);
    191         link_t *item = hash_table_find(&instance->ep_table, key);
     200        link_t *item =
     201            hash_table_find(&instance->ep_table, (unsigned long*)&id);
    192202        if (item == NULL) {
    193203                fibril_mutex_unlock(&instance->guard);
     
    197207        node_t *node = hash_table_get_instance(item, node_t, link);
    198208        instance->free_bw += node->bw;
    199         hash_table_remove(&instance->ep_table, key, MAX_KEYS);
     209        hash_table_remove(&instance->ep_table, (unsigned long*)&id, MAX_KEYS);
    200210
    201211        fibril_mutex_unlock(&instance->guard);
     
    209219{
    210220        assert(instance);
    211         unsigned long key[MAX_KEYS] = {address, endpoint, direction};
    212 
     221        id_t id = {
     222                .address = address,
     223                .endpoint = endpoint,
     224                .direction = direction,
     225        };
    213226        fibril_mutex_lock(&instance->guard);
    214         link_t *item = hash_table_find(&instance->ep_table, key);
     227        link_t *item =
     228            hash_table_find(&instance->ep_table, (unsigned long*)&id);
    215229        if (item == NULL) {
    216230                fibril_mutex_unlock(&instance->guard);
Note: See TracChangeset for help on using the changeset viewer.