Changeset 2bf8f8c in mainline


Ignore:
Timestamp:
2011-03-21T13:18:03Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d328172
Parents:
be7950e8
Message:

Implement batch_get

Location:
uspace/drv/ohci
Files:
4 edited

Legend:

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

    rbe7950e8 r2bf8f8c  
    3939
    4040#include "batch.h"
     41#include "utils/malloc32.h"
    4142
    4243#define DEFAULT_ERROR_COUNT 3
     
    4849    usb_speed_t speed,
    4950                char *buffer,
    50                 size_t size,
     51                size_t buffer_size,
    5152                char *setup_buffer,
    5253                size_t setup_size,
     
    5758                )
    5859{
    59         return NULL;
     60#define CHECK_NULL_DISPOSE_RETURN(ptr, message...) \
     61        if (ptr == NULL) { \
     62                usb_log_error(message); \
     63                if (instance) { \
     64                        batch_dispose(instance); \
     65                } \
     66                return NULL; \
     67        } else (void)0
     68
     69        batch_t *instance = malloc(sizeof(batch_t));
     70        CHECK_NULL_DISPOSE_RETURN(instance,
     71            "Failed to allocate batch instance.\n");
     72        batch_init(instance, target, transfer_type, speed, max_packet_size,
     73            buffer, NULL, buffer_size, NULL, setup_size, func_in,
     74            func_out, arg, fun, NULL);
     75
     76        if (buffer_size > 0) {
     77                instance->transport_buffer = malloc32(buffer_size);
     78                CHECK_NULL_DISPOSE_RETURN(instance->transport_buffer,
     79                    "Failed to allocate device accessible buffer.\n");
     80        }
     81
     82        if (setup_size > 0) {
     83                instance->setup_buffer = malloc32(setup_size);
     84                CHECK_NULL_DISPOSE_RETURN(instance->setup_buffer,
     85                    "Failed to allocate device accessible setup buffer.\n");
     86                memcpy(instance->setup_buffer, setup_buffer, setup_size);
     87        }
     88
     89
     90        return instance;
    6091}
    6192/*----------------------------------------------------------------------------*/
    6293void batch_dispose(batch_t *instance)
    6394{
     95        assert(instance);
    6496}
    6597/*----------------------------------------------------------------------------*/
    6698void batch_control_write(batch_t *instance)
    6799{
     100        assert(instance);
    68101}
    69102/*----------------------------------------------------------------------------*/
    70103void batch_control_read(batch_t *instance)
    71104{
     105        assert(instance);
    72106}
    73107/*----------------------------------------------------------------------------*/
    74108void batch_interrupt_in(batch_t *instance)
    75109{
     110        assert(instance);
    76111}
    77112/*----------------------------------------------------------------------------*/
    78113void batch_interrupt_out(batch_t *instance)
    79114{
     115        assert(instance);
    80116}
    81117/*----------------------------------------------------------------------------*/
    82118void batch_bulk_in(batch_t *instance)
    83119{
     120        assert(instance);
    84121}
    85122/*----------------------------------------------------------------------------*/
    86123void batch_bulk_out(batch_t *instance)
    87124{
     125        assert(instance);
    88126}
    89127/**
  • uspace/drv/ohci/hc.c

    rbe7950e8 r2bf8f8c  
    108108        assert(batch);
    109109        if (batch->target.address == instance->rh.address) {
    110                 rh_request(&instance->rh, batch);
    111                 return EOK;
     110                return rh_request(&instance->rh, batch);
    112111        }
    113112        /* TODO: implement */
  • uspace/drv/ohci/root_hub.c

    rbe7950e8 r2bf8f8c  
    5656}
    5757/*----------------------------------------------------------------------------*/
    58 void rh_request(rh_t *instance, batch_t *request)
     58int rh_request(rh_t *instance, batch_t *request)
    5959{
    60         usb_log_error("Request processing not implemented.\n");
    6160        /* TODO: implement */
     61        usb_log_error("Root hub request processing not implemented.\n");
     62        return ENOTSUP;
    6263}
    6364/*----------------------------------------------------------------------------*/
  • uspace/drv/ohci/root_hub.h

    rbe7950e8 r2bf8f8c  
    4949int rh_init(rh_t *instance, ddf_dev_t *dev, ohci_regs_t *regs);
    5050
    51 void rh_request(rh_t *instance, batch_t *request);
     51int rh_request(rh_t *instance, batch_t *request);
    5252
    5353void rh_interrupt(rh_t *instance);
Note: See TracChangeset for help on using the changeset viewer.