Changeset a39cfb8 in mainline for uspace/drv/ohci/hcd_endpoint.c


Ignore:
Timestamp:
2011-04-14T07:54:33Z (13 years ago)
Author:
Matus Dekanek <smekideki@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e05d6c3
Parents:
3f3afb9 (diff), 34e8bab (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge from development

File:
1 moved

Legend:

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

    r3f3afb9 ra39cfb8  
    11/*
    2  * Copyright (c) 2007 Jan Hudecek
    3  * Copyright (c) 2008 Martin Decky
     2 * Copyright (c) 2011 Jan Vesely
    43 * All rights reserved.
    54 *
     
    2726 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2827 */
    29 
    30 /** @addtogroup genericproc
     28/** @addtogroup drvusbohci
    3129 * @{
    3230 */
    33 /** @file tasklet.c
    34  *  @brief Tasklet implementation
     31/** @file
     32 * @brief OHCI driver
    3533 */
     34#include "utils/malloc32.h"
     35#include "hcd_endpoint.h"
    3636
    37 #include <proc/tasklet.h>
    38 #include <synch/spinlock.h>
    39 #include <mm/slab.h>
    40 #include <config.h>
     37hcd_endpoint_t * hcd_endpoint_assign(endpoint_t *ep)
     38{
     39        assert(ep);
     40        hcd_endpoint_t *hcd_ep = malloc(sizeof(hcd_endpoint_t));
     41        if (hcd_ep == NULL)
     42                return NULL;
    4143
    42 /** Spinlock protecting list of tasklets */
    43 SPINLOCK_INITIALIZE(tasklet_lock);
     44        hcd_ep->ed = malloc32(sizeof(ed_t));
     45        if (hcd_ep->ed == NULL) {
     46                free(hcd_ep);
     47                return NULL;
     48        }
    4449
    45 /** Array of tasklet lists for every CPU */
    46 tasklet_descriptor_t **tasklet_list;
     50        hcd_ep->td = malloc32(sizeof(td_t));
     51        if (hcd_ep->td == NULL) {
     52                free32(hcd_ep->ed);
     53                free(hcd_ep);
     54                return NULL;
     55        }
    4756
    48 void tasklet_init(void)
     57        ed_init(hcd_ep->ed, ep);
     58        ed_set_td(hcd_ep->ed, hcd_ep->td);
     59        endpoint_set_hc_data(ep, hcd_ep, NULL, NULL);
     60
     61        return hcd_ep;
     62}
     63/*----------------------------------------------------------------------------*/
     64hcd_endpoint_t * hcd_endpoint_get(endpoint_t *ep)
    4965{
    50         unsigned int i;
    51        
    52         tasklet_list = malloc(sizeof(tasklet_descriptor_t *) * config.cpu_count, 0);
    53         if (!tasklet_list)
    54                 panic("Error initializing tasklets.");
    55        
    56         for (i = 0; i < config.cpu_count; i++)
    57                 tasklet_list[i] = NULL;
    58        
    59         spinlock_initialize(&tasklet_lock, "tasklet_lock");
     66        assert(ep);
     67        return ep->hc_data.data;
    6068}
    61 
    62 
    63 /** @}
     69/*----------------------------------------------------------------------------*/
     70void hcd_endpoint_clear(endpoint_t *ep)
     71{
     72        assert(ep);
     73        hcd_endpoint_t *hcd_ep = ep->hc_data.data;
     74        assert(hcd_ep);
     75        free32(hcd_ep->ed);
     76        free32(hcd_ep->td);
     77        free(hcd_ep);
     78}
     79/**
     80 * @}
    6481 */
Note: See TracChangeset for help on using the changeset viewer.