2003-11-15 11:46:33 +03:00
|
|
|
/*
|
2009-09-02 16:04:00 +04:00
|
|
|
* Copyright 2009, Haiku Inc. All Rights Reserved.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2003-11-15 11:46:33 +03:00
|
|
|
#ifndef _MIDI_DRIVER_H
|
|
|
|
#define _MIDI_DRIVER_H
|
|
|
|
|
2009-09-02 16:04:00 +04:00
|
|
|
|
2003-11-15 11:46:33 +03:00
|
|
|
#include <Drivers.h>
|
|
|
|
#include <module.h>
|
|
|
|
|
|
|
|
|
2009-09-02 16:04:00 +04:00
|
|
|
/* deprecated interface */
|
2003-11-15 11:46:33 +03:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2009-09-02 16:04:00 +04:00
|
|
|
|
2003-11-15 11:46:33 +03:00
|
|
|
#define B_MIDI_DEFAULT_TIMEOUT 1000000000000000LL
|
|
|
|
|
|
|
|
typedef struct {
|
2009-09-02 16:04:00 +04:00
|
|
|
bigtime_t when;
|
|
|
|
size_t size;
|
|
|
|
uint8* data;
|
2003-11-15 11:46:33 +03:00
|
|
|
} midi_timed_data;
|
|
|
|
|
|
|
|
|
|
|
|
#define B_MIDI_PARSER_MODULE_NAME "media/midiparser/v1"
|
|
|
|
|
|
|
|
typedef struct _midi_parser_module_info {
|
|
|
|
module_info minfo;
|
2009-09-02 16:04:00 +04:00
|
|
|
int (*parse)(uint32* state, uchar byte, size_t maxSize);
|
|
|
|
int _reserved_;
|
2003-11-15 11:46:33 +03:00
|
|
|
} midi_parser_module_info;
|
|
|
|
|
2009-09-02 16:04:00 +04:00
|
|
|
|
2003-11-15 11:46:33 +03:00
|
|
|
#define B_MPU_401_MODULE_NAME "generic/mpu401/v1"
|
|
|
|
|
|
|
|
enum {
|
|
|
|
B_MPU_401_ENABLE_CARD_INT = 1,
|
|
|
|
B_MPU_401_DISABLE_CARD_INT
|
|
|
|
};
|
2009-09-02 16:04:00 +04:00
|
|
|
|
2003-11-15 11:46:33 +03:00
|
|
|
typedef struct _generic_mpu401_module {
|
2009-09-02 16:04:00 +04:00
|
|
|
module_info minfo;
|
|
|
|
status_t (*create_device)(int port, void** _handle, uint32 workArounds,
|
|
|
|
void (*interruptOp)(int32 op, void* card), void* card);
|
|
|
|
status_t (*delete_device)(void* handle);
|
|
|
|
status_t (*open_hook)(void* storage, uint32 flags, void** _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 length);
|
|
|
|
status_t (*read_hook)(void* cookie, off_t pos, void* data,
|
|
|
|
size_t* _length);
|
|
|
|
status_t (*write_hook)(void* cookie, off_t pos, const void* data,
|
|
|
|
size_t* _length);
|
|
|
|
bool (*interrupt_hook)(void* cookie);
|
|
|
|
int _reserved_;
|
2003-11-15 11:46:33 +03:00
|
|
|
} generic_mpu401_module;
|
|
|
|
|
2009-09-02 16:04:00 +04:00
|
|
|
|
|
|
|
#endif /* _MIDI_DRIVER_H */
|