summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-02-05 15:26:32 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2012-02-05 16:05:07 +0100
commit0aca81d807ed4159113fa7ae5bceaa6dee3abf38 (patch)
treef4ec92cb222ef56da42e387df6b46fff99cf03d4 /firmware/target
parentcd89b31133334f97f841ecf52481c648173a05f9 (diff)
downloadrockbox-0aca81d807ed4159113fa7ae5bceaa6dee3abf38.tar.gz
rockbox-0aca81d807ed4159113fa7ae5bceaa6dee3abf38.zip
imx233: add audioin init code, add adc dma interrupts, fix register defines
Change-Id: I204afbd3390f8dcde6ea1315ea6aa8dde12d3749
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/imx233/audioin-imx233.c13
-rw-r--r--firmware/target/arm/imx233/audioin-imx233.h9
-rw-r--r--firmware/target/arm/imx233/pcm-imx233.c4
-rw-r--r--firmware/target/arm/imx233/system-imx233.c4
-rw-r--r--firmware/target/arm/imx233/system-target.h2
5 files changed, 27 insertions, 5 deletions
diff --git a/firmware/target/arm/imx233/audioin-imx233.c b/firmware/target/arm/imx233/audioin-imx233.c
index 4c2ee657f9..dcb9c7c4b4 100644
--- a/firmware/target/arm/imx233/audioin-imx233.c
+++ b/firmware/target/arm/imx233/audioin-imx233.c
@@ -18,10 +18,16 @@
18 * KIND, either express or implied. 18 * KIND, either express or implied.
19 * 19 *
20 ****************************************************************************/ 20 ****************************************************************************/
21#include "audioout-imx233.h" 21#include "audioin-imx233.h"
22 22
23void imx233_audioin_preinit(void) 23void imx233_audioin_preinit(void)
24{ 24{
25 /* Enable AUDIOIN block */
26 imx233_reset_block(&HW_AUDIOIN_CTRL);
27 /* Enable ADC */
28 __REG_CLR(HW_AUDIOIN_ANACLKCTRL) = HW_AUDIOIN_ANACLKCTRL__CLKGATE;
29 /* Set word-length to 16-bit */
30 __REG_SET(HW_AUDIOIN_CTRL) = HW_AUDIOIN_CTRL__WORD_LENGTH;
25} 31}
26 32
27void imx233_audioin_postinit(void) 33void imx233_audioin_postinit(void)
@@ -30,4 +36,9 @@ void imx233_audioin_postinit(void)
30 36
31void imx233_audioin_close(void) 37void imx233_audioin_close(void)
32{ 38{
39 /* TODO mute */
40 /* Gate off ADC */
41 __REG_SET(HW_AUDIOIN_ANACLKCTRL) = HW_AUDIOIN_ANACLKCTRL__CLKGATE;
42 /* will also gate off the module */
43 __REG_CLR(HW_AUDIOIN_CTRL) = HW_AUDIOIN_CTRL__RUN;
33} 44}
diff --git a/firmware/target/arm/imx233/audioin-imx233.h b/firmware/target/arm/imx233/audioin-imx233.h
index 4875c8da45..6351173967 100644
--- a/firmware/target/arm/imx233/audioin-imx233.h
+++ b/firmware/target/arm/imx233/audioin-imx233.h
@@ -23,6 +23,7 @@
23 23
24#include "config.h" 24#include "config.h"
25#include "cpu.h" 25#include "cpu.h"
26#include "system.h"
26 27
27#define HW_AUDIOIN_BASE 0x8004c000 28#define HW_AUDIOIN_BASE 0x8004c000
28 29
@@ -69,7 +70,7 @@
69#define HW_AUDIOIN_ADCDEBUG (*(volatile uint32_t *)(HW_AUDIOIN_BASE + 0x40)) 70#define HW_AUDIOIN_ADCDEBUG (*(volatile uint32_t *)(HW_AUDIOIN_BASE + 0x40))
70#define HW_AUDIOIN_ADCDEBUG__FIFO_STATUS 1 71#define HW_AUDIOIN_ADCDEBUG__FIFO_STATUS 1
71 72
72#define HW_AUDIOIN_ADCVOL (*(volatile uint32_t *)(HW_AUDIOOUT_BASE + 0x50)) 73#define HW_AUDIOIN_ADCVOL (*(volatile uint32_t *)(HW_AUDIOIN_BASE + 0x50))
73#define HW_AUDIOIN_ADCVOL__GAIN_RIGHT_BP 0 74#define HW_AUDIOIN_ADCVOL__GAIN_RIGHT_BP 0
74#define HW_AUDIOIN_ADCVOL__GAIN_RIGHT_BM (0xf << 0) 75#define HW_AUDIOIN_ADCVOL__GAIN_RIGHT_BM (0xf << 0)
75#define HW_AUDIOIN_ADCVOL__SELECT_RIGHT_BP 4 76#define HW_AUDIOIN_ADCVOL__SELECT_RIGHT_BP 4
@@ -82,7 +83,7 @@
82#define HW_AUDIOIN_ADCVOL__EN_ADC_ZCD (1 << 25) 83#define HW_AUDIOIN_ADCVOL__EN_ADC_ZCD (1 << 25)
83#define HW_AUDIOIN_ADCVOL__VOLUME_UPDATE_PENDING (1 << 28) 84#define HW_AUDIOIN_ADCVOL__VOLUME_UPDATE_PENDING (1 << 28)
84 85
85#define HW_AUDIOIN_MICLINE (*(volatile uint32_t *)(HW_AUDIOOUT_BASE + 0x60)) 86#define HW_AUDIOIN_MICLINE (*(volatile uint32_t *)(HW_AUDIOIN_BASE + 0x60))
86#define HW_AUDIOIN_MICLINE__MIC_GAIN_BP 0 87#define HW_AUDIOIN_MICLINE__MIC_GAIN_BP 0
87#define HW_AUDIOIN_MICLINE__MIC_GAIN_BM 0x3 88#define HW_AUDIOIN_MICLINE__MIC_GAIN_BM 0x3
88#define HW_AUDIOIN_MICLINE__MIC_CHOPCLK_BP 4 89#define HW_AUDIOIN_MICLINE__MIC_CHOPCLK_BP 4
@@ -95,7 +96,7 @@
95#define HW_AUDIOIN_MICLINE__DIVIDE_LINE2 (1 << 28) 96#define HW_AUDIOIN_MICLINE__DIVIDE_LINE2 (1 << 28)
96#define HW_AUDIOIN_MICLINE__DIVIDE_LINE1 (1 << 29) 97#define HW_AUDIOIN_MICLINE__DIVIDE_LINE1 (1 << 29)
97 98
98#define HW_AUDIOIN_ANACLKCTRL (*(volatile uint32_t *)(HW_AUDIOOUT_BASE + 0x70)) 99#define HW_AUDIOIN_ANACLKCTRL (*(volatile uint32_t *)(HW_AUDIOIN_BASE + 0x70))
99#define HW_AUDIOIN_ANACLKCTRL__ADCDIV_BP 0 100#define HW_AUDIOIN_ANACLKCTRL__ADCDIV_BP 0
100#define HW_AUDIOIN_ANACLKCTRL__ADCDIV_BM (0x7 << 0) 101#define HW_AUDIOIN_ANACLKCTRL__ADCDIV_BM (0x7 << 0)
101#define HW_AUDIOIN_ANACLKCTRL__ADCCLK_SHIFT_BP 4 102#define HW_AUDIOIN_ANACLKCTRL__ADCCLK_SHIFT_BP 4
@@ -105,7 +106,7 @@
105#define HW_AUDIOIN_ANACLKCTRL__DITHER_OFF (1 << 10) 106#define HW_AUDIOIN_ANACLKCTRL__DITHER_OFF (1 << 10)
106#define HW_AUDIOIN_ANACLKCTRL__CLKGATE (1 << 31) 107#define HW_AUDIOIN_ANACLKCTRL__CLKGATE (1 << 31)
107 108
108#define HW_AUDIOIN_DATA (*(volatile uint32_t *)(HW_AUDIOOUT_BASE + 0x80)) 109#define HW_AUDIOIN_DATA (*(volatile uint32_t *)(HW_AUDIOIN_BASE + 0x80))
109 110
110void imx233_audioin_preinit(void); 111void imx233_audioin_preinit(void);
111void imx233_audioin_postinit(void); 112void imx233_audioin_postinit(void);
diff --git a/firmware/target/arm/imx233/pcm-imx233.c b/firmware/target/arm/imx233/pcm-imx233.c
index 787c828f21..c8b79b3875 100644
--- a/firmware/target/arm/imx233/pcm-imx233.c
+++ b/firmware/target/arm/imx233/pcm-imx233.c
@@ -131,6 +131,10 @@ const void *pcm_play_dma_get_peak_buffer(int *count)
131 return (void *)info.bar; 131 return (void *)info.bar;
132} 132}
133 133
134/*
135 * Recording
136 */
137
134void pcm_rec_lock(void) 138void pcm_rec_lock(void)
135{ 139{
136} 140}
diff --git a/firmware/target/arm/imx233/system-imx233.c b/firmware/target/arm/imx233/system-imx233.c
index c9d490302e..36b67674c2 100644
--- a/firmware/target/arm/imx233/system-imx233.c
+++ b/firmware/target/arm/imx233/system-imx233.c
@@ -69,6 +69,8 @@ default_interrupt(INT_LRADC_CH6);
69default_interrupt(INT_LRADC_CH7); 69default_interrupt(INT_LRADC_CH7);
70default_interrupt(INT_DAC_DMA); 70default_interrupt(INT_DAC_DMA);
71default_interrupt(INT_DAC_ERROR); 71default_interrupt(INT_DAC_ERROR);
72default_interrupt(INT_ADC_DMA);
73default_interrupt(INT_ADC_ERROR);
72default_interrupt(INT_DCP); 74default_interrupt(INT_DCP);
73 75
74typedef void (*isr_t)(void); 76typedef void (*isr_t)(void);
@@ -102,6 +104,8 @@ static isr_t isr_table[INT_SRC_NR_SOURCES] =
102 [INT_SRC_LRADC_CHx(7)] = INT_LRADC_CH7, 104 [INT_SRC_LRADC_CHx(7)] = INT_LRADC_CH7,
103 [INT_SRC_DAC_DMA] = INT_DAC_DMA, 105 [INT_SRC_DAC_DMA] = INT_DAC_DMA,
104 [INT_SRC_DAC_ERROR] = INT_DAC_ERROR, 106 [INT_SRC_DAC_ERROR] = INT_DAC_ERROR,
107 [INT_SRC_ADC_DMA] = INT_ADC_DMA,
108 [INT_SRC_ADC_ERROR] = INT_ADC_ERROR,
105 [INT_SRC_DCP] = INT_DCP, 109 [INT_SRC_DCP] = INT_DCP,
106}; 110};
107 111
diff --git a/firmware/target/arm/imx233/system-target.h b/firmware/target/arm/imx233/system-target.h
index a4ab64e562..d9a19efa8f 100644
--- a/firmware/target/arm/imx233/system-target.h
+++ b/firmware/target/arm/imx233/system-target.h
@@ -66,6 +66,8 @@
66#define INT_SRC_VDD5V 3 66#define INT_SRC_VDD5V 3
67#define INT_SRC_DAC_DMA 5 67#define INT_SRC_DAC_DMA 5
68#define INT_SRC_DAC_ERROR 6 68#define INT_SRC_DAC_ERROR 6
69#define INT_SRC_ADC_DMA 7
70#define INT_SRC_ADC_ERROR 8
69#define INT_SRC_USB_CTRL 11 71#define INT_SRC_USB_CTRL 11
70#define INT_SRC_SSP1_DMA 14 72#define INT_SRC_SSP1_DMA 14
71#define INT_SRC_SSP1_ERROR 15 73#define INT_SRC_SSP1_ERROR 15