summaryrefslogtreecommitdiff
path: root/apps/talk.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/talk.c')
-rw-r--r--apps/talk.c33
1 files changed, 2 insertions, 31 deletions
diff --git a/apps/talk.c b/apps/talk.c
index 72b9a2eb30..3aedaf34ec 100644
--- a/apps/talk.c
+++ b/apps/talk.c
@@ -107,17 +107,13 @@ struct voicefile_header /* file format of our voice file */
107 107
108/***************** Globals *****************/ 108/***************** Globals *****************/
109 109
110#if (CONFIG_CODEC == SWCODEC && MEMORYSIZE <= 2) || defined(ONDIO_SERIES) 110#if (CONFIG_CODEC == SWCODEC && MEMORYSIZE <= 2)
111/* On low memory swcodec targets the entire voice file wouldn't fit in memory 111/* On low memory swcodec targets the entire voice file wouldn't fit in memory
112 * together with codecs, so we load clips each time they are accessed. 112 * together with codecs, so we load clips each time they are accessed. */
113 * The Ondios have slow storage access and loading the entire voice file would
114 * take several seconds, so we use the same mechanism. */
115#define TALK_PROGRESSIVE_LOAD 113#define TALK_PROGRESSIVE_LOAD
116#if !defined(ONDIO_SERIES)
117/* 70+ clips should fit into 100k */ 114/* 70+ clips should fit into 100k */
118#define MAX_CLIP_BUFFER_SIZE (100000) 115#define MAX_CLIP_BUFFER_SIZE (100000)
119#endif 116#endif
120#endif
121 117
122#ifndef MAX_CLIP_BUFFER_SIZE 118#ifndef MAX_CLIP_BUFFER_SIZE
123/* 1GB should be enough for everybody; will be capped to voicefile size */ 119/* 1GB should be enough for everybody; will be capped to voicefile size */
@@ -212,14 +208,6 @@ static void sync_callback(int handle, bool sync_on)
212 mutex_lock(&read_buffer_mutex); 208 mutex_lock(&read_buffer_mutex);
213 else 209 else
214 mutex_unlock(&read_buffer_mutex); 210 mutex_unlock(&read_buffer_mutex);
215#if CONFIG_CPU == SH7034
216 /* DMA must not interrupt during buffer move or commit_buffer copies
217 * from inconsistent buflib buffer */
218 if (sync_on)
219 CHCR3 &= ~0x0001; /* disable the DMA (and therefore the interrupt also) */
220 else
221 CHCR3 |= 0x0001; /* re-enable the DMA */
222#endif
223} 211}
224 212
225static ssize_t read_to_handle_ex(int fd, struct buflib_context *ctx, int handle, 213static ssize_t read_to_handle_ex(int fd, struct buflib_context *ctx, int handle,
@@ -781,9 +769,6 @@ void talk_force_shutup(void)
781 if (QUEUE_LEVEL == 0) /* has ended anyway */ 769 if (QUEUE_LEVEL == 0) /* has ended anyway */
782 return; 770 return;
783 771
784#if CONFIG_CPU == SH7034
785 CHCR3 &= ~0x0001; /* disable the DMA (and therefore the interrupt also) */
786#endif /* CONFIG_CPU == SH7034 */
787 /* search next frame boundary and continue up to there */ 772 /* search next frame boundary and continue up to there */
788 pos = search = mp3_get_pos(); 773 pos = search = mp3_get_pos();
789 end = buflib_get_data(&clip_ctx, queue[queue_read].handle); 774 end = buflib_get_data(&clip_ctx, queue[queue_read].handle);
@@ -814,10 +799,6 @@ void talk_force_shutup(void)
814 queue_write = (queue_read + 1) & QUEUE_MASK; /* will be empty after next callback */ 799 queue_write = (queue_read + 1) & QUEUE_MASK; /* will be empty after next callback */
815 queue[queue_read].length = sent; /* current one ends after this */ 800 queue[queue_read].length = sent; /* current one ends after this */
816 801
817#if CONFIG_CPU == SH7034
818 DTCR3 = sent; /* let the DMA finish this frame */
819 CHCR3 |= 0x0001; /* re-enable DMA */
820#endif /* CONFIG_CPU == SH7034 */
821 thumbnail_buf_used = 0; 802 thumbnail_buf_used = 0;
822 return; 803 return;
823 } 804 }
@@ -854,10 +835,6 @@ static void queue_clip(struct queue_entry *clip, bool enqueue)
854 835
855 if (!clip->length) 836 if (!clip->length)
856 return; /* safety check */ 837 return; /* safety check */
857#if CONFIG_CPU == SH7034
858 /* disable the DMA temporarily, to be safe of race condition */
859 CHCR3 &= ~0x0001;
860#endif
861 talk_queue_lock(); 838 talk_queue_lock();
862 queue_level = QUEUE_LEVEL; /* check old level */ 839 queue_level = QUEUE_LEVEL; /* check old level */
863 qe = &queue[queue_write]; 840 qe = &queue[queue_write];
@@ -880,12 +857,6 @@ static void queue_clip(struct queue_entry *clip, bool enqueue)
880 curr_hd[2] = commit_buffer[3]; 857 curr_hd[2] = commit_buffer[3];
881 mp3_play_pause(true); /* kickoff audio */ 858 mp3_play_pause(true); /* kickoff audio */
882 } 859 }
883 else
884 {
885#if CONFIG_CPU == SH7034
886 CHCR3 |= 0x0001; /* re-enable DMA */
887#endif
888 }
889 860
890 need_shutup = true; 861 need_shutup = true;
891 862