/****************************************************************************

   File              : sosfnct.h

   Programmer(s)     : Don Fowler, Nick Skrepetos
   Date              :

   Purpose           : Include Files For Zortech C++ Compiler

   Last Updated      :

****************************************************************************
               Copyright(c) 1993,1994 Human Machine Interfaces 
                            All Rights Reserved
****************************************************************************/

#ifndef  _SOS_FUNCTIONS
#define  _SOS_FUNCTIONS

#pragma pack(4)

#ifdef __cplusplus // HACK - ECH 96/01/26
extern "C" {
#endif

VOID sosDIGILockMemory          (  VOID  );
VOID sosDIGIUnLockMemory        (  VOID  );
WORD sosDIGIInitSystem          (  PSTR, WORD  );
WORD sosDIGIUnInitSystem        (  VOID  );
WORD sosDIGIInitDriver          (  WORD, _SOS_HARDWARE *,
                                   _SOS_INIT_DRIVER *, WORD * );
WORD sosDIGIUnInitDriver        (  WORD, BOOL, BOOL  );
WORD sosDIGILoadDriver          (  WORD, WORD, SFAR *, SFAR *, PSTR, PSTR, WORD * );
WORD sosDIGIUnLoadDriver        (  WORD  );
WORD sosDIGIGetDeviceCaps       (  WORD, PSOSDEVICECAPS  );

#ifdef PHARLAP
WORD sosDIGIAllocateBuffer      (  WORD , WORD *, WORD *, SFAR * );
#else
WORD sosDIGIAllocateBuffer      (  WORD , WORD *, WORD *, SFAR * );
#endif

WORD sosDIGIStopSample           (  WORD, WORD  );
WORD sosDIGISamplesPlaying       (  WORD  );
BOOL sosDIGISampleDone           (  WORD, WORD  );
BOOL sosDIGISampleFilling        (  WORD, WORD  );
WORD sosDIGIStartSample          (  WORD, _SOS_START_SAMPLE *  );
WORD sosDIGIContinueSample       (  WORD, WORD, _SOS_START_SAMPLE * );


WORD  sosDIGIDetectInit          (  PSTR  );
WORD  sosDIGIDetectUnInit        (  VOID  );
WORD  sosDIGIDetectFindHardware  (  WORD, _SOS_CAPABILITIES *, WORD * );
WORD  sosDIGIDetectFindFirst     (  _SOS_CAPABILITIES *, WORD *  );
WORD  sosDIGIDetectFindNext      (  _SOS_CAPABILITIES *, WORD *  );
WORD  sosDIGIDetectGetSettings   (  _SOS_HARDWARE *  );
WORD  sosDIGIDetectGetCaps       (  WORD, _SOS_CAPABILITIES *  );
WORD  sosDIGIDetectVerifySettings(  _SOS_HARDWARE *  );
PSTR  sosGetErrorString          (  WORD  );

WORD  sosDIGILoadTimer           (  WORD , SFAR *, SFAR *, PSTR, PSTR, WORD * );
WORD  sosDIGIUnLoadTimer         (  WORD  );

WORD  sosTIMERRegisterEvent      ( WORD, VOID ( * )( VOID ), WORD * );
WORD  sosTIMERInitSystem         (  WORD, WORD  );
WORD  sosTIMERUnInitSystem       (  WORD  );
WORD  sosTIMERSetRate            (  WORD  );  
WORD  sosTIMERRemoveEvent        (  WORD );
WORD  sosTIMERAlterEventRate     (  WORD, WORD  );
WORD  sosTIMERGetEventRate       (  WORD  );
VOID  sosTIMEROldHandler         (  VOID  );
VOID  sosTIMERHandler            (  VOID  );
VOID  sosFillThunk0              (  VOID  );
VOID  sosFillThunk1              (  VOID  );
VOID  sosFillThunk2              (  VOID  );
VOID  sosFillThunk3              (  VOID  );
VOID  sosFillThunk4              (  VOID  );

// functions in soscntl.c
WORD  sosDIGISetSampleVolume     ( WORD, WORD, WORD );
WORD  sosDIGIGetSampleVolume     ( WORD, WORD );
WORD  sosDIGISetChannel          ( WORD, WORD, WORD );
WORD  sosDIGIGetChannel          ( WORD, WORD );
WORD  sosDIGIGetBytesProcessed   ( WORD, WORD );
WORD  sosDIGIGetLoopCount        ( WORD, WORD );
WORD  sosDIGISetPanLocation      ( WORD, WORD, WORD );
WORD  sosDIGIGetPanLocation      ( WORD, WORD );
DWORD sosDIGISetPitch            ( WORD, WORD, DWORD );
DWORD sosDIGIGetPitch            ( WORD, WORD );
WORD  sosDIGIGetDMAPosition      ( WORD );
WORD  sosDIGISetPanSpeed         ( WORD, WORD, WORD );
WORD  sosDIGIGetPanSpeed         ( WORD, WORD );
WORD  sosDIGIGetSampleID         ( WORD, WORD );
WORD  sosDIGIGetSampleHandle     ( WORD, WORD );
WORD  sosDIGISetMasterVolume     ( WORD, WORD );
#ifdef PHARLAP
VOID  sosFreeVDSPage             ( WORD, WORD, LONG );
WORD  sosAllocVDSPage            ( SFAR *, WORD *, WORD * );
extern   int   cdecl sosRealAlloc( int, int *, int * );
extern   void  cdecl sosDRVFarMemCopy( LPSTR, LPSTR, WORD );
extern   int   cdecl sosGetCS    ( VOID );
extern   int   cdecl sosGetES    ( VOID );
#else
WORD  sosAllocVDSPage            ( SFAR *, WORD *, WORD * );
VOID  sosFreeVDSPage             ( WORD, WORD, LONG );
extern   int   cdecl sosRealAlloc( int, int *, int * );
extern   int   cdecl sosRealFree ( int );
#endif

extern   BOOL  cdecl  _sos_read  ( WORD, SFAR, WORD, WORD * );
#ifdef __cplusplus // HACK - ECH 96/01/26
}
#endif

#ifdef __cplusplus
extern "C" {
#endif
// sos driver functions
extern   int   cdecl sosDRVLockMemory     ( DWORD, DWORD );
extern   int   cdecl sosDRVUnLockMemory   ( DWORD, DWORD );
extern   void  cdecl sosDRVGetCapsInfo    ( SFAR, SFAR, _SOS_CAPABILITIES  * );
extern   void  cdecl sosDetDRVGetCapsInfo ( SFAR, SFAR, _SOS_CAPABILITIES  * );
extern   void  cdecl sosDRVGetCapsPtr     ( SFAR, SFAR, _SOS_CAPABILITIES  * );
extern   void  cdecl sosDRVInit           ( SFAR, SFAR, int, int, int, int, int, int );  
extern   void  cdecl sosDRVStart          ( SFAR, SFAR, int, int );
extern   void  cdecl sosDRVSetRate        ( SFAR, SFAR, int );
extern   void  cdecl sosDRVSetAction      ( SFAR, SFAR );
extern   void  cdecl sosDRVStop           ( SFAR, SFAR );
extern   void  cdecl sosDRVUnInit         ( SFAR, SFAR );
extern   void  cdecl sosDRVGetFillInfo    ( SFAR, SFAR, SFAR, int, int, int, _SOS_FILL_INFO * );
extern   void  cdecl sosFillSampleStructs ( PSTR, SFAR );
extern   WORD  cdecl sosDetDRVExist       ( SFAR, SFAR );
extern   WORD  cdecl sosDetDRVGetSettings ( SFAR, SFAR );
extern   WORD  cdecl sosCreateAliasCS       ( SFAR, SFAR * );
extern   WORD  cdecl sosDetDRVVerifySettings( SFAR, WORD, WORD, WORD, SFAR );
extern   WORD  cdecl sosDIGIInitForWindows( WORD );
extern   WORD  cdecl sosDIGIUnInitForWindows( WORD );
extern   WORD  cdecl sosAllocateFarMem      ( WORD, PSTR, WORD *, SFAR * );
extern   VOID  cdecl sosFreeSelector        ( SFAR, DWORD );
extern   WORD  cdecl sosMAKEDOSPtr          ( PSTR, SFAR * );
extern   VOID  cdecl sosDetDRVSetEnvString  ( DWORD, PSTR );
extern   PSTR  cdecl sosDetDRVGetEnvString  ( DWORD );
extern   VOID  cdecl sosDetDRVEnvStringInit ( SFAR, SFAR );
extern   VOID  cdecl sosDRVSetupCallFunctions( SFAR, SFAR, SFAR, SFAR );
extern   WORD  cdecl sosDRVGetFreeMemory     ( VOID );
extern   WORD  cdecl sosDRVAllocVDSStruct    ( WORD, WORD *, WORD * );
extern   WORD  cdecl sosDRVFreeVDSStruct     ( WORD, WORD );
extern   WORD  cdecl sosDRVIsWindowsActive   ( VOID );
extern   WORD  cdecl sosDRVVDSGetBuffer    ( WORD );
extern   WORD  cdecl sosDRVVDSFreeBuffer   ( WORD );
extern   WORD  cdecl sosSetupVDSBufferSize( WORD, WORD );
extern   WORD  cdecl sfmemcpy( PSTR, WORD, WORD );
extern   WORD  cdecl sfmemcpy1( PSTR, WORD, WORD );
extern   WORD  cdecl getDS( VOID );
extern   WORD  cdecl getCS( VOID );
extern   WORD  cdecl sosDRVMakeDMASelector   ( WORD );  
extern   WORD  cdecl sosDRVFreeDMASelector   ( WORD );  
extern   WORD  cdecl sosSetPageAccess        ( WORD, WORD );
extern   VOID  cdecl sosCopyToFarMem         ( SFAR, PSTR, WORD );
extern   VOID  cdecl sosDRVCallFillHandler   (  SFAR  );
extern   VOID  cdecl sosInitDMABuffer( SFAR, WORD, WORD );
extern   VOID  cdecl sosDIGISetupDS( VOID );

extern   void  cdecl sosTIMERDRVInit( int wRate, void (  * )( void ) );
extern   void  cdecl sosTIMERDRVUnInit( void );
extern   void  cdecl sosTIMERDRVHandler( void );
extern   void  cdecl sosTIMERDRVFHandler( void );
extern   void  cdecl sosTIMERDRVEnable( void );
extern   void  cdecl sosTIMERDRVDisable( void );
extern   void  cdecl sosTIMERDRVCallOld( void );
extern   void  cdecl sosTIMERDRVSetRate( WORD );    
extern   void  cdecl sosDIGITimer_Start( void );
extern   void  cdecl sosDIGITimer_End( void );
extern   void  cdecl sosDIGIDrv_Start( void );
extern   void  cdecl sosDIGIDrv_End( void );
extern   void  cdecl sosInt3( void );
extern   void  cdecl sosFARRet( WORD );
extern   void  cdecl sosDIGIFARRet( VOID );
#ifdef __cplusplus
}
#endif 

// memory locking prototypes
VOID  sosDIGICaps_Start( VOID );
VOID  sosDIGICaps_End( VOID );
VOID  sosDIGIErr_Start( VOID );
VOID  sosDIGIErr_End( VOID );
VOID  sosDIGITmr_Start( VOID );
VOID  sosDIGITmr_End( VOID );
VOID  sosDIGIStart_Start( VOID );
VOID  sosDIGIStart_End( VOID );
VOID  sosDIGIPlyng_Start( VOID );
VOID  sosDIGIPlyng_End( VOID );
VOID  sosDIGIRate_Start( VOID );
VOID  sosDIGIRate_End( VOID );
VOID  sosDIGIDone_Start( VOID );
VOID  sosDIGIDone_End( VOID );
VOID  sosDIGIDetec_Start( VOID );
VOID  sosDIGIDetec_End( VOID );
VOID  sosDIGIInit_Start( VOID );
VOID  sosDIGIInit_End( VOID );
VOID  sosDIGILoad_Start( VOID );
VOID  sosDIGILoad_End( VOID );
VOID  sosDIGICntl_Start( VOID );
VOID  sosDIGICntl_End( VOID );

#pragma pack()

#endif
