Changeset 151 for sbliveos2


Ignore:
Timestamp:
May 28, 2000, 6:50:46 PM (25 years ago)
Author:
sandervl
Message:

update

Location:
sbliveos2/trunk
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • sbliveos2/trunk/Build.txt

    r150 r151  
    1616OS/2 audio driver.
    1717It also tries to give some information about the architecture of the driver
    18 and some of technical details.
     18and explain some technical details.
    1919
    2020However, it does not attempt to explain everything. People that are not
  • sbliveos2/trunk/ChangeLog

    r150 r151  
    11$Id$
     2
     3 2000-05-20: Sander van Leeuwen <sandervl@xs4all.nl>
     4        - Added RTMIDI support
     5
     6 2000-05-18: Sander van Leeuwen <sandervl@xs4all.nl>
     7        - Added /D debug option for sblive32.sys (prints code start + end address)
     8
     9 2000-05-15: Sander van Leeuwen <sandervl@xs4all.nl>
     10        - Replaced Resource Manager detection with manual PCI detection
    211
    312 2000-04-28: Sander van Leeuwen <sandervl@xs4all.nl>
  • sbliveos2/trunk/drv16/init.cpp

    r147 r151  
    6363#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002UL
    6464#endif
    65 #define PCI_ID  ((PCI_VENDOR_ID_CREATIVE<<16UL)|PCI_DEVICE_ID_CREATIVE_EMU10K1)
     65#define PCI_ID  ((PCI_DEVICE_ID_CREATIVE_EMU10K1<<16UL)|PCI_VENDOR_ID_CREATIVE)
    6666
    6767// Default MIDI timer interval, milliseconds.
     
    133133      memcpy(phdr->abName,szCL_DevName,8);   // yes, copy it to the dev header
    134134
    135    pRM = new ResourceManager();        // Create the RM object.
     135   pRM = new ResourceManager(PCI_ID);        // Create the RM object.
    136136   if (! pRM) {
    137137      return;
     
    156156   // First create a timer, then the HW object.
    157157   TIMER* pMPUTimer =
    158        new TIMER( NULL, MIDI_TimerInterval, STREAM_MPU401_PLAY );
     158       new TIMER(NULL, MIDI_TimerInterval, STREAM_MPU401_PLAY );
    159159   if (pMPUTimer->eState() != TIMER_Disabled)
    160160         new MPU_401(pMPUTimer);
  • sbliveos2/trunk/drv16/mpu401.cpp

    r147 r151  
    4040#include "parse.h"
    4141#include "ossidc.h"
     42#include <dbgos2.h>
     43
     44#define TIMEOUT   60000
    4245
    4346
     
    4750   MIDIAUDIO ( AUDIOHW_MPU401_PLAY, pTimer )
    4851{
    49    static char szName[] = "SBLive #";  // Instance name for RTMIDI.  A number will be appended.
     52   static char szName[] = "SBLive RTMIDI #";  // Instance name for RTMIDI.  A number will be appended.
    5053   static char szSuffix[] = "0";       // Printable char that is appended to szName.
    5154
    5255   // RTMIDI (MIDI.SYS) related stuff
    53    ++szSuffix[0];                      // Bump number in instance name.
     56////   ++szSuffix[0];                      // Bump number in instance name.
    5457   strcpy( szRTMIDI_Name, szName );    // Setup instance name.
    5558   strcat( szRTMIDI_Name, szSuffix );  // Append ASCII number to instance name.
    56    ulRTMIDI_Caps = MIDICAPSA_INPUT;    // Set RTMIDI caps.
    57    // When we have an IRQ and a send capability, add next line.
    58    // ulCapabilities |= MIDICAPSA_OUTPUT;
     59   ulRTMIDI_Caps = MIDICAPSA_INPUT | MIDICAPSA_OUTPUT;    // Set RTMIDI caps.
    5960
    6061   midiOutStreamId = 0;
     
    124125int MPU_401::writeByte(BYTE b)
    125126{
    126    //TODO:
     127   if(!midiOutStreamId) {
     128        DebugInt3();
     129        return 0;
     130   }
     131   unsigned int i;
     132
     133   for (i=0; i<TIMEOUT; i++) {
     134        if(OSS16_WriteMidiByte(midiOutStreamId, b)) {
     135                return 1;
     136        }
     137        iodelay(1);
     138   }
    127139   return 0;
    128140}
     
    132144   //TODO:
    133145   return -1;
     146}
     147
     148void MPU_401::processIrq(unsigned long streamid)
     149{
     150 char buffer[64];
     151 int  bufsize;
     152
     153   MIDIAUDIO* pma = (MIDIAUDIO *) pAudioHWList->Head();
     154   while (pma) {
     155      if((pma->ulDeviceType == AUDIOHW_MPU401_CAPTURE) ||
     156        (pma->ulDeviceType == AUDIOHW_MPU401_PLAY)) {
     157                break;
     158      }
     159      pma = (MIDIAUDIO *) pma->pNext;
     160   }
     161   if(pma == NULL) {
     162        dprintf(("MPU_401::processIrq: mpu device found!!"));
     163        return;
     164   }
     165
     166   while(TRUE) {
     167        bufsize = OSS16_ReadMidiBytes(streamid, &buffer[0], sizeof(buffer));
     168        for(int i=0;i<bufsize;i++) {
     169                pma->pfnSendByte(pma->ulRTMIDI_Handle, buffer[i]);
     170        }
     171        if(bufsize != sizeof(buffer)) {
     172                break;
     173        }
     174   }   
    134175}
    135176
     
    175216USHORT MPU_401::RTMIDI_OpenReceive(void)
    176217{
     218   if(midiOutStreamId == 0) {
     219          midiOutStreamId = OSS16_OpenMidiStream(MIDI_RECEIVE);
     220   }
     221   return (midiOutStreamId) ? 0 : MIDIERRA_HW_FAILED;
     222}
     223
     224USHORT MPU_401::RTMIDI_OpenSend(void)
     225{
    177226   if(midiInStreamId == 0) {
    178           midiInStreamId = OSS16_OpenMidiStream(MIDI_RECEIVE);
     227          midiInStreamId = OSS16_OpenMidiStream(MIDI_SEND);
    179228   }
    180229   return (midiInStreamId) ? 0 : MIDIERRA_HW_FAILED;
    181230}
    182231
    183 USHORT MPU_401::RTMIDI_OpenSend(void)
    184 {
    185    if(midiOutStreamId == 0) {
    186           midiOutStreamId = OSS16_OpenMidiStream(MIDI_SEND);
    187    }
    188    return (midiOutStreamId) ? 0 : MIDIERRA_HW_FAILED;
    189 }
    190 
    191232USHORT MPU_401::RTMIDI_CloseReceive(void)
    192233{
    193    OSS16_CloseMidiStream(MIDI_RECEIVE, midiInStreamId);
     234   if(midiOutStreamId) {
     235        OSS16_CloseMidiStream(MIDI_RECEIVE, midiOutStreamId);
     236        midiOutStreamId = 0;
     237   }
    194238   return 0;
    195239}
     
    197241USHORT MPU_401::RTMIDI_CloseSend(void)
    198242{
    199    OSS16_CloseMidiStream(MIDI_SEND, midiOutStreamId);
    200    return 0;
    201 }
    202 
     243   if(midiInStreamId) {
     244        OSS16_CloseMidiStream(MIDI_SEND, midiInStreamId);
     245        midiInStreamId = 0;
     246   }
     247   return 0;
     248}
     249
  • sbliveos2/trunk/drv16/mpu401.hpp

    r147 r151  
    4949   MPU_401( TIMER* pTimer );
    5050
     51   static void processIrq(unsigned long streamid);
     52
    5153   // Standard MIDI channel commands.
    5254   virtual void noteOff( BYTE mchan, BYTE note, BYTE velocity );
  • sbliveos2/trunk/drv16/ossidc16.cpp

    r147 r151  
    2424#include "stream.hpp"
    2525#include "wavestrm.hpp"
     26#include "mpu401.hpp"
    2627#include "malloc.h"
    2728#include <ossidc.h>
     
    8485ULONG OSS16_OpenMidiStream(MIDITYPE midiType)
    8586{
    86    return CallOSS32(IDC32_STREAM_OPEN, 0x666, (midiType == MIDI_RECEIVE) ? OSS_STREAM_MIDIIN : OSS_STREAM_MIDIOUT, 0, 0, 0);
     87   return CallOSS32(IDC32_STREAM_OPEN, 0x666, (midiType == MIDI_RECEIVE) ? OSS_STREAM_MIDIOUT: OSS_STREAM_MIDIIN, 0, 0, 0);
     88}
     89//******************************************************************************
     90//******************************************************************************
     91BOOL OSS16_WriteMidiByte(ULONG streamid, BYTE midiByte)
     92{
     93   return CallOSS32(IDC32_MIDI_WRITE, 0x666, OSS_STREAM_MIDIOUT, streamid, midiByte, 0);
     94}
     95//******************************************************************************
     96//******************************************************************************
     97int OSS16_ReadMidiBytes(ULONG streamid, char far *buffer, int bufsize)
     98{
     99   return CallOSS32(IDC32_MIDI_READ, 0x666, OSS_STREAM_MIDIIN, streamid, (ULONG)buffer, bufsize);
    87100}
    88101//******************************************************************************
     
    90103void OSS16_CloseMidiStream(MIDITYPE midiType, ULONG streamid)
    91104{
    92    CallOSS32(IDC32_STREAM_CLOSE, 0x666, (midiType == MIDI_RECEIVE) ? OSS_STREAM_MIDIIN : OSS_STREAM_MIDIOUT, streamid, 0, 0);
     105   CallOSS32(IDC32_STREAM_CLOSE, 0x666, (midiType == MIDI_RECEIVE) ? OSS_STREAM_MIDIOUT : OSS_STREAM_MIDIIN, streamid, 0, 0);
    93106}
    94107//******************************************************************************
     
    309322        PWAVESTREAM pStream;
    310323
    311         pStream = (PWAVESTREAM)FindActiveStream((packet->process.type) ? STREAM_WAVE_PLAY : STREAM_WAVE_CAPTURE,
     324        if(packet->process.type == IDC16_MIDI_IRQ) {
     325                MPU_401::processIrq(packet->process.streamid);
     326                break;
     327        }
     328
     329        pStream = (PWAVESTREAM)FindActiveStream((packet->process.type == IDC16_WAVEOUT_IRQ) ? STREAM_WAVE_PLAY : STREAM_WAVE_CAPTURE,
    312330                                                 packet->process.streamid);
    313331        if(pStream) {
  • sbliveos2/trunk/drv16/rm.cpp

    r142 r151  
    4040#include <string.h>                    // _fmemset()
    4141#include "malloc.h"                    // malloc()
    42 
     42#include <dbgos2.h>
    4343
    4444char DeviceName[64] = "Creative Labs SoundBlaster Live";
     
    9696 *  allocate resources.
    9797 */
    98 ResourceManager::ResourceManager ( )
     98ResourceManager::ResourceManager(ULONG pciId)
    9999{
    100100   APIRET rc;
     
    141141           ((pGIS->uchMajorVersion == 20) && (pGIS->uchMinorVersion > 30)) );
    142142   }
    143 }
    144 
    145 bool ResourceManager::bIsDevDetected ( DEVID DevID , ULONG ulSearchFlags, bool fPciDevice)
     143
     144   if(getPCIConfiguration(pciId) == FALSE) {
     145      _state = rmDriverFailed;
     146   }
     147
     148}
     149
     150#pragma off (unreferenced)
     151bool ResourceManager::bIsDevDetected( DEVID DevID , ULONG ulSearchFlags, bool fPciDevice)
     152#pragma on (unreferenced)
    146153/*
    147154;  PURPOSE: Search the Resource Manager's "current detected" tree for
     
    158165*/
    159166{
     167#if 1
     168   //Manual detection in ResourceManager class constructor;
     169   return _state == rmDriverCreated;
     170#else
    160171   BOOL bReturn = FALSE;
    161172   NPHANDLELIST pHandleList = 0;
     
    173184
    174185   return bReturn ;
     186#endif
    175187}
    176188
     
    190202 * @return NULL on error situations.
    191203 */
     204#pragma off (unreferenced)
    192205LDev_Resources* ResourceManager::GetRMDetectedResources ( DEVID DevID , ULONG ulSearchFlags, bool fPciDevice)
    193 {
     206#pragma on (unreferenced)
     207{
     208#if 1
     209   LDev_Resources* pResources = 0;     // Used to return result.
     210
     211   pResources = new LDev_Resources();
     212   if (!pResources) return NULL;
     213
     214   pResources->vClear();
     215
     216   //Fill in resources read from PCI Configuration space
     217   pResources->uIRQLevel[0]  = pciConfigData->InterruptLine;
     218   if(pResources->uIRQLevel[0] == 0 || pResources->uIRQLevel[0] > 15)  {
     219        dprintf(("Invalid PCI irq %x", (int)pResources->uIRQLevel[0]));
     220        DebugInt3();
     221        return NULL;
     222   }
     223   pResources->uIOBase[0]   = (USHORT)(pciConfigData->Bar0 & 0xFFFFFF00);
     224   pResources->uIOLength[0] = 0x20;
     225
     226   return pResources;
     227#else
    194228   LDev_Resources* pResources = 0;     // Used to return result.
    195229   NPRM_GETNODE_DATA pNode = 0;        // Node resource data for spec'd DEVID's.
     
    254288   delete pResources;
    255289   return NULL;
     290#endif
    256291}
    257292
     
    723758}
    724759
     760
     761#define PCI_CONFIG_ENABLE       0x80000000
     762#define PCI_CONFIG_ADDRESS      0xCF8
     763#define PCI_CONFIG_DATA         0xCFC
     764
     765unsigned long _inpd(unsigned short);
     766#pragma aux _inpd "_inpd" \
     767  parm   [dx] \
     768  value  [dx ax];
     769
     770//COMPILER BUG: bx cx == cx bx
     771void _outpd(unsigned short, unsigned long);
     772#pragma aux _outpd "_outpd" \
     773  parm   [dx] [cx bx] \
     774  modify [ax dx];
     775
     776BOOL ResourceManager::getPCIConfiguration(ULONG pciId)
     777{
     778 ULONG devNr, busNr, funcNr, temp, cfgaddrreg, detectedId;
     779 BOOL  found = FALSE;
     780
     781        cfgaddrreg = _inpd(PCI_CONFIG_ADDRESS);
     782        for(busNr=0;busNr<255;busNr++)     //BusNumber<255
     783        {
     784                for(devNr=0;devNr<32;devNr++)
     785                {
     786                        for(funcNr=0;funcNr<8;funcNr++)
     787                        {
     788                                temp = ((ULONG)((ULONG)devNr<<11UL) + ((ULONG)busNr<<16UL) + ((ULONG)funcNr << 8UL));
     789
     790                                _outpd(PCI_CONFIG_ADDRESS, PCI_CONFIG_ENABLE|temp);
     791                                detectedId = _inpd(PCI_CONFIG_DATA);
     792                                if(detectedId == pciId)
     793                                {
     794                                        found = TRUE;
     795                                        break;
     796                                }
     797                        }
     798                        if(found) break;
     799                }
     800                if(found) break;
     801        }
     802
     803        if(!found) {
     804                _outpd(PCI_CONFIG_ADDRESS, cfgaddrreg);
     805                return FALSE;
     806        }
     807
     808        for(int i=0;i<64;i++)
     809        {
     810                temp = ((ULONG)((ULONG)devNr<<11UL) + ((ULONG)busNr<<16UL) + ((ULONG)funcNr << 8UL) + (i << 2));
     811                _outpd(PCI_CONFIG_ADDRESS, PCI_CONFIG_ENABLE|temp);
     812
     813                PCIConfig[i] = _inpd(PCI_CONFIG_DATA);
     814        }
     815        _outpd(PCI_CONFIG_ADDRESS, cfgaddrreg);
     816
     817        pciConfigData = (PCIConfigData *)&PCIConfig[0];
     818
     819        if(pciConfigData->Bar0 == 0 || pciConfigData->Bar0 == 0xFFFFFFFF)
     820        {
     821                DebugInt3();
     822                return(FALSE);
     823        }
     824        return TRUE;
     825}
     826
  • sbliveos2/trunk/drv16/rm.hpp

    r142 r151  
    8383
    8484
     85typedef struct
     86{
     87        USHORT VendorID;
     88        USHORT DeviceID;
     89        USHORT Command;
     90        USHORT Status;
     91        UCHAR  RevisionID;
     92        UCHAR  filler1[7];
     93        ULONG  Bar0;
     94        ULONG  Bar1;
     95        ULONG  filler2[5];
     96        USHORT SubsystemVendorID;
     97        USHORT SubsystemID;
     98        ULONG  filler3[3];
     99        UCHAR  InterruptLine;
     100        UCHAR  InterruptPin;
     101        UCHAR  Max_Gnt;
     102        UCHAR  Max_Lat;
     103        UCHAR  TRDY_Timeout;
     104        UCHAR  Retry_Timeout;
     105        UCHAR  filler4[0x9a];
     106        UCHAR  CapabilityID;
     107        UCHAR  NextItemPtr;
     108        USHORT PowerMgtCapability;
     109        USHORT PowerMgtCSR;
     110} PCIConfigData;
     111
    85112// This value indicates an empty entry in an LDev_Resource data item.
    86113const USHORT NoIOValue = 0xffff;
     
    126153 public:                        // at bottom of file.
    127154
    128    ResourceManager ( void );
     155   ResourceManager ( ULONG pciId );
    129156        // Register the device driver (this activates the RM interface).
    130157        // Intention is that only one ResourceManager object is created
     
    185212   APIRET _rmCreateDevice( PSZ pszName, NPAHRESOURCE pahResource );
    186213
     214   BOOL   getPCIConfiguration(ULONG pciId);
     215
     216   ULONG          PCIConfig[64];
     217   PCIConfigData *pciConfigData;
     218
    187219};
    188220
  • sbliveos2/trunk/drv16/timer.cpp

    r142 r151  
    207207         }
    208208      }
     209#endif
    209210
    210211      // Timer IRQ hook didn't work for some reason, use system timer.
     
    215216         _eState = TIMER_Stopped;
    216217      }
    217    }  // End of setup for interrupt operation, executed for 1st Timer only.
    218 #endif
     218//   }  // End of setup for interrupt operation, executed for 1st Timer only.
    219219
    220220   // If good creation, add Timer to global timer list & reset all time vbls.
  • sbliveos2/trunk/drv16/vddentry.asm

    r142 r151  
    103103_OSSIDC_ENTRY ENDP
    104104
     105        PUBLIC  _inpd
     106_inpd proc near
     107        in   eax, dx
     108        mov  dx, ax
     109        shr  eax, 16
     110        xchg ax, dx
     111        ret
     112_inpd endp
     113
     114        PUBLIC  _outpd
     115_outpd proc near
     116        mov ax, cx
     117        shl eax, 16
     118        mov ax, bx
     119        out dx, eax
     120        ret
     121_outpd endp
     122
    105123_TEXT   ENDS
    106124
  • sbliveos2/trunk/drv16/wavestrm.cpp

    r147 r151  
    258258        OSS16_StreamGetPos(this, &ulCurBytesProcessed);
    259259        if(ulCurBytesProcessed == 0) {
    260                 //shouldn't happen (TODO recording)
     260                //shouldn't happen
    261261                DebugInt3();
    262262                return;
  • sbliveos2/trunk/drv32/idc.c

    r142 r151  
    105105  }
    106106
     107  case IDC32_MIDI_WRITE:
     108        return OSS32_StreamMidiWrite(pPacket->midiwrite.streamid, pPacket->midiwrite.midiByte);
     109
     110  case IDC32_MIDI_READ:
     111        return OSS32_StreamMidiRead(pPacket->midiread.streamid, (char NEAR *)__StackToFlat((ULONG)pPacket->midiread.buffer), pPacket->midiread.bufsize);
     112
    107113  case IDC32_STREAM_RESET:
    108114        return OSS32_StreamReset(pPacket->startstop.streamtype, pPacket->startstop.streamid);
  • sbliveos2/trunk/drv32/init.c

    r142 r151  
    2727#include <os2.h>
    2828}
     29#include <string.h>
    2930
    3031// Device support
     
    4849const char szCopyRight1[]= "Copyright 1999, 2000 Creative Labs, Inc.\r\n";
    4950const char szCopyRight2[]= "Copyright 2000 Sander van Leeuwen (OS/2 Port)\r\n\r\n";
    50 
     51const char szCodeStartEnd[] = "Code 0x%0x - 0x%0x\r\n\r\n";
     52 
    5153typedef struct {
    5254 USHORT MsgLength;
     
    5557
    5658extern "C" WORD32 MSG_TABLE32;
     59
     60extern "C" int sprintf (char *buffer, const char *format, ...);
    5761
    5862//Print messages with DosWrite when init is done or has failed (see startup.asm)
     
    149153
    150154// Initialize device driver
    151 
    152155WORD32 DiscardableInit(RPInit __far* rp) 
    153156{
     157 char        debugmsg[64];
     158 char FAR48 *args;
     159
    154160  GetTKSSBase();
    155161  if(LockSegments()) {
    156     WriteString(ERR_ERROR, sizeof(ERR_ERROR)-1);
    157     WriteString(ERR_LOCK, sizeof(ERR_LOCK)-1);
    158     return RPDONE | RPERR;
     162        WriteString(ERR_ERROR, sizeof(ERR_ERROR)-1);
     163        WriteString(ERR_LOCK, sizeof(ERR_LOCK)-1);
     164        return RPDONE | RPERR;
    159165  }
    160166
     
    167173  WriteString(szCopyRight1, sizeof(szCopyRight1)-1);
    168174  WriteString(szCopyRight2, sizeof(szCopyRight2)-1);
     175
     176  args = __Make48Pointer(rp->In.Args);
     177  while(*args && *args == ' ') args++;
     178  while(*args && *args != ' ') args++;
     179  while(*args && *args == ' ') args++;
     180  while(*args && *args != '/') args++;
     181  if(*args) args++;
     182
     183  if(*args == 'D' || *args == 'd') {
     184        sprintf(debugmsg, szCodeStartEnd, OffsetBeginCS32, OffsetFinalCS32);
     185        WriteString(debugmsg, strlen(debugmsg));
     186  }
    169187
    170188  // Complete the installation
  • sbliveos2/trunk/drv32/sbseg.inc

    r142 r151  
    99CODE32 segment dword public use32 'CODE'
    1010CODE32 ends
     11
     12_TEXT segment dword public use32 'CODE'
     13_TEXT ends
    1114
    1215BSS32   segment dword use32 public 'BSS'
     
    3740DGROUP  group DATA32, CONST32, C_COMMON, c_common, CONST2, CONST, BSS32, _BSS
    3841
     42CGROUP  group CODE32, _TEXT
  • sbliveos2/trunk/include/linux/delay.h

    r142 r151  
    2828#endif
    2929
    30 #include <iodelay.h>
     30void iodelay(unsigned long);
     31#pragma aux iodelay parm nomemory [ecx] modify nomemory exact [eax ecx];
    3132
    3233#define mdelay(n) iodelay(n*2)
  • sbliveos2/trunk/include/ossidc.h

    r148 r151  
    7171                ULONG   volume;
    7272        } mixer;
     73        struct {
     74                ULONG   streamtype;
     75                ULONG   streamid;
     76                ULONG   midiByte;
     77        } midiwrite;
     78        struct {
     79                ULONG   streamtype;
     80                ULONG   streamid;
     81                ULONG   buffer;
     82                ULONG   bufsize;
     83        } midiread;
    7384        struct {
    7485                ULONG   param1;
     
    121132#define IDC32_STREAM_IOCTL              10
    122133#define IDC32_STREAM_MIXER              11
     134#define IDC32_MIDI_WRITE                12
     135#define IDC32_MIDI_READ                 13
    123136
    124137#define MIX_SETMASTERVOL                0
     
    164177#define IDC16_VMFREE                    11
    165178#define IDC16_PROCESS                   12
     179
     180#define IDC16_WAVEIN_IRQ                0
     181#define IDC16_WAVEOUT_IRQ               1
     182#define IDC16_MIDI_IRQ                  2
    166183
    167184#define MAX_RES_IRQ     2
     
    237254ULONG OSS32_StreamAddBuffer(ULONG streamtype, ULONG streamid, ULONG buffer, ULONG size);
    238255ULONG OSS32_SetVolume(ULONG streamtype, ULONG streamid, ULONG cmd, ULONG volume);
     256ULONG OSS32_StreamMidiWrite(ULONG streamid, ULONG midiByte);
     257ULONG OSS32_StreamMidiRead(ULONG streamid, char NEAR *buffer, ULONG bufsize);
    239258
    240259//Sets file id in current task structure
     
    263282} MIDITYPE;
    264283ULONG OSS16_OpenMidiStream(MIDITYPE midiType);
    265 void OSS16_CloseMidiStream(MIDITYPE midiType, ULONG streamid);
     284void  OSS16_CloseMidiStream(MIDITYPE midiType, ULONG streamid);
     285BOOL  OSS16_WriteMidiByte(ULONG streamid, BYTE midiByte);
     286int   OSS16_ReadMidiBytes(ULONG streamid, char far *buffer, int bufsize);
    266287
    267288#endif //TARGET_OS216
  • sbliveos2/trunk/include/sbversion.h

    r148 r151  
    2525#define __SBVERSION_H__
    2626
    27 #define SBLIVE_VERSION "0.2.5"
     27#define SBLIVE_VERSION "0.4.0"
    2828
    2929#endif //__SBVERSION_H__
  • sbliveos2/trunk/include/version.mak

    r148 r151  
    1111
    1212_VENDOR = Creative Labs SoundBlaster Live
    13 _VERSION = 0.25.000
     13_VERSION = 0.40.000
    1414
    1515FILEVER = @^#$(_VENDOR):$(_VERSION)^#@
  • sbliveos2/trunk/install/control.scr

    r149 r151  
    6565ssgroup=17
    6666ssname="SoundBlaster Live! Wave Audio"
    67 ssversion="0.2.5"
     67ssversion="0.4.0"
    6868sssize=300
    6969ssdll="genin.dll"
  • sbliveos2/trunk/lib32/debug.c

    r142 r151  
    3939#include <os2.h>
    4040
    41 #ifdef  DEBUG
    4241
    4342#define CR 0x0d
     
    146145}
    147146
     147#ifdef  DEBUG
    148148char BuildString[1024];
    149149#endif          // DEBUG
  • sbliveos2/trunk/lib32/misc.c

    r142 r151  
    5050}
    5151
     52#define CR 0x0d
     53#define LF 0x0a
     54
     55
     56#define LEADING_ZEROES          0x8000
     57#define SIGNIFICANT_FIELD       0x0007
     58
     59char *HexLongToASCII(char *StrPtr, unsigned long wHexVal, unsigned short Option);
     60char *DecLongToASCII(char *StrPtr, unsigned long lDecVal, unsigned short Option);
     61
     62
     63//SvL: Not safe to use in non-KEE driver
    5264int sprintf (char *buffer, const char *format, ...)
    5365{
    54   return 0;
     66   char *BuildPtr=buffer;
     67   char *pStr = (char *) format;
     68   char *SubStr;
     69   union {
     70         void   *VoidPtr;
     71         unsigned short *WordPtr;
     72         unsigned long  *LongPtr;
     73#ifdef KEE
     74         unsigned long  *StringPtr;
     75#else
     76         double *StringPtr;
     77#endif
     78         } Parm;
     79   int wBuildOption;
     80
     81   Parm.VoidPtr=(void *) &format;
     82   Parm.StringPtr++;                            // skip size of string pointer
     83
     84   while (*pStr)
     85      {
     86      switch (*pStr)
     87         {
     88         case '%':
     89            wBuildOption=0;
     90            pStr++;
     91            if (*pStr=='0')
     92               {
     93               wBuildOption|=LEADING_ZEROES;
     94               pStr++;
     95               }
     96            if (*pStr=='u')                                                         // always unsigned
     97               pStr++;
     98
     99            switch(*pStr)
     100               {
     101               case 'x':
     102               case 'X':
     103                  BuildPtr=HexLongToASCII(BuildPtr, *Parm.LongPtr++,wBuildOption);
     104                  pStr++;
     105                  continue;
     106
     107               case 'd':
     108                  BuildPtr=DecLongToASCII(BuildPtr, *Parm.LongPtr++,wBuildOption);
     109                  pStr++;
     110                  continue;
     111
     112#ifdef KEE
     113               case 's':
     114                  SubStr=(char *)*Parm.StringPtr;
     115                  while (*BuildPtr++ = *SubStr++);
     116                  Parm.StringPtr++;
     117                  BuildPtr--;                      // remove the \0
     118                  pStr++;
     119                  continue;
     120#endif
     121               case 'l':
     122                  pStr++;
     123                  switch (*pStr)
     124                  {
     125                  case 'x':
     126                  case 'X':
     127                  BuildPtr=HexLongToASCII(BuildPtr, *Parm.LongPtr++,wBuildOption);
     128                  pStr++;
     129                  continue;
     130
     131                  case 'd':
     132                     BuildPtr=DecLongToASCII(BuildPtr, *Parm.LongPtr++,wBuildOption);
     133                     pStr++;
     134                     continue;
     135                  } // end switch
     136                  continue;                        // dunno what he wants
     137
     138               case 0:
     139                  continue;
     140               } // end switch
     141            break;
     142
     143      case '\\':
     144         pStr++;
     145         switch (*pStr)
     146            {
     147            case 'n':
     148            *BuildPtr++=LF;
     149            pStr++;
     150            continue;
     151
     152            case 'r':
     153            *BuildPtr++=CR;
     154            pStr++;
     155            continue;
     156
     157            case 0:
     158            continue;
     159            break;
     160            } // end switch
     161
     162         break;
     163         } // end switch
     164
     165      *BuildPtr++=*pStr++;
     166      } // end while
     167
     168   *BuildPtr=0;                                 // cauterize the string
     169   return 1; //not correct
    55170}
    56171
  • sbliveos2/trunk/lib32/ossidc.cpp

    r148 r151  
    9696extern "C" int OSS32_ProcessIRQ(int fWaveOut, unsigned long streamid)
    9797{
    98   return CallOSS16(IDC16_PROCESS, fWaveOut, streamid);
     98  return CallOSS16(IDC16_PROCESS, (fWaveOut) ? IDC16_WAVEOUT_IRQ : IDC16_WAVEIN_IRQ, streamid);
    9999}
    100100//******************************************************************************
    101101//******************************************************************************
     102extern "C" int OSS32_ProcessMidiIRQ(unsigned long streamid)
     103{
     104  return CallOSS16(IDC16_PROCESS, IDC16_MIDI_IRQ, streamid);
     105}
     106//******************************************************************************
     107//******************************************************************************
  • sbliveos2/trunk/lib32/pci.c

    r142 r151  
    7777        pcidev->device     = device;
    7878       
    79         devid     = (vendor << 16) | device;
     79        devid     = (device << 16) | vendor;
    8080
    8181#ifdef KEE
  • sbliveos2/trunk/lib32/sound.c

    r147 r151  
    3030#include <asm/uaccess.h>
    3131#include <asm/hardirq.h>
     32#include "..\sblive\icardmid.h"
     33#include "..\sblive\cardmi.h"
     34#include "..\sblive\midi.h"
    3235
    3336#define LINUX
     
    563566//******************************************************************************
    564567//******************************************************************************
     568unsigned long OSS32_StreamMidiWrite(unsigned long streamid, unsigned long midiByte)
     569{
     570 struct emu10k1_mididevice *midi_dev = (struct emu10k1_mididevice *)streamid;
     571
     572  return emu10k1_mpu_write_data(midi_dev->card, (u8)midiByte) == 0;
     573}
     574//******************************************************************************
     575//******************************************************************************
     576unsigned long OSS32_StreamMidiRead(unsigned long streamid, char near *buffer, unsigned long bufsize)
     577{
     578 struct emu10k1_mididevice *midi_dev = (struct emu10k1_mididevice *)streamid;
     579 int count = 0;
     580 u8  MPUIvalue;
     581
     582  while(TRUE) {
     583        if(emu10k1_mpu_read_data(midi_dev->card, &MPUIvalue) == 0) {
     584                buffer[count] = MPUIvalue;
     585                count++;
     586        }
     587        else    break;
     588
     589        if(count >= bufsize) {
     590                break;
     591        }
     592  }
     593  return count;
     594}
     595//******************************************************************************
     596//******************************************************************************
  • sbliveos2/trunk/readme.txt

    r148 r151  
    1             SoundBlaster Live! OS/2 Audio driver version 0.25 (beta)
     1            SoundBlaster Live! OS/2 Audio driver version 0.35 (beta)
    22            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    33
     
    772   Features
    883   Requirements
    9 4   Installation
     94   Installation/uninstall
    10105   Config.sys options
    11116   Known problems
     
    3535- Support for the IOCTL90 mixer interface (designed by Joe Nord of
    3636  Crystal Semiconductor and supported by the Crystal OS/2 audio drivers)
    37 - RTMIDI playback & recording (not yet implemented in this release)
     37- RTMIDI playback & recording
    3838
    3939
     
    4545
    4646
    47 4 Installation
    48 ==============
     474 Installation/uninstall
     48========================
     49To install the SB Live driver:
    4950- Unzip driver archive
    5051- Run install.cmd
    5152- Select 'SoundBlaster Live! Wave Audio' and continue installation
    5253- Reboot
    53 - During OS/2 boot, press Alt-F1 and select 'Enable Hardware Detection'
    5454
     55To remove the SB Live driver you should proceed with the installation
     56as described above, but select zero SB Live cards when asked.
    5557
    56585 Config.sys options
     
    6163- /M: enable microphone audio input
    6264- /L: enable linein audio input
     65
     66DEVICE=J:\MMOS2\SBLIVE32.SYS /D
     67- /D: print start and end address of code
     68      (useful to locate the code that causes a trap (CS:EIP in trapscreen))
    6369
    6470The installation adds the verbose and CD settings to the config.sys line.
     
    7783  Workaround: move the first minstall window (which asks you to select the sb
    7884  driver) almost completely outside of the screen and press enter.
    79 
     85- No sound when there are still inactive audio drivers in MMOS2\mmpm2.ini.
     86  To correct the problem uninstall the SB Live and your old audio driver.
     87  You can also manually remove references to the old driver:
     88        - uninstall the SB Live driver
     89        - edit MMOS2\mmpm2.ini
     90               - search for 'Waveaudio=' section and remove any names that
     91                 are listed on that line
     92               - search for 'Ampmix=' section and remove any names that
     93                 are listed on that line
     94                 (result: Waveaudio=
     95                          Ampmix=
     96                 )
     97        - reinstall the SB Live driver
     98          MMOS2\mmpm2.ini should now contain:
     99                 Waveaudio=SBLIVEWAVE01
     100                 Ampmix=SBLIVEAMPMIX01
     101        - reboot
    80102
    811037 File listing
    82104==============
    83105Installation files:
    84         23-04-00  16:55        326           0  audfiles.scr
    85         19-07-94  17:54       4395           0  audplay.ico
    86         24-04-00  10:37        952           0  AUDHELP.HLP
    87         24-04-00  17:09      20519           0  CARDINFO.dll
    88         24-04-00  17:09       3500           0  control.scr
    89         19-07-94  17:54       4395           0  midiplay.ico
    90         19-07-94  17:54       4395           0  vidplay.ico
     106        audfiles.scr
     107        audplay.ico
     108        AUDHELP.HLP
     109        CARDINFO.dll
     110        control.scr
     111        midiplay.ico
     112        vidplay.ico
    91113
    9211416 bits MMPM/2 audio driver:
    93         24-04-00  17:26      40382           0  sblive16.sys
     115        sblive16.sys
    94116
    9511732 bits SB Live Core audio driver:
    96         25-04-00  21:38      81056           0  sblive32w4.sys
     118        sblive32w4.sys
    97119
    9812032 bits SB Live Core audio driver:
    99121(uses the new KEE api found in Warp 4 + Fixpack 13 or Warp Server for
    100122 e-Business)
    101         25-04-00  21:42      63936           0  sblive32kee.sys
     123        sblive32kee.sys
    102124
    103125
     
    121143- OS/2 version + fixpack level
    122144- Description of the procedure to reproduce the bug
     145- Trap description (register contents) (if you're reporting a crash)
     146  Add the /D option to the sblive32.sys config.sys line and write down
     147  the start & end address printed during the driver initialization.
    123148
    124149Please note that I do *not* want people to mail me about problems that
  • sbliveos2/trunk/sblive/cardmi.c

    r142 r151  
    3737#include "cardmi.h"
    3838
     39#ifdef TARGET_OS2
     40extern int OSS32_ProcessMidiIRQ(unsigned long streamid);
     41#endif
     42
    3943static struct {
    4044        int (*Fn) (struct emu10k1_mpuin *, u8);
     
    96100        emu10k1_mpu_acquire(card);
    97101
     102#ifdef TARGET_OS2
     103        emu10k1_irq_enable(card, INTE_MIDIRXENABLE);
     104#endif
    98105        return CTSTATUS_SUCCESS;
    99106}
     
    343350         */
    344351
     352#ifdef TARGET_OS2
     353        OSS32_ProcessMidiIRQ((unsigned long)card_mpuin->openinfo.refdata);
     354        return CTSTATUS_SUCCESS;
     355#else
    345356        count = 0;
    346357        idx = card_mpuin->qtail;
     
    364375
    365376        return CTSTATUS_SUCCESS;
     377#endif
    366378}
    367379
  • sbliveos2/trunk/sblive/cardmi.h

    r142 r151  
    5858/* flags for card MIDI in object */
    5959#define FLAGS_MIDM_STARTED          0x00001000      // Data has started to come in after Midm Start
     60
     61#ifdef TARGET_OS2
     62#define MIDIIN_MAX_BUFFER_SIZE      4
     63#else
    6064#define MIDIIN_MAX_BUFFER_SIZE      200             // Definition for struct emu10k1_mpuin
     65#endif
    6166
    6267struct midi_data
  • sbliveos2/trunk/sblive/midi.c

    r142 r151  
    5555        struct midi_hdr *midihdr;
    5656
     57#ifdef TARGET_OS2
     58        if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL) {
     59#else
    5760        if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr *), GFP_KERNEL)) == NULL) {
     61#endif
    5862                ERROR();
    5963                return -EINVAL;
     
    336340                return -EFAULT;
    337341
     342#ifdef TARGET_OS2
     343        if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr), GFP_KERNEL)) == NULL)
     344#else
    338345        if ((midihdr = (struct midi_hdr *) kmalloc(sizeof(struct midi_hdr *), GFP_KERNEL)) == NULL)
     346#endif
    339347                return -EINVAL;
    340348
  • sbliveos2/trunk/sblive/midi.h

    r142 r151  
    4242#define MIDIIN_STATE_STOPPED 0x00000002
    4343
     44#ifdef TARGET_OS2
     45#define MIDIIN_BUFLEN 16
     46#else
    4447#define MIDIIN_BUFLEN 1024
     48#endif
    4549
    4650struct emu10k1_mididevice
Note: See TracChangeset for help on using the changeset viewer.