Changeset 8b54fe6 in mainline
- Timestamp:
- 2011-09-15T15:05:38Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- db2cb04
- Parents:
- f58ef61
- Location:
- uspace
- Files:
-
- 10 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hc.c
rf58ef61 r8b54fe6 128 128 129 129 const usb_address_t hub_address = 130 device_keeper_get_free_address(130 usb_device_manager_get_free_address( 131 131 &instance->generic.dev_manager, USB_SPEED_FULL); 132 132 if (hub_address <= 0) { … … 136 136 } 137 137 instance->rh.address = hub_address; 138 usb_device_ keeper_bind(138 usb_device_manager_bind( 139 139 &instance->generic.dev_manager, hub_address, hub_fun->handle); 140 140 … … 144 144 usb_endpoint_manager_unregister_ep( \ 145 145 &instance->generic.ep_manager, hub_address, 0, USB_DIRECTION_BOTH);\ 146 usb_device_ keeper_release( \146 usb_device_manager_release( \ 147 147 &instance->generic.dev_manager, hub_address); \ 148 148 return ret; \ -
uspace/drv/bus/usb/ohci/hc.h
rf58ef61 r8b54fe6 41 41 42 42 #include <usb/usb.h> 43 #include <usb/host/device_keeper.h>44 #include <usb/host/usb_endpoint_manager.h>45 43 #include <usb/host/hcd.h> 46 44 -
uspace/drv/bus/usb/ohci/ohci.c
rf58ef61 r8b54fe6 86 86 { 87 87 assert(fun); 88 usb_device_ keeper_t *manager =88 usb_device_manager_t *manager = 89 89 &dev_to_ohci(fun->dev)->hc.generic.dev_manager; 90 90 91 const usb_address_t addr = usb_device_ keeper_find(manager, handle);91 const usb_address_t addr = usb_device_manager_find(manager, handle); 92 92 if (addr < 0) { 93 93 return addr; -
uspace/drv/bus/usb/uhci/uhci.c
rf58ef61 r8b54fe6 99 99 { 100 100 assert(fun); 101 usb_device_keeper_t *manager = &dev_to_uhci(fun->dev)->hc.generic.dev_manager; 102 usb_address_t addr = usb_device_keeper_find(manager, handle); 101 usb_device_manager_t *manager = 102 &dev_to_uhci(fun->dev)->hc.generic.dev_manager; 103 const usb_address_t addr = usb_device_manager_find(manager, handle); 103 104 104 105 if (addr < 0) { -
uspace/drv/bus/usb/vhc/connhost.c
rf58ef61 r8b54fe6 62 62 VHC_DATA(vhc, fun); 63 63 64 usb_address_t addr = device_keeper_get_free_address(&vhc->dev_keeper,65 USB_SPEED_HIGH);64 usb_address_t addr = usb_device_manager_get_free_address( 65 &vhc->dev_manager, USB_SPEED_HIGH); 66 66 if (addr < 0) { 67 67 return addr; … … 88 88 usb_log_debug("Binding handle %" PRIun " to address %d.\n", 89 89 handle, address); 90 usb_device_ keeper_bind(&vhc->dev_keeper, address, handle);90 usb_device_manager_bind(&vhc->dev_manager, address, handle); 91 91 92 92 return EOK; … … 105 105 VHC_DATA(vhc, fun); 106 106 bool found = 107 usb_device_ keeper_find_by_address(&vhc->dev_keeper, address, handle);107 usb_device_manager_find_by_address(&vhc->dev_manager, address, handle); 108 108 return found ? EOK : ENOENT; 109 109 } … … 119 119 VHC_DATA(vhc, fun); 120 120 usb_log_debug("Releasing address %d...\n", address); 121 usb_device_ keeper_release(&vhc->dev_keeper, address);121 usb_device_manager_release(&vhc->dev_manager, address); 122 122 123 123 return ENOTSUP; … … 514 514 515 515 usb_log_debug("tell_address_rh(handle=%" PRIun ")\n", handle); 516 usb_address_t addr = usb_device_ keeper_find(&vhc->dev_keeper, handle);516 usb_address_t addr = usb_device_manager_find(&vhc->dev_manager, handle); 517 517 if (addr < 0) { 518 518 return addr; -
uspace/drv/bus/usb/vhc/main.c
rf58ef61 r8b54fe6 80 80 return rc; 81 81 } 82 usb_device_ keeper_init(&data->dev_keeper);82 usb_device_manager_init(&data->dev_manager); 83 83 84 84 ddf_fun_t *hc = ddf_fun_create(dev, fun_exposed, "hc"); -
uspace/drv/bus/usb/vhc/vhcd.h
rf58ef61 r8b54fe6 39 39 #include <usbvirt/device.h> 40 40 #include <usb/host/usb_endpoint_manager.h> 41 #include <usb/host/ device_keeper.h>41 #include <usb/host/usb_device_manager.h> 42 42 #include <usbhc_iface.h> 43 43 #include <async.h> … … 60 60 fibril_mutex_t guard; 61 61 usb_endpoint_manager_t ep_manager; 62 usb_device_ keeper_t dev_keeper;62 usb_device_manager_t dev_manager; 63 63 usbvirt_device_t *hub; 64 64 ddf_fun_t *hc_fun; -
uspace/lib/usbhost/Makefile
rf58ef61 r8b54fe6 35 35 36 36 SOURCES = \ 37 src/device_keeper.c \38 37 src/endpoint.c \ 39 38 src/iface.c \ 39 src/usb_device_manager.c \ 40 40 src/usb_endpoint_manager.c \ 41 41 src/usb_transfer_batch.c -
uspace/lib/usbhost/include/usb/host/hcd.h
rf58ef61 r8b54fe6 37 37 38 38 #include <assert.h> 39 #include <usb/host/ device_keeper.h>39 #include <usb/host/usb_device_manager.h> 40 40 #include <usb/host/usb_endpoint_manager.h> 41 41 #include <usb/host/usb_transfer_batch.h> … … 45 45 46 46 struct hcd { 47 usb_device_ keeper_t dev_manager;47 usb_device_manager_t dev_manager; 48 48 usb_endpoint_manager_t ep_manager; 49 49 void *private_data; … … 57 57 { 58 58 assert(hcd); 59 usb_device_ keeper_init(&hcd->dev_manager);59 usb_device_manager_init(&hcd->dev_manager); 60 60 return usb_endpoint_manager_init(&hcd->ep_manager, bandwidth, bw_count); 61 61 } -
uspace/lib/usbhost/include/usb/host/usb_device_manager.h
rf58ef61 r8b54fe6 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 29 28 /** @addtogroup libusbhost 30 29 * @{ 31 30 */ 32 31 /** @file 33 * Device keeper structure and functions.32 * Device manager structure and functions. 34 33 * 35 34 * Typical USB host controller needs to keep track of various settings for … … 38 37 * This structure shall simplify the management. 39 38 */ 40 #ifndef LIBUSBHOST_HOST_ DEVICE_KEEPER_H41 #define LIBUSBHOST_HOST_ DEVICE_KEEPER_H39 #ifndef LIBUSBHOST_HOST_USB_DEVICE_MANAGER_H 40 #define LIBUSBHOST_HOST_USB_DEVICE_MANAGER_H 42 41 43 42 #include <adt/list.h> … … 57 56 }; 58 57 59 /** Host controller device keeper.58 /** Host controller device manager. 60 59 * You shall not access members directly but only using functions below. 61 60 */ … … 64 63 fibril_mutex_t guard; 65 64 usb_address_t last_address; 66 } usb_device_ keeper_t;65 } usb_device_manager_t; 67 66 68 void usb_device_ keeper_init(usb_device_keeper_t *instance);67 void usb_device_manager_init(usb_device_manager_t *instance); 69 68 70 usb_address_t device_keeper_get_free_address(usb_device_keeper_t *instance,71 usb_ speed_t speed);69 usb_address_t usb_device_manager_get_free_address( 70 usb_device_manager_t *instance, usb_speed_t speed); 72 71 73 void usb_device_ keeper_bind(usb_device_keeper_t *instance,72 void usb_device_manager_bind(usb_device_manager_t *instance, 74 73 usb_address_t address, devman_handle_t handle); 75 74 76 void usb_device_ keeper_release(usb_device_keeper_t *instance,75 void usb_device_manager_release(usb_device_manager_t *instance, 77 76 usb_address_t address); 78 77 79 usb_address_t usb_device_ keeper_find(usb_device_keeper_t *instance,78 usb_address_t usb_device_manager_find(usb_device_manager_t *instance, 80 79 devman_handle_t handle); 81 80 82 bool usb_device_ keeper_find_by_address(usb_device_keeper_t *instance,81 bool usb_device_manager_find_by_address(usb_device_manager_t *instance, 83 82 usb_address_t address, devman_handle_t *handle); 84 83 85 usb_speed_t usb_device_ keeper_get_speed(usb_device_keeper_t *instance,84 usb_speed_t usb_device_manager_get_speed(usb_device_manager_t *instance, 86 85 usb_address_t address); 87 86 #endif -
uspace/lib/usbhost/src/iface.c
rf58ef61 r8b54fe6 107 107 108 108 usb_log_debug("Address request speed: %s.\n", usb_str_speed(speed)); 109 *address = device_keeper_get_free_address(&hcd->dev_manager, speed); 109 *address = 110 usb_device_manager_get_free_address(&hcd->dev_manager, speed); 110 111 usb_log_debug("Address request with result: %d.\n", *address); 111 112 if (*address <= 0) … … 129 130 130 131 usb_log_debug("Address bind %d-%" PRIun ".\n", address, handle); 131 usb_device_ keeper_bind(&hcd->dev_manager, address, handle);132 usb_device_manager_bind(&hcd->dev_manager, address, handle); 132 133 return EOK; 133 134 } … … 147 148 assert(hcd); 148 149 const bool found = 149 usb_device_ keeper_find_by_address(&hcd->dev_manager, address, handle);150 usb_device_manager_find_by_address(&hcd->dev_manager, address, handle); 150 151 return found ? EOK : ENOENT; 151 152 } … … 163 164 assert(hcd); 164 165 usb_log_debug("Address release %d.\n", address); 165 usb_device_ keeper_release(&hcd->dev_manager, address);166 usb_device_manager_release(&hcd->dev_manager, address); 166 167 return EOK; 167 168 } … … 180 181 * thus it does not provide speed info. */ 181 182 const usb_speed_t speed = (address == 0) ? ep_speed : 182 usb_device_ keeper_get_speed(&hcd->dev_manager, address);183 usb_device_manager_get_speed(&hcd->dev_manager, address); 183 184 184 185 usb_log_debug("Register endpoint %d:%d %s-%s %s %zuB %ums.\n", -
uspace/lib/usbhost/src/usb_device_manager.c
rf58ef61 r8b54fe6 31 31 */ 32 32 /** @file 33 * Device keeper structure and functions (implementation).33 * Device manager structure and functions (implementation). 34 34 */ 35 35 #include <assert.h> 36 36 #include <errno.h> 37 37 #include <usb/debug.h> 38 #include <usb/host/ device_keeper.h>39 40 /*----------------------------------------------------------------------------*/ 41 /** Initialize device keeper structure.38 #include <usb/host/usb_device_manager.h> 39 40 /*----------------------------------------------------------------------------*/ 41 /** Initialize device manager structure. 42 42 * 43 43 * @param[in] instance Memory place to initialize. … … 45 45 * Set all values to false/0. 46 46 */ 47 void usb_device_ keeper_init(usb_device_keeper_t *instance)47 void usb_device_manager_init(usb_device_manager_t *instance) 48 48 { 49 49 assert(instance); … … 63 63 /** Get a free USB address 64 64 * 65 * @param[in] instance Device keeper structure to use.65 * @param[in] instance Device manager structure to use. 66 66 * @param[in] speed Speed of the device requiring address. 67 67 * @return Free address, or error code. 68 68 */ 69 usb_address_t device_keeper_get_free_address(70 usb_device_ keeper_t *instance, usb_speed_t speed)69 usb_address_t usb_device_manager_get_free_address( 70 usb_device_manager_t *instance, usb_speed_t speed) 71 71 { 72 72 assert(instance); … … 97 97 /** Bind USB address to devman handle. 98 98 * 99 * @param[in] instance Device keeper structure to use.99 * @param[in] instance Device manager structure to use. 100 100 * @param[in] address Device address 101 101 * @param[in] handle Devman handle of the device. 102 102 */ 103 void usb_device_ keeper_bind(usb_device_keeper_t *instance,103 void usb_device_manager_bind(usb_device_manager_t *instance, 104 104 usb_address_t address, devman_handle_t handle) 105 105 { … … 117 117 /** Release used USB address. 118 118 * 119 * @param[in] instance Device keeper structure to use.119 * @param[in] instance Device manager structure to use. 120 120 * @param[in] address Device address 121 121 */ 122 void usb_device_ keeper_release(123 usb_device_ keeper_t *instance, usb_address_t address)122 void usb_device_manager_release( 123 usb_device_manager_t *instance, usb_address_t address) 124 124 { 125 125 assert(instance); … … 136 136 /** Find USB address associated with the device 137 137 * 138 * @param[in] instance Device keeper structure to use.138 * @param[in] instance Device manager structure to use. 139 139 * @param[in] handle Devman handle of the device seeking its address. 140 140 * @return USB Address, or error code. 141 141 */ 142 usb_address_t usb_device_ keeper_find(143 usb_device_ keeper_t *instance, devman_handle_t handle)142 usb_address_t usb_device_manager_find( 143 usb_device_manager_t *instance, devman_handle_t handle) 144 144 { 145 145 assert(instance); … … 161 161 * Intentionally refuse to find handle of default address. 162 162 * 163 * @param[in] instance Device keeper structure to use.163 * @param[in] instance Device manager structure to use. 164 164 * @param[in] address Address the caller wants to find. 165 165 * @param[out] handle Where to store found handle. 166 166 * @return Whether such address is currently occupied. 167 167 */ 168 bool usb_device_ keeper_find_by_address(usb_device_keeper_t *instance,168 bool usb_device_manager_find_by_address(usb_device_manager_t *instance, 169 169 usb_address_t address, devman_handle_t *handle) 170 170 { … … 191 191 /** Get speed associated with the address 192 192 * 193 * @param[in] instance Device keeper structure to use.193 * @param[in] instance Device manager structure to use. 194 194 * @param[in] address Address of the device. 195 195 * @return USB speed. 196 196 */ 197 usb_speed_t usb_device_ keeper_get_speed(198 usb_device_ keeper_t *instance, usb_address_t address)197 usb_speed_t usb_device_manager_get_speed( 198 usb_device_manager_t *instance, usb_address_t address) 199 199 { 200 200 assert(instance);
Note:
See TracChangeset
for help on using the changeset viewer.