diff options
author | Tobias Diedrich <ranma+coreboot@tdiedrich.de> | 2010-03-23 11:13:17 +0000 |
---|---|---|
committer | Tobias Diedrich <ranma+coreboot@tdiedrich.de> | 2010-03-23 11:13:17 +0000 |
commit | c4e4ffb5418afce2602a2310747676647ee04ddf (patch) | |
tree | 3e26d05e501bdf1c6d4ea5ed6f7013968226fd59 /firmware/target/arm/as3525 | |
parent | f5988d4fbd7150e59f0ea9e4f3f0bd61bbcb0bf9 (diff) | |
download | rockbox-c4e4ffb5418afce2602a2310747676647ee04ddf.tar.gz rockbox-c4e4ffb5418afce2602a2310747676647ee04ddf.zip |
Limit AUDIO_IRQ handling to AS3525, since it doesn't work on the newer SoC in SANSA_CLIPPLUS yet.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25305 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/as3525')
-rw-r--r-- | firmware/target/arm/as3525/ascodec-as3525.c | 14 | ||||
-rw-r--r-- | firmware/target/arm/as3525/ascodec-target.h | 12 | ||||
-rw-r--r-- | firmware/target/arm/as3525/usb-as3525.c | 27 | ||||
-rw-r--r-- | firmware/target/arm/as3525/usb-target.h | 6 |
4 files changed, 48 insertions, 11 deletions
diff --git a/firmware/target/arm/as3525/ascodec-as3525.c b/firmware/target/arm/as3525/ascodec-as3525.c index 441008493c..ed7aa962e7 100644 --- a/firmware/target/arm/as3525/ascodec-as3525.c +++ b/firmware/target/arm/as3525/ascodec-as3525.c | |||
@@ -96,7 +96,9 @@ static unsigned char *req_data_ptr = NULL; | |||
96 | static struct ascodec_request *req_head = NULL; | 96 | static struct ascodec_request *req_head = NULL; |
97 | static struct ascodec_request *req_tail = NULL; | 97 | static struct ascodec_request *req_tail = NULL; |
98 | 98 | ||
99 | #if CONFIG_CPU == AS3525 | ||
99 | static struct wakeup adc_wkup; | 100 | static struct wakeup adc_wkup; |
101 | static struct ascodec_request as_audio_req; | ||
100 | 102 | ||
101 | #ifdef DEBUG | 103 | #ifdef DEBUG |
102 | static int int_audio_ctr = 0; | 104 | static int int_audio_ctr = 0; |
@@ -107,15 +109,16 @@ static int int_usb_insert = 0; | |||
107 | static int int_usb_remove = 0; | 109 | static int int_usb_remove = 0; |
108 | static int int_rtc = 0; | 110 | static int int_rtc = 0; |
109 | static int int_adc = 0; | 111 | static int int_adc = 0; |
110 | #endif | 112 | #endif /* DEBUG */ |
111 | 113 | ||
112 | static struct ascodec_request as_audio_req; | 114 | static void ascodec_read_cb(unsigned const char *data, unsigned int len); |
115 | #endif /* CONFIG_CPU == AS3525 */ | ||
113 | 116 | ||
114 | static void ascodec_start_req(struct ascodec_request *req); | 117 | static void ascodec_start_req(struct ascodec_request *req); |
115 | static int ascodec_continue_req(struct ascodec_request *req, int irq_status); | 118 | static int ascodec_continue_req(struct ascodec_request *req, int irq_status); |
116 | static void ascodec_finish_req(struct ascodec_request *req); | 119 | static void ascodec_finish_req(struct ascodec_request *req); |
117 | static void ascodec_read_cb(unsigned const char *data, unsigned int len); | ||
118 | 120 | ||
121 | #if CONFIG_CPU == AS3525 | ||
119 | void INT_AUDIO(void) | 122 | void INT_AUDIO(void) |
120 | { | 123 | { |
121 | VIC_INT_EN_CLEAR = INTERRUPT_AUDIO; | 124 | VIC_INT_EN_CLEAR = INTERRUPT_AUDIO; |
@@ -123,6 +126,7 @@ void INT_AUDIO(void) | |||
123 | 126 | ||
124 | ascodec_async_read(AS3514_IRQ_ENRD0, 3, &as_audio_req, ascodec_read_cb); | 127 | ascodec_async_read(AS3514_IRQ_ENRD0, 3, &as_audio_req, ascodec_read_cb); |
125 | } | 128 | } |
129 | #endif /* CONFIG_CPU == AS3525 */ | ||
126 | 130 | ||
127 | void INT_I2C_AUDIO(void) | 131 | void INT_I2C_AUDIO(void) |
128 | { | 132 | { |
@@ -162,7 +166,9 @@ void ascodec_init(void) | |||
162 | int prescaler; | 166 | int prescaler; |
163 | 167 | ||
164 | mutex_init(&as_mtx); | 168 | mutex_init(&as_mtx); |
169 | #if CONFIG_CPU == AS3525 | ||
165 | wakeup_init(&adc_wkup); | 170 | wakeup_init(&adc_wkup); |
171 | #endif | ||
166 | 172 | ||
167 | /* enable clock */ | 173 | /* enable clock */ |
168 | CGU_PERI |= CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE; | 174 | CGU_PERI |= CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE; |
@@ -423,6 +429,7 @@ int ascodec_readbytes(unsigned int index, unsigned int len, unsigned char *data) | |||
423 | return i; | 429 | return i; |
424 | } | 430 | } |
425 | 431 | ||
432 | #if CONFIG_CPU == AS3525 | ||
426 | static void ascodec_read_cb(unsigned const char *data, unsigned int len) | 433 | static void ascodec_read_cb(unsigned const char *data, unsigned int len) |
427 | { | 434 | { |
428 | if (len != 3) /* some error happened? */ | 435 | if (len != 3) /* some error happened? */ |
@@ -465,6 +472,7 @@ void ascodec_wait_adc_finished(void) | |||
465 | { | 472 | { |
466 | wakeup_wait(&adc_wkup, TIMEOUT_BLOCK); | 473 | wakeup_wait(&adc_wkup, TIMEOUT_BLOCK); |
467 | } | 474 | } |
475 | #endif /* CONFIG_CPU == AS3525 */ | ||
468 | 476 | ||
469 | 477 | ||
470 | void ascodec_enable_endofch_irq(void) | 478 | void ascodec_enable_endofch_irq(void) |
diff --git a/firmware/target/arm/as3525/ascodec-target.h b/firmware/target/arm/as3525/ascodec-target.h index 989712ad0f..11474a44da 100644 --- a/firmware/target/arm/as3525/ascodec-target.h +++ b/firmware/target/arm/as3525/ascodec-target.h | |||
@@ -28,7 +28,8 @@ | |||
28 | #ifndef SIMULATOR | 28 | #ifndef SIMULATOR |
29 | 29 | ||
30 | #include "as3514.h" | 30 | #include "as3514.h" |
31 | #include "kernel.h" /* for struct wakeup */ | 31 | #include "kernel.h" /* for struct wakeup */ |
32 | #include "clock-target.h" /* for AS3525_I2C_PRESCALER */ | ||
32 | 33 | ||
33 | /* Charge Pump and Power management Settings */ | 34 | /* Charge Pump and Power management Settings */ |
34 | #define AS314_CP_DCDC3_SETTING \ | 35 | #define AS314_CP_DCDC3_SETTING \ |
@@ -70,8 +71,6 @@ struct ascodec_request { | |||
70 | 71 | ||
71 | void ascodec_init(void); | 72 | void ascodec_init(void); |
72 | 73 | ||
73 | void ascodec_init_late(void); | ||
74 | |||
75 | int ascodec_write(unsigned int index, unsigned int value); | 74 | int ascodec_write(unsigned int index, unsigned int value); |
76 | 75 | ||
77 | int ascodec_read(unsigned int index); | 76 | int ascodec_read(unsigned int index); |
@@ -106,7 +105,14 @@ void ascodec_lock(void); | |||
106 | 105 | ||
107 | void ascodec_unlock(void); | 106 | void ascodec_unlock(void); |
108 | 107 | ||
108 | #if CONFIG_CPU == AS3525 | ||
109 | void ascodec_wait_adc_finished(void); | 109 | void ascodec_wait_adc_finished(void); |
110 | #else | ||
111 | static inline void ascodec_wait_adc_finished(void) | ||
112 | { | ||
113 | /* FIXME: Doesn't work yet on AS3525v2 */ | ||
114 | } | ||
115 | #endif | ||
110 | 116 | ||
111 | void ascodec_enable_endofch_irq(void); | 117 | void ascodec_enable_endofch_irq(void); |
112 | 118 | ||
diff --git a/firmware/target/arm/as3525/usb-as3525.c b/firmware/target/arm/as3525/usb-as3525.c index 65edb598a3..4eb533e13c 100644 --- a/firmware/target/arm/as3525/usb-as3525.c +++ b/firmware/target/arm/as3525/usb-as3525.c | |||
@@ -29,7 +29,13 @@ | |||
29 | #include "power.h" | 29 | #include "power.h" |
30 | #include "as3525.h" | 30 | #include "as3525.h" |
31 | 31 | ||
32 | #if defined(SANSA_CLIPV2) || defined(SANSA_CLIPPLUS) || defined(SANSA_FUZEV2) | ||
33 | #warning USB_DETECT_PIN not defined for your target | ||
34 | #endif | ||
35 | |||
36 | #if CONFIG_CPU == AS3525 | ||
32 | static int usb_status = USB_EXTRACTED; | 37 | static int usb_status = USB_EXTRACTED; |
38 | #endif | ||
33 | 39 | ||
34 | void usb_enable(bool on) | 40 | void usb_enable(bool on) |
35 | { | 41 | { |
@@ -43,6 +49,14 @@ void usb_enable(bool on) | |||
43 | #endif | 49 | #endif |
44 | } | 50 | } |
45 | 51 | ||
52 | void usb_init_device(void) | ||
53 | { | ||
54 | #ifdef USB_DETECT_PIN | ||
55 | GPIOA_DIR &= ~(1 << USB_DETECT_PIN); /* set as input */ | ||
56 | #endif | ||
57 | } | ||
58 | |||
59 | #if CONFIG_CPU == AS3525 | ||
46 | void usb_insert_int(void) | 60 | void usb_insert_int(void) |
47 | { | 61 | { |
48 | usb_status = USB_INSERTED; | 62 | usb_status = USB_INSERTED; |
@@ -53,11 +67,18 @@ void usb_remove_int(void) | |||
53 | usb_status = USB_EXTRACTED; | 67 | usb_status = USB_EXTRACTED; |
54 | } | 68 | } |
55 | 69 | ||
56 | void usb_init_device(void) | 70 | int usb_detect(void) |
57 | { | 71 | { |
72 | return usb_status; | ||
58 | } | 73 | } |
59 | 74 | #else | |
60 | int usb_detect(void) | 75 | int usb_detect(void) |
61 | { | 76 | { |
62 | return usb_status; | 77 | #ifdef USB_DETECT_PIN |
78 | if (GPIOA_PIN( USB_DETECT_PIN )) | ||
79 | return USB_INSERTED; | ||
80 | else | ||
81 | #endif | ||
82 | return USB_EXTRACTED; | ||
63 | } | 83 | } |
84 | #endif | ||
diff --git a/firmware/target/arm/as3525/usb-target.h b/firmware/target/arm/as3525/usb-target.h index 55a7d87857..4c54dc182d 100644 --- a/firmware/target/arm/as3525/usb-target.h +++ b/firmware/target/arm/as3525/usb-target.h | |||
@@ -22,8 +22,10 @@ | |||
22 | #define USB_TARGET_H | 22 | #define USB_TARGET_H |
23 | 23 | ||
24 | void usb_init_device(void); | 24 | void usb_init_device(void); |
25 | int usb_detect(void); | ||
26 | #if CONFIG_CPU == AS3525 | ||
25 | void usb_insert_int(void); | 27 | void usb_insert_int(void); |
26 | void usb_remove_int(void); | 28 | void usb_remove_int(void); |
27 | int usb_detect(void); | 29 | #endif /* CONFIG_CPU == AS3525 */ |
28 | 30 | ||
29 | #endif | 31 | #endif /* USB_TARGET_H */ |