Changeset dfe4955 in mainline for uspace/drv/bus/usb/uhci/hc.c
- Timestamp:
- 2011-07-12T18:38:27Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 26858040
- Parents:
- b4f291d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/hc.c
rb4f291d rdfe4955 47 47 (UHCI_STATUS_INTERRUPT | UHCI_STATUS_ERROR_INTERRUPT) 48 48 49 static const irq_cmd_t uhci_irq_commands[] = 50 { 51 { .cmd = CMD_PIO_READ_16, .dstarg = 1, .addr = NULL/*filled later*/}, 52 { .cmd = CMD_BTEST, .srcarg = 1, .dstarg = 2, 53 .value = UHCI_STATUS_USED_INTERRUPTS | UHCI_STATUS_NM_INTERRUPTS }, 54 { .cmd = CMD_PREDICATE, .srcarg = 2, .value = 2 }, 55 { .cmd = CMD_PIO_WRITE_A_16, .srcarg = 1, .addr = NULL/*filled later*/}, 56 { .cmd = CMD_ACCEPT }, 57 }; 49 58 50 59 static int hc_init_transfer_lists(hc_t *instance); … … 54 63 static int hc_interrupt_emulator(void *arg); 55 64 static int hc_debug_checker(void *arg); 65 66 /*----------------------------------------------------------------------------*/ 67 /** Get number of commands used in IRQ code. 68 * @return Number of commands. 69 */ 70 size_t hc_irq_cmd_count(void) 71 { 72 return sizeof(uhci_irq_commands) / sizeof(irq_cmd_t); 73 } 74 /*----------------------------------------------------------------------------*/ 75 /** Generate IRQ code commands. 76 * @param[out] cmds Place to store the commands. 77 * @param[in] cmd_size Size of the place (bytes). 78 * @param[in] regs Physical address of device's registers. 79 * @param[in] reg_size Size of the register area (bytes). 80 * 81 * @return Error code. 82 */ 83 int hc_get_irq_commands( 84 irq_cmd_t cmds[], size_t cmd_size, uintptr_t regs, size_t reg_size) 85 { 86 if (cmd_size < sizeof(uhci_irq_commands) 87 || reg_size < sizeof(uhci_regs_t)) 88 return EOVERFLOW; 89 90 uhci_regs_t *registers = (uhci_regs_t*)regs; 91 92 memcpy(cmds, uhci_irq_commands, sizeof(uhci_irq_commands)); 93 94 cmds[0].addr = (void*)®isters->usbsts; 95 cmds[3].addr = (void*)®isters->usbsts; 96 return EOK; 97 } 56 98 /*----------------------------------------------------------------------------*/ 57 99 /** Initialize UHCI hc driver structure … … 69 111 int hc_init(hc_t *instance, void *regs, size_t reg_size, bool interrupts) 70 112 { 71 assert(reg_size >= sizeof( regs_t));113 assert(reg_size >= sizeof(uhci_regs_t)); 72 114 int ret; 73 115 … … 82 124 83 125 /* allow access to hc control registers */ 84 regs_t *io;126 uhci_regs_t *io; 85 127 ret = pio_enable(regs, reg_size, (void **)&io); 86 128 CHECK_RET_RETURN(ret, … … 116 158 { 117 159 assert(instance); 118 regs_t *registers = instance->registers;160 uhci_regs_t *registers = instance->registers; 119 161 120 162 /* Reset everything, who knows what touched it before us */
Note:
See TracChangeset
for help on using the changeset viewer.