From c0edce8f5c51508ccaef9bb8460205b0ea2c9438 Mon Sep 17 00:00:00 2001 From: Bertrik Sikken Date: Mon, 20 Sep 2010 19:37:17 +0000 Subject: iap: make variable serbuf non-global git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28128 a1c6a512-1295-4272-9138-f99709370657 --- apps/debug_menu.c | 6 +++++- apps/iap.c | 12 +++++++++--- firmware/drivers/tuner/ipod_remote_tuner.c | 4 ++-- firmware/export/iap.h | 2 +- firmware/export/ipod_remote_tuner.h | 4 ++-- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/apps/debug_menu.c b/apps/debug_menu.c index c0a476dc10..94076bf64d 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c @@ -122,6 +122,10 @@ #include "usb_core.h" #endif +#if defined(IPOD_ACCESSORY_PROTOCOL) +#include "iap.h" +#endif + /*---------------------------------------------------*/ /* SPECIAL DEBUG STUFF */ /*---------------------------------------------------*/ @@ -1182,7 +1186,7 @@ bool dbg_ports(void) #endif #if defined(IPOD_ACCESSORY_PROTOCOL) -extern unsigned char serbuf[]; + const unsigned char *serbuf = iap_get_serbuf(); lcd_putsf(0, line++, "IAP PACKET: %02x %02x %02x %02x %02x %02x %02x %02x", serbuf[0], serbuf[1], serbuf[2], serbuf[3], serbuf[4], serbuf[5], serbuf[6], serbuf[7]); diff --git a/apps/iap.c b/apps/iap.c index 4d2ec625cd..f53717e625 100644 --- a/apps/iap.c +++ b/apps/iap.c @@ -52,7 +52,7 @@ static unsigned long iap_remotebtn = 0; static int iap_repeatbtn = 0; static bool iap_btnrepeat = false, iap_btnshuffle = false; -unsigned char serbuf[RX_BUFLEN]; +static unsigned char serbuf[RX_BUFLEN]; static int serbuf_i = 0; static unsigned char response[TX_BUFLEN]; @@ -837,13 +837,13 @@ void iap_handlepkt(void) /* tuner frequency from scan */ case 0x13: { - rmt_tuner_freq(); + rmt_tuner_freq(serbuf); break; } /* RDS station name 0x21 1E 00 + ASCII text*/ case 0x21: { - rmt_tuner_rds_data(); + rmt_tuner_rds_data(serbuf); break; } } @@ -868,3 +868,9 @@ int remote_control_rx(void) return btn; } + +const unsigned char *iap_get_serbuf(void) +{ + return serbuf; +} + diff --git a/firmware/drivers/tuner/ipod_remote_tuner.c b/firmware/drivers/tuner/ipod_remote_tuner.c index a20735402e..92fcd902ab 100644 --- a/firmware/drivers/tuner/ipod_remote_tuner.c +++ b/firmware/drivers/tuner/ipod_remote_tuner.c @@ -57,7 +57,7 @@ static void rmt_tuner_signal_power(unsigned char value) tuner_signal_power = (int)(value); } -void rmt_tuner_freq(void) +void rmt_tuner_freq(const unsigned char *serbuf) { char tempdata[4]; tempdata[0] = serbuf[6]; @@ -285,7 +285,7 @@ static bool reply_timeout(void) return (timeout >= TIMEOUT_VALUE); } -void rmt_tuner_rds_data(void) +void rmt_tuner_rds_data(const unsigned char *serbuf) { if (serbuf[3] == 0x1E) { diff --git a/firmware/export/iap.h b/firmware/export/iap.h index b6d6e64d68..fab218cf05 100644 --- a/firmware/export/iap.h +++ b/firmware/export/iap.h @@ -29,6 +29,6 @@ extern void iap_bitrate_set(int ratenum); extern void iap_periodic(void); extern void iap_handlepkt(void); extern void iap_send_pkt(const unsigned char * data, int len); -extern unsigned char serbuf[RX_BUFLEN]; +const unsigned char *iap_get_serbuf(void); #endif diff --git a/firmware/export/ipod_remote_tuner.h b/firmware/export/ipod_remote_tuner.h index c22978b0e4..e87b967193 100644 --- a/firmware/export/ipod_remote_tuner.h +++ b/firmware/export/ipod_remote_tuner.h @@ -28,8 +28,8 @@ extern int radio_present; -extern void rmt_tuner_freq(void); -extern void rmt_tuner_rds_data(void); +extern void rmt_tuner_freq(const unsigned char *serbuf); +extern void rmt_tuner_rds_data(const unsigned char *serbuf); int ipod_rmt_tuner_set(int setting, int value); int ipod_rmt_tuner_get(int setting); -- cgit v1.2.3