summaryrefslogtreecommitdiff
path: root/firmware/target/arm/imx233/dma-imx233.h
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2011-10-18 22:03:25 +0000
committerAmaury Pouly <pamaury@rockbox.org>2011-10-18 22:03:25 +0000
commitb0a20dbc992be1bc748c8c75953bf37453b444d0 (patch)
treece1f92024b275969b86652e5063f1b4326f1a1ee /firmware/target/arm/imx233/dma-imx233.h
parente428717d308f84a861f8b7f44889da50deaca401 (diff)
downloadrockbox-b0a20dbc992be1bc748c8c75953bf37453b444d0.tar.gz
rockbox-b0a20dbc992be1bc748c8c75953bf37453b444d0.zip
imx233/fuze+: allow dma info retrieval; wait for end of channel reset before returning; fix typo
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30795 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm/imx233/dma-imx233.h')
-rw-r--r--firmware/target/arm/imx233/dma-imx233.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/dma-imx233.h b/firmware/target/arm/imx233/dma-imx233.h
index c0727a51e1..05baea989c 100644
--- a/firmware/target/arm/imx233/dma-imx233.h
+++ b/firmware/target/arm/imx233/dma-imx233.h
@@ -65,6 +65,10 @@
65#define HW_APBH_CHx_DEBUG1(i) (*(volatile uint32_t *)(HW_APBH_BASE + 0x90 + 0x70 * (i))) 65#define HW_APBH_CHx_DEBUG1(i) (*(volatile uint32_t *)(HW_APBH_BASE + 0x90 + 0x70 * (i)))
66 66
67#define HW_APBH_CHx_DEBUG2(i) (*(volatile uint32_t *)(HW_APBH_BASE + 0xa0 + 0x70 * (i))) 67#define HW_APBH_CHx_DEBUG2(i) (*(volatile uint32_t *)(HW_APBH_BASE + 0xa0 + 0x70 * (i)))
68#define HW_APBH_CHx_DEBUG2__AHB_BYTES_BP 0
69#define HW_APBH_CHx_DEBUG2__AHB_BYTES_BM 0xffff
70#define HW_APBH_CHx_DEBUG2__APB_BYTES_BP 16
71#define HW_APBH_CHx_DEBUG2__APB_BYTES_BM 0xffff0000
68 72
69/******** 73/********
70 * APHX * 74 * APHX *
@@ -104,6 +108,10 @@
104#define HW_APBX_CHx_DEBUG1(i) (*(volatile uint32_t *)(HW_APBX_BASE + 0x150 + (i) * 0x70)) 108#define HW_APBX_CHx_DEBUG1(i) (*(volatile uint32_t *)(HW_APBX_BASE + 0x150 + (i) * 0x70))
105 109
106#define HW_APBX_CHx_DEBUG2(i) (*(volatile uint32_t *)(HW_APBX_BASE + 0x160 + (i) * 0x70)) 110#define HW_APBX_CHx_DEBUG2(i) (*(volatile uint32_t *)(HW_APBX_BASE + 0x160 + (i) * 0x70))
111#define HW_APBX_CHx_DEBUG2__AHB_BYTES_BP 0
112#define HW_APBX_CHx_DEBUG2__AHB_BYTES_BM 0xffff
113#define HW_APBX_CHx_DEBUG2__APB_BYTES_BP 16
114#define HW_APBX_CHx_DEBUG2__APB_BYTES_BM 0xffff0000
107 115
108/********** 116/**********
109 * COMMON * 117 * COMMON *
@@ -117,6 +125,32 @@ struct apb_dma_command_t
117 /* PIO words follow */ 125 /* PIO words follow */
118}; 126};
119 127
128#define DMA_INFO_CURCMDADDR (1 << 0)
129#define DMA_INFO_NXTCMDADDR (1 << 1)
130#define DMA_INFO_CMD (1 << 2)
131#define DMA_INFO_BAR (1 << 3)
132#define DMA_INFO_APB_BYTES (1 << 4)
133#define DMA_INFO_AHB_BYTES (1 << 5)
134#define DMA_INFO_FREEZED (1 << 6)
135#define DMA_INFO_GATED (1 << 7)
136#define DMA_INFO_INTERRUPT (1 << 8)
137#define DMA_INFO_ALL 0x1ff
138
139struct imx233_dma_info_t
140{
141 unsigned long cur_cmd_addr;
142 unsigned long nxt_cmd_addr;
143 unsigned long cmd;
144 unsigned long bar;
145 unsigned apb_bytes;
146 unsigned ahb_bytes;
147 bool freezed;
148 bool gated;
149 bool int_enabled;
150 bool int_cmdcomplt;
151 bool int_error;
152};
153
120#define APBH_DMA_CHANNEL(i) i 154#define APBH_DMA_CHANNEL(i) i
121#define APBX_DMA_CHANNEL(i) ((i) | 0x10) 155#define APBX_DMA_CHANNEL(i) ((i) | 0x10)
122#define APB_IS_APBX_CHANNEL(x) ((x) & 0x10) 156#define APB_IS_APBX_CHANNEL(x) ((x) & 0x10)
@@ -124,6 +158,7 @@ struct apb_dma_command_t
124 158
125#define APB_SSP(ssp) APBH_DMA_CHANNEL(HW_APBH_SSP(ssp)) 159#define APB_SSP(ssp) APBH_DMA_CHANNEL(HW_APBH_SSP(ssp))
126#define APB_AUDIO_ADC APBX_DMA_CHANNEL(HW_APBX_AUDIO_ADC) 160#define APB_AUDIO_ADC APBX_DMA_CHANNEL(HW_APBX_AUDIO_ADC)
161#define APB_AUDIO_DAC APBX_DMA_CHANNEL(HW_APBX_AUDIO_DAC)
127#define APB_I2C APBX_DMA_CHANNEL(HW_APBX_I2C) 162#define APB_I2C APBX_DMA_CHANNEL(HW_APBX_I2C)
128 163
129#define HW_APB_CHx_CMD__COMMAND_BM 0x3 164#define HW_APB_CHx_CMD__COMMAND_BM 0x3
@@ -160,6 +195,7 @@ void imx233_dma_reset_channel(unsigned chan);
160/* only apbh channel have clkgate control */ 195/* only apbh channel have clkgate control */
161void imx233_dma_clkgate_channel(unsigned chan, bool enable_clock); 196void imx233_dma_clkgate_channel(unsigned chan, bool enable_clock);
162 197
198void imx233_dma_freeze_channel(unsigned chan, bool freeze);
163void imx233_dma_enable_channel_interrupt(unsigned chan, bool enable); 199void imx233_dma_enable_channel_interrupt(unsigned chan, bool enable);
164/* clear both channel complete and error bits */ 200/* clear both channel complete and error bits */
165void imx233_dma_clear_channel_interrupt(unsigned chan); 201void imx233_dma_clear_channel_interrupt(unsigned chan);
@@ -167,5 +203,8 @@ bool imx233_dma_is_channel_error_irq(unsigned chan);
167/* assume no command is in progress */ 203/* assume no command is in progress */
168void imx233_dma_start_command(unsigned chan, struct apb_dma_command_t *cmd); 204void imx233_dma_start_command(unsigned chan, struct apb_dma_command_t *cmd);
169void imx233_dma_wait_completion(unsigned chan); 205void imx233_dma_wait_completion(unsigned chan);
206/* get some info
207 * WARNING: if channel is not freezed, data might not be coherent ! */
208struct imx233_dma_info_t imx233_dma_get_info(unsigned chan, unsigned flags);
170 209
171#endif // __DMA_IMX233_H__ 210#endif // __DMA_IMX233_H__