es1370: Apply SMAP fixes based on hrev51775.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
SubDir HAIKU_TOP src add-ons kernel drivers audio ac97 es1370 ;
|
SubDir HAIKU_TOP src add-ons kernel drivers audio ac97 es1370 ;
|
||||||
|
|
||||||
|
UsePrivateKernelHeaders ;
|
||||||
UsePrivateHeaders libroot audio system ;
|
UsePrivateHeaders libroot audio system ;
|
||||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) ] ;
|
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) ] ;
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,9 @@
|
|||||||
#include <MediaDefs.h>
|
#include <MediaDefs.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
|
#include <kernel.h>
|
||||||
|
|
||||||
#include "hmulti_audio.h"
|
#include "hmulti_audio.h"
|
||||||
#include "multi.h"
|
#include "multi.h"
|
||||||
#include "ac97.h"
|
#include "ac97.h"
|
||||||
@@ -517,6 +520,15 @@ es1370_get_global_format(es1370_dev *card, multi_format_info *data)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static status_t
|
||||||
|
es1370_set_global_format(es1370_dev *card, multi_format_info *data)
|
||||||
|
{
|
||||||
|
/* XXX BUG! we *MUST* return B_OK, returning B_ERROR will prevent
|
||||||
|
* BeOS to accept the format returned in B_MULTI_GET_GLOBAL_FORMAT
|
||||||
|
*/
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
es1370_get_buffers(es1370_dev *card, multi_buffer_list *data)
|
es1370_get_buffers(es1370_dev *card, multi_buffer_list *data)
|
||||||
{
|
{
|
||||||
@@ -551,11 +563,18 @@ es1370_get_buffers(es1370_dev *card, multi_buffer_list *data)
|
|||||||
if (bufcount > data->request_playback_buffers)
|
if (bufcount > data->request_playback_buffers)
|
||||||
bufcount = data->request_playback_buffers;
|
bufcount = data->request_playback_buffers;
|
||||||
|
|
||||||
for (i = 0; i < bufcount; i++)
|
for (i = 0; i < bufcount; i++) {
|
||||||
|
struct buffer_desc descs[data->return_playback_channels];
|
||||||
for (j=0; j<pchannels; j++)
|
for (j=0; j<pchannels; j++)
|
||||||
es1370_stream_get_nth_buffer(card->pstream, j, i,
|
es1370_stream_get_nth_buffer(card->pstream, j, i,
|
||||||
&data->playback_buffers[i][j].base,
|
&descs[j].base,
|
||||||
&data->playback_buffers[i][j].stride);
|
&descs[j].stride);
|
||||||
|
if (!IS_USER_ADDRESS(data->playback_buffers[i])
|
||||||
|
|| user_memcpy(data->playback_buffers[i], descs, sizeof(descs))
|
||||||
|
< B_OK) {
|
||||||
|
return B_BAD_ADDRESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
data->return_record_buffers = current_settings.buffer_count;
|
data->return_record_buffers = current_settings.buffer_count;
|
||||||
data->return_record_channels = rchannels;
|
data->return_record_channels = rchannels;
|
||||||
@@ -565,11 +584,18 @@ es1370_get_buffers(es1370_dev *card, multi_buffer_list *data)
|
|||||||
if (bufcount > data->request_record_buffers)
|
if (bufcount > data->request_record_buffers)
|
||||||
bufcount = data->request_record_buffers;
|
bufcount = data->request_record_buffers;
|
||||||
|
|
||||||
for (i = 0; i < bufcount; i++)
|
for (i = 0; i < bufcount; i++) {
|
||||||
|
struct buffer_desc descs[data->return_record_channels];
|
||||||
for (j=0; j<rchannels; j++)
|
for (j=0; j<rchannels; j++)
|
||||||
es1370_stream_get_nth_buffer(card->rstream, j, i,
|
es1370_stream_get_nth_buffer(card->rstream, j, i,
|
||||||
&data->record_buffers[i][j].base,
|
&descs[j].base,
|
||||||
&data->record_buffers[i][j].stride);
|
&descs[j].stride);
|
||||||
|
if (!IS_USER_ADDRESS(data->record_buffers[i])
|
||||||
|
|| user_memcpy(data->record_buffers[i], descs, sizeof(descs))
|
||||||
|
< B_OK) {
|
||||||
|
return B_BAD_ADDRESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -696,77 +722,27 @@ es1370_buffer_force_stop(es1370_dev *card)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define cookie_type es1370_dev
|
||||||
|
#define get_description es1370_get_description
|
||||||
|
#define get_enabled_channels es1370_get_enabled_channels
|
||||||
|
#define get_global_format es1370_get_global_format
|
||||||
|
#define set_global_format es1370_set_global_format
|
||||||
|
#define list_mix_channels es1370_list_mix_channels
|
||||||
|
#define list_mix_controls es1370_list_mix_controls
|
||||||
|
#define list_mix_connections es1370_list_mix_connections
|
||||||
|
#define get_mix es1370_get_mix
|
||||||
|
#define set_mix es1370_set_mix
|
||||||
|
#define get_buffers es1370_get_buffers
|
||||||
|
#define buffer_exchange es1370_buffer_exchange
|
||||||
|
#define buffer_force_stop es1370_buffer_force_stop
|
||||||
|
#include "../generic/multi.c"
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
es1370_multi_control(void *cookie, uint32 op, void *data, size_t length)
|
es1370_multi_control(void *cookie, uint32 op, void *data, size_t length)
|
||||||
{
|
{
|
||||||
es1370_dev *card = (es1370_dev *)cookie;
|
es1370_dev *card = (es1370_dev *)cookie;
|
||||||
|
|
||||||
switch (op) {
|
return multi_audio_control_generic(card, op, data, length);
|
||||||
case B_MULTI_GET_DESCRIPTION:
|
|
||||||
LOG(("B_MULTI_GET_DESCRIPTION\n"));
|
|
||||||
return es1370_get_description(card, (multi_description *)data);
|
|
||||||
case B_MULTI_GET_EVENT_INFO:
|
|
||||||
LOG(("B_MULTI_GET_EVENT_INFO\n"));
|
|
||||||
return B_ERROR;
|
|
||||||
case B_MULTI_SET_EVENT_INFO:
|
|
||||||
LOG(("B_MULTI_SET_EVENT_INFO\n"));
|
|
||||||
return B_ERROR;
|
|
||||||
case B_MULTI_GET_EVENT:
|
|
||||||
LOG(("B_MULTI_GET_EVENT\n"));
|
|
||||||
return B_ERROR;
|
|
||||||
case B_MULTI_GET_ENABLED_CHANNELS:
|
|
||||||
LOG(("B_MULTI_GET_ENABLED_CHANNELS\n"));
|
|
||||||
return es1370_get_enabled_channels(card, (multi_channel_enable *)data);
|
|
||||||
case B_MULTI_SET_ENABLED_CHANNELS:
|
|
||||||
LOG(("B_MULTI_SET_ENABLED_CHANNELS\n"));
|
|
||||||
return es1370_set_enabled_channels(card, (multi_channel_enable *)data);
|
|
||||||
case B_MULTI_GET_GLOBAL_FORMAT:
|
|
||||||
LOG(("B_MULTI_GET_GLOBAL_FORMAT\n"));
|
|
||||||
return es1370_get_global_format(card, (multi_format_info *)data);
|
|
||||||
case B_MULTI_SET_GLOBAL_FORMAT:
|
|
||||||
LOG(("B_MULTI_SET_GLOBAL_FORMAT\n"));
|
|
||||||
return B_OK; /* XXX BUG! we *MUST* return B_OK, returning B_ERROR will prevent
|
|
||||||
* BeOS to accept the format returned in B_MULTI_GET_GLOBAL_FORMAT
|
|
||||||
*/
|
|
||||||
case B_MULTI_GET_CHANNEL_FORMATS:
|
|
||||||
LOG(("B_MULTI_GET_CHANNEL_FORMATS\n"));
|
|
||||||
return B_ERROR;
|
|
||||||
case B_MULTI_SET_CHANNEL_FORMATS: /* only implemented if possible */
|
|
||||||
LOG(("B_MULTI_SET_CHANNEL_FORMATS\n"));
|
|
||||||
return B_ERROR;
|
|
||||||
case B_MULTI_GET_MIX:
|
|
||||||
LOG(("B_MULTI_GET_MIX\n"));
|
|
||||||
return es1370_get_mix(card, (multi_mix_value_info *)data);
|
|
||||||
case B_MULTI_SET_MIX:
|
|
||||||
LOG(("B_MULTI_SET_MIX\n"));
|
|
||||||
return es1370_set_mix(card, (multi_mix_value_info *)data);
|
|
||||||
case B_MULTI_LIST_MIX_CHANNELS:
|
|
||||||
LOG(("B_MULTI_LIST_MIX_CHANNELS\n"));
|
|
||||||
return es1370_list_mix_channels(card, (multi_mix_channel_info *)data);
|
|
||||||
case B_MULTI_LIST_MIX_CONTROLS:
|
|
||||||
LOG(("B_MULTI_LIST_MIX_CONTROLS\n"));
|
|
||||||
return es1370_list_mix_controls(card, (multi_mix_control_info *)data);
|
|
||||||
case B_MULTI_LIST_MIX_CONNECTIONS:
|
|
||||||
LOG(("B_MULTI_LIST_MIX_CONNECTIONS\n"));
|
|
||||||
return es1370_list_mix_connections(card, (multi_mix_connection_info *)data);
|
|
||||||
case B_MULTI_GET_BUFFERS: /* Fill out the struct for the first time; doesn't start anything. */
|
|
||||||
LOG(("B_MULTI_GET_BUFFERS\n"));
|
|
||||||
return es1370_get_buffers(card, data);
|
|
||||||
case B_MULTI_SET_BUFFERS: /* Set what buffers to use, if the driver supports soft buffers. */
|
|
||||||
LOG(("B_MULTI_SET_BUFFERS\n"));
|
|
||||||
return B_ERROR; /* we do not support soft buffers */
|
|
||||||
case B_MULTI_SET_START_TIME: /* When to actually start */
|
|
||||||
LOG(("B_MULTI_SET_START_TIME\n"));
|
|
||||||
return B_ERROR;
|
|
||||||
case B_MULTI_BUFFER_EXCHANGE: /* stop and go are derived from this being called */
|
|
||||||
//TRACE(("B_MULTI_BUFFER_EXCHANGE\n"));
|
|
||||||
return es1370_buffer_exchange(card, (multi_buffer_info *)data);
|
|
||||||
case B_MULTI_BUFFER_FORCE_STOP: /* force stop of playback, nothing in data */
|
|
||||||
LOG(("B_MULTI_BUFFER_FORCE_STOP\n"));
|
|
||||||
return es1370_buffer_force_stop(card);
|
|
||||||
}
|
|
||||||
LOG(("ERROR: unknown multi_control %#x\n",op));
|
|
||||||
return B_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static status_t es1370_open(const char *name, uint32 flags, void** cookie);
|
static status_t es1370_open(const char *name, uint32 flags, void** cookie);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ alloc_mem(void **phy, void **log, size_t size, const char *name)
|
|||||||
PRINT(("couldn't map %s\n", name));
|
PRINT(("couldn't map %s\n", name));
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
}
|
}
|
||||||
memset(logadr, 0, size);
|
user_memset(logadr, 0, size);
|
||||||
if (log)
|
if (log)
|
||||||
*log = logadr;
|
*log = logadr;
|
||||||
if (phy)
|
if (phy)
|
||||||
|
|||||||
Reference in New Issue
Block a user