Changeset a39cfb8 in mainline for uspace/drv/ohci/hcd_endpoint.c
- Timestamp:
- 2011-04-14T07:54:33Z (13 years ago)
- 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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/hcd_endpoint.c
r3f3afb9 ra39cfb8 1 1 /* 2 * Copyright (c) 2007 Jan Hudecek 3 * Copyright (c) 2008 Martin Decky 2 * Copyright (c) 2011 Jan Vesely 4 3 * All rights reserved. 5 4 * … … 27 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 27 */ 29 30 /** @addtogroup genericproc 28 /** @addtogroup drvusbohci 31 29 * @{ 32 30 */ 33 /** @file tasklet.c34 * @brief Tasklet implementation31 /** @file 32 * @brief OHCI driver 35 33 */ 34 #include "utils/malloc32.h" 35 #include "hcd_endpoint.h" 36 36 37 #include <proc/tasklet.h> 38 #include <synch/spinlock.h> 39 #include <mm/slab.h> 40 #include <config.h> 37 hcd_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; 41 43 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 } 44 49 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 } 47 56 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 /*----------------------------------------------------------------------------*/ 64 hcd_endpoint_t * hcd_endpoint_get(endpoint_t *ep) 49 65 { 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; 60 68 } 61 62 63 /** @} 69 /*----------------------------------------------------------------------------*/ 70 void 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 * @} 64 81 */
Note:
See TracChangeset
for help on using the changeset viewer.