| [150] | 1 | /* $Id: Build.txt 173 2001-04-14 16:22:10Z sandervl $ */
 | 
|---|
 | 2 |           SoundBlaster Live! OS/2 Audio driver Build Instructions 
 | 
|---|
 | 3 |           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 | 
|---|
 | 4 | Contents
 | 
|---|
 | 5 | ========
 | 
|---|
 | 6 | 1 Introduction
 | 
|---|
 | 7 | 2 Required tools
 | 
|---|
 | 8 | 3 Recommended tools for debugging
 | 
|---|
 | 9 | 4 Building the driver
 | 
|---|
 | 10 | 5 SBLive driver architecture
 | 
|---|
 | 11 | 6 Difference between the two kinds of 32 bits drivers
 | 
|---|
 | 12 | 
 | 
|---|
 | 13 | 1 Introduction
 | 
|---|
 | 14 | ==============
 | 
|---|
 | 15 | This document lists all the needed tools and compilers to build the SB Live
 | 
|---|
 | 16 | OS/2 audio driver.
 | 
|---|
 | 17 | It also tries to give some information about the architecture of the driver
 | 
|---|
| [151] | 18 | and explain some technical details.
 | 
|---|
| [150] | 19 | 
 | 
|---|
 | 20 | However, it does not attempt to explain everything. People that are not
 | 
|---|
 | 21 | familiar with either device drivers or MMPM/2 audio drivers should
 | 
|---|
 | 22 | read the PDD & MMPM/2 driver references. Although those two documents
 | 
|---|
 | 23 | are not meant for beginners, they do contain a lot of very useful information.
 | 
|---|
 | 24 | 
 | 
|---|
 | 25 | You can always email me (sandervl@xs4all.nl) if you wish to help out with the 
 | 
|---|
 | 26 | development of the driver and have some questions.
 | 
|---|
 | 27 | Please make sure you've read at least the pdd & mmpm2 references and try
 | 
|---|
 | 28 | to understand the source code before doing so.
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 | 2 Required tools
 | 
|---|
 | 32 | ================
 | 
|---|
 | 33 | - Watcom C/C++ version 11.0b
 | 
|---|
 | 34 | - ALP 4.x (IBM assembler; comes with ddk)
 | 
|---|
 | 35 | - IBM OS/2 DDK (http://service.boulder.ibm.com/ddk/)
 | 
|---|
 | 36 |   - Base headers/libraries/tools (combase.zip)
 | 
|---|
| [170] | 37 |     Due to a typo in devhelp.h, you must change the DevHelp_VMProcessToGlobal macro:
 | 
|---|
 | 38 |      USHORT DevHelp_VMProcessToGlobal(ULONG Flags, LIN LinearAddr, ULONG Length, PLIN GlobalLinearAddr);
 | 
|---|
 | 39 |      #pragma aux DevHelp_ProcessToGlobal = \
 | 
|---|
 | 40 | 
 | 
|---|
| [150] | 41 |   - MMPM/2 base                  (mmpmdd.zip)
 | 
|---|
 | 42 |   - PDD & MMPM/2 driver reference
 | 
|---|
 | 43 | 
 | 
|---|
 | 44 | 3 Recommended tools for debugging
 | 
|---|
 | 45 | =================================
 | 
|---|
 | 46 | - ICAT debugger (follow link from IBM DDK page)
 | 
|---|
 | 47 | - OS/2 Debug kernel
 | 
|---|
 | 48 | 
 | 
|---|
 | 49 | 
 | 
|---|
 | 50 | 4 Building the driver
 | 
|---|
 | 51 | =====================
 | 
|---|
| [173] | 52 | First you must create the makefile.inc file. This is done by running
 | 
|---|
 | 53 | the Configure.cmd rexx script.
 | 
|---|
 | 54 | 
 | 
|---|
| [150] | 55 | You can build the driver from the main directory by executing:
 | 
|---|
 | 56 |       WMAKE -f makefile.os2 /ms
 | 
|---|
 | 57 | 
 | 
|---|
 | 58 | To build the debug version of the driver (which can be used with ICAT
 | 
|---|
 | 59 | for source-level debugging) run
 | 
|---|
 | 60 |       WMAKE -f makefile.os2 DEBUG=1 /ms
 | 
|---|
 | 61 | 
 | 
|---|
 | 62 | To build the KEE enhanced version of the driver 
 | 
|---|
 | 63 |       WMAKE -f makefile.os2 KEE=1 /ms
 | 
|---|
 | 64 | 
 | 
|---|
 | 65 | 
 | 
|---|
 | 66 | 5 SBLive driver architecture
 | 
|---|
 | 67 | ============================
 | 
|---|
 | 68 | Simplified overview of the flow of control from a multimedia application
 | 
|---|
 | 69 | to the SB Live driver. (for a more complete overview, check the MMPM/2
 | 
|---|
 | 70 | Device Driver Reference; Audio Physical Device Driver Template/PDD architecture)
 | 
|---|
 | 71 | 
 | 
|---|
 | 72 |               |=============|
 | 
|---|
 | 73 |               |             |
 | 
|---|
 | 74 |               | application |
 | 
|---|
 | 75 |               |             |
 | 
|---|
 | 76 |               |=============|
 | 
|---|
 | 77 | ring 3          |        ^
 | 
|---|
 | 78 | --------------------------------------------------------------------------------
 | 
|---|
 | 79 | ring 0          |        |
 | 
|---|
 | 80 |                 v        |
 | 
|---|
 | 81 |               |=============|
 | 
|---|
 | 82 |               |             |
 | 
|---|
 | 83 |           --->|   MMPM/2    |
 | 
|---|
 | 84 |           |   |             |
 | 
|---|
 | 85 |           |   |=============|
 | 
|---|
 | 86 |           |     | IOCtls |
 | 
|---|
 | 87 | SHD calls |     |        |
 | 
|---|
 | 88 | to return |     |        | IDC
 | 
|---|
 | 89 | buffers   |     |        |
 | 
|---|
 | 90 |           |     |        |
 | 
|---|
 | 91 |           |     v        v
 | 
|---|
 | 92 |           |   |-------------|    OSS cmds     |-------------|
 | 
|---|
 | 93 |           |   |             |   <--------->   |             |
 | 
|---|
 | 94 |           ----|sblive16.sys |    irqs         |sblive32.sys |
 | 
|---|
 | 95 |               |             |   ---------->   |             |
 | 
|---|
 | 96 |               |-------------|                 |-------------|
 | 
|---|
 | 97 |                         ^                        |
 | 
|---|
 | 98 | --------------------------------------------------------------------------------
 | 
|---|
 | 99 | hardware
 | 
|---|
 | 100 |                    irqs |                        |
 | 
|---|
 | 101 |                         |                        | hardware programming
 | 
|---|
 | 102 |                       |==============|           |
 | 
|---|
 | 103 |                       |              |           |
 | 
|---|
 | 104 |                       | SB Live card |<-----------
 | 
|---|
 | 105 |                       |              |
 | 
|---|
 | 106 |                       |==============|
 | 
|---|
 | 107 | 
 | 
|---|
 | 108 | 
 | 
|---|
 | 109 | The drv16 directory contains the sources for the 16 bits driver that handles
 | 
|---|
 | 110 | all MMPM/2 commands and communicates (IDC) with the 32 bits core driver using
 | 
|---|
 | 111 | OSS (Linux audio api) commands.
 | 
|---|
 | 112 | Sblive32.sys contains a small wrapper that interprets the IDC commands and
 | 
|---|
 | 113 | translates them into appriate calls to the original Linux OSS driver (ioctls/
 | 
|---|
 | 114 | open/close/read/write).
 | 
|---|
 | 115 | Basically, the Linux code in sblive32 treats the 16 bits driver as a Linux
 | 
|---|
 | 116 | application trying to use the audio card.
 | 
|---|
 | 117 | 
 | 
|---|
 | 118 | During the init complete strategy call of sblive16, it sends the init command
 | 
|---|
 | 119 | to the 32 bits driver. Which ends up calling module_init in the Linux code
 | 
|---|
 | 120 | (sblive\main.c). At this point the Linux code tries to detect the sblive
 | 
|---|
 | 121 | hardware using Linux pci kernel calls.
 | 
|---|
 | 122 | All Linux kernel calls are implemented in sblive32 using OS/2 system calls.
 | 
|---|
 | 123 | (i.e. kmalloc uses DevHlp_VMAlloc)
 | 
|---|
 | 124 | 
 | 
|---|
 | 125 | The original Linux SB Live! sources have not changed for the most part.
 | 
|---|
 | 126 | An exception is the acknowledgment that part of a buffer has been played/
 | 
|---|
 | 127 | recorded. (emu10k1_waveout_bh/emu10k1_wavein_bh in sblive\audio.c)
 | 
|---|
 | 128 | OSS32_ProcessIRQ is called from those procedures to tell the 16 bits driver
 | 
|---|
 | 129 | to query the current position and return/queue buffers if needed.
 | 
|---|
 | 130 | 
 | 
|---|
 | 131 | The 16 bits driver is more or less a generic MMPM/2 driver that could be used
 | 
|---|
 | 132 | (in theory) to port any OSS Linux audio driver.
 | 
|---|
 | 133 | The wrapper and linux kernel calls implemented in the lib directory can
 | 
|---|
 | 134 | also be reused.
 | 
|---|
 | 135 | 
 | 
|---|
 | 136 | 
 | 
|---|
 | 137 | 6 Difference between the two kinds of 32 bits drivers
 | 
|---|
 | 138 | =====================================================
 | 
|---|
 | 139 | Warp Server for e-Business (and now Warp 4 too; with fixpack 13) feature
 | 
|---|
 | 140 | a new 32 bits kernel api for physical device driver (well, not entirely true).
 | 
|---|
 | 141 | 
 | 
|---|
 | 142 | The 'standard' 32 bits driver (not compiled with KEE=1) is a 32 bits compact
 | 
|---|
 | 143 | memory model driver. (cs=ds, ss!=ds; small code, large data)
 | 
|---|
 | 144 | The stack is still 16 bits and the SS and DS selectors are not identical.
 | 
|---|
 | 145 | Therefor all pointers are far by default. (32 bits far; meaning 16:32, 16
 | 
|---|
 | 146 | bits selector, 32 bits offset)
 | 
|---|
 | 147 | 
 | 
|---|
 | 148 | Using this memory model works fine, but is a bit inefficient and not ideal
 | 
|---|
 | 149 | for porting 32 bits code (which may have hidden dependencies on the 32 bits
 | 
|---|
 | 150 | flat memory model; the sblive driver has none).
 | 
|---|
 | 151 | That also explains why the standard 32 bits driver is 18kb larger than the
 | 
|---|
 | 152 | KEE version.
 | 
|---|
 | 153 | 
 | 
|---|
 | 154 | The 'enhanced' 32 bits driver uses the KEE interface to create a true 32 bits
 | 
|---|
 | 155 | driver (cs=ds=ss).
 | 
|---|
 | 156 | 
 | 
|---|
 | 157 | A small 16 bits part is still needed as our IDC, strategy and irq handlers
 | 
|---|
 | 158 | are expected to be in the 16 bits code segment.
 | 
|---|
 | 159 | An assembly file (drv32\startup.asm) takes care of the thunking that is
 | 
|---|
 | 160 | required.
 | 
|---|
 | 161 | 
 | 
|---|
 | 162 | 
 | 
|---|