Changeset 7786cea in mainline


Ignore:
Timestamp:
2011-04-08T21:54:12Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b854e56
Parents:
96b8f322
Message:

Implement endpoint descriptor initialization

Location:
uspace/drv/ohci
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/ohci/Makefile

    r96b8f322 r7786cea  
    4040        pci.c \
    4141        root_hub.c \
    42         transfer_list.c
     42        transfer_list.c \
     43        hw_struct/endpoint_descriptor.c
    4344
    4445
  • uspace/drv/ohci/batch.c

    r96b8f322 r7786cea  
    5151} ohci_batch_t;
    5252
     53static void batch_control(usb_transfer_batch_t *instance);
    5354static void batch_call_in_and_dispose(usb_transfer_batch_t *instance);
    5455static void batch_call_out_and_dispose(usb_transfer_batch_t *instance);
     
    8384        instance->private_data = data;
    8485
     86        /* we needs + 1 transfer descriptor as the last one won't be executed */
    8587        data->td_count =
    86             (buffer_size + OHCI_MAX_TRANSFER - 1) / OHCI_MAX_TRANSFER;
     88            1 + ((buffer_size + OHCI_MAX_TRANSFER - 1) / OHCI_MAX_TRANSFER);
    8789        if (ep->transfer_type == USB_TRANSFER_CONTROL) {
    8890                data->td_count += 2;
     
    135137            instance->buffer_size);
    136138        instance->next_step = batch_call_out_and_dispose;
    137         /* TODO: implement */
     139        batch_control(instance);
    138140        usb_log_debug("Batch(%p) CONTROL WRITE initialized.\n", instance);
    139141}
     
    143145        assert(instance);
    144146        instance->next_step = batch_call_in_and_dispose;
    145         /* TODO: implement */
     147        batch_control(instance);
    146148        usb_log_debug("Batch(%p) CONTROL READ initialized.\n", instance);
    147149}
     
    150152{
    151153        assert(instance);
    152         instance->direction = USB_DIRECTION_IN;
     154        assert(instance->direction == USB_DIRECTION_IN);
    153155        instance->next_step = batch_call_in_and_dispose;
    154156        /* TODO: implement */
     
    159161{
    160162        assert(instance);
    161         instance->direction = USB_DIRECTION_OUT;
     163        assert(instance->direction == USB_DIRECTION_OUT);
    162164        /* We are data out, we are supposed to provide data */
    163165        memcpy(instance->transport_buffer, instance->buffer,
     
    188190ed_t * batch_ed(usb_transfer_batch_t *instance)
    189191{
    190         return NULL;
     192        assert(instance);
     193        ohci_batch_t *data = instance->private_data;
     194        assert(data);
     195        return data->ed;
     196}
     197/*----------------------------------------------------------------------------*/
     198static void batch_control(usb_transfer_batch_t *instance)
     199{
     200        assert(instance);
     201        ohci_batch_t *data = instance->private_data;
     202        assert(data);
     203        ed_init(data->ed, instance->ep);
    191204}
    192205/*----------------------------------------------------------------------------*/
  • uspace/drv/ohci/hw_struct/endpoint_descriptor.h

    r96b8f322 r7786cea  
    3838#include <stdint.h>
    3939
     40#include <usb/host/endpoint.h>
     41
    4042#include "utils/malloc32.h"
    4143
     
    5254#define ED_STATUS_D_IN (0x1)
    5355#define ED_STATUS_D_OUT (0x2)
     56#define ED_STATUS_D_TRANSFER (0x3)
    5457
    55 #define ED_STATUS_S_FLAG (1 << 13) /* speed flag */
     58#define ED_STATUS_S_FLAG (1 << 13) /* speed flag: 1 = low */
    5659#define ED_STATUS_K_FLAG (1 << 14) /* skip flag (no not execute this ED) */
    5760#define ED_STATUS_F_FLAG (1 << 15) /* format: 1 = isochronous*/
     
    7578} __attribute__((packed)) ed_t;
    7679
    77 static inline void ed_init_dummy(ed_t *instance)
     80void ed_init(ed_t *instance, endpoint_t *ep);
     81
     82static inline void ed_add_tds(ed_t *instance, uint32_t head, uint32_t tail)
    7883{
    7984        assert(instance);
    80         bzero(instance, sizeof(ed_t));
    81         instance->status |= ED_STATUS_K_FLAG;
     85        instance->td_head = head & ED_TDHEAD_PTR_MASK;
     86        instance->td_tail = tail & ED_TDTAIL_PTR_MASK;
    8287}
    8388
  • uspace/drv/ohci/transfer_list.c

    r96b8f322 r7786cea  
    6161            name, instance->list_head, instance->list_head_pa);
    6262
    63         ed_init_dummy(instance->list_head);
     63        ed_init(instance->list_head, NULL);
    6464        list_initialize(&instance->batch_list);
    6565        fibril_mutex_initialize(&instance->guard);
  • uspace/drv/ohci/utils/malloc32.h

    r96b8f322 r7786cea  
    3737#include <assert.h>
    3838#include <malloc.h>
     39#include <errno.h>
    3940#include <mem.h>
    4041#include <as.h>
Note: See TracChangeset for help on using the changeset viewer.