home *** CD-ROM | disk | FTP | other *** search
/ PC Loisirs 18 / cd.iso / sharewar / mikm202 / source / drvgus / ultraext.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-09-18  |  1.5 KB  |  84 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include "mtypes.h"
  4. #include "extern.h"
  5. #include "ultraerr.h"
  6. #include "ultraext.h"
  7.  
  8. #include "forte.h"
  9. #include "gf1proto.h"
  10. #include "osproto.h"
  11. #include "gf1hware.h"
  12. #include "gf1os.h"
  13. #include "extern.h"
  14. #include "ultraerr.h"
  15. #include "mdriver.h"
  16.  
  17. extern ULTRA_DATA _gf1_data;
  18.  
  19. ULTRA_CFG config;
  20.  
  21.  
  22. // extern ULTRA_DATA _gf1_data;
  23.  
  24.  
  25. int UltraNumVoices(int voices)
  26. {
  27.     int temp;
  28.  
  29.     _gf1_data.voices = voices;
  30.  
  31.     UltraDisableLineIn();
  32.     UltraDisableMicIn();
  33.     UltraDisableOutput();
  34.  
  35.     temp=UltraReset(voices);
  36.     if(temp!=ULTRA_OK) return(temp);
  37.  
  38.     UltraSetInterface(_gf1_data.dram_dma_chan,_gf1_data.adc_dma_chan,
  39.                       _gf1_data.gf1_irq_num,_gf1_data.midi_irq_num);
  40.  
  41.     SetIrqs(_gf1_data.gf1_irq_num,_gf1_data.midi_irq_num);
  42.  
  43.     UltraEnableOutput();
  44.     return(ULTRA_OK);
  45. }
  46.  
  47.  
  48.  
  49.  
  50. int UltraGetCfg(ULTRA_CFG *config)
  51. {
  52.     char *ptr;
  53.  
  54.     config->base_port = 0x220;
  55.     config->dram_dma_chan = 1;
  56.     config->adc_dma_chan = 1;
  57.     config->gf1_irq_num = 11;
  58.     config->midi_irq_num = 5;
  59.  
  60.     if((ptr=getenv("ULTRASND"))==NULL) return FALSE;
  61.  
  62.     if(sscanf(ptr,"%x,%d,%d,%d,%d"
  63.                 ,&config->base_port,
  64.                 &config->dram_dma_chan,
  65.                 &config->adc_dma_chan,
  66.                 &config->gf1_irq_num,
  67.                 &config->midi_irq_num)!=5) return FALSE;
  68.  
  69.     return(TRUE);
  70. }
  71.  
  72.  
  73.  
  74. UBYTE UltraPeek(ULONG address)
  75. {
  76.     return(UltraPeekData(config.base_port,address));
  77. }
  78.  
  79.  
  80. void UltraPoke(ULONG address,UBYTE val)
  81. {
  82.     UltraPokeData(config.base_port,address,val);
  83. }
  84.