home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / detk45he.zip / shdd.h < prev    next >
C/C++ Source or Header  |  1999-03-15  |  17KB  |  319 lines

  1. /* NOINC */
  2. #ifdef __cplusplus
  3. extern "C" {
  4. #endif
  5.  
  6. #ifndef _SHDD_H_      /* notforh2inc */
  7. /* INC */
  8.  
  9. #define _SHDD_H_ 
  10. /***************************************************************************\
  11. *
  12. * Module Name: SHDD.H
  13. *
  14. * OS/2 2.0 Multimedia Extensions Stream Handler Device Driver Interfaces
  15. * Block defintions.
  16. *
  17. * Copyright (c) International Business Machines Corporation 1990,1991
  18. *                         All Rights Reserved
  19. *
  20. \***************************************************************************/
  21.  
  22. /****************************************************************************/
  23. /*                         D E F I N E S                                    */
  24. /****************************************************************************/
  25.  
  26. /* XLATOFF */
  27. typedef RC (FAR *PSHDFN)        (PVOID pParmIn);
  28. typedef RC (FAR *PDDCMDFN)      (PVOID pParmIn);
  29. /* XLATON */
  30. #ifdef XXXXX                                 /* Picked up by H2INC only    */
  31. typedef PVOID PSHDFN;                        /* Because previous function  */
  32. typedef PVOID PDDCMDFN;                      /* prototypes generate errors */
  33.                                              /* when parsed by H2INC.      */
  34. #endif                                       /*                            */
  35.  
  36.  
  37.  
  38.  
  39.  
  40. /****************************************************************************/
  41. /*                       S T R U C T U R E S                                */
  42. /****************************************************************************/
  43.  
  44. /* XLATOFF */
  45. #pragma pack(4)
  46. /* XLATON */
  47.  
  48. /****************************************************************************/
  49. /****   DDCMD Interface                                                    **/
  50. /****************************************************************************/
  51.  
  52. /* DDCMD Defines */
  53. #define     DDCMD_SETUP         0L
  54. #define     DDCMD_READ          1L
  55. #define     DDCMD_WRITE         2L
  56. #define     DDCMD_STATUS        3L
  57. #define     DDCMD_CONTROL       4L
  58. #define     DDCMD_REG_STREAM    5L
  59. #define     DDCMD_DEREG_STREAM  6L
  60.  
  61. typedef struct  _ddcmd_common_parm {            /* comm  - common to all DD cmds */
  62.                         ULONG   ulFunction;     /* Function requested by SH */
  63.                         HSTREAM hStream;        /* data stream instance     */
  64.                       } DDCMDCOMMON;
  65. typedef DDCMDCOMMON    FAR     *PDDCMDCOMMON;
  66.  
  67. typedef struct  _ddcmd_setup_parm {             /* setu */
  68.                         ULONG   ulFunction;     /* Function requested by SH */
  69.                         HSTREAM hStream;
  70.                         PVOID   pSetupParm;      /* see SETUP_PARM struct   */
  71.                         ULONG   ulSetupParmSize; /* see SETUP_PARM struct   */
  72.                       } DDCMDSETUP;
  73. typedef DDCMDSETUP     FAR     *PDDCMDSETUP;
  74.  
  75.                 /**********************************************/
  76.                 /* SETUP_PARM structure                       */
  77.                 /**********************************************/
  78. typedef struct  _SETUP_PARM { /*  setu_parm  - DDCMDSETUP parameter block    */
  79.                         ULONG   ulStreamTime; /* stream time in milliseconds */
  80.                         ULONG   ulFlags;      /* various flags (input/output)*/
  81.                         /* NOTE: new fields will be added here               */
  82.                       } SETUP_PARM;
  83. typedef SETUP_PARM  FAR  *PSETUP_PARM;
  84.  
  85.                 /**********************************************/
  86.                 /* ulFlag defines                             */
  87.                 /**********************************************/
  88. #define SETUP_RECURRING_EVENTS    0x00000001
  89.                 /* the device driver sets this flag on return from the     */
  90.                 /* DDCMD_SETUP command if the device driver assumes events */
  91.                 /* are recurring events---in this case, the stream handler */
  92.                 /* will not have to re-enable a recurring event each time  */
  93.                 /* the event occurs by sending a DDCMD_CONTROL command to  */
  94.                 /* the device driver.  this is useful when CUE_TIME or     */
  95.                 /* DATA_CUE events are expected to be used as RECURRING    */
  96.  
  97. typedef struct  _ddcmd_readwrite_parm {         /* read */
  98.                         ULONG   ulFunction;     /* Function requested by SH */
  99.                         HSTREAM hStream;
  100.                         PVOID   pBuffer;
  101.                         ULONG   ulBufferSize;
  102.                         PVOID   pProcessLin;
  103.                         BOOL    fEOS;           /* Is this the EOS buffer???*/
  104.                         ULONG   ulParm1;        /* Reserved for future use  */
  105.                         ULONG   ulParm2;        /* Reserved for future use  */
  106.                         ULONG   ulLength;
  107.                       } DDCMDREADWRITE;
  108. typedef DDCMDREADWRITE FAR     *PDDCMDREADWRITE;
  109. typedef PDDCMDREADWRITE FAR     *PPDDCMDREADWRITE;
  110.  
  111. typedef struct  _ddcmd_status_parm {            /* stat */
  112.                         ULONG   ulFunction;     /* Function requested by SH */
  113.                         HSTREAM hStream;
  114.                         PVOID   pStatus;        /* (output)ptr to current position time */
  115.                         ULONG   ulStatusSize;   /* (output)size of position time        */
  116.                       } DDCMDSTATUS;
  117. typedef DDCMDSTATUS    FAR     *PDDCMDSTATUS;
  118.  
  119.                 /**********************************************/
  120.                 /* STATUS_PARM structure                      */
  121.                 /**********************************************/
  122. typedef struct  _STATUS_PARM { /*  stat_parm  - DDCMDSTATUS parameter block                */
  123.                         ULONG   ulTime;       /* current position time in milliseconds     */
  124.                         /* NOTE: new fields will be added here                             */
  125.                       } STATUS_PARM;
  126. typedef STATUS_PARM  FAR  *PSTATUS_PARM;
  127.  
  128. typedef struct  _ddcmd_control_parm {           /* cont */
  129.                         ULONG   ulFunction;     /* Function requested by SH */
  130.                         HSTREAM hStream;
  131.                         HEVENT  hEvent;         /* used for EVENTS only                 */
  132.                         ULONG   ulCmd;
  133.                         PVOID   pParm;          /* see CONTROL_PARM structure  */
  134.                         ULONG   ulParmSize;     /* see CONTROL_PARM structure */
  135.                       } DDCMDCONTROL;
  136. typedef DDCMDCONTROL   FAR     *PDDCMDCONTROL;
  137.  
  138.                 /**********************************************/
  139.                 /* ulCmd defines                              */
  140.                 /**********************************************/
  141.                                           /* CHANGE and WAIT not implemented                   */
  142. #define DDCMD_START         1             /* start device                                      */
  143. #define DDCMD_STOP          2             /* stop device and return current position in pParm  */
  144. #define DDCMD_PAUSE         3             /* pause device and return current position in pParm */
  145. #define DDCMD_RESUME        4             /* resume device                                     */
  146. #define DDCMD_ENABLE_EVENT  5             /* ask PDD to create this event                      */
  147. #define DDCMD_DISABLE_EVENT 6             /* ask PDD to purge this event                       */
  148. #define DDCMD_PAUSE_TIME    7             /* pause time keeping, but not the stream            */
  149. #define DDCMD_RESUME_TIME   8             /* resume time keeping.                              */
  150.  
  151.                 /**********************************************/
  152.                 /* CONTROL_PARM structure                     */
  153.                 /**********************************************/
  154. typedef struct  _CONTROL_PARM { /*  cont_parm  - DDCMDCONTROL parameter block               */
  155.                         ULONG   ulTime;       /* time in milliseconds                       */
  156.                                               /* SH sets cuetime when ulCmd is ENABLE_EVENT */
  157.                                               /* PDD returns current time for STOP, PAUSE   */
  158.                         TIME_EVCB evcb;
  159.  
  160.                       } CONTROL_PARM;
  161. typedef CONTROL_PARM  FAR  *PCONTROL_PARM;
  162.  
  163.                 /*******************************************************************************/
  164.                 /* This structure is filled in by the amp mixer based on the instance          */
  165.                 /* data.                                                                       */
  166.                 /*******************************************************************************/
  167. typedef struct  _AUDIOMODE {    /* audio mode fields for DDCMDRegister */
  168.         LONG lSRate;            /* sample rate              */
  169.         LONG lBitsPerSRate;     /* bits per sample          */
  170.         SHORT sChannels;        /* Channels                 */
  171.                     } AUDIOMODE;
  172. typedef AUDIOMODE    FAR     *PAUDIOMODE;
  173.  
  174. typedef struct  _ddcmd_register_parm {          /* regi */
  175.                         ULONG   ulFunction;     /* Function requested by SH                    */
  176.                         HSTREAM hStream;        /* Stream handle needed @ interrupt time       */
  177.                         ULONG   ulSysFileNum;   /* Device Handle so pdd can map device instance to hstream */
  178.                         PSHDFN  pSHDEntryPoint; /* Stream handler entry point                  */
  179.                         ULONG   ulStreamOperation; /* SH input Record or play                  */
  180.                         SPCBKEY spcbkey;
  181.                         ULONG   ulBufSize;      /* PDD output (optional) buffer size in bytes for SPCB */
  182.                         ULONG   ulNumBufs;      /* PDD output (optional) # of buffers for SPCB         */
  183.                         ULONG   ulAddressType;  /* PDD output (required) addr ptr type to data buffer  */
  184.                         ULONG   ulBytesPerUnit; /*PDD output (required)                                */
  185.                         MMTIME  mmtimePerUnit;  /*PDD output (required)                                */
  186.                         E_DCB   dcbAudio;       /* SH input Device Control Block */
  187.                         HID     hid;            /* SH input stream handler id */
  188.                         AUDIOMODE AudioMode;    /* PPC - Audio mode data structure */
  189.                       } DDCMDREGISTER;
  190. typedef DDCMDREGISTER  FAR     *PDDCMDREGISTER;
  191.  
  192.                 /*****************************/
  193.                 /* ulStreamOperation  defines*/
  194.                 /*****************************/
  195. #define STREAM_OPERATION_MASK     0xC000
  196. #define STREAM_OPERATION_CONSUME  0x8000
  197. #define STREAM_OPERATION_PRODUCE  0xC000
  198.  
  199.                 /*******************************************************************************/
  200.                 /* ulAddressType  defines                                                      */
  201.                 /* The PDD will tell the SH what type of address ptr it expects the data buffer*/
  202.                 /* to be.  The SH will then request this address type to the SSM, so that the  */
  203.                 /* SSM will send the correct type of each buffer request.                      */
  204.                 /*******************************************************************************/
  205. #define ADDRESS_TYPE_VIRTUAL    0L
  206. #define ADDRESS_TYPE_PHYSICAL   1L              /*default                  */
  207. #define ADDRESS_TYPE_LINEAR     2L
  208.  
  209. typedef struct  _ddcmd_deregister_parm {        /* dere */
  210.                         ULONG   ulFunction;     /* Function requested by SH */
  211.                         HSTREAM hStream;        /* Stream handle needed @ interrupt time */
  212.                       } DDCMDDEREGISTER;
  213. typedef DDCMDDEREGISTER FAR    *PDDCMDDEREGISTER;
  214.  
  215.  
  216.  
  217. /****************************************************************************/
  218. /**** RING 0 Stream Handler SHD Interfaces                                ***/
  219. /****************************************************************************/
  220.  
  221. /* RING 0 Stream Handler  SHD's:                                            */
  222. #define     SHD_REPORT_INT      0L      /* PDD reports interrupt has arrived*/
  223. #define     SHD_REPORT_EVENT    1L      /* PDD reports cuetime has arrived  */
  224.  
  225. typedef struct  _shd_common_parm {              /* shdc */
  226.                         ULONG   ulFunction;     /* Function requested by PDD               */
  227.                         HSTREAM hStream;        /* Stream handle needed @ interrupt time   */
  228.                         }SHD_COMMON;
  229. typedef SHD_COMMON      FAR  *PSHD_COMMON;
  230.  
  231. typedef struct  _shd_reportint_parm {           /* repi */
  232.                         ULONG   ulFunction;     /* Function requested by PDD*/
  233.                         HSTREAM hStream;        /* so SH knows which stream to process     */
  234.                         PVOID   pBuffer;        /* return ptr to last used buffer          */
  235.                         ULONG   ulFlag;         /* reason for interrupt     */
  236.                         ULONG   ulStatus;       /* rc or bytes read/written */
  237.                         ULONG   ulStreamTime;   /* time in milliseconds of stream position  */
  238.                       } SHD_REPORTINT;
  239. typedef SHD_REPORTINT   FAR  *PSHD_REPORTINT;
  240.  
  241.                 /*******************/
  242.                 /* ulFlag settings */
  243.                 /*******************/
  244. #define ERROR               0x80L
  245. #define STREAM_STOP_NOW     0x40L
  246. #define SHD_READ_COMPLETE   1L
  247. #define SHD_WRITE_COMPLETE  2L
  248.  
  249. typedef struct  _shd_reportevent_parm {         /* repe */
  250.                         ULONG   ulFunction;     /* Function requested by PDD*/
  251.                         HSTREAM hStream;        /* so SH knows which stream to process     */
  252.                         HEVENT  hEvent;         /* event handle pass back to stream handler*/
  253.                         ULONG   ulStreamTime;   /* time in milliseconds of stream position  */
  254.                       } SHD_REPORTEVENT;
  255. typedef SHD_REPORTEVENT FAR  *PSHD_REPORTEVENT;
  256.  
  257.  
  258.  
  259. /****************************************************************************/
  260. /**** RING 3 Stream Handler SHD Interfaces                                ***/
  261. /****************************************************************************/
  262.  
  263. /* RING 3 Stream Handler  SHD's: (Uses SpiSendMsg as interface) */
  264. #define     SHC_REPORT_INT      0x80000000L   /* ulMsgType for SHD_REPORT_INT */
  265. #define     SHC_REPORT_EVENT    0x80000001L   /* ulMsgType for SHD_REPORT_EVENT */
  266.  
  267. /**********************************************
  268.  *
  269.  * MSG_REPORTINT Control Block.
  270.  *  pMsg field of SpiSendMsg api
  271.  *
  272.  **********************************************/
  273. typedef struct  _MSG_REPORTINT { /* msgrepi */
  274.    ULONG   ulMsgLen;       /* Length of structure                     */
  275.    PVOID   pBuffer;        /* return ptr to last used buffer          */
  276.    ULONG   ulFlag;         /* reason for interrupt                    */
  277.    ULONG   ulStatus;       /* rc or bytes read/written                */
  278.    ULONG   ulStreamTime;   /* time in milliseconds of stream position */
  279.    } MSG_REPORTINT, FAR  *PMSG_REPORTINT;
  280.  
  281.    /* For ulFlag defines, refer to the _shd_reportint_parm structure */
  282.  
  283.  
  284.  
  285. /**********************************************
  286.  *
  287.  * MSG_REPORTEVENT Control Block.
  288.  *  pMsg field of SpiSendMsg api
  289.  *
  290.  **********************************************/
  291. typedef struct  _MSG_REPORTEVENT { /* msgrepe */
  292.    ULONG   ulMsgLen;       /* Length of structure                      */
  293.    HEVENT  hevent;         /* event handle pass back to stream handler */
  294.    ULONG   ulStreamTime;   /* time in milliseconds of stream position  */
  295.    } MSG_REPORTEVENT, FAR  *PMSG_REPORTEVENT;
  296.  
  297.  
  298.  
  299. /* XLATOFF */
  300. #pragma pack()
  301. /* XLATON */
  302.  
  303. /****************************************************************************/
  304. /*              F U N C T I O N   P R O T O T Y P E S                       */
  305. /****************************************************************************/
  306.  
  307. /* XLATOFF */
  308. RC  FAR         SHDEntryPoint(PSHD_COMMON pCommon);
  309. RC  FAR         DDCMDEntryPoint(PDDCMDCOMMON pCommon);
  310. /* XLATON  */
  311.  
  312. /* NOINC */
  313. #endif                /* notforh2inc */
  314.  
  315. #ifdef __cplusplus
  316. }
  317. #endif
  318. /* INC */            
  319.