summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2011-12-29 14:55:49 +0000
committerMichael Sevakis <jethead71@rockbox.org>2011-12-29 14:55:49 +0000
commit2403f38c1fd8bc35d4d8e4b12047265366fbf1b7 (patch)
treeda021fed131c9c05512ea7632b059b19ff37b0a7
parentea55ad07b700307b6f66960e08b52d96828ce789 (diff)
downloadrockbox-2403f38c1fd8bc35d4d8e4b12047265366fbf1b7.tar.gz
rockbox-2403f38c1fd8bc35d4d8e4b12047265366fbf1b7.zip
RDS: Use a define that doesn't imply any particular hardware dependency.
Theoretically, anything with the capability could implement the decoding action in an ISR on any radio chip supporting RDS. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31464 a1c6a512-1295-4272-9138-f99709370657
-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];
36static int rt_segment; 36static int rt_segment;
37static int rt_abflag; 37static int rt_abflag;
38 38
39#ifdef SI4700_RDS_ASYNC 39#ifdef RDS_ISR_PROCESSING
40/* Functions are called in ISR context */ 40/* Functions are called in ISR context */
41#define rds_disable_irq_save() disable_irq_save() 41#define rds_disable_irq_save() disable_irq_save()
42#define rds_restore_irq(old) restore_irq(old) 42#define rds_restore_irq(old) restore_irq(old)
@@ -57,12 +57,12 @@ static inline char * get_rt(void)
57 rds_restore_irq(oldlevel); 57 rds_restore_irq(oldlevel);
58 return rt_out; 58 return rt_out;
59} 59}
60#else /* ndef SI4700_RDS_ASYNC */ 60#else /* ndef RDS_ISR_PROCESSING */
61#define rds_disable_irq_save() 0 61#define rds_disable_irq_save() 0
62#define rds_restore_irq(old) ((void)(old)) 62#define rds_restore_irq(old) ((void)(old))
63static inline char * get_ps(void) { return ps_copy; } 63static inline char * get_ps(void) { return ps_copy; }
64static inline char * get_rt(void) { return rt_copy; } 64static inline char * get_rt(void) { return rt_copy; }
65#endif /* SI4700_RDS_ASYNC */ 65#endif /* RDS_ISR_PROCESSING */
66 66
67/* resets the rds parser */ 67/* resets the rds parser */
68void rds_reset(void) 68void 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 @@
21 * 21 *
22 ****************************************************************************/ 22 ****************************************************************************/
23#include "config.h" 23#include "config.h"
24#include <stdbool.h> 24#include "system.h"
25#include <string.h> 25#include <string.h>
26#include <stdlib.h>
27#include "kernel.h" 26#include "kernel.h"
28#include "power.h" 27#include "power.h"
29#include "tuner.h" /* tuner abstraction interface */ 28#include "tuner.h" /* tuner abstraction interface */
@@ -529,9 +528,17 @@ int si4700_get(int setting)
529 528
530#ifdef HAVE_RDS_CAP 529#ifdef HAVE_RDS_CAP
531 case RADIO_EVENT: 530 case RADIO_EVENT:
531 {
532 #ifdef RDS_ISR_PROCESSING
533 int oldlevel = disable_irq_save();
534 #endif
532 val = rds_event; 535 val = rds_event;
533 rds_event = 0; 536 rds_event = 0;
537 #ifdef RDS_ISR_PROCESSING
538 restore_irq(oldlevel);
539 #endif
534 break; 540 break;
541 }
535#endif 542#endif
536 } 543 }
537 544
@@ -557,8 +564,8 @@ void si4700_dbg_info(struct si4700_dbg_info *nfo)
557 564
558#ifdef HAVE_RDS_CAP 565#ifdef HAVE_RDS_CAP
559 566
560#ifdef SI4700_RDS_ASYNC 567#ifdef RDS_ISR_PROCESSING
561/* Read raw RDS info for processing - asynchronously */ 568/* Read raw RDS info for processing - in ISR */
562 569
563/* Assumes regbuf is 32 bytes */ 570/* Assumes regbuf is 32 bytes */
564void si4700_rds_read_raw_async(void) 571void si4700_rds_read_raw_async(void)
@@ -583,7 +590,7 @@ void si4700_rds_set_event(void)
583 rds_event = 1; 590 rds_event = 1;
584} 591}
585 592
586#else 593#else /* ndef RDS_ISR_PROCESSING */
587/* Read raw RDS info for processing */ 594/* Read raw RDS info for processing */
588bool si4700_rds_read_raw(uint16_t data[4]) 595bool si4700_rds_read_raw(uint16_t data[4])
589{ 596{
@@ -610,7 +617,7 @@ void si4700_rds_set_event(void)
610 rds_event = 1; 617 rds_event = 1;
611 mutex_unlock(&fmr_mutex); 618 mutex_unlock(&fmr_mutex);
612} 619}
613#endif /* SI4700_RDS_ASYNC */ 620#endif /* RDS_ISR_PROCESSING */
614 621
615char * si4700_get_rds_info(int setting) 622char * si4700_get_rds_info(int setting)
616{ 623{
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 @@
90#define CONFIG_TUNER SI4700 90#define CONFIG_TUNER SI4700
91 91
92#define HAVE_RDS_CAP 92#define HAVE_RDS_CAP
93#define SI4700_RDS_ASYNC 93#define RDS_ISR_PROCESSING
94 94
95/* Define this if you have the WM8978 audio codec */ 95/* Define this if you have the WM8978 audio codec */
96#define HAVE_WM8978 96#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);
46void si4700_rds_init(void); 46void si4700_rds_init(void);
47/* Radio is fully powered up or about to be powered down */ 47/* Radio is fully powered up or about to be powered down */
48void si4700_rds_powerup(bool on); 48void si4700_rds_powerup(bool on);
49#ifdef SI4700_RDS_ASYNC 49#ifdef RDS_ISR_PROCESSING
50/* Read raw RDS info for processing - asynchronously */ 50/* Read raw RDS info for processing - asynchronously */
51void si4700_read_raw_async(int count); 51void si4700_read_raw_async(int count); /* implemented by target */
52void si4700_rds_read_raw_async(void); 52void si4700_rds_read_raw_async(void);
53void si4700_rds_read_raw_async_complete(unsigned char *regbuf, 53void si4700_rds_read_raw_async_complete(unsigned char *regbuf,
54 uint16_t data[4]); 54 uint16_t data[4]);
55#else 55#else /* ndef RDS_ISR_PROCESSING */
56/* Read raw RDS info for processing */ 56/* Read raw RDS info for processing */
57bool si4700_rds_read_raw(uint16_t data[4]); 57bool si4700_rds_read_raw(uint16_t data[4]);
58#endif 58#endif /* RDS_ISR_PROCESSING */
59/* Obtain specified string */ 59/* Obtain specified string */
60char* si4700_get_rds_info(int setting); 60char* si4700_get_rds_info(int setting);
61/* Set the event flag */ 61/* Set the event flag */