summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/drivers/rds.c6
-rw-r--r--firmware/drivers/tuner/si4700.c19
-rw-r--r--firmware/export/config/gigabeats.h2
-rw-r--r--firmware/export/si4700.h8
4 files changed, 21 insertions, 14 deletions
diff --git a/firmware/drivers/rds.c b/firmware/drivers/rds.c
index 828c28b672..05b17aba12 100644
--- a/firmware/drivers/rds.c
+++ b/firmware/drivers/rds.c
@@ -36,7 +36,7 @@ static char rt_copy[65];
static int rt_segment;
static int rt_abflag;
-#ifdef SI4700_RDS_ASYNC
+#ifdef RDS_ISR_PROCESSING
/* Functions are called in ISR context */
#define rds_disable_irq_save() disable_irq_save()
#define rds_restore_irq(old) restore_irq(old)
@@ -57,12 +57,12 @@ static inline char * get_rt(void)
rds_restore_irq(oldlevel);
return rt_out;
}
-#else /* ndef SI4700_RDS_ASYNC */
+#else /* ndef RDS_ISR_PROCESSING */
#define rds_disable_irq_save() 0
#define rds_restore_irq(old) ((void)(old))
static inline char * get_ps(void) { return ps_copy; }
static inline char * get_rt(void) { return rt_copy; }
-#endif /* SI4700_RDS_ASYNC */
+#endif /* RDS_ISR_PROCESSING */
/* resets the rds parser */
void rds_reset(void)
diff --git a/firmware/drivers/tuner/si4700.c b/firmware/drivers/tuner/si4700.c
index 0684d2042f..917f628490 100644
--- a/firmware/drivers/tuner/si4700.c
+++ b/firmware/drivers/tuner/si4700.c
@@ -21,9 +21,8 @@
*
****************************************************************************/
#include "config.h"
-#include <stdbool.h>
+#include "system.h"
#include <string.h>
-#include <stdlib.h>
#include "kernel.h"
#include "power.h"
#include "tuner.h" /* tuner abstraction interface */
@@ -529,9 +528,17 @@ int si4700_get(int setting)
#ifdef HAVE_RDS_CAP
case RADIO_EVENT:
+ {
+ #ifdef RDS_ISR_PROCESSING
+ int oldlevel = disable_irq_save();
+ #endif
val = rds_event;
rds_event = 0;
+ #ifdef RDS_ISR_PROCESSING
+ restore_irq(oldlevel);
+ #endif
break;
+ }
#endif
}
@@ -557,8 +564,8 @@ void si4700_dbg_info(struct si4700_dbg_info *nfo)
#ifdef HAVE_RDS_CAP
-#ifdef SI4700_RDS_ASYNC
-/* Read raw RDS info for processing - asynchronously */
+#ifdef RDS_ISR_PROCESSING
+/* Read raw RDS info for processing - in ISR */
/* Assumes regbuf is 32 bytes */
void si4700_rds_read_raw_async(void)
@@ -583,7 +590,7 @@ void si4700_rds_set_event(void)
rds_event = 1;
}
-#else
+#else /* ndef RDS_ISR_PROCESSING */
/* Read raw RDS info for processing */
bool si4700_rds_read_raw(uint16_t data[4])
{
@@ -610,7 +617,7 @@ void si4700_rds_set_event(void)
rds_event = 1;
mutex_unlock(&fmr_mutex);
}
-#endif /* SI4700_RDS_ASYNC */
+#endif /* RDS_ISR_PROCESSING */
char * si4700_get_rds_info(int setting)
{
diff --git a/firmware/export/config/gigabeats.h b/firmware/export/config/gigabeats.h
index 9a34791ab1..481a666b4b 100644
--- a/firmware/export/config/gigabeats.h
+++ b/firmware/export/config/gigabeats.h
@@ -90,7 +90,7 @@
#define CONFIG_TUNER SI4700
#define HAVE_RDS_CAP
-#define SI4700_RDS_ASYNC
+#define RDS_ISR_PROCESSING
/* Define this if you have the WM8978 audio codec */
#define HAVE_WM8978
diff --git a/firmware/export/si4700.h b/firmware/export/si4700.h
index fe55dd3853..6b7992c025 100644
--- a/firmware/export/si4700.h
+++ b/firmware/export/si4700.h
@@ -46,16 +46,16 @@ bool si4700_st(void);
void si4700_rds_init(void);
/* Radio is fully powered up or about to be powered down */
void si4700_rds_powerup(bool on);
-#ifdef SI4700_RDS_ASYNC
+#ifdef RDS_ISR_PROCESSING
/* Read raw RDS info for processing - asynchronously */
-void si4700_read_raw_async(int count);
+void si4700_read_raw_async(int count); /* implemented by target */
void si4700_rds_read_raw_async(void);
void si4700_rds_read_raw_async_complete(unsigned char *regbuf,
uint16_t data[4]);
-#else
+#else /* ndef RDS_ISR_PROCESSING */
/* Read raw RDS info for processing */
bool si4700_rds_read_raw(uint16_t data[4]);
-#endif
+#endif /* RDS_ISR_PROCESSING */
/* Obtain specified string */
char* si4700_get_rds_info(int setting);
/* Set the event flag */