Changeset d328172 in mainline for uspace/drv/ohci/batch.c


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

Implement driver side batch routines, make rh reuse requests

File:
1 edited

Legend:

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

    r2bf8f8c rd328172  
    4040#include "batch.h"
    4141#include "utils/malloc32.h"
     42
     43static void batch_call_in_and_dispose(batch_t *instance);
     44static void batch_call_out_and_dispose(batch_t *instance);
    4245
    4346#define DEFAULT_ERROR_COUNT 3
     
    9497{
    9598        assert(instance);
     99        free32(instance->transport_buffer);
     100        free32(instance->setup_buffer);
     101        free(instance);
    96102}
    97103/*----------------------------------------------------------------------------*/
     
    99105{
    100106        assert(instance);
     107        /* We are data out, we are supposed to provide data */
     108        memcpy(instance->transport_buffer, instance->buffer,
     109            instance->buffer_size);
     110        instance->next_step = batch_call_out_and_dispose;
     111        /* TODO: implement */
     112        usb_log_debug("Batch(%p) CONTROL WRITE initialized.\n", instance);
    101113}
    102114/*----------------------------------------------------------------------------*/
     
    104116{
    105117        assert(instance);
     118        instance->next_step = batch_call_in_and_dispose;
     119        /* TODO: implement */
     120        usb_log_debug("Batch(%p) CONTROL WRITE initialized.\n", instance);
    106121}
    107122/*----------------------------------------------------------------------------*/
     
    109124{
    110125        assert(instance);
     126        instance->direction = USB_DIRECTION_IN;
     127        instance->next_step = batch_call_in_and_dispose;
     128        /* TODO: implement */
     129        usb_log_debug("Batch(%p) INTERRUPT IN initialized.\n", instance);
    111130}
    112131/*----------------------------------------------------------------------------*/
     
    114133{
    115134        assert(instance);
     135        instance->direction = USB_DIRECTION_OUT;
     136        /* We are data out, we are supposed to provide data */
     137        memcpy(instance->transport_buffer, instance->buffer,
     138            instance->buffer_size);
     139        instance->next_step = batch_call_out_and_dispose;
     140        /* TODO: implement */
     141        usb_log_debug("Batch(%p) INTERRUPT OUT initialized.\n", instance);
    116142}
    117143/*----------------------------------------------------------------------------*/
     
    119145{
    120146        assert(instance);
     147        instance->direction = USB_DIRECTION_IN;
     148        instance->next_step = batch_call_in_and_dispose;
     149        /* TODO: implement */
     150        usb_log_debug("Batch(%p) BULK IN initialized.\n", instance);
    121151}
    122152/*----------------------------------------------------------------------------*/
     
    124154{
    125155        assert(instance);
     156        instance->direction = USB_DIRECTION_IN;
     157        instance->next_step = batch_call_in_and_dispose;
     158        /* TODO: implement */
     159        usb_log_debug("Batch(%p) BULK IN initialized.\n", instance);
     160}
     161/*----------------------------------------------------------------------------*/
     162/** Helper function calls callback and correctly disposes of batch structure.
     163 *
     164 * @param[in] instance Batch structure to use.
     165 */
     166void batch_call_in_and_dispose(batch_t *instance)
     167{
     168        assert(instance);
     169        batch_call_in(instance);
     170        batch_dispose(instance);
     171}
     172/*----------------------------------------------------------------------------*/
     173/** Helper function calls callback and correctly disposes of batch structure.
     174 *
     175 * @param[in] instance Batch structure to use.
     176 */
     177void batch_call_out_and_dispose(batch_t *instance)
     178{
     179        assert(instance);
     180        batch_call_out(instance);
     181        batch_dispose(instance);
    126182}
    127183/**
Note: See TracChangeset for help on using the changeset viewer.