Changes in uspace/drv/bus/usb/uhci/hc.c [6bba41d:d57122c] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/hc.c
r6bba41d rd57122c 48 48 (UHCI_STATUS_INTERRUPT | UHCI_STATUS_ERROR_INTERRUPT) 49 49 50 51 static const irq_cmd_t uhci_irq_commands[] = 52 { 50 static const irq_pio_range_t uhci_irq_pio_ranges[] = { 51 { 52 .base = 0, /* filled later */ 53 .size = sizeof(uhci_regs_t) 54 } 55 }; 56 57 static const irq_cmd_t uhci_irq_commands[] = { 53 58 { .cmd = CMD_PIO_READ_16, .dstarg = 1, .addr = NULL/*filled later*/}, 54 59 { .cmd = CMD_BTEST, .srcarg = 1, .dstarg = 2, … … 68 73 69 74 /*----------------------------------------------------------------------------*/ 75 /** Get number of PIO ranges used in IRQ code. 76 * @return Number of ranges. 77 */ 78 size_t hc_irq_pio_range_count(void) 79 { 80 return sizeof(uhci_irq_pio_ranges) / sizeof(irq_pio_range_t); 81 } 82 /*----------------------------------------------------------------------------*/ 70 83 /** Get number of commands used in IRQ code. 71 84 * @return Number of commands. … … 76 89 } 77 90 /*----------------------------------------------------------------------------*/ 78 /** Generate IRQ code commands. 79 * @param[out] cmds Place to store the commands. 80 * @param[in] cmd_size Size of the place (bytes). 91 /** Generate IRQ code. 92 * @param[out] ranges PIO ranges buffer. 93 * @param[in] ranges_size Size of the ranges buffer (bytes). 94 * @param[out] cmds Commands buffer. 95 * @param[in] cmds_size Size of the commands buffer (bytes). 81 96 * @param[in] regs Physical address of device's registers. 82 97 * @param[in] reg_size Size of the register area (bytes). … … 84 99 * @return Error code. 85 100 */ 86 int hc_get_irq_commands( 87 irq_cmd_t cmds[], size_t cmd_size, uintptr_t regs, size_t reg_size) 88 { 89 if (cmd_size < sizeof(uhci_irq_commands) 90 || reg_size < sizeof(uhci_regs_t)) 101 int 102 hc_get_irq_code(irq_pio_range_t ranges[], size_t ranges_size, irq_cmd_t cmds[], 103 size_t cmds_size, uintptr_t regs, size_t reg_size) 104 { 105 if ((ranges_size < sizeof(uhci_irq_pio_ranges)) || 106 (cmds_size < sizeof(uhci_irq_commands)) || 107 (reg_size < sizeof(uhci_regs_t))) 91 108 return EOVERFLOW; 92 109 93 uhci_regs_t *registers = (uhci_regs_t*)regs; 110 memcpy(ranges, uhci_irq_pio_ranges, sizeof(uhci_irq_pio_ranges)); 111 ranges[0].base = regs; 94 112 95 113 memcpy(cmds, uhci_irq_commands, sizeof(uhci_irq_commands)); 96 97 cmds[0].addr = (void*)®isters->usbsts; 98 cmds[3].addr = (void*)®isters->usbsts; 114 uhci_regs_t *registers = (uhci_regs_t *) regs; 115 cmds[0].addr = ®isters->usbsts; 116 cmds[3].addr = ®isters->usbsts; 117 99 118 return EOK; 100 119 }
Note:
See TracChangeset
for help on using the changeset viewer.