summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-11-25 20:16:44 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-11-25 20:16:44 +0000
commitcde27c3909f9a4f74c43f20ce252e43227cbed2e (patch)
tree7ff482ec81fab5693b59f1c4ab169d6981af2bf5
parent2c0b72f103e5d924da78f089cea778363e8d4bed (diff)
downloadrockbox-cde27c3909f9a4f74c43f20ce252e43227cbed2e.zip
rockbox-cde27c3909f9a4f74c43f20ce252e43227cbed2e.tar.gz
rockbox-cde27c3909f9a4f74c43f20ce252e43227cbed2e.tar.bz2
rockbox-cde27c3909f9a4f74c43f20ce252e43227cbed2e.tar.xz
Even more recording fixes. No more lockups (i hope)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2886 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/mpeg.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index b5d8289..0eb041f 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -1931,8 +1931,8 @@ static void init_recording(void)
val = 0;
mas_writemem(MAS_BANK_D0, 0x7f9, &val, 1);
- /* Set Demand mode and validate all settings */
- val = 0x25;
+ /* Set Demand mode, no monitoring and validate all settings */
+ val = 0x125;
mas_writemem(MAS_BANK_D0, 0x7f1, &val, 1);
/* Start the encoder application */
@@ -1943,6 +1943,13 @@ static void init_recording(void)
mas_readmem(MAS_BANK_D0, 0x7f7, &val, 1);
} while(!(val & 0x40));
+ /* We have started the recording application with monitoring OFF.
+ This is because we want to record at least one frame to fill the DMA
+ buffer, because the silly MAS will not negate EOD until at least one
+ DMA transfer has taken place.
+ Now let's wait for some data to be encoded. */
+ sleep(20);
+
/* Disable IRQ6 */
IPRB &= 0xff0f;
@@ -2026,6 +2033,14 @@ static void start_recording(void)
val |= 1;
mas_writemem(MAS_BANK_D0, 0x7f1, &val, 1);
+ /* Wait until the DSP has accepted the settings */
+ do
+ {
+ mas_readmem(MAS_BANK_D0, 0x7f1, &val,1);
+ } while(val & 1);
+
+ sleep(20);
+
/* Read the current frame */
mas_readmem(MAS_BANK_D0, 0xfd0, &record_start_frame, 1);
@@ -2044,6 +2059,12 @@ static void stop_recording(void)
val |= (1 << 10) | 1;
mas_writemem(MAS_BANK_D0, 0x7f1, &val, 1);
+ /* Wait until the DSP has accepted the settings */
+ do
+ {
+ mas_readmem(MAS_BANK_D0, 0x7f1, &val,1);
+ } while(val & 1);
+
drain_dma_buffer();
}
@@ -2617,7 +2638,7 @@ void mpeg_set_recording_options(int frequency, int quality,
DEBUGF("mas_writemem(MAS_BANK_D0, 0x7f0, %x)\n", val);
- val = ((1 << 10) | /* Monitoring on */
+ val = ((!is_recording << 10) | /* Monitoring */
((source < 2)?1:2) << 8) | /* Input select */
(1 << 5) | /* SDO strobe invert */
((is_mpeg1?0:1) << 3) |
@@ -2626,7 +2647,7 @@ void mpeg_set_recording_options(int frequency, int quality,
mas_writemem(MAS_BANK_D0, 0x7f1, &val,1);
DEBUGF("mas_writemem(MAS_BANK_D0, 0x7f1, %x)\n", val);
-
+
drain_dma_buffer();
if(source == 0) /* Mic */