Skip to content

Commit

Permalink
CMI: revert experimental code, but keeps buffering periods.
Browse files Browse the repository at this point in the history
  • Loading branch information
crazii committed Jan 14, 2024
1 parent d82881e commit 4d39e46
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions mpxplay/au_cards/sc_cmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,25 +695,19 @@ static void CMI8X38_setrate(struct mpxplay_audioout_info_s *aui)
return;

//buffer cfg
#ifdef SBEMU
int periods = max(1, dmabufsize / PCMBUFFERPAGESIZE);
#ifdef SBEMU
int periods = max(1, dmabufsize / PCMBUFFERPAGESIZE);
card->dma_size = dmabufsize >> card->shift;
card->period_size = (dmabufsize/periods) >> card->shift;

aui->card_samples_per_int = card->period_size;

// set buffer address
snd_cmipci_write_32(card, CM_REG_CH0_FRAME1, (uint32_t) pds_cardmem_physicalptr(card->dm, card->pcmout_buffer));
// program sample counts
// EXPERIMENTAL: the spec says 'Base count of samples at Codec.' and 'Base count of samples at Bus Master.' but never mention -1,
// it's possible that the driver reserved 1 sample for safety, but we don't need that
// or it possible the spec is not clear, need test out.
snd_cmipci_write_16(card, CM_REG_CH0_FRAME2 , card->dma_size);
snd_cmipci_write_16(card, CM_REG_CH0_FRAME2 + 2, card->period_size);
#else
#else
card->dma_size = dmabufsize >> card->shift;
card->period_size = dmabufsize >> card->shift;

#endif
//card->dma_size >>= card->ac3_shift;
//card->period_size >>= card->ac3_shift;

Expand All @@ -727,7 +721,6 @@ static void CMI8X38_setrate(struct mpxplay_audioout_info_s *aui)
// program sample counts
snd_cmipci_write_16(card, CM_REG_CH0_FRAME2 , card->dma_size - 1);
snd_cmipci_write_16(card, CM_REG_CH0_FRAME2 + 2, card->period_size - 1);
#endif

// set sample rate
freqnum = snd_cmipci_rate_freq(aui->freq_card);
Expand Down Expand Up @@ -794,7 +787,7 @@ static long CMI8X38_getbufpos(struct mpxplay_audioout_info_s *aui)
for (tries = 0; tries < 3; tries++) {
rem = snd_cmipci_read_16(card, reg); //note: current sample count can be 0
//mpxplay_debugf(CMI_DEBUG_OUTPUT, "PCM ptr: %u, card->dma_size: %d aui->card_dmasize: %d", rem, card->dma_size, aui->card_dmasize);
if (rem <= card->dma_size) //add = since we don't use card->dma_size-1 as base count.
if (rem < card->dma_size)
goto ok;
}
//mpxplay_debugf(CMI_DEBUG_OUTPUT, "invalid PCM pointer!!! %u", rem);
Expand Down

0 comments on commit 4d39e46

Please sign in to comment.