Changeset 159c722d in mainline
- Timestamp:
- 2014-08-26T10:10:50Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6747b929
- Parents:
- 99cb9bf
- Location:
- uspace/drv/audio/hdaudio
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/hdaudio/codec.c
r99cb9bf r159c722d 279 279 uint32_t fmt; 280 280 /* 48 kHz, 16-bits, 1 channel */ 281 fmt = fmt_bits_16 << fmt_bits_l;281 fmt = (fmt_base_44khz << fmt_base) | (fmt_bits_16 << fmt_bits_l); 282 282 283 283 /* Configure converter */ -
uspace/drv/audio/hdaudio/hdaudio.c
r99cb9bf r159c722d 354 354 if (0) ddf_msg(LVL_NOTE, "## interrupt ##"); 355 355 // ddf_msg(LVL_NOTE, "interrupt arg4=0x%x", (int)IPC_GET_ARG4(*icall)); 356 if (IPC_GET_ARG3(*icall) != 0) { 357 hda_pcm_event(hda, PCM_EVENT_FRAMES_PLAYED); 358 hda_pcm_event(hda, PCM_EVENT_FRAMES_PLAYED); 359 hda_pcm_event(hda, PCM_EVENT_FRAMES_PLAYED); 360 hda_pcm_event(hda, PCM_EVENT_FRAMES_PLAYED); 361 /* hda_pcm_event(hda, PCM_EVENT_FRAMES_PLAYED); 362 hda_pcm_event(hda, PCM_EVENT_FRAMES_PLAYED); 363 hda_pcm_event(hda, PCM_EVENT_FRAMES_PLAYED); 364 hda_pcm_event(hda, PCM_EVENT_FRAMES_PLAYED);*/ 365 } 356 366 hda_ctl_interrupt(hda->ctl); 357 367 } -
uspace/drv/audio/hdaudio/hdaudio.h
r99cb9bf r159c722d 45 45 typedef struct hda { 46 46 async_sess_t *parent_sess; 47 async_sess_t *ev_sess; 47 48 ddf_fun_t *fun_pcm; 48 49 uint64_t rwbase; -
uspace/drv/audio/hdaudio/pcm_iface.c
r99cb9bf r159c722d 43 43 #include "hdactl.h" 44 44 #include "hdaudio.h" 45 #include "pcm_iface.h" 45 46 #include "spec/fmt.h" 46 47 #include "stream.h" … … 155 156 uint32_t fmt; 156 157 /* 48 kHz, 16-bits, 1 channel */ 157 fmt = fmt_bits_16 << fmt_bits_l;158 fmt = (fmt_base_44khz << fmt_base) | (fmt_bits_16 << fmt_bits_l); 158 159 159 160 ddf_msg(LVL_NOTE, "hda_get_buffer() - create stream"); … … 165 166 /* XXX This is only one buffer */ 166 167 *buffer = hda->pcm_stream->buf[0]; 167 *size = hda->pcm_stream->bufsize ;168 *size = hda->pcm_stream->bufsize * hda->pcm_stream->nbuffers; 168 169 169 170 ddf_msg(LVL_NOTE, "hda_get_buffer() retturing EOK, buffer=%p, size=%zu", … … 180 181 static int hda_set_event_session(ddf_fun_t *fun, async_sess_t *sess) 181 182 { 183 hda_t *hda = fun_to_hda(fun); 184 182 185 ddf_msg(LVL_NOTE, "hda_set_event_session()"); 183 return ENOTSUP; 186 hda->ev_sess = sess; 187 return EOK; 184 188 } 185 189 186 190 static async_sess_t *hda_get_event_session(ddf_fun_t *fun) 187 191 { 192 hda_t *hda = fun_to_hda(fun); 193 188 194 ddf_msg(LVL_NOTE, "hda_get_event_session()"); 189 return NULL;195 return hda->ev_sess; 190 196 } 191 197 … … 215 221 return rc; 216 222 223 async_usleep(1000*1000); 217 224 hda_stream_start(hda->pcm_stream); 218 225 return EOK; … … 238 245 } 239 246 247 void hda_pcm_event(hda_t *hda, pcm_event_t event) 248 { 249 async_exch_t *exchange; 250 251 if (hda->ev_sess == NULL) { 252 ddf_log_warning("No one listening for event %u", event); 253 return; 254 } 255 256 exchange = async_exchange_begin(hda->ev_sess); 257 async_msg_1(exchange, event, 0); 258 async_exchange_end(exchange); 259 } 260 240 261 /** @} 241 262 */ -
uspace/drv/audio/hdaudio/pcm_iface.h
r99cb9bf r159c722d 38 38 #include <audio_pcm_iface.h> 39 39 40 #include "hdaudio.h" 41 40 42 extern audio_pcm_iface_t hda_pcm_iface; 43 extern void hda_pcm_event(hda_t *, pcm_event_t); 41 44 42 45 #endif -
uspace/drv/audio/hdaudio/stream.c
r99cb9bf r159c722d 54 54 uintptr_t buffer_phys; 55 55 size_t i; 56 size_t j, k;56 // size_t j, k; 57 57 int rc; 58 58 59 stream->nbuffers = 2;59 stream->nbuffers = 4; 60 60 stream->bufsize = 16384; 61 61 … … 84 84 85 85 /* Allocate buffers */ 86 86 /* 87 87 for (i = 0; i < stream->nbuffers; i++) { 88 88 buffer = AS_AREA_ANY; … … 108 108 } 109 109 } 110 */ 111 // async_usleep(1000*1000); 112 /* audio_pcm_iface requires a single contiguous buffer */ 113 buffer = AS_AREA_ANY; 114 rc = dmamem_map_anonymous(stream->bufsize * stream->nbuffers, 115 stream->hda->ctl->ok64bit ? 0 : DMAMEM_4GiB, AS_AREA_READ | AS_AREA_WRITE, 116 0, &buffer_phys, &buffer); 117 if (rc != EOK) { 118 ddf_msg(LVL_NOTE, "dmamem_map_anon -> %d", rc); 119 goto error; 120 } 121 122 for (i = 0; i < stream->nbuffers; i++) { 123 stream->buf[i] = buffer + i * stream->bufsize; 124 stream->buf_phys[i] = buffer_phys + i * stream->bufsize; 125 126 ddf_msg(LVL_NOTE, "Stream buf phys=0x%llx virt=%p", 127 (long long unsigned)(uintptr_t)stream->buf[i], 128 (void *)stream->buf_phys[i]); 129 /* k = 0; 130 for (j = 0; j < stream->bufsize / 2; j++) { 131 int16_t *bp = stream->buf[i]; 132 bp[j] = (k > 128) ? -10000 : 10000; 133 ++k; 134 if (k >= 256) 135 k = 0; 136 } 137 */ 138 } 110 139 111 140 /* Fill in BDL */
Note:
See TracChangeset
for help on using the changeset viewer.