Changeset b04967a in mainline for uspace/drv/usbhub/ports.h
- Timestamp:
- 2011-04-07T15:53:46Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c156c2d
- Parents:
- 64dbc83 (diff), a82889e (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/usbhub/ports.h
r64dbc83 rb04967a 1 1 /* 2 * Copyright (c) 201 0 Matus Dekanek2 * Copyright (c) 2011 Vojtech Horky 3 3 * All rights reserved. 4 4 * … … 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 /** @addtogroup drvusbhub 29 30 * @{ 30 31 */ 31 32 /** @file 32 * @brief usblist implementation33 * Hub ports related functions. 33 34 */ 34 #include <sys/types.h> 35 #ifndef DRV_USBHUB_PORTS_H 36 #define DRV_USBHUB_PORTS_H 35 37 36 #include "usbhub_private.h" 38 #include <ipc/devman.h> 39 #include <usb/usb.h> 40 #include <ddf/driver.h> 41 #include <fibril_synch.h> 42 43 #include <usb/hub.h> 44 45 #include <usb/pipes.h> 46 #include <usb/devdrv.h> 47 48 /** Information about single port on a hub. */ 49 typedef struct { 50 /** Mutex needed by CV for checking port reset. */ 51 fibril_mutex_t reset_mutex; 52 /** CV for waiting to port reset completion. */ 53 fibril_condvar_t reset_cv; 54 /** Whether port reset is completed. 55 * Guarded by @c reset_mutex. 56 */ 57 bool reset_completed; 58 59 /** Information about attached device. */ 60 usb_hc_attached_device_t attached_device; 61 } usb_hub_port_t; 62 63 /** Initialize hub port information. 64 * 65 * @param port Port to be initialized. 66 */ 67 static inline void usb_hub_port_init(usb_hub_port_t *port) { 68 port->attached_device.address = -1; 69 port->attached_device.handle = 0; 70 fibril_mutex_initialize(&port->reset_mutex); 71 fibril_condvar_initialize(&port->reset_cv); 72 } 73 74 bool hub_port_changes_callback(usb_device_t *, uint8_t *, size_t, void *); 37 75 38 76 39 usb_general_list_t * usb_lst_create(void) { 40 usb_general_list_t* result = usb_new(usb_general_list_t); 41 usb_lst_init(result); 42 return result; 43 } 44 45 void usb_lst_init(usb_general_list_t * lst) { 46 lst->prev = lst; 47 lst->next = lst; 48 lst->data = NULL; 49 } 50 51 void usb_lst_prepend(usb_general_list_t* item, void* data) { 52 usb_general_list_t* appended = usb_new(usb_general_list_t); 53 appended->data = data; 54 appended->next = item; 55 appended->prev = item->prev; 56 item->prev->next = appended; 57 item->prev = appended; 58 } 59 60 void usb_lst_append(usb_general_list_t* item, void* data) { 61 usb_general_list_t* appended = usb_new(usb_general_list_t); 62 appended->data = data; 63 appended->next = item->next; 64 appended->prev = item; 65 item->next->prev = appended; 66 item->next = appended; 67 } 68 69 void usb_lst_remove(usb_general_list_t* item) { 70 item->next->prev = item->prev; 71 item->prev->next = item->next; 72 } 73 74 75 77 #endif 76 78 /** 77 79 * @} 78 80 */ 79 80
Note:
See TracChangeset
for help on using the changeset viewer.