summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/export/pcm_record.h10
-rw-r--r--firmware/pcm_record.c14
2 files changed, 14 insertions, 10 deletions
diff --git a/firmware/export/pcm_record.h b/firmware/export/pcm_record.h
index 865a37fc70..8075b00ffc 100644
--- a/firmware/export/pcm_record.h
+++ b/firmware/export/pcm_record.h
@@ -45,15 +45,17 @@
45#define PCMREC_E_ENCODER 0x80002000 45#define PCMREC_E_ENCODER 0x80002000
46/* filename queue has desynced from stream markers */ 46/* filename queue has desynced from stream markers */
47#define PCMREC_E_FNQ_DESYNC 0x80004000 47#define PCMREC_E_FNQ_DESYNC 0x80004000
48/* I/O error has occurred */
49#define PCMREC_E_IO 0x80008000
48#ifdef PCMREC_PARANOID 50#ifdef PCMREC_PARANOID
49/* encoder has written past end of allotted space */ 51/* encoder has written past end of allotted space */
50#define PCMREC_E_CHUNK_OVF 0x80008000 52#define PCMREC_E_CHUNK_OVF 0x80010000
51/* chunk header incorrect */ 53/* chunk header incorrect */
52#define PCMREC_E_BAD_CHUNK 0x80010000 54#define PCMREC_E_BAD_CHUNK 0x80020000
53/* encoder read position changed outside of recording control */ 55/* encoder read position changed outside of recording control */
54#define PCMREC_E_ENC_RD_INDEX_TRASHED 0x80020000 56#define PCMREC_E_ENC_RD_INDEX_TRASHED 0x80040000
55/* encoder write position changed outside of recording control */ 57/* encoder write position changed outside of recording control */
56#define PCMREC_E_ENC_WR_INDEX_TRASHED 0x80040000 58#define PCMREC_E_ENC_WR_INDEX_TRASHED 0x80080000
57#endif /* PCMREC_PARANOID */ 59#endif /* PCMREC_PARANOID */
58 60
59/** 61/**
diff --git a/firmware/pcm_record.c b/firmware/pcm_record.c
index e0bb664af1..c27f80400d 100644
--- a/firmware/pcm_record.c
+++ b/firmware/pcm_record.c
@@ -653,7 +653,9 @@ static void pcmrec_close_file(int *fd_p)
653 if (*fd_p < 0) 653 if (*fd_p < 0)
654 return; /* preserve error */ 654 return; /* preserve error */
655 655
656 close(*fd_p); 656 if (close(*fd_p) != 0)
657 errors |= PCMREC_E_IO;
658
657 *fd_p = -1; 659 *fd_p = -1;
658} /* pcmrec_close_file */ 660} /* pcmrec_close_file */
659 661
@@ -1042,8 +1044,8 @@ static void pcmrec_flush(unsigned flush_num)
1042 } /* end while */ 1044 } /* end while */
1043 1045
1044 /* sync file */ 1046 /* sync file */
1045 if (rec_fdata.rec_file >= 0) 1047 if (rec_fdata.rec_file >= 0 && fsync(rec_fdata.rec_file) != 0)
1046 fsync(rec_fdata.rec_file); 1048 errors |= PCMREC_E_IO;
1047 1049
1048 cpu_boost(false); 1050 cpu_boost(false);
1049 1051
@@ -1239,13 +1241,13 @@ static void pcmrec_init(void)
1239{ 1241{
1240 unsigned char *buffer; 1242 unsigned char *buffer;
1241 1243
1242 pcmrec_close_file(&rec_fdata.rec_file);
1243 rec_fdata.rec_file = -1;
1244
1245 /* warings and errors */ 1244 /* warings and errors */
1246 warnings = 1245 warnings =
1247 errors = 0; 1246 errors = 0;
1248 1247
1248 pcmrec_close_file(&rec_fdata.rec_file);
1249 rec_fdata.rec_file = -1;
1250
1249 /* pcm FIFO */ 1251 /* pcm FIFO */
1250 dma_lock = true; 1252 dma_lock = true;
1251 SET_PCM_POS(pcm_rd_pos, 0); 1253 SET_PCM_POS(pcm_rd_pos, 0);