Changeset e099f26 in mainline for uspace/drv/ohci/hc.h
- Timestamp:
- 2011-03-21T20:22:50Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c56c5b5b
- Parents:
- 4fb6d9ee (diff), 31b568e (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/hc.h
r4fb6d9ee re099f26 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 29 /** @addtogroup drvusbuhcihc 28 /** @addtogroup drvusbohci 30 29 * @{ 31 30 */ 32 31 /** @file 33 * @brief UHCI driver32 * @brief OHCI host controller driver structure 34 33 */ 35 #ifndef UTILS_DEVICE_KEEPER_H 36 #define UTILS_DEVICE_KEEPER_H 37 #include <devman.h> 34 #ifndef DRV_OHCI_HC_H 35 #define DRV_OHCI_HC_H 36 37 #include <fibril.h> 38 38 #include <fibril_synch.h> 39 #include <adt/list.h> 40 #include <ddi.h> 41 39 42 #include <usb/usb.h> 43 #include <usb/host/device_keeper.h> 44 #include <usbhc_iface.h> 40 45 41 #define USB_ADDRESS_COUNT (USB11_ADDRESS_MAX + 1) 46 #include "batch.h" 47 #include "ohci_regs.h" 48 #include "root_hub.h" 42 49 43 struct usb_device_info { 44 usb_speed_t speed; 45 bool occupied; 46 uint16_t toggle_status; 47 devman_handle_t handle; 48 }; 50 typedef struct hc { 51 ohci_regs_t *registers; 52 usb_address_t rh_address; 53 rh_t rh; 54 ddf_fun_t *ddf_instance; 55 usb_device_keeper_t manager; 56 fid_t interrupt_emulator; 57 } hc_t; 49 58 50 typedef struct device_keeper { 51 struct usb_device_info devices[USB_ADDRESS_COUNT]; 52 fibril_mutex_t guard; 53 fibril_condvar_t default_address_occupied; 54 usb_address_t last_address; 55 } device_keeper_t; 59 int hc_init(hc_t *instance, ddf_fun_t *fun, ddf_dev_t *dev, 60 uintptr_t regs, size_t reg_size, bool interrupts); 56 61 57 void device_keeper_init(device_keeper_t *instance);62 int hc_register_hub(hc_t *instance); 58 63 59 void device_keeper_reserve_default( 60 device_keeper_t *instance, usb_speed_t speed); 64 int hc_schedule(hc_t *instance, usb_transfer_batch_t *batch); 61 65 62 void device_keeper_release_default(device_keeper_t *instance);66 void hc_interrupt(hc_t *instance, uint32_t status); 63 67 64 void device_keeper_reset_if_need( 65 device_keeper_t *instance, usb_target_t target, const unsigned char *setup_data); 68 /** Safely dispose host controller internal structures 69 * 70 * @param[in] instance Host controller structure to use. 71 */ 72 static inline void hc_fini(hc_t *instance) { /* TODO: implement*/ }; 66 73 67 int device_keeper_get_toggle(device_keeper_t *instance, usb_target_t target); 68 69 int device_keeper_set_toggle( 70 device_keeper_t *instance, usb_target_t target, bool toggle); 71 72 usb_address_t device_keeper_request( 73 device_keeper_t *instance, usb_speed_t speed); 74 75 void device_keeper_bind( 76 device_keeper_t *instance, usb_address_t address, devman_handle_t handle); 77 78 void device_keeper_release(device_keeper_t *instance, usb_address_t address); 79 80 usb_address_t device_keeper_find( 81 device_keeper_t *instance, devman_handle_t handle); 82 83 usb_speed_t device_keeper_speed( 84 device_keeper_t *instance, usb_address_t address); 74 /** Get and cast pointer to the driver data 75 * 76 * @param[in] fun DDF function pointer 77 * @return cast pointer to driver_data 78 */ 79 static inline hc_t * fun_to_hc(ddf_fun_t *fun) 80 { return (hc_t*)fun->driver_data; } 85 81 #endif 86 82 /**
Note:
See TracChangeset
for help on using the changeset viewer.