1 #ifndef DRIVER_H 2 #define DRIVER_H 3 4 #include <drivers/driver_settings.h> 5 #include <drivers/KernelExport.h> 6 #include <drivers/Drivers.h> 7 8 #include <string.h> 9 #include <stdlib.h> 10 11 #ifdef COMPILE_FOR_R5 12 #define DEVFS_PATH "audio/multi" 13 #include <multi_audio.h> 14 #else 15 #define DEVFS_PATH "audio/hmulti" 16 #include <hmulti_audio.h> 17 #endif 18 19 #define STRMINBUF 2 20 #define STRMAXBUF 2 21 #define DEFAULT_FRAMESPERBUF 512 22 23 #define SB16_MULTI_CONTROL_FIRSTID 1024 24 #define SB16_MULTI_CONTROL_MASTERID 0 25 26 typedef struct { 27 int running; 28 spinlock lock; 29 int bits; 30 31 void* buffers[STRMAXBUF]; 32 uint32 num_buffers; 33 uint32 num_channels; 34 uint32 sample_size; 35 uint32 sampleformat; 36 uint32 samplerate; 37 uint32 buffer_length; 38 sem_id buffer_ready_sem; 39 uint32 frames_count; 40 uint32 buffer_cycle; 41 bigtime_t real_time; 42 } sb16_stream_t; 43 44 typedef struct { 45 int port, irq, dma8, dma16, midiport; 46 int opened; 47 48 sb16_stream_t playback_stream; 49 sb16_stream_t record_stream; 50 } sb16_dev_t; 51 52 extern device_hooks driver_hooks; 53 54 status_t sb16_hw_init(sb16_dev_t* dev); 55 void sb16_hw_stop(sb16_dev_t* dev); 56 void sb16_hw_uninit(sb16_dev_t* dev); 57 58 status_t sb16_stream_setup_buffers(sb16_dev_t* dev, sb16_stream_t* s, const char* desc); 59 status_t sb16_stream_start(sb16_dev_t* dev, sb16_stream_t* s); 60 status_t sb16_stream_stop(sb16_dev_t* dev, sb16_stream_t* s); 61 void sb16_stream_buffer_done(sb16_stream_t* stream); 62 63 status_t multi_audio_control(void* cookie, uint32 op, void* arg, size_t len); 64 65 #endif /* DRIVER_H */ 66 67