Changeset dda5848 in mainline for uspace/drv/audio/hdaudio/hdactl.c


Ignore:
Timestamp:
2014-08-26T23:07:47Z (10 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9034876
Parents:
2f6b916
Message:

Fix buffer overrun errors.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/audio/hdaudio/hdactl.c

    r2f6b916 rdda5848  
    106106 *
    107107 * We always use the largest available size. In @a sizecap each of bits
    108  * 0, 1, 2 determine whether one of the supported size (0 == 2 enries,
     108 * 0, 1, 2 determine whether one of the supported size (0 == 2 entries,
    109109 * 1 == 16 entries, 2 == 256 entries) is supported. @a *selsz is set to
    110110 * one of 0, 1, 2 on success.
     
    249249        }
    250250        rirbsz = rirbsz & ~BIT_RANGE(uint8_t, rirbsize_size_h, rirbsize_size_l);
    251         rirbsz = rirbsz | selsz;
     251        rirbsz = rirbsz | (selsz << rirbsize_size_l);
    252252
    253253        ddf_msg(LVL_NOTE, "Setting RIRB Size register to 0x%x", rirbsz);
     
    395395                return ENOENT;
    396396
    397         ++hda->ctl->rirb_rp;
     397        hda->ctl->rirb_rp = (hda->ctl->rirb_rp + 1) % hda->ctl->rirb_entries;
    398398        resp = rirb[hda->ctl->rirb_rp];
    399399
     
    415415        while (count > 0) {
    416416                while (count > 0 && hda->ctl->solrb_rp != hda->ctl->solrb_wp) {
    417                         ++hda->ctl->solrb_rp;
     417                        hda->ctl->solrb_rp = (hda->ctl->solrb_rp + 1) % softrb_entries;
    418418                        resp = hda->ctl->solrb[hda->ctl->solrb_rp];
    419419
     
    629629}
    630630
     631void hda_ctl_dump_info(hda_ctl_t *ctl)
     632{
     633        ddf_msg(LVL_NOTE, "corbwp=%d, corbrp=%d",
     634            hda_reg16_read(&ctl->hda->regs->corbwp),
     635            hda_reg16_read(&ctl->hda->regs->corbrp));
     636        ddf_msg(LVL_NOTE, "corbctl=0x%x, corbsts=0x%x",
     637            hda_reg8_read(&ctl->hda->regs->corbctl),
     638            hda_reg8_read(&ctl->hda->regs->corbsts));
     639        ddf_msg(LVL_NOTE, "rirbwp=0x%x, soft-rirbrp=0x%x",
     640            hda_reg16_read(&ctl->hda->regs->rirbwp),
     641            ctl->rirb_rp);
     642        ddf_msg(LVL_NOTE, "solrb_wp=0x%x, solrb_rp=0x%x",
     643            ctl->solrb_wp, ctl->solrb_wp);
     644}
     645
    631646/** @}
    632647 */
Note: See TracChangeset for help on using the changeset viewer.