Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.
My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
diff --git a/apps/recorder/pcm_record.c b/apps/recorder/pcm_record.c index 217d276..e5a5107 100644 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) 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 */ 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); 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) 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) 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 - 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); diff --git a/firmware/export/config/sansac200v2.h b/firmware/export/config/sansac200v2.h index bf6f460..ff68e97 100644 #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 diff --git a/firmware/export/config/sansaclip.h b/firmware/export/config/sansaclip.h index 6cf7ec7..c139d91 100644 #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 diff --git a/firmware/export/config/sansam200v4.h b/firmware/export/config/sansam200v4.h index 9a544ff..fa91631 100644 #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 |