OpenCores
URL https://opencores.org/ocsvn/sd_card_controller/sd_card_controller/trunk

Subversion Repositories sd_card_controller

[/] [sd_card_controller/] [trunk/] [doc/] [src/] [sw_if.tex] - Blame information for rev 3

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 rozpruwacz
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
%%%%                                                              %%%%
3
%%%% WISHBONE SD Card Controller IP Core                          %%%%
4
%%%%                                                              %%%%
5
%%%% sw_if.tex                                                    %%%%
6
%%%%                                                              %%%%
7
%%%% This file is part of the WISHBONE SD Card                    %%%%
8
%%%% Controller IP Core project                                   %%%%
9
%%%% http://www.opencores.org/cores/xxx/                          %%%%
10
%%%%                                                              %%%%
11
%%%% Description                                                  %%%%
12
%%%% documentation 'Software interface' chapter                   %%%%
13
%%%%                                                              %%%%
14
%%%% Author(s):                                                   %%%%
15
%%%%     - Marek Czerski, ma.czerski@gmail.com                    %%%%
16
%%%%                                                              %%%%
17
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18
%%%%                                                              %%%%
19
%%%% Copyright (C) 2013 Authors                                   %%%%
20
%%%%                                                              %%%%
21
%%%% This source file may be used and distributed without         %%%%
22
%%%% restriction provided that this copyright statement is not    %%%%
23
%%%% removed from the file and that any derivative work contains  %%%%
24
%%%% the original copyright notice and the associated disclaimer. %%%%
25
%%%%                                                              %%%%
26
%%%% This source file is free software; you can redistribute it   %%%%
27
%%%% and/or modify it under the terms of the GNU Lesser General   %%%%
28
%%%% Public License as published by the Free Software Foundation; %%%%
29
%%%% either version 2.1 of the License, or (at your option) any   %%%%
30
%%%% later version.                                               %%%%
31
%%%%                                                              %%%%
32
%%%% This source is distributed in the hope that it will be       %%%%
33
%%%% useful, but WITHOUT ANY WARRANTY; without even the implied   %%%%
34
%%%% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      %%%%
35
%%%% PURPOSE. See the GNU Lesser General Public License for more  %%%%
36
%%%% details.                                                     %%%%
37
%%%%                                                              %%%%
38
%%%% You should have received a copy of the GNU Lesser General    %%%%
39
%%%% Public License along with this source; if not, download it   %%%%
40
%%%% from http://www.opencores.org/lgpl.shtml                     %%%%
41
%%%%                                                              %%%%
42
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
43
\section{Software interface}
44
\label{sec:sw_if}
45
 
46
    Access to IP core registers is provided through Wishbone slave interface.
47
 
48
    \subsection{IP Core registers}
49
    \label{sec:regs}
50
 
51
    \begin{table}[H]
52
    \caption{List of registers}
53
        \begin{tabular}{l|l|l|l}
54
                \rowcolor[gray]{0.7} name & address & access & description \\ \hline \hline
55
                \texttt{argument} & \texttt{0x00} & RW & command argument \\ \hline
56
                \texttt{command} & \texttt{0x04} & RW & command transaction configuration \\ \hline
57
                \texttt{response0} & \texttt{0x08} & R & bits 31-0 of the response \\ \hline
58
                \texttt{response1} & \texttt{0x0C} & R & bits 63-32 of the response \\ \hline
59
                \texttt{response2} & \texttt{0x10} & R & bits 95-64 of the response \\ \hline
60
                \texttt{response3} & \texttt{0x14} & R & bits 119-96 of the response \\ \hline
61
                \texttt{control} & \texttt{0x1C} & RW & IP core control settings \\ \hline
62
                \texttt{timeout} & \texttt{0x20} & RW & timeout configuration \\ \hline
63
                \texttt{clock\_devider} & \texttt{0x24} & RW & MMC/SD interface clock devider \\ \hline
64
                \texttt{reset} & \texttt{0x28} & RW & software reset \\ \hline
65
                \texttt{voltage} & \texttt{0x2C} & R & power control information \\ \hline
66
                \texttt{capabilities} & \texttt{0x30} & R & capabilities information \\ \hline
67
                \texttt{cmd\_event\_status} & \texttt{0x34} & RW & command transaction events status / clear \\ \hline
68
                \texttt{cmd\_event\_enable} & \texttt{0x38} & RW & command transaction events enable \\ \hline
69
                \texttt{data\_event\_status} & \texttt{0x3C} & RW & data transaction events status / clear \\ \hline
70
                \texttt{data\_event\_enable} & \texttt{0x38} & RW & data transaction events enable \\ \hline
71
                \texttt{blkock\_size} & \texttt{0x44} & RW & read / write block transfer size \\ \hline
72
                \texttt{blkock\_count} & \texttt{0x48} & RW & read / write block count \\ \hline
73
                \texttt{dst\_src\_address} & \texttt{0x60} & RW & DMA destination / source address \\ \hline
74
                \hline
75
        \end{tabular}
76
        \label{tab:registers}
77
    \end{table}
78
 
79
    \subsubsection{Argument register}
80
    \label{sec:arg_reg}
81
 
82
    Write operation to this register triggers command transaction (command register has to be configured before writing to this register).
83
 
84
    \begin{table}[H]
85
    \caption{Argument register}
86
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
87
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
88
                \texttt{[31:0]} & \texttt{0x00000000} & RW & command argument value. \\ \hline
89
                \hline
90
        \end{tabular}
91
        \label{tab:arg_reg}
92
    \end{table}
93
 
94
    \subsubsection{Command register}
95
    \label{sec:cmd_reg}
96
 
97
    This register configures all aspects of command to be sent.
98
 
99
    \begin{table}[H]
100
    \caption{Command register}
101
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
102
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
103
                \texttt{[31:14]} & &  & reserved \\ \hline
104
                \texttt{[13:8]} & \texttt{0x00} & RW & command index \\ \hline
105
                \texttt{[7]} & & & reserved \\ \hline
106
                \texttt{[6:5]} & \texttt{0x0} & RW & data transfer specification. 0x0 - no data transfer; 0x1 - triggers read data transaction after command transaction;
107
                0x2 - triggers write data transaction after command transaction\\ \hline
108
                \texttt{[4]} & \texttt{0x0} & RW & check response for correct command index \\ \hline
109
                \texttt{[3]} & \texttt{0x0} & RW & check response crc \\ \hline
110
                \texttt{[2]} & \texttt{0x0} & RW & check for busy signal after command transaction (if busy signal will be asserted after command transaction,
111
                core will wait for as long as busy signal remains) \\ \hline
112
                \texttt{[1:0]} & \texttt{0x0} & RW & response check configuration. 0x0 - don't wait for response; 0x1 - wait for short response (48-bits);
113
                0x2 - wait for long response (136-bits) \\ \hline
114
                \hline
115
        \end{tabular}
116
        \label{tab:cmd_reg}
117
    \end{table}
118
 
119
    \subsubsection{Response register 0-3}
120
    \label{sec:resp_reg}
121
 
122
    Response registers 0-3 contains response data bits after end of succesful command transaction (if bits 1-0 of command register were configured to wait for response).
123
 
124
    \begin{table}[H]
125
    \caption{Response register 0-3}
126
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
127
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
128
                \texttt{[31:0]} & \texttt{0x00000000} & R & response data bits \\ \hline
129
                \hline
130
        \end{tabular}
131
        \label{tab:resp_reg}
132
    \end{table}
133
 
134
 
135
    \subsubsection{Control register}
136
    \label{sec:control_reg}
137
 
138
    \begin{table}[H]
139
    \caption{Control register}
140
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
141
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
142
                \texttt{[31:1]} & & & reserved \\ \hline
143
                \texttt{[0]} & \texttt{0x0} & RW & MMC/SD bus width; 0x0 - 1-bit operation; 0x1 - 4-bit operation \\ \hline
144
                \hline
145
        \end{tabular}
146
        \label{tab:control_reg}
147
    \end{table}
148
 
149
    \subsubsection{Timeout register}
150
    \label{sec:timeout_reg}
151
 
152
    Timeout register configures transaction watchdog counter. If any transaction will last longer than configured timeout, interrupt will be generated.
153
    Value in timeout register represents the number of \texttt{sd\_clk\_o\_pad} clock cyckles. Register value is calculated by following formula:
154
    \begin{equation}
155
    REG = \frac{timeout[s] * frequency_{\texttt{sd\_clk\_i\_pad}}[Hz]}{(2*(\texttt{clock\_devider} + 1))}
156
    \end{equation}
157
 
158
    \begin{table}[H]
159
    \caption{Timeout register}
160
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
161
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
162
                \texttt{[31:16]} & & & reserved \\ \hline
163
                \texttt{[15:0]} & \texttt{0x0} & RW & timeout value \\ \hline
164
                \hline
165
        \end{tabular}
166
        \label{tab:timeout_reg}
167
    \end{table}
168
 
169
    \subsubsection{Clock devider register}
170
    \label{sec:div_reg}
171
 
172
    Clock devider register control division of \texttt{sd\_clk\_i\_pad} signal frequency. Output of this devider is routed to MMC/SD interface clock domain.
173
    Register value is calculated by following formula:
174
    \begin{equation}
175
    REG = \frac{frequency_{\texttt{sd\_clk\_i\_pad}}[Hz]}{2*frequency_{\texttt{sd\_clk\_i\_pad}}[Hz]} - 1
176
    \end{equation}
177
 
178
    \begin{table}[H]
179
    \caption{Clock devider register}
180
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
181
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
182
                \texttt{[31:8]} & & & reserved \\ \hline
183
                \texttt{[7:0]} & \texttt{0x0} & RW & devider ratio \\ \hline
184
                \hline
185
        \end{tabular}
186
        \label{tab:div_reg}
187
    \end{table}
188
 
189
    \subsubsection{Software reset register}
190
    \label{sec:reset_reg}
191
 
192
    \begin{table}[H]
193
    \caption{Software reset register}
194
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
195
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
196
                \texttt{[31:1]} & & & reserved \\ \hline
197
                \texttt{[0]} & \texttt{0x0} & RW & reset; 0x0 - no reset; 0x1 - reset applied \\ \hline
198
                \hline
199
        \end{tabular}
200
        \label{tab:reset_reg}
201
    \end{table}
202
 
203
    \subsubsection{Voltage information register}
204
    \label{sec:voltage_reg}
205
 
206
    \begin{table}[H]
207
    \caption{Software reset register}
208
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
209
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
210
                \texttt{[31:0]} & & & reserved \\ \hline
211
                \hline
212
        \end{tabular}
213
        \label{tab:voltage_reg}
214
    \end{table}
215
 
216
    \subsubsection{Capabilities information register}
217
    \label{sec:capa_reg}
218
 
219
    \begin{table}[H]
220
    \caption{Capabilities information register}
221
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
222
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
223
                \texttt{[31:0]} & & & reserved \\ \hline
224
                \hline
225
        \end{tabular}
226
        \label{tab:capa_reg}
227
    \end{table}
228
 
229
    \subsubsection{Command events status register}
230
    \label{sec:cmd_evt_reg}
231
 
232
    This register holds all pending event flags related to command transactions. Write operation to this register
233
    clears all flags.
234
 
235
    \begin{table}[H]
236
    \caption{Command events status register}
237
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
238
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
239
                \texttt{[31:5]} & & & reserved \\ \hline
240
                \texttt{[4]} & \texttt{0x0} & RW & index error event \\ \hline
241
                \texttt{[3]} & \texttt{0x0} & RW & crc error event \\ \hline
242
                \texttt{[2]} & \texttt{0x0} & RW & timeout error event \\ \hline
243
                \texttt{[1]} & \texttt{0x0} & RW & error event (logic sum of all error events) \\ \hline
244
                \texttt{[0]} & \texttt{0x0} & RW & command transaction succesful completion event \\ \hline
245
                \hline
246
        \end{tabular}
247
        \label{tab:cmd_evt_reg}
248
    \end{table}
249
 
250
    \subsubsection{Command transaction events enable register}
251
    \label{sec:cmd_ena_reg}
252
 
253
    This register acts as event \textit{and} mask. To enable given event, corresponding bit must be set to 1.
254
 
255
    \begin{table}[H]
256
    \caption{Command transaction events enable register}
257
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
258
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
259
                \texttt{[31:5]} & & & reserved \\ \hline
260
                \texttt{[4]} & \texttt{0x0} & RW & enable index error event \\ \hline
261
                \texttt{[3]} & \texttt{0x0} & RW & enable crc error event \\ \hline
262
                \texttt{[2]} & \texttt{0x0} & RW & enable timeout error event \\ \hline
263
                \texttt{[1]} & \texttt{0x0} & RW & enable error event (logic sum of all error events) \\ \hline
264
                \texttt{[0]} & \texttt{0x0} & RW & enable command transaction succesful completion event \\ \hline
265
                \hline
266
        \end{tabular}
267
        \label{tab:cmd_ena_reg}
268
    \end{table}
269
 
270
    \subsubsection{Data transaction events status register}
271
    \label{sec:data_evt_reg}
272
 
273
    This register holds all pending event flags related to data transactions. Write operation to this register
274
    clears all flags.
275
 
276
    \begin{table}[H]
277
    \caption{Data transaction events status register}
278
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
279
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
280
                \texttt{[31:3]} & & & reserved \\ \hline
281
                \texttt{[2]} & \texttt{0x0} & RW & fifo error event \\ \hline
282
                \texttt{[1]} & \texttt{0x0} & RW & crc error event \\ \hline
283
                \texttt{[0]} & \texttt{0x0} & RW & data transaction succesful completion event \\ \hline
284
                \hline
285
        \end{tabular}
286
        \label{tab:data_evt_reg}
287
    \end{table}
288
 
289
    \subsubsection{Data transaction events enable register}
290
    \label{sec:data_ena_reg}
291
 
292
    This register acts as event \textit{and} mask. To enable given event, corresponding bit must be set to 1.
293
 
294
    \begin{table}[H]
295
    \caption{Data transaction events enable register}
296
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
297
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
298
                \texttt{[31:3]} & & & reserved \\ \hline
299
                \texttt{[2]} & \texttt{0x0} & RW & enable fifo error event \\ \hline
300
                \texttt{[1]} & \texttt{0x0} & RW & enable crc error event \\ \hline
301
                \texttt{[0]} & \texttt{0x0} & RW & enable data transaction succesful completion event \\ \hline
302
                \hline
303
        \end{tabular}
304
        \label{tab:data_ena_reg}
305
    \end{table}
306
 
307
    \subsubsection{Block size register}
308
    \label{sec:blocksize_reg}
309
 
310
    This register controls the number of bytes to write/read in a single block. Data transaction will transmit number of bytes equal to value of this register times value
311
    of \texttt{blkock\_count} register.
312
 
313
    \begin{table}[H]
314
    \caption{Block size register}
315
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
316
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
317
                \texttt{[31:12]} & & & reserved \\ \hline
318
                \texttt{[11:0]} & \texttt{0x200} & RW & number of byes in a single block \\ \hline
319
                \hline
320
        \end{tabular}
321
        \label{tab:blocksize_reg}
322
    \end{table}
323
 
324
    \subsubsection{Block count register}
325
    \label{sec:blockcnt_reg}
326
 
327
    This register controls the number of blocks to write/read in data transaction. Data transaction will transmit number of bytes equal to value of this register times value
328
    of \texttt{blkock\_size} register.
329
 
330
    \begin{table}[H]
331
    \caption{Block count register}
332
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
333
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
334
                \texttt{[31:12]} & & & reserved \\ \hline
335
                \texttt{[11:0]} & \texttt{0x200} & RW & number of blocks in data transaction \\ \hline
336
                \hline
337
        \end{tabular}
338
        \label{tab:blockcnt_reg}
339
    \end{table}
340
 
341
    \subsubsection{DMA destination / source register}
342
    \label{sec:dst_src_reg}
343
 
344
    This registers configures the DMA source / destination address. For write transactions, this address points to the begining of data block to be sent.
345
    For read transactions, this address points to the begining of data block to be written.
346
 
347
    \begin{table}[H]
348
    \caption{DMA destination / source register}
349
        \begin{tabular}{m{1.3cm}|m{2cm}|m{1cm}|m{8cm}}
350
                \rowcolor[gray]{0.7} bit \# & reset value & access & description \\ \hline \hline
351
                \texttt{[31:o]} & 0x00000000 & RW & address \\ \hline
352
                \hline
353
        \end{tabular}
354
        \label{tab:dst_src_reg}
355
    \end{table}
356
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.