Changeset 4f66cc7b in mainline for uspace/drv/uhci-hcd/uhci_rh.c
- Timestamp:
- 2011-03-17T12:45:23Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade
- Children:
- 4fec9ee, 6e3b9a58
- Parents:
- 45dd8bf (diff), 039c66c (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/uhci-hcd/uhci_rh.c
r45dd8bf r4f66cc7b 26 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 /** @addtogroup usb28 /** @addtogroup drvusbuhci 29 29 * @{ 30 30 */ … … 33 33 */ 34 34 #include <assert.h> 35 #include <errno.h> 36 #include <str_error.h> 35 37 #include <stdio.h> 36 38 37 39 #include <usb/debug.h> 38 40 39 #include "port_status.h" 41 #include "uhci_rh.h" 42 #include "uhci_hc.h" 40 43 41 struct flag_name 42 { 43 uint16_t flag; 44 const char *name; 45 }; 46 47 static const struct flag_name flags[] = 48 { 49 { STATUS_SUSPEND, "suspended" }, 50 { STATUS_IN_RESET, "in reset" }, 51 { STATUS_LOW_SPEED, "low speed device" }, 52 { STATUS_ALWAYS_ONE, "always 1 bit" }, 53 { STATUS_RESUME, "resume" }, 54 { STATUS_LINE_D_MINUS, "line D- value" }, 55 { STATUS_LINE_D_PLUS, "line D+ value" }, 56 { STATUS_ENABLED_CHANGED, "enabled changed" }, 57 { STATUS_ENABLED, "enabled" }, 58 { STATUS_CONNECTED_CHANGED, "connected changed" }, 59 { STATUS_CONNECTED, "connected" } 60 }; 61 62 /** Prints portr status in a human readable way. 63 * 64 * @param[in] value Port value to print. 44 /** Root hub initialization 45 * @param[in] instance RH structure to initialize 46 * @param[in] fun DDF function representing UHCI root hub 47 * @param[in] reg_addr Address of root hub status and control registers. 48 * @param[in] reg_size Size of accessible address space. 65 49 * @return Error code. 66 50 */ 67 void print_port_status(port_status_t value) 51 int uhci_rh_init( 52 uhci_rh_t *instance, ddf_fun_t *fun, uintptr_t reg_addr, size_t reg_size) 68 53 { 69 unsigned i = 0; 70 for (;i < sizeof(flags)/sizeof(struct flag_name); ++i) { 71 usb_log_debug2("\t%s status: %s.\n", flags[i].name, 72 ((value & flags[i].flag) != 0) ? "YES" : "NO"); 54 assert(fun); 55 56 char *match_str = NULL; 57 int ret = asprintf(&match_str, "usb&uhci&root-hub"); 58 if (ret < 0) { 59 usb_log_error("Failed to create root hub match string.\n"); 60 return ENOMEM; 73 61 } 62 63 ret = ddf_fun_add_match_id(fun, match_str, 100); 64 if (ret != EOK) { 65 usb_log_error("Failed(%d) to add root hub match id: %s\n", 66 ret, str_error(ret)); 67 return ret; 68 } 69 70 hw_resource_list_t *resource_list = &instance->resource_list; 71 resource_list->count = 1; 72 resource_list->resources = &instance->io_regs; 73 assert(resource_list->resources); 74 instance->io_regs.type = IO_RANGE; 75 instance->io_regs.res.io_range.address = reg_addr; 76 instance->io_regs.res.io_range.size = reg_size; 77 instance->io_regs.res.io_range.endianness = LITTLE_ENDIAN; 78 79 return EOK; 74 80 } 75 81 /**
Note:
See TracChangeset
for help on using the changeset viewer.