forked from len0rd/rockbox
Enable recording on clipv1/m200v4/c200v2
Use smaller recording buffer and watermarks on these models with 2MB of ram Rearrange watermark calculation expressions so we can use fractional numbers of seconds but still with integer results Only enable spinup time adjustement for ATA targets Flash targets (sansas and ondiofm) should still work fine, but they were not tested git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26014 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
abd6b147cc
commit
020dddffac
4 changed files with 25 additions and 9 deletions
|
@ -127,7 +127,11 @@ static unsigned long pre_record_ticks; /* pre-record time in ticks */
|
|||
****************************************************************************/
|
||||
|
||||
/** buffer parameters where incoming PCM data is placed **/
|
||||
#if MEM <= 2
|
||||
#define PCM_NUM_CHUNKS 16 /* Power of 2 */
|
||||
#else
|
||||
#define PCM_NUM_CHUNKS 256 /* Power of 2 */
|
||||
#endif
|
||||
#define PCM_CHUNK_SIZE 8192 /* Power of 2 */
|
||||
#define PCM_CHUNK_MASK (PCM_NUM_CHUNKS*PCM_CHUNK_SIZE - 1)
|
||||
|
||||
|
@ -168,15 +172,22 @@ static int flood_watermark; /* boost thread priority when here */
|
|||
#endif
|
||||
|
||||
/* Constants that control watermarks */
|
||||
#define LOW_SECONDS 1 /* low watermark time till empty */
|
||||
#define MINI_CHUNKS 10 /* chunk count for mini flush */
|
||||
#ifdef HAVE_PRIORITY_SCHEDULING
|
||||
#define PRIO_SECONDS 10 /* max flush time before priority boost */
|
||||
#endif
|
||||
#if MEM <= 16
|
||||
#if MEM <= 2
|
||||
/* fractions must be integer fractions of 4 because they are evaluated with
|
||||
* X*4*XXX_SECONDS, that way we avoid float calculation */
|
||||
#define LOW_SECONDS 1/4 /* low watermark time till empty */
|
||||
#define PANIC_SECONDS 1/2 /* flood watermark time until full */
|
||||
#define FLUSH_SECONDS 1 /* flush watermark time until full */
|
||||
#elif MEM <= 16
|
||||
#define LOW_SECONDS 1 /* low watermark time till empty */
|
||||
#define PANIC_SECONDS 5 /* flood watermark time until full */
|
||||
#define FLUSH_SECONDS 7 /* flush watermark time until full */
|
||||
#else
|
||||
#define LOW_SECONDS 1 /* low watermark time till empty */
|
||||
#define PANIC_SECONDS 8
|
||||
#define FLUSH_SECONDS 10
|
||||
#endif /* MEM */
|
||||
|
@ -734,7 +745,9 @@ static void pcmrec_refresh_watermarks(void)
|
|||
logf("ata spinup: %d", storage_spinup_time());
|
||||
|
||||
/* set the low mark for when flushing stops if automatic */
|
||||
low_watermark = (LOW_SECONDS*4*sample_rate + (enc_chunk_size-1))
|
||||
/* don't change the order in this expression, LOW_SECONDS can be an
|
||||
* integer fraction of 4 */
|
||||
low_watermark = (sample_rate*4*LOW_SECONDS + (enc_chunk_size-1))
|
||||
/ enc_chunk_size;
|
||||
logf("low wmk: %d", low_watermark);
|
||||
|
||||
|
@ -743,8 +756,10 @@ static void pcmrec_refresh_watermarks(void)
|
|||
this allows encoder to boost with just under a second of
|
||||
pcm data (if not yet full enough to boost itself)
|
||||
and not falsely trip the alarm. */
|
||||
/* don't change the order in this expression, PANIC_SECONDS can be an
|
||||
* integer fraction of 4 */
|
||||
flood_watermark = enc_num_chunks -
|
||||
(PANIC_SECONDS*4*sample_rate + (enc_chunk_size-1))
|
||||
(sample_rate*4*PANIC_SECONDS + (enc_chunk_size-1))
|
||||
/ enc_chunk_size;
|
||||
|
||||
if (flood_watermark < low_watermark)
|
||||
|
@ -756,7 +771,7 @@ static void pcmrec_refresh_watermarks(void)
|
|||
logf("flood at: %d", flood_watermark);
|
||||
#endif
|
||||
spinup_time = last_storage_spinup_time = storage_spinup_time();
|
||||
|
||||
#if (CONFIG_STORAGE & STORAGE_ATA)
|
||||
/* write at 8s + st remaining in enc_buffer - range 12s to
|
||||
20s total - default to 3.5s spinup. */
|
||||
if (spinup_time == 0)
|
||||
|
@ -765,6 +780,7 @@ static void pcmrec_refresh_watermarks(void)
|
|||
spinup_time = 2*HZ; /* ludicrous - ramdisk? */
|
||||
else if (spinup_time > 10*HZ)
|
||||
spinup_time = 10*HZ; /* do you have a functioning HD? */
|
||||
#endif
|
||||
|
||||
/* try to start writing with 10s remaining after disk spinup */
|
||||
high_watermark = enc_num_chunks -
|
||||
|
@ -773,9 +789,9 @@ static void pcmrec_refresh_watermarks(void)
|
|||
|
||||
if (high_watermark < low_watermark)
|
||||
{
|
||||
logf("warning: low 'write at' (%d)", high_watermark);
|
||||
high_watermark = low_watermark;
|
||||
low_watermark /= 2;
|
||||
logf("warning: low 'write at'");
|
||||
}
|
||||
|
||||
logf("write at: %d", high_watermark);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define HW_SAMPR_CAPS SAMPR_CAP_ALL
|
||||
|
||||
/* define this if you have recording possibility */
|
||||
//#define HAVE_RECORDING
|
||||
#define HAVE_RECORDING
|
||||
|
||||
#define REC_SAMPR_CAPS SAMPR_CAP_ALL
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#define HW_SAMPR_CAPS SAMPR_CAP_ALL
|
||||
|
||||
/* define this if you have recording possibility */
|
||||
//#define HAVE_RECORDING
|
||||
#define HAVE_RECORDING
|
||||
|
||||
#define REC_SAMPR_CAPS SAMPR_CAP_ALL
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#define HW_SAMPR_CAPS SAMPR_CAP_ALL
|
||||
|
||||
/* define this if you have recording possibility */
|
||||
//#define HAVE_RECORDING
|
||||
#define HAVE_RECORDING
|
||||
|
||||
#define REC_SAMPR_CAPS SAMPR_CAP_ALL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue