Changeset 31ccd42a in mainline
- Timestamp:
- 2014-08-25T21:03:11Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 93c3163
- Parents:
- 903eff5
- Location:
- uspace/drv/audio/hdaudio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/hdaudio/hdaudio.c
r903eff5 r31ccd42a 79 79 80 80 irq_cmd_t hdaudio_irq_commands[] = { 81 /* 0 */ 81 82 { 82 83 .cmd = CMD_PIO_READ_8, … … 84 85 .dstarg = 2 85 86 }, 87 /* 1 */ 86 88 { 87 89 .cmd = CMD_AND, … … 90 92 .dstarg = 3 91 93 }, 94 /* 2 */ 92 95 { 93 96 .cmd = CMD_PREDICATE, … … 95 98 .srcarg = 3 96 99 }, 100 /* 3 */ 97 101 { 98 102 .cmd = CMD_PIO_WRITE_8, 99 103 .addr = NULL, /* rirbsts */ 100 .value = BIT_V(uint8_t, rirbsts_intfl), 101 }, 104 .value = BIT_V(uint8_t, rirbsts_intfl) 105 }, 106 /* 4 */ 102 107 { 103 108 .cmd = CMD_ACCEPT … … 105 110 }; 106 111 107 irq_code_t hdaudio_irq_code = { 108 .rangecount = sizeof(hdaudio_irq_pio_ranges) / sizeof(irq_pio_range_t), 109 .ranges = hdaudio_irq_pio_ranges, 110 .cmdcount = sizeof(hdaudio_irq_commands) / sizeof(irq_cmd_t), 111 .cmds = hdaudio_irq_commands 112 irq_cmd_t hdaudio_irq_commands_sdesc[] = { 113 /* 0 */ 114 { 115 .cmd = CMD_PIO_READ_32, 116 .addr = NULL, /* intsts */ 117 .dstarg = 2 118 }, 119 /* 1 */ 120 { 121 .cmd = CMD_AND, 122 .value = 0, /* 1 << idx */ 123 .srcarg = 2, 124 .dstarg = 3, 125 }, 126 /* 2 */ 127 { 128 .cmd = CMD_PREDICATE, 129 .value = 2, 130 .srcarg = 3 131 }, 132 /* 3 */ 133 { 134 .cmd = CMD_PIO_WRITE_8, 135 .addr = NULL, /* sdesc[x].sts */ 136 .value = 0x4 /* XXX sdesc.sts.BCIS */ 137 }, 138 /* 4 */ 139 { 140 .cmd = CMD_ACCEPT 141 } 112 142 }; 113 143 … … 117 147 hda_t *hda = NULL; 118 148 hw_res_list_parsed_t res; 149 irq_code_t irq_code; 150 irq_cmd_t *cmds; 151 size_t ncmds_base; 152 size_t ncmds_sdesc; 153 size_t ncmds; 154 int i; 119 155 void *regs; 120 156 int rc; … … 181 217 ddf_msg(LVL_NOTE, "interrupt no: %d", res.irqs.irqs[0]); 182 218 219 ncmds_base = sizeof(hdaudio_irq_commands) / sizeof(irq_cmd_t); 220 ncmds_sdesc = sizeof(hdaudio_irq_commands_sdesc) / sizeof(irq_cmd_t); 221 ncmds = ncmds_base + 30 * ncmds_sdesc; 222 223 cmds = calloc(ncmds, sizeof(irq_cmd_t)); 224 if (cmds == NULL) { 225 ddf_msg(LVL_ERROR, "Out of memory"); 226 goto error; 227 } 228 229 irq_code.rangecount = sizeof(hdaudio_irq_pio_ranges) / 230 sizeof(irq_pio_range_t); 231 irq_code.ranges = hdaudio_irq_pio_ranges; 232 irq_code.cmdcount = ncmds; 233 irq_code.cmds = cmds; 234 183 235 hda_regs_t *rphys = (hda_regs_t *)(uintptr_t)hda->rwbase; 184 236 hdaudio_irq_pio_ranges[0].base = (uintptr_t)hda->rwbase; 185 hdaudio_irq_commands[0].addr = (void *)&rphys->rirbsts; 186 hdaudio_irq_commands[3].addr = (void *)&rphys->rirbsts; 237 238 memcpy(cmds, hdaudio_irq_commands, sizeof(hdaudio_irq_commands)); 239 cmds[0].addr = (void *)&rphys->rirbsts; 240 cmds[3].addr = (void *)&rphys->rirbsts; 241 242 for (i = 0; i < 30; i++) { 243 memcpy(&cmds[ncmds_base + i * ncmds_sdesc], 244 hdaudio_irq_commands_sdesc, sizeof(hdaudio_irq_commands_sdesc)); 245 cmds[ncmds_base + i * ncmds_sdesc + 0].addr = (void *)&rphys->intsts; 246 cmds[ncmds_base + i * ncmds_sdesc + 1].value = BIT_V(uint32_t, i); 247 cmds[ncmds_base + i * ncmds_sdesc + 3].addr = (void *)&rphys->sdesc[i].sts; 248 } 249 187 250 ddf_msg(LVL_NOTE, "range0.base=%x", hdaudio_irq_pio_ranges[0].base); 188 ddf_msg(LVL_NOTE, "cmd0.addr=%p", hdaudio_irq_commands[0].addr);189 ddf_msg(LVL_NOTE, "cmd3.addr=%p", hdaudio_irq_commands[3].addr);190 251 191 252 rc = register_interrupt_handler(dev, res.irqs.irqs[0], 192 hdaudio_interrupt, & hdaudio_irq_code);253 hdaudio_interrupt, &irq_code); 193 254 if (rc != EOK) { 194 255 ddf_msg(LVL_ERROR, "Failed registering interrupt handler. (%d)", … … 284 345 hda_t *hda = (hda_t *)ddf_dev_data_get(dev); 285 346 286 ddf_msg(LVL_NOTE, "## interrupt ##");347 if (0) ddf_msg(LVL_NOTE, "## interrupt ##"); 287 348 hda_ctl_interrupt(hda->ctl); 288 349 } -
uspace/drv/audio/hdaudio/stream.c
r903eff5 r31ccd42a 113 113 stream->bdl[i].address = host2uint64_t_le(stream->buf_phys[i]); 114 114 stream->bdl[i].length = host2uint32_t_le(stream->bufsize); 115 stream->bdl[i].flags = 0/*BIT_V(uint32_t, bdf_ioc)*/;115 stream->bdl[i].flags = BIT_V(uint32_t, bdf_ioc); 116 116 } 117 117
Note:
See TracChangeset
for help on using the changeset viewer.