Changeset 00006e0 in mainline
- Timestamp:
- 2012-07-02T12:31:08Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2f7042e
- Parents:
- bd250b0f
- Location:
- uspace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/audio/sb16/dsp.c
rbd250b0f r00006e0 113 113 } 114 114 /*----------------------------------------------------------------------------*/ 115 static inline int sb_setup_buffer(sb_dsp_t *dsp) 116 { 117 assert(dsp); 118 uint8_t *buffer = dma_create_buffer24(BUFFER_SIZE); 115 static inline int sb_setup_buffer(sb_dsp_t *dsp, size_t size) 116 { 117 assert(dsp); 118 if (size > BUFFER_SIZE || size == 0 || (size % 2) == 1) 119 size = BUFFER_SIZE; 120 uint8_t *buffer = dma_create_buffer24(size); 119 121 if (buffer == NULL) { 120 122 ddf_log_error("Failed to allocate buffer.\n"); … … 125 127 assert(pa < (1 << 25)); 126 128 /* Set 16 bit channel */ 127 const int ret = sb_setup_dma(dsp, pa, BUFFER_SIZE);129 const int ret = sb_setup_dma(dsp, pa, size); 128 130 if (ret == EOK) { 129 131 dsp->buffer.data = buffer; 130 dsp->buffer.size = BUFFER_SIZE;131 bzero( buffer, BUFFER_SIZE);132 dsp->buffer.size = size; 133 bzero(dsp->buffer.data, dsp->buffer.size); 132 134 } else { 133 135 ddf_log_error("Failed to setup DMA16 channel %s.\n", … … 197 199 { 198 200 assert(dsp); 199 const int ret = sb_setup_buffer(dsp); 200 ddf_log_debug("Providing buffer(%u): %p, %zu.\n", 201 assert(size); 202 203 const int ret = sb_setup_buffer(dsp, *size); 204 ddf_log_debug("Providing buffer(%u): %p, %zu B.\n", 201 205 BUFFER_ID, dsp->buffer.data, dsp->buffer.size); 206 202 207 if (ret == EOK && buffer) 203 208 *buffer = dsp->buffer.data; -
uspace/lib/drv/generic/remote_audio_pcm_buffer.c
rbd250b0f r00006e0 34 34 #include <async.h> 35 35 #include <errno.h> 36 #include <assert.h>37 36 #include <str.h> 38 37 #include <as.h> … … 85 84 unsigned *id) 86 85 { 87 if (!exch || !buffer || !size) 88 return EINVAL; 89 sysarg_t buffer_size, buffer_id; 90 const int ret = async_req_1_2(exch, 86 if (!exch || !buffer || !size || !id) 87 return EINVAL; 88 89 sysarg_t buffer_size = *size, buffer_id = 0; 90 const int ret = async_req_2_2(exch, 91 91 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_GET_BUFFER, 92 &buffer_size, &buffer_id);92 (sysarg_t)buffer_size, &buffer_size, &buffer_id); 93 93 if (ret == EOK) { 94 94 void *dst = NULL; 95 const int ret =96 95 // FIXME Do we need to know the flags? 96 const int ret = async_share_in_start_0_0(exch, buffer_size, &dst); 97 97 if (ret != EOK) { 98 98 return ret; … … 100 100 *buffer = dst; 101 101 *size = buffer_size; 102 }103 if (ret == EOK && id)104 102 *id = buffer_id; 103 } 105 104 return ret; 106 105 } … … 219 218 } 220 219 void *buffer = NULL; 221 size_t size = 0;220 size_t size = DEV_IPC_GET_ARG1(*call); 222 221 unsigned id = 0; 223 222 const int ret = pcm_iface->get_buffer(fun, &buffer, &size, &id);
Note:
See TracChangeset
for help on using the changeset viewer.