Annotation of ntddk/src/mmedia/sndblst/dll/initc.c, revision 1.1.1.1

1.1       root        1: /****************************************************************************
                      2:  *
                      3:  *   initc.c
                      4:  *
                      5:  *   Copyright (c) 1991-1992 Microsoft Corporation.  All Rights Reserved.
                      6:  *
                      7:  ***************************************************************************/
                      8: 
                      9: #include <windows.h>
                     10: #include <mmsystem.h>
                     11: #include <mmddk.h>
                     12: #define NOSTR  /* to avoid redefining strings */
                     13: #include "registry.h"            // Local registry access functions
                     14: #include "sndblst.h"
                     15: 
                     16: /****************************************************************************
                     17: 
                     18:     strings
                     19: 
                     20:  ***************************************************************************/
                     21: 
                     22: /* non-localized strings */
                     23: TCHAR STR_DRIVERNAME[]     = TEXT("sndblst");
                     24: TCHAR STR_PRODUCTNAME[]    = TEXT("Sound Blaster");
                     25: 
                     26: /****************************************************************************
                     27: 
                     28:     public data
                     29: 
                     30:  ***************************************************************************/
                     31: 
                     32: WORD    gwErrorStringId = 0;            /* if initialization fails, string id */
                     33: 
                     34: #ifdef DEBUG
                     35: WORD    wDebugLevel = 0;        /* debug level */
                     36: #endif
                     37: 
                     38: 
                     39: /***************************************************************************
                     40:  * @doc INTERNAL
                     41:  *
                     42:  * @api WORD | ConfigGetPortBase |
                     43:  *
                     44:  * @rdesc Returns the port base from the registry
                     45:  ***************************************************************************/
                     46: DWORD ConfigGetPortBase(void)
                     47: {
                     48: DWORD    Port;
                     49: 
                     50:     /* read registry and get the board configuration information. */
                     51: 
                     52:     if (ERROR_SUCCESS !=
                     53:         DrvQueryDeviceParameter(&RegAccess, SOUND_REG_PORT, &Port)) {
                     54: 
                     55:         Port = (DWORD)SOUND_DEF_PORT;
                     56:     }
                     57: 
                     58:     switch (Port) {
                     59:         case 0x200:
                     60:         case 0x210:
                     61:         case 0x220:
                     62:         case 0x230:
                     63:         case 0x240:
                     64:         case 0x250:
                     65:         case 0x260:
                     66:         case 0x270:
                     67:             break;
                     68: 
                     69:         default:
                     70:             Port = (DWORD)-1;
                     71:             D1("driver PORT not configured");
                     72:     }
                     73: 
                     74:     return (Port);
                     75: }
                     76: 
                     77: 
                     78: /***************************************************************************
                     79:  * @doc INTERNAL
                     80:  *
                     81:  * @api WORD | ConfigGetIRQ |
                     82:  *
                     83:  * @rdesc Returns the IRQ ('int') from the registry
                     84:  ***************************************************************************/
                     85: DWORD ConfigGetIRQ(void)
                     86: {
                     87: DWORD    Int;
                     88: 
                     89:     if (ERROR_SUCCESS !=
                     90:         DrvQueryDeviceParameter(&RegAccess, SOUND_REG_INTERRUPT, &Int)) {
                     91: 
                     92:         Int = (DWORD)SOUND_DEF_INT;
                     93:     }
                     94: 
                     95:     switch (Int) {
                     96:         case 3:
                     97:         case 5:
                     98:         case 7:
                     99:         case 9:
                    100:         case 10:
                    101:             break;
                    102: 
                    103:         case 2:
                    104:             Int = 9;
                    105:             break;
                    106: 
                    107:         default:
                    108:             Int = (DWORD)-1;
                    109:             D1("driver INT not configured");
                    110:             break;
                    111:     }
                    112: 
                    113:     return (Int);
                    114: }
                    115: 
                    116: 
                    117: /***************************************************************************
                    118:  * @doc INTERNAL
                    119:  *
                    120:  * @api WORD | ConfigGetDMAChannel |
                    121:  *
                    122:  * @rdesc Returns the DMA channel from the registry
                    123:  ***************************************************************************/
                    124: DWORD ConfigGetDMAChannel(void)
                    125: {
                    126: DWORD    DMAChannel;
                    127: 
                    128:     /* get the DMA channel that the card is using... */
                    129:     if (ERROR_SUCCESS !=
                    130:         DrvQueryDeviceParameter(&RegAccess, SOUND_REG_DMACHANNEL, &DMAChannel)) {
                    131: 
                    132:         DMAChannel = (DWORD)-1;
                    133:     }
                    134: 
                    135:     switch (DMAChannel) {
                    136:         case 0:
                    137:         case 1:
                    138:         case 3:
                    139:             break;
                    140: 
                    141:         default:
                    142:             DMAChannel = 1;
                    143:     }
                    144: 
                    145:     return (DMAChannel);
                    146: }
                    147: 
                    148: 
                    149: /***************************************************************************/
                    150: 
                    151: static void NEAR PASCAL HardErrorMsgBox(WORD wStringId)
                    152: {
                    153: TCHAR szErrorBuffer[MAX_ERR_STRING]; /* buffer for error messages */
                    154: 
                    155:     LoadString(ghModule, wStringId, szErrorBuffer, sizeof(szErrorBuffer));
                    156:     MessageBox(NULL, szErrorBuffer, STR_PRODUCTNAME, MB_OK|MB_SYSTEMMODAL|MB_ICONHAND);
                    157: }
                    158: 
                    159: 
                    160: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.