| 1 | /* SCCSID = %W% %E% */
|
|---|
| 2 | /****************************************************************************
|
|---|
| 3 | * *
|
|---|
| 4 | * Copyright (c) IBM Corporation 1994 - 1997. *
|
|---|
| 5 | * (c) Copyright Media Vision Corporation 1993. *
|
|---|
| 6 | * *
|
|---|
| 7 | * The following IBM OS/2 source code is provided to you solely for the *
|
|---|
| 8 | * the purpose of assisting you in your development of OS/2 device drivers. *
|
|---|
| 9 | * You may use this code in accordance with the IBM License Agreement *
|
|---|
| 10 | * provided in the IBM Device Driver Source Kit for OS/2. *
|
|---|
| 11 | * *
|
|---|
| 12 | ****************************************************************************/
|
|---|
| 13 | /**@internal %W%
|
|---|
| 14 | * Provides lowest level IO routines for FMSYNTH operation.
|
|---|
| 15 | * @version %I%
|
|---|
| 16 | * @context
|
|---|
| 17 | * Unless otherwise noted, all interfaces are Ring-0, 16-bit, kernel stack.
|
|---|
| 18 | * @notes
|
|---|
| 19 | * @history
|
|---|
| 20 | */
|
|---|
| 21 |
|
|---|
| 22 | extern "C" {
|
|---|
| 23 | #define INCL_DOSINFOSEG
|
|---|
| 24 | #define INCL_BASE
|
|---|
| 25 | #include <os2.h>
|
|---|
| 26 | #include <conio.h> // outp()
|
|---|
| 27 | #include "iodelay.h" // iodelay()
|
|---|
| 28 | #include <devhelp.h>
|
|---|
| 29 | }
|
|---|
| 30 | #include "fmsynth.hpp"
|
|---|
| 31 |
|
|---|
| 32 | #define WAIT_OPL3_ADDR_LATCH 7 // 3.5 æs
|
|---|
| 33 | #define WAIT_OPL3_DATA_LATCH 7 // 3.5 æs
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 | #if 0
|
|---|
| 37 | /* -------------------------- SndOutput1 -
|
|---|
| 38 | ** Set the register at internal chip address 'addr' to the value 'data'.
|
|---|
| 39 | ** Also perform 'data register-to-data register' write delay.
|
|---|
| 40 | */
|
|---|
| 41 | void FMSYNTH::SndOutput1 (USHORT addr, USHORT data)
|
|---|
| 42 | {
|
|---|
| 43 | outp( _port, addr );
|
|---|
| 44 | iodelay( WAIT_OPL3_ADDR_LATCH );
|
|---|
| 45 | outp( _port+1, data );
|
|---|
| 46 | iodelay( WAIT_OPL3_DATA_LATCH );
|
|---|
| 47 | }
|
|---|
| 48 |
|
|---|
| 49 | /* ------------------------- SndOpl3_2_1 -
|
|---|
| 50 | ** Set the register at internal chip address 'addr' to the value 'data'.
|
|---|
| 51 | ** Also perform 'data register-to-data register' write delay.
|
|---|
| 52 | ** This function set the other half of the OPL-3 chip
|
|---|
| 53 | */
|
|---|
| 54 | void FMSYNTH::SndOpl3_2_1 ( USHORT addr, USHORT data)
|
|---|
| 55 | {
|
|---|
| 56 | outp( _port+2, addr );
|
|---|
| 57 | iodelay( WAIT_OPL3_ADDR_LATCH );
|
|---|
| 58 | outp( _port+3, data );
|
|---|
| 59 | iodelay( WAIT_OPL3_DATA_LATCH );
|
|---|
| 60 | }
|
|---|
| 61 | #endif
|
|---|
| 62 |
|
|---|
| 63 |
|
|---|
| 64 | /*
|
|---|
| 65 | ** Rudi: Write data to chip with neccessary delays.
|
|---|
| 66 | ** Port address is calculated by the caller.
|
|---|
| 67 | */
|
|---|
| 68 | void FMSYNTH::OplWrite(USHORT usPort, UCHAR uchOffset, UCHAR uchData)
|
|---|
| 69 | {
|
|---|
| 70 | #if 0
|
|---|
| 71 | ULONG ulTemp = usPort | ((ULONG)uchOffset << 16) | ((ULONG)uchData << 24);
|
|---|
| 72 | DevHelp_RAS(240, 240, sizeof(ulTemp), (PBYTE)&ulTemp);
|
|---|
| 73 | #endif
|
|---|
| 74 |
|
|---|
| 75 | outp( usPort++, uchOffset );
|
|---|
| 76 | iodelay( WAIT_OPL3_ADDR_LATCH );
|
|---|
| 77 | outp( usPort, uchData );
|
|---|
| 78 | iodelay( WAIT_OPL3_DATA_LATCH );
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| 81 |
|
|---|