Warnings fixed, midi_driver.h is now in system headers
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5373 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -176,7 +176,7 @@ codec_table codecs[] =
|
||||
{ 0x00000000, 0x00000000, &default_ops, "Unknown" } /* must be last one, matches every codec */
|
||||
};
|
||||
|
||||
codec_table *
|
||||
static codec_table *
|
||||
find_codec_table(uint32 codecid)
|
||||
{
|
||||
codec_table *codec;
|
||||
|
||||
@@ -43,7 +43,7 @@ static sem_id loglock;
|
||||
|
||||
void debug_printf(const char *text,...);
|
||||
void log_printf(const char *text,...);
|
||||
void log_create();
|
||||
void log_create(void);
|
||||
|
||||
void debug_printf(const char *text,...)
|
||||
{
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <midi_driver.h>
|
||||
#include "emuxki.h"
|
||||
#include "debug.h"
|
||||
#include "config.h"
|
||||
@@ -56,7 +57,6 @@
|
||||
#include <malloc.h>
|
||||
#include "multi.h"
|
||||
#include "ac97.h"
|
||||
#include "midi_driver.h"
|
||||
|
||||
status_t init_hardware(void);
|
||||
status_t init_driver(void);
|
||||
@@ -82,7 +82,7 @@ extern device_hooks midi_hooks;
|
||||
|
||||
/* Hardware Dump */
|
||||
|
||||
void
|
||||
static void
|
||||
dump_hardware_regs(device_config *config)
|
||||
{
|
||||
LOG(("EMU_IPR = %#08x\n",emuxki_reg_read_32(config, EMU_IPR)));
|
||||
@@ -121,7 +121,7 @@ dump_hardware_regs(device_config *config)
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
trace_hardware_regs(device_config *config)
|
||||
{
|
||||
TRACE(("EMU_IPR = %#08x\n",emuxki_reg_read_32(config, EMU_IPR)));
|
||||
@@ -227,10 +227,10 @@ emuxki_mem_delete(emuxki_mem *mem)
|
||||
void *
|
||||
emuxki_pmem_alloc(emuxki_dev *card, size_t size)
|
||||
{
|
||||
int i, j;//, s;
|
||||
int i;//, s;
|
||||
size_t numblocks;
|
||||
emuxki_mem *mem;
|
||||
uint32 *ptb, silentpage;
|
||||
uint32 j, *ptb, silentpage;
|
||||
|
||||
ptb = card->ptb_log_base;
|
||||
silentpage = ((uint32)card->silentpage_phy_base) << 1;
|
||||
@@ -296,10 +296,9 @@ emuxki_rmem_alloc(emuxki_dev *card, size_t size)
|
||||
void
|
||||
emuxki_mem_free(emuxki_dev *card, void *ptr)
|
||||
{
|
||||
int i;//, s;
|
||||
emuxki_mem *mem;
|
||||
size_t numblocks;
|
||||
uint32 *ptb, silentpage;
|
||||
uint32 i, *ptb, silentpage;
|
||||
|
||||
ptb = card->ptb_log_base;
|
||||
silentpage = ((uint32)card->silentpage_phy_base) << 1;
|
||||
@@ -624,8 +623,8 @@ emuxki_channel_stop(emuxki_channel *chan)
|
||||
}
|
||||
|
||||
/* Emuxki voice functions */
|
||||
|
||||
void emuxki_dump_voice(emuxki_voice *voice)
|
||||
static void
|
||||
emuxki_dump_voice(emuxki_voice *voice)
|
||||
{
|
||||
LOG(("voice->use = %#u\n", voice->use));
|
||||
LOG(("voice->state = %#u\n", voice->state));
|
||||
@@ -1545,7 +1544,7 @@ emuxki_stream_get_nth_buffer(emuxki_stream *stream, uint8 chan, uint8 buf,
|
||||
else
|
||||
break;
|
||||
if(voice) {
|
||||
*buffer = voice->buffer->log_base + (buf * stream->bufframes * sample_size * 2);
|
||||
*buffer = (char*)voice->buffer->log_base + (buf * stream->bufframes * sample_size * 2);
|
||||
if(chan % 2 == 1)
|
||||
*buffer += sample_size;
|
||||
*stride = sample_size * 2;
|
||||
@@ -1561,7 +1560,7 @@ emuxki_stream_get_nth_buffer(emuxki_stream *stream, uint8 chan, uint8 buf,
|
||||
else
|
||||
break;
|
||||
if(voice) {
|
||||
*buffer = voice->buffer->log_base + (buf * stream->bufframes * sample_size);
|
||||
*buffer = (char*)voice->buffer->log_base + (buf * stream->bufframes * sample_size);
|
||||
*stride = sample_size;
|
||||
} else
|
||||
return B_ERROR;
|
||||
@@ -1858,8 +1857,8 @@ emuxki_parameter_get(emuxki_dev *card, const void* cookie, int32 type, int32 *va
|
||||
}
|
||||
|
||||
/* Emuxki interrupt */
|
||||
|
||||
int32 emuxki_int(void *arg)
|
||||
static int32
|
||||
emuxki_int(void *arg)
|
||||
{
|
||||
emuxki_dev *card = arg;
|
||||
uint32 ipr, curblk;
|
||||
|
||||
@@ -124,14 +124,14 @@ emuxki_chan_write(device_config *config, uint16 chano,
|
||||
|
||||
/* Microcode */
|
||||
|
||||
void
|
||||
static void
|
||||
emuxki_write_micro(device_config *config, uint32 pc, uint32 data)
|
||||
{
|
||||
emuxki_chan_write(config, 0, (IS_AUDIGY(config) ? EMU_A_MICROCODEBASE :
|
||||
EMU_MICROCODEBASE ) + pc, data);
|
||||
}
|
||||
|
||||
uint32
|
||||
static uint32
|
||||
emuxki_read_micro(device_config *config, uint32 pc)
|
||||
{
|
||||
return emuxki_chan_read(config, 0, (IS_AUDIGY(config) ? EMU_A_MICROCODEBASE :
|
||||
|
||||
@@ -1,118 +0,0 @@
|
||||
/* ++++++++++
|
||||
FILE: midi_driver.h
|
||||
REVS: $Revision: 1.1 $
|
||||
NAME: herold
|
||||
DATE: Tue Jun 4 15:23:29 PDT 1996
|
||||
|
||||
Interface to /dev/midi, the midi driver
|
||||
+++++ */
|
||||
/*
|
||||
Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
*/
|
||||
|
||||
#ifndef _MIDI_DRIVER_H
|
||||
#define _MIDI_DRIVER_H
|
||||
|
||||
#include <Drivers.h>
|
||||
#include <module.h>
|
||||
|
||||
/* -----
|
||||
ioctl codes
|
||||
----- */
|
||||
|
||||
/* the old opcodes are deprecated, and may or may not work
|
||||
in newer drivers */
|
||||
enum {
|
||||
B_MIDI_GET_READ_TIMEOUT = B_MIDI_DRIVER_BASE,
|
||||
B_MIDI_SET_READ_TIMEOUT,
|
||||
B_MIDI_TIMED_READ,
|
||||
B_MIDI_TIMED_WRITE,
|
||||
B_MIDI_WRITE_SYNC,
|
||||
B_MIDI_WRITE_CLEAR,
|
||||
B_MIDI_GET_READ_TIMEOUT_OLD = B_DEVICE_OP_CODES_END + 1,
|
||||
B_MIDI_SET_READ_TIMEOUT_OLD
|
||||
};
|
||||
|
||||
/* the default timeout when you open a midi driver */
|
||||
#define B_MIDI_DEFAULT_TIMEOUT 1000000000000000LL
|
||||
|
||||
/* Usage:
|
||||
To read, set "data" to a pointer to your buffer, and "size" to the
|
||||
maximum size of this buffer. On return, "when" will contain the time
|
||||
at which the data was received (first byte) and "size" will contain
|
||||
the actual amount of data read.
|
||||
Call ioctl(fd, B_MIDI_TIMED_READ, &midi_timed_data, sizeof(midi_timed_data));
|
||||
To write, set "when" to when you want the first byte to go out the
|
||||
wire, set "data" to point to your data, and set "size" to the size
|
||||
of your data.
|
||||
Call ioctl(fd, B_MIDI_TIMED_WRITE, &midi_timed_data, sizeof(midi_timed_data));
|
||||
*/
|
||||
typedef struct {
|
||||
bigtime_t when;
|
||||
size_t size;
|
||||
unsigned char * data;
|
||||
} midi_timed_data;
|
||||
|
||||
|
||||
/* The MIDI parser returns the number of bytes that a message contains, given the */
|
||||
/* initial byte. For some messages, this is not known until the second byte is seen. */
|
||||
/* For such messages, a state > 0 is returned as well as some count > 0. When state */
|
||||
/* is > 0, you should call (*parse) for the next byte as well, which might modify */
|
||||
/* the returned message size. Message size will always be returned with the current */
|
||||
/* byte being counted as byte 1. A return of 0 means that the byte initiates a new */
|
||||
/* message. SysX is handled by returning max_size until the end or next initial message */
|
||||
/* is seen. So your loop looks something like: */
|
||||
/*
|
||||
uint32 state = 0; // Only set this to 0 the first time you call the parser.
|
||||
// preserve the 'state' between invocations of your read() hook.
|
||||
int todo = 0;
|
||||
unsigned char * end = in_buf+buf_size
|
||||
unsigned char * out_buf = in_buf;
|
||||
while (true) {
|
||||
uchar byte = read_midi();
|
||||
if (!todo || state) {
|
||||
todo = (*parser->parse)(&state, byte, end-out_buf);
|
||||
}
|
||||
if (todo < 1) {
|
||||
unput_midi(byte);
|
||||
} else {
|
||||
*(out_buf++) = byte;
|
||||
todo--;
|
||||
}
|
||||
if (todo < 1 || out_buf >= end) {
|
||||
received_midi_message(in_buf, out_buf-in_buf);
|
||||
todo = 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#define B_MIDI_PARSER_MODULE_NAME "media/midiparser/v1"
|
||||
|
||||
typedef struct _midi_parser_module_info {
|
||||
module_info minfo;
|
||||
int (*parse)(uint32 * state, uchar byte, size_t max_size);
|
||||
int _reserved_;
|
||||
} midi_parser_module_info;
|
||||
|
||||
#define B_MPU_401_MODULE_NAME "generic/mpu401/v1"
|
||||
|
||||
enum {
|
||||
B_MPU_401_ENABLE_CARD_INT = 1,
|
||||
B_MPU_401_DISABLE_CARD_INT
|
||||
};
|
||||
typedef struct _generic_mpu401_module {
|
||||
module_info minfo;
|
||||
status_t (*create_device)(int port, void ** out_storage, uint32 workarounds, void (*interrupt_op)(int32 op, void * card), void * card);
|
||||
status_t (*delete_device)(void * storage);
|
||||
status_t (*open_hook)(void * storage, uint32 flags, void ** out_cookie);
|
||||
status_t (*close_hook)(void * cookie);
|
||||
status_t (*free_hook)(void * cookie);
|
||||
status_t (*control_hook)(void * cookie, uint32 op, void * data, size_t len);
|
||||
status_t (*read_hook)(void * cookie, off_t pos, void * data, size_t * len);
|
||||
status_t (*write_hook)(void * cookie, off_t pos, const void * data, size_t * len);
|
||||
bool (*interrupt_hook)(void * cookie);
|
||||
int _reserved_;
|
||||
} generic_mpu401_module;
|
||||
|
||||
#endif
|
||||
@@ -522,7 +522,8 @@ emuxki_create_controls_list(multi_dev *multi)
|
||||
static status_t
|
||||
emuxki_get_mix(emuxki_dev *card, multi_mix_value_info * MMVI)
|
||||
{
|
||||
int32 i, id;
|
||||
int32 i;
|
||||
uint32 id;
|
||||
multi_mixer_control *control = NULL;
|
||||
for(i=0; i<MMVI->item_count; i++) {
|
||||
id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
|
||||
@@ -561,7 +562,8 @@ emuxki_get_mix(emuxki_dev *card, multi_mix_value_info * MMVI)
|
||||
static status_t
|
||||
emuxki_set_mix(emuxki_dev *card, multi_mix_value_info * MMVI)
|
||||
{
|
||||
int32 i, id;
|
||||
int32 i;
|
||||
uint32 id;
|
||||
multi_mixer_control *control = NULL;
|
||||
for(i=0; i<MMVI->item_count; i++) {
|
||||
id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID;
|
||||
@@ -625,7 +627,7 @@ static status_t
|
||||
emuxki_list_mix_controls(emuxki_dev *card, multi_mix_control_info * MMCI)
|
||||
{
|
||||
multi_mix_control *MMC;
|
||||
int32 i;
|
||||
uint32 i;
|
||||
|
||||
MMC = MMCI->controls;
|
||||
if(MMCI->control_count < 24)
|
||||
@@ -690,7 +692,8 @@ static void
|
||||
emuxki_create_channels_list(multi_dev *multi)
|
||||
{
|
||||
emuxki_stream *stream;
|
||||
uint32 index, i, mode, designations, nchannels;
|
||||
uint32 index, i, designations, nchannels;
|
||||
int32 mode;
|
||||
multi_channel_info *chans;
|
||||
uint32 chan_designations[] = {
|
||||
B_CHANNEL_LEFT,
|
||||
@@ -769,7 +772,7 @@ emuxki_create_channels_list(multi_dev *multi)
|
||||
static status_t
|
||||
emuxki_get_description(emuxki_dev *card, multi_description *data)
|
||||
{
|
||||
uint32 size;
|
||||
int32 size;
|
||||
|
||||
data->interface_version = B_CURRENT_INTERFACE_VERSION;
|
||||
data->interface_minimum = B_CURRENT_INTERFACE_VERSION;
|
||||
@@ -882,7 +885,7 @@ emuxki_get_global_format(emuxki_dev *card, multi_format_info *data)
|
||||
static status_t
|
||||
emuxki_get_buffers(emuxki_dev *card, multi_buffer_list *data)
|
||||
{
|
||||
uint32 i, j, pchannels, pchannels2, rchannels, rchannels2;
|
||||
int32 i, j, pchannels, pchannels2, rchannels, rchannels2;
|
||||
|
||||
LOG(("flags = %#x\n",data->flags));
|
||||
LOG(("request_playback_buffers = %#x\n",data->request_playback_buffers));
|
||||
@@ -944,7 +947,7 @@ emuxki_get_buffers(emuxki_dev *card, multi_buffer_list *data)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
static void
|
||||
emuxki_play_inth(void* inthparams)
|
||||
{
|
||||
emuxki_stream *stream = (emuxki_stream *)inthparams;
|
||||
@@ -962,7 +965,7 @@ emuxki_play_inth(void* inthparams)
|
||||
release_sem_etc(stream->card->buffer_ready_sem, 1, B_DO_NOT_RESCHEDULE);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
emuxki_record_inth(void* inthparams)
|
||||
{
|
||||
emuxki_stream *stream = (emuxki_stream *)inthparams;
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
#define _MULTI_AUDIO_H
|
||||
|
||||
#include <Drivers.h>
|
||||
#ifndef ASSERT
|
||||
#include <Debug.h>
|
||||
#endif
|
||||
|
||||
#define B_MULTI_DRIVER_BASE (B_AUDIO_DRIVER_BASE+20)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user