static void do_3724_config(struct comedi_device *dev, struct comedi_subdevice *s, int chanspec) { struct comedi_subdevice *s_dio1 = &dev->subdevices[0]; struct comedi_subdevice *s_dio2 = &dev->subdevices[1]; int config; int buffer_config; unsigned long port_8255_cfg; config = CR_CW; buffer_config = 0; /* 1 in io_bits indicates output, 1 in config indicates input */ if (!(s->io_bits & 0x0000ff)) config |= CR_A_IO; if (!(s->io_bits & 0x00ff00)) config |= CR_B_IO; if (!(s->io_bits & 0xff0000)) config |= CR_C_IO; buffer_config = compute_buffer(0, 0, s_dio1); buffer_config = compute_buffer(buffer_config, 1, s_dio2); if (s == s_dio1) port_8255_cfg = dev->iobase + _8255_CR; else port_8255_cfg = dev->iobase + SIZE_8255 + _8255_CR; outb(buffer_config, dev->iobase + 8); /* update buffer register */ outb(config, port_8255_cfg); }
void WavePlayBack(uint32_t AudioFreq) { /* note: these mallocs are NOT freed at the moment */ sp_create(&sp); sp->sr = AudioFreq; sp_ftbl_create(sp, &ft, 8192); sp_gen_sine(sp, ft); sp_osc_create(&osc); sp_osc_init(sp, osc, ft, 0); osc->freq = 0.2f; osc->amp = 1.f; uint32_t i; for(i = 0; i < NOSCS; i++) { sp_fosc_create(&fosc[i]); sp_fosc_init(sp, fosc[i], ft); fosc[i]->freq = sp_midi2cps(scale[i]); fosc[i]->amp = 0.1f; } for(i = 0; i < MY_BUFSIZE; i++) { buf0[i] = 0; buf1[i] = 0; } sp_revsc_create(&revsc); sp_revsc_init(sp, revsc); /* Initialize wave player (Codec, DMA, I2C) */ WavePlayerInit(AudioFreq); nextbuf = 1; compute_buffer(buf1, MY_BUFSIZE); Audio_MAL_Play((uint32_t)buf0, MY_BUFSIZE / 2); EVAL_AUDIO_Mute(AUDIO_MUTE_ON); while(1) { while(nextbuf == 1); if(please_play == 0) { EVAL_AUDIO_Mute(AUDIO_MUTE_OFF); please_play = 1; } compute_buffer(buf0, MY_BUFSIZE); while(nextbuf == 0); compute_buffer(buf1, MY_BUFSIZE); }; }