Changes in uspace/drv/uhci-rhd/root_hub.c [dced52a:f123909] in mainline
- File:
-
- 1 edited
-
uspace/drv/uhci-rhd/root_hub.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-rhd/root_hub.c
rdced52a rf123909 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 /** @addtogroup usb28 /** @addtogroup drvusbuhcirh 29 29 * @{ 30 30 */ 31 31 /** @file 32 * @brief UHCI driver32 * @brief UHCI root hub driver 33 33 */ 34 34 #include <errno.h> 35 #include <stdint.h>36 35 #include <ddi.h> 37 #include <devman.h>38 36 #include <usb/debug.h> 39 37 40 38 #include "root_hub.h" 41 39 40 /** Initialize UHCI root hub instance. 41 * 42 * @param[in] instance Driver memory structure to use. 43 * @param[in] addr Address of I/O registers. 44 * @param[in] size Size of available I/O space. 45 * @param[in] rh Pointer to ddf instance of the root hub driver. 46 * @return Error code. 47 */ 42 48 int uhci_root_hub_init( 43 49 uhci_root_hub_t *instance, void *addr, size_t size, ddf_dev_t *rh) … … 47 53 int ret; 48 54 49 /* allow access to root hubregisters */50 assert(sizeof(port_status_t) * UHCI_ROOT_HUB_PORT_COUNT == size);55 /* Allow access to root hub port registers */ 56 assert(sizeof(port_status_t) * UHCI_ROOT_HUB_PORT_COUNT <= size); 51 57 port_status_t *regs; 52 58 ret = pio_enable(addr, size, (void**)®s); 53 54 59 if (ret < 0) { 55 usb_log_error("Failed to gain access to port registers at %p\n", regs); 60 usb_log_error( 61 "Failed(%d) to gain access to port registers at %p\n", 62 ret, regs); 56 63 return ret; 57 64 } 58 65 59 /* add fibrils for periodic port checks */66 /* Initialize root hub ports */ 60 67 unsigned i = 0; 61 68 for (; i < UHCI_ROOT_HUB_PORT_COUNT; ++i) { 62 /* mind pointer arithmetics*/69 /* NOTE: mind pointer arithmetics here */ 63 70 ret = uhci_port_init( 64 &instance->ports[i], regs + i, i, ROOT_HUB_WAIT_USEC, rh);71 &instance->ports[i], regs + i, i, ROOT_HUB_WAIT_USEC, rh); 65 72 if (ret != EOK) { 66 73 unsigned j = 0; … … 74 81 } 75 82 /*----------------------------------------------------------------------------*/ 76 int uhci_root_hub_fini( uhci_root_hub_t* instance ) 83 /** Cleanup UHCI root hub instance. 84 * 85 * @param[in] instance Root hub structure to use. 86 * @return Error code. 87 */ 88 int uhci_root_hub_fini(uhci_root_hub_t* instance) 77 89 { 78 assert( instance ); 79 // TODO: 80 //destroy fibril here 81 //disable access to registers 90 assert(instance); 91 unsigned i = 0; 92 for (; i < UHCI_ROOT_HUB_PORT_COUNT; ++i) { 93 uhci_port_fini(&instance->ports[i]); 94 } 82 95 return EOK; 83 96 }
Note:
See TracChangeset
for help on using the changeset viewer.
