Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 903eff5 in mainline


Ignore:
Timestamp:
2014-08-25T11:05:05Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
31ccd42a
Parents:
a10f3f3
Message:

First sound.

Location:
uspace/drv/audio/hdaudio
Files:
3 edited

Legend:

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

    ra10f3f3 r903eff5  
    485485            intctl | BIT_V(uint32_t, intctl_gie) | BIT_V(uint32_t, intctl_cie));
    486486        hda_reg32_write(&hda->regs->intctl, intctl |
    487             BIT_V(uint32_t, intctl_gie) | BIT_V(uint32_t, intctl_cie));
     487            BIT_V(uint32_t, intctl_gie) | BIT_V(uint32_t, intctl_cie) |
     488            0x3fffffff);
    488489
    489490        rc = hda_corb_init(hda);
     
    501502                goto error;
    502503        }
     504
     505        async_usleep(5*1000*1000);
     506        ddf_msg(LVL_NOTE, "intsts=0x%x", hda_reg32_read(&hda->regs->intsts));
     507        ddf_msg(LVL_NOTE, "sdesc[%d].sts=0x%x",
     508            hda->ctl->iss, hda_reg8_read(&hda->regs->sdesc[hda->ctl->iss].sts));
    503509
    504510        return ctl;
  • uspace/drv/audio/hdaudio/hdaudio.c

    ra10f3f3 r903eff5  
    8181        {
    8282                .cmd = CMD_PIO_READ_8,
    83                 .addr = NULL,
     83                .addr = NULL, /* rirbsts */
    8484                .dstarg = 2
    8585        },
     
    9797        {
    9898                .cmd = CMD_PIO_WRITE_8,
    99                 .addr = NULL,
     99                .addr = NULL, /* rirbsts */
    100100                .value = BIT_V(uint8_t, rirbsts_intfl),
    101101        },
  • uspace/drv/audio/hdaudio/stream.c

    ra10f3f3 r903eff5  
    3434
    3535#include <as.h>
     36#include <bitops.h>
     37#include <byteorder.h>
    3638#include <ddf/log.h>
    3739#include <ddi.h>
    3840#include <errno.h>
     41#include <macros.h>
    3942#include <stdlib.h>
    4043
     
    9093                        goto error;
    9194
     95                ddf_msg(LVL_NOTE, "Stream buf phys=0x%llx virt=%p",
     96                    (unsigned long long)buffer_phys, buffer);
     97
    9298                stream->buf[i] = buffer;
    9399                stream->buf_phys[i] = buffer_phys;
     
    105111        /* Fill in BDL */
    106112        for (i = 0; i < stream->nbuffers; i++) {
    107                 stream->bdl[i].address = stream->buf_phys[i];
    108                 stream->bdl[i].length = stream->bufsize;
    109                 stream->bdl[i].flags = 0;
     113                stream->bdl[i].address = host2uint64_t_le(stream->buf_phys[i]);
     114                stream->bdl[i].length = host2uint32_t_le(stream->bufsize);
     115                stream->bdl[i].flags = 0/*BIT_V(uint32_t, bdf_ioc)*/;
    110116        }
    111117
     
    118124{
    119125        hda_sdesc_regs_t *sdregs;
     126        uint8_t ctl1;
     127        uint8_t ctl3;
     128
     129        ctl3 = (stream->sid << 4);
     130        ctl1 = 0x4;
    120131
    121132        sdregs = &stream->hda->regs->sdesc[stream->sdid];
     133        hda_reg8_write(&sdregs->ctl3, ctl3);
     134        hda_reg8_write(&sdregs->ctl1, ctl1);
    122135        hda_reg32_write(&sdregs->cbl, stream->nbuffers * stream->bufsize);
    123136        hda_reg16_write(&sdregs->lvi, stream->nbuffers - 1);
    124137        hda_reg16_write(&sdregs->fmt, stream->fmt);
     138        hda_reg32_write(&sdregs->bdpl, LOWER32(stream->bdl_phys));
     139        hda_reg32_write(&sdregs->bdpu, UPPER32(stream->bdl_phys));
    125140}
    126141
Note: See TracChangeset for help on using the changeset viewer.