forked from len0rd/rockbox
Sansa AMS PCM: remove runtime sanity checks
Unaligned memory ops will cause a data abort anyway Make the check for samplerate at buildtime git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23480 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e28bfd1349
commit
f64a3fe149
2 changed files with 15 additions and 8 deletions
|
@ -132,21 +132,35 @@
|
|||
#if (CLK_DIV(AS3525_PLLA_FREQ, AS3525_PCLK_FREQ) - 1) >= (1<<4) /* 4 bits */
|
||||
#error PCLK frequency is too low : clock divider will not fit !
|
||||
#endif
|
||||
|
||||
/* AS3525_DBOP_FREQ */
|
||||
#if (CLK_DIV(AS3525_PCLK_FREQ, AS3525_DBOP_FREQ) - 1) >= (1<<3) /* 3 bits */
|
||||
#error DBOP frequency is too low : clock divider will not fit !
|
||||
#endif
|
||||
|
||||
/* AS3525_IDE_FREQ */
|
||||
#if (CLK_DIV(AS3525_PLLA_FREQ, AS3525_IDE_FREQ) - 1) >= (1<<4) /* 4 bits */
|
||||
#error IDE frequency is too low : clock divider will not fit !
|
||||
#endif
|
||||
|
||||
/* AS3525_I2C_FREQ */
|
||||
#if (CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ)) >= (1<<10) /* 2+8 bits */
|
||||
#error I2C frequency is too low : clock divider will not fit !
|
||||
#endif
|
||||
|
||||
/* AS3525_SD_IDENT_FREQ */
|
||||
#if ((CLK_DIV(AS3525_PCLK_FREQ, AS3525_SD_IDENT_FREQ) / 2) - 1) >= (1<<8) /* 8 bits */
|
||||
#error SD IDENTIFICATION frequency is too low : clock divider will not fit !
|
||||
#endif
|
||||
|
||||
/* I2SIN / I2SOUT frequencies */
|
||||
/* low samplerate */
|
||||
#if ((AS3525_PLLA_FREQ/(128*8000))) > 512 /* 8kHz = lowest frequency */
|
||||
#error PLLA frequency is too low for 8kHz samplerate !
|
||||
#endif
|
||||
/* high samplerate */
|
||||
#if ((AS3525_PLLA_FREQ/(128*96000))) < 1 /* 96kHz = highest frequency */
|
||||
#error PLLA frequency is too high for 96kHz samplerate !
|
||||
#endif
|
||||
|
||||
#endif /* CLOCK_TARGET_H */
|
||||
|
|
|
@ -61,9 +61,6 @@ static void play_start_pcm(void)
|
|||
if(size > MAX_TRANSFER)
|
||||
size = MAX_TRANSFER;
|
||||
|
||||
if((unsigned int)dma_start_addr & 3)
|
||||
panicf("unaligned pointer!");
|
||||
|
||||
dma_size -= size;
|
||||
dma_start_addr += size;
|
||||
|
||||
|
@ -148,9 +145,8 @@ void pcm_dma_apply_settings(void)
|
|||
{
|
||||
unsigned long frequency = pcm_sampr;
|
||||
|
||||
/* TODO : use a table ? */
|
||||
const int divider = (((AS3525_PLLA_FREQ/128) + (frequency/2)) / frequency) - 1;
|
||||
if(divider < 0 || divider > 511)
|
||||
panicf("unsupported frequency %ld", frequency);
|
||||
|
||||
int cgu_audio = CGU_AUDIO; /* read register */
|
||||
cgu_audio &= ~(511 << 2); /* clear i2sout divider */
|
||||
|
@ -266,9 +262,6 @@ void pcm_rec_dma_start(void *addr, size_t size)
|
|||
rec_start_addr = addr;
|
||||
rec_size = size;
|
||||
|
||||
if((unsigned int)addr & 3)
|
||||
panicf("unaligned pointer!");
|
||||
|
||||
CGU_PERI |= CGU_I2SIN_APB_CLOCK_ENABLE|CGU_I2SOUT_APB_CLOCK_ENABLE;
|
||||
CGU_AUDIO |= ((1<<23)|(1<<11));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue