xref: /haiku/headers/os/drivers/midi_driver.h (revision 1deede7388b04dbeec5af85cae7164735ea9e70d)
1 /*
2  * Copyright 2009, Haiku Inc. All Rights Reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _MIDI_DRIVER_H
6 #define _MIDI_DRIVER_H
7 
8 
9 #include <Drivers.h>
10 #include <module.h>
11 
12 
13 /* deprecated interface */
14 enum {
15 	B_MIDI_GET_READ_TIMEOUT = B_MIDI_DRIVER_BASE,
16 	B_MIDI_SET_READ_TIMEOUT,
17 	B_MIDI_TIMED_READ,
18 	B_MIDI_TIMED_WRITE,
19 	B_MIDI_WRITE_SYNC,
20 	B_MIDI_WRITE_CLEAR,
21 	B_MIDI_GET_READ_TIMEOUT_OLD	= B_DEVICE_OP_CODES_END + 1,
22 	B_MIDI_SET_READ_TIMEOUT_OLD
23 };
24 
25 
26 #define B_MIDI_DEFAULT_TIMEOUT 1000000000000000LL
27 
28 typedef struct {
29 	bigtime_t	when;
30 	size_t		size;
31 	uint8*		data;
32 } midi_timed_data;
33 
34 
35 #define B_MIDI_PARSER_MODULE_NAME "media/midiparser/v1"
36 
37 typedef struct _midi_parser_module_info {
38 	module_info	minfo;
39 	int			(*parse)(uint32* state, uchar byte, size_t maxSize);
40 	int			_reserved_;
41 } midi_parser_module_info;
42 
43 
44 #define B_MPU_401_MODULE_NAME "generic/mpu401/v1"
45 
46 enum {
47 	B_MPU_401_ENABLE_CARD_INT = 1,
48 	B_MPU_401_DISABLE_CARD_INT
49 };
50 
51 typedef struct _generic_mpu401_module {
52 	module_info	minfo;
53 	status_t	(*create_device)(int port, void** _handle, uint32 workArounds,
54 					void (*interruptOp)(int32 op, void* card), void* card);
55 	status_t	(*delete_device)(void* handle);
56 	status_t	(*open_hook)(void* storage, uint32 flags, void** _cookie);
57 	status_t	(*close_hook)(void* cookie);
58 	status_t	(*free_hook)(void* cookie);
59 	status_t	(*control_hook)(void* cookie, uint32 op, void* data,
60 					size_t length);
61 	status_t	(*read_hook)(void* cookie, off_t pos, void* data,
62 					size_t* _length);
63 	status_t	(*write_hook)(void* cookie, off_t pos, const void* data,
64 					size_t* _length);
65 	bool		(*interrupt_hook)(void* cookie);
66 	int			_reserved_;
67 } generic_mpu401_module;
68 
69 
70 #endif	/* _MIDI_DRIVER_H */
71