Diff for /np2/sound/cs4231c.c between versions 1.1 and 1.5

version 1.1, 2003/10/16 17:58:08 version 1.5, 2004/01/05 11:46:56
Line 1 Line 1
 #include        "compiler.h"  #include        "compiler.h"
 #include        "memory.h"  
 #include        "pccore.h"  #include        "pccore.h"
 #include        "iocore.h"  #include        "iocore.h"
 #include        "sound.h"  #include        "sound.h"
 #include        "fmboard.h"  #include        "fmboard.h"
   
   
           CS4231CFG       cs4231cfg;
   
   
 static const UINT16 cs4231samprate[] = {  static const UINT16 cs4231samprate[] = {
                                          8000,   5510,  16000,  11025,                                           8000,   5510,  16000,  11025,
                                         27420,  18900,  32000,  22050,                                          27420,  18900,  32000,  22050,
                                         54840,  37800,  64000,  44100,                                          54840,  37800,  64000,  44100,
                                         48000,  33075,   9600,   6620};                                          48000,  33075,   9600,   6620};
   
 static const BYTE dmach[] =  {0xff, 0x00, 0x01, 0x03, 0xff, 0xff, 0xff, 0xff};  
 static const BYTE dmairq[] = {0xff, 0x03, 0x06, 0x0a, 0x0c, 0xff, 0xff, 0xff};  
   
   
 void cs4231_initialize(UINT rate) {  void cs4231_initialize(UINT rate) {
   
         (void)rate;          cs4231cfg.rate = rate;
 }  }
   
 void cs4231_setvol(UINT vol) {  void cs4231_setvol(UINT vol) {
Line 29  void cs4231_setvol(UINT vol) { Line 28  void cs4231_setvol(UINT vol) {
   
 void cs4231_dma(NEVENTITEM item) {  void cs4231_dma(NEVENTITEM item) {
   
         BYTE    ret;          REG8    ret;
         SINT32  cnt;          SINT32  cnt;
   
         if (item->flag & NEVENT_SETEVENT) {          if (item->flag & NEVENT_SETEVENT) {
Line 38  void cs4231_dma(NEVENTITEM item) { Line 37  void cs4231_dma(NEVENTITEM item) {
                         ret = cs4231.proc();                          ret = cs4231.proc();
                         if ((ret) && (cs4231.reg.pinctrl & 2)) {                          if ((ret) && (cs4231.reg.pinctrl & 2)) {
                                 dmac.dmach[0].leng.w = 0;                                  dmac.dmach[0].leng.w = 0;
                                 cs4231.intflag = 1;                                  if (cs4231.dmairq != 0xff) {
                                 pic_setirq(0x0c);                                          cs4231.intflag = 1;
                                           pic_setirq(cs4231.dmairq);
                                   }
                         }                          }
                 }                  }
                 cnt = pc.realclock * 16 / opna_rate;                  if (cs4231cfg.rate) {
                 nevent_set(NEVENT_CS4231, cnt, cs4231_dma, NEVENT_RELATIVE);                          cnt = pc.realclock * 16 / cs4231cfg.rate;
                           nevent_set(NEVENT_CS4231, cnt, cs4231_dma, NEVENT_RELATIVE);
                   }
         }          }
         (void)item;          (void)item;
 }  }
   
 BYTE DMACCALL cs4231dmafunc(BYTE func) {  REG8 DMACCALL cs4231dmafunc(REG8 func) {
   
         SINT32  cnt;          SINT32  cnt;
   
         switch(func) {          switch(func) {
                 case DMAEXT_START:                  case DMAEXT_START:
                         cnt = pc.realclock * 16 / opna_rate;                          if (cs4231cfg.rate) {
                         nevent_set(NEVENT_CS4231, cnt, cs4231_dma, NEVENT_ABSOLUTE);                                  cnt = pc.realclock * 16 / cs4231cfg.rate;
                                   nevent_set(NEVENT_CS4231, cnt, cs4231_dma, NEVENT_ABSOLUTE);
                           }
                         break;                          break;
   
                 case DMAEXT_BREAK:                  case DMAEXT_BREAK:
Line 78  void cs4231_update(void) { Line 83  void cs4231_update(void) {
 }  }
   
   
 void cs4231_control(UINT index, BYTE value) {  void cs4231_control(UINT index, REG8 value) {
   
         *(((BYTE *)(&cs4231.reg)) + index) = value;          *(((BYTE *)(&cs4231.reg)) + index) = value;
         switch(index) {          switch(index) {

Removed from v.1.1  
changed lines
  Added in v.1.5


RetroPC.NET-CVS <cvs@retropc.net>