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

Subversion Repositories xenie

[/] [xenie/] [trunk/] [examples/] [Eth_example/] [mb_fw/] [drivers/] [iic_v3_4/] [doc/] [html/] [api/] [xiic__low__level__eeprom__example_8c.html] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 DFC
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
3
<head>
4
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
6
<meta name="generator" content="Doxygen 1.8.11"/>
7
<title>iic_v3_4: xiic_low_level_eeprom_example.c File Reference</title>
8
<link href="tabs.css" rel="stylesheet" type="text/css"/>
9
<script type="text/javascript" src="jquery.js"></script>
10
<script type="text/javascript" src="dynsections.js"></script>
11
<link href="navtree.css" rel="stylesheet" type="text/css"/>
12
<script type="text/javascript" src="resize.js"></script>
13
<script type="text/javascript" src="navtreedata.js"></script>
14
<script type="text/javascript" src="navtree.js"></script>
15
<script type="text/javascript">
16
  $(document).ready(initResizable);
17
  $(window).load(resizeHeight);
18
</script>
19
<link href="doxygen.css" rel="stylesheet" type="text/css" />
20
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
21
</head>
22
<body>
23
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
24
<div id="titlearea">
25
<table cellspacing="0" cellpadding="0">
26
 <tbody>
27
 <tr style="height: 56px;">
28
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.gif"/></td>
29
  <td id="projectalign" style="padding-left: 0.5em;">
30
   <div id="projectname">iic_v3_4
31
   </div>
32
   <div id="projectbrief">Xilinx SDK Drivers API Documentation</div>
33
  </td>
34
 </tr>
35
 </tbody>
36
</table>
37
</div>
38
<!-- end header part -->
39
<!-- Generated by Doxygen 1.8.11 -->
40
  <div id="navrow1" class="tabs">
41
    <ul class="tablist">
42
      <li><a href="index.html"><span>Overview</span></a></li>
43
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
44
      <li><a href="globals.html"><span>APIs</span></a></li>
45
      <li><a href="files.html"><span>File&#160;List</span></a></li>
46
    </ul>
47
  </div>
48
</div><!-- top -->
49
<div id="side-nav" class="ui-resizable side-nav-resizable">
50
  <div id="nav-tree">
51
    <div id="nav-tree-contents">
52
      <div id="nav-sync" class="sync"></div>
53
    </div>
54
  </div>
55
  <div id="splitbar" style="-moz-user-select:none;"
56
       class="ui-resizable-handle">
57
  </div>
58
</div>
59
<script type="text/javascript">
60
$(document).ready(function(){initNavTree('xiic__low__level__eeprom__example_8c.html','');});
61
</script>
62
<div id="doc-content">
63
<div class="header">
64
  <div class="summary">
65
<a href="#func-members">Functions</a>  </div>
66
  <div class="headertitle">
67
<div class="title">xiic_low_level_eeprom_example.c File Reference</div>  </div>
68
</div><!--header-->
69
<div class="contents">
70
<a name="details" id="details"></a><h2 class="groupheader">Overview</h2>
71
<div class="textblock"><p>This example writes/reads from the lower 256 bytes of the IIC EEPROMS. Please refer to the datasheets of the IIC EEPROM's for details about the internal addressing and page size of these devices.</p>
72
<p>The <a class="el" href="group__iic__v3__1.html#ga907c577b53407fb0bfc98d0ca37ee221" title="Send data as a master on the IIC bus. ">XIic_Send()</a> API is used to transmit the data and <a class="el" href="group__iic__v3__1.html#ga7a848238d75ff57837afa5a58f11f326" title="Receive data as a master on the IIC bus. ">XIic_Recv()</a> API is used to receive the data.</p>
73
<p>This example is tested on ML300/ML310/ML403/ML501/ML507/ML510/ML605/SP601 and SP605 Xilinx boards.</p>
74
<p>The ML310/ML410/ML510 boards have a on-board 64 Kb serial IIC EEPROM (Microchip 24LC64A). The WP pin of the IIC EEPROM is hardwired to ground on this board.</p>
75
<p>The ML300 board has an on-board 32 Kb serial IIC EEPROM(Microchip 24LC32A). The WP pin of the IIC EEPROM has to be connected to ground for this example. The WP is connected to pin Y3 of the FPGA.</p>
76
<p>The ML403 board has an on-board 4 Kb serial IIC EEPROM(Microchip 24LC04A). The WP pin of the IIC EEPROM is hardwired to ground on this board.</p>
77
<p>The ML501/ML505/ML507/ML605/SP601/SP605 boards have an on-board 8 Kb serial IIC EEPROM(STM M24C08). The WP pin of the IIC EEPROM is hardwired to ground on these boards.</p>
78
<p>The AddressType for ML300/ML310/ML410/ML510 boards should be u16 as the address pointer in the on board EEPROM is 2 bytes.</p>
79
<p>The AddressType for ML403/ML501/ML505/ML507/ML605/SP601/SP605 boards should be u8 as the address pointer for the on board EEPROM is 1 byte.</p>
80
<p>The 7 bit IIC Slave address of the IIC EEPROM on the ML300/ML310/ML403/ML410/ ML501/ML505/ML507/ML510 boards is 0x50. The 7 bit IIC Slave address of the IIC EEPROM on the ML605/SP601/SP605 boards is 0x54. Refer to the User Guide's of the respective boards for further information about the IIC slave address of IIC EEPROM's.</p>
81
<p>The define EEPROM_ADDRESS in this file needs to be changed depending on the board on which this example is to be run.</p>
82
<p>This code assumes that no Operating System is being used.</p>
83
<dl class="section note"><dt>Note</dt><dd>None</dd></dl>
84
<pre>
85
MODIFICATION HISTORY:</pre><pre>Ver     Who  Date        Changes
86
----- ---- -------- -----------------------------------------------
87
1.00a jhl  09/10/03 Created
88
1.00a sv   05/09/05 Minor changes to comply to Doxygen and coding guidelines
89
1.00a mta  03/09/06 Minor updates due to changes in the low level driver for
90
              supporting repeated start functionality.
91
2.00a sdm  09/22/09 Converted all register accesses to 32 bit access and minor
92
              modifications as per coding guidelines.
93
2.01a ktn  03/17/10 Updated the information about the EEPROM's used on
94
              ML605/SP601/SP605 boards. Updated the example so that it
95
              can be used to access the entire IIC EEPROM for devices
96
              like M24C04/M24C08 that use LSB bits of the IIC device
97
              select code (IIC slave address) to specify the higher
98
              address bits of the EEPROM internal address.
99
2.01a sdm  06/13/11 Updated the example to flush the Tx FIFO when waiting for
100
              the previous command to be completed for CR612546.
101
</pre> </div><table class="memberdecls">
102
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
103
Functions</h2></td></tr>
104
<tr class="memitem:a8db240f5cab3c37c56c8db4e0ad37ebd"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic__low__level__eeprom__example_8c.html#a8db240f5cab3c37c56c8db4e0ad37ebd">IicLowLevelEeprom</a> ()</td></tr>
105
<tr class="separator:a8db240f5cab3c37c56c8db4e0ad37ebd"><td class="memSeparator" colspan="2">&#160;</td></tr>
106
<tr class="memitem:ad3c29e4ee8b1f6749a579636a178c069"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic__low__level__eeprom__example_8c.html#ad3c29e4ee8b1f6749a579636a178c069">ReadWriteVerify</a> (AddressType Address)</td></tr>
107
<tr class="separator:ad3c29e4ee8b1f6749a579636a178c069"><td class="memSeparator" colspan="2">&#160;</td></tr>
108
<tr class="memitem:a16a37ddca6337489a7c9deadddfc1547"><td class="memItemLeft" align="right" valign="top">unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic__low__level__eeprom__example_8c.html#a16a37ddca6337489a7c9deadddfc1547">EepromWriteByte</a> (AddressType Address, u8 *BufferPtr, u16 ByteCount)</td></tr>
109
<tr class="separator:a16a37ddca6337489a7c9deadddfc1547"><td class="memSeparator" colspan="2">&#160;</td></tr>
110
<tr class="memitem:a5c87929a9d1ad69044b17cde4cf03c0a"><td class="memItemLeft" align="right" valign="top">unsigned&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic__low__level__eeprom__example_8c.html#a5c87929a9d1ad69044b17cde4cf03c0a">EepromReadByte</a> (AddressType Address, u8 *BufferPtr, u16 ByteCount)</td></tr>
111
<tr class="separator:a5c87929a9d1ad69044b17cde4cf03c0a"><td class="memSeparator" colspan="2">&#160;</td></tr>
112
<tr class="memitem:a840291bc02cba5474a4cb46a9b9566fe"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="xiic__low__level__eeprom__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main</a> (void)</td></tr>
113
<tr class="separator:a840291bc02cba5474a4cb46a9b9566fe"><td class="memSeparator" colspan="2">&#160;</td></tr>
114
</table>
115
<h2 class="groupheader">Function Documentation</h2>
116
<a class="anchor" id="a5c87929a9d1ad69044b17cde4cf03c0a"></a>
117
<div class="memitem">
118
<div class="memproto">
119
      <table class="memname">
120
        <tr>
121
          <td class="memname">unsigned EepromReadByte </td>
122
          <td>(</td>
123
          <td class="paramtype">AddressType&#160;</td>
124
          <td class="paramname"><em>Address</em>, </td>
125
        </tr>
126
        <tr>
127
          <td class="paramkey"></td>
128
          <td></td>
129
          <td class="paramtype">u8 *&#160;</td>
130
          <td class="paramname"><em>BufferPtr</em>, </td>
131
        </tr>
132
        <tr>
133
          <td class="paramkey"></td>
134
          <td></td>
135
          <td class="paramtype">u16&#160;</td>
136
          <td class="paramname"><em>ByteCount</em>&#160;</td>
137
        </tr>
138
        <tr>
139
          <td></td>
140
          <td>)</td>
141
          <td></td><td></td>
142
        </tr>
143
      </table>
144
</div><div class="memdoc">
145
 
146
<p>This function reads a number of bytes from the IIC serial EEPROM into a specified buffer. </p>
147
<dl class="params"><dt>Parameters</dt><dd>
148
  <table class="params">
149
    <tr><td class="paramname">Address</td><td>contains the address in the EEPROM to read from. </td></tr>
150
    <tr><td class="paramname">BufferPtr</td><td>contains the address of the data buffer to be filled. </td></tr>
151
    <tr><td class="paramname">ByteCount</td><td>contains the number of bytes in the buffer to be read. This value is not constrained by the page size of the device such that up to 64K may be read in one call.</td></tr>
152
  </table>
153
  </dd>
154
</dl>
155
<dl class="section return"><dt>Returns</dt><dd>The number of bytes read. A value less than the specified input value indicates an error.</dd></dl>
156
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>
157
 
158
<p>References <a class="el" href="group__iic__v3__1.html#gaa4fa9698cb076131f2d4571ef3bae6f3">XIIC_CR_ENABLE_DEVICE_MASK</a>, <a class="el" href="group__iic__v3__1.html#ga03585e458e3c5adf56986e7c2c3d9d42">XIIC_CR_REG_OFFSET</a>, <a class="el" href="group__iic__v3__1.html#ga2342662b2911c5aea24b397e17be7e41">XIIC_CR_TX_FIFO_RESET_MASK</a>, <a class="el" href="group__iic__v3__1.html#gab28be58b11c65ecc54fc2f0c300412c1">XIic_ReadReg</a>, <a class="el" href="group__iic__v3__1.html#ga7a848238d75ff57837afa5a58f11f326">XIic_Recv()</a>, <a class="el" href="group__iic__v3__1.html#ga907c577b53407fb0bfc98d0ca37ee221">XIic_Send()</a>, <a class="el" href="group__iic__v3__1.html#ga41bc9ddb46bd9eca389b60503e7a0589">XIIC_SR_BUS_BUSY_MASK</a>, <a class="el" href="group__iic__v3__1.html#gaa039f3dea3b57add15de333f733b5561">XIIC_SR_REG_OFFSET</a>, <a class="el" href="group__iic__v3__1.html#gacdf6b790e752c7f789c81ee4721bafe8">XIIC_STOP</a>, and <a class="el" href="group__iic__v3__1.html#ga7a9318f43afc81c1dbd30a27587ba51d">XIic_WriteReg</a>.</p>
159
 
160
<p>Referenced by <a class="el" href="xiic__low__level__dynamic__eeprom__example_8c.html#a50f19b8762ac4b72ca5740da9b4c3690">EepromWriteByte()</a>, <a class="el" href="xiic__low__level__eeprom__example_8c.html#a8db240f5cab3c37c56c8db4e0ad37ebd">IicLowLevelEeprom()</a>, <a class="el" href="xiic__low__level__dynamic__eeprom__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>, and <a class="el" href="xiic__low__level__eeprom__example_8c.html#ad3c29e4ee8b1f6749a579636a178c069">ReadWriteVerify()</a>.</p>
161
 
162
</div>
163
</div>
164
<a class="anchor" id="a16a37ddca6337489a7c9deadddfc1547"></a>
165
<div class="memitem">
166
<div class="memproto">
167
      <table class="memname">
168
        <tr>
169
          <td class="memname">unsigned EepromWriteByte </td>
170
          <td>(</td>
171
          <td class="paramtype">AddressType&#160;</td>
172
          <td class="paramname"><em>Address</em>, </td>
173
        </tr>
174
        <tr>
175
          <td class="paramkey"></td>
176
          <td></td>
177
          <td class="paramtype">u8 *&#160;</td>
178
          <td class="paramname"><em>BufferPtr</em>, </td>
179
        </tr>
180
        <tr>
181
          <td class="paramkey"></td>
182
          <td></td>
183
          <td class="paramtype">u16&#160;</td>
184
          <td class="paramname"><em>ByteCount</em>&#160;</td>
185
        </tr>
186
        <tr>
187
          <td></td>
188
          <td>)</td>
189
          <td></td><td></td>
190
        </tr>
191
      </table>
192
</div><div class="memdoc">
193
 
194
<p>This function writes a buffer of bytes to the IIC serial EEPROM. </p>
195
<dl class="params"><dt>Parameters</dt><dd>
196
  <table class="params">
197
    <tr><td class="paramname">Address</td><td>contains the address in the EEPROM to write to. </td></tr>
198
    <tr><td class="paramname">BufferPtr</td><td>contains the address of the data to write. </td></tr>
199
    <tr><td class="paramname">ByteCount</td><td>contains the number of bytes in the buffer to be written. Note that this should not exceed the page size of the EEPROM as noted by the constant PAGE_SIZE.</td></tr>
200
  </table>
201
  </dd>
202
</dl>
203
<dl class="section return"><dt>Returns</dt><dd>The number of bytes written, a value less than that which was specified as an input indicates an error.</dd></dl>
204
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>
205
 
206
<p>References <a class="el" href="group__iic__v3__1.html#gaa4fa9698cb076131f2d4571ef3bae6f3">XIIC_CR_ENABLE_DEVICE_MASK</a>, <a class="el" href="group__iic__v3__1.html#ga03585e458e3c5adf56986e7c2c3d9d42">XIIC_CR_REG_OFFSET</a>, <a class="el" href="group__iic__v3__1.html#ga2342662b2911c5aea24b397e17be7e41">XIIC_CR_TX_FIFO_RESET_MASK</a>, <a class="el" href="group__iic__v3__1.html#ga907c577b53407fb0bfc98d0ca37ee221">XIic_Send()</a>, <a class="el" href="group__iic__v3__1.html#gacdf6b790e752c7f789c81ee4721bafe8">XIIC_STOP</a>, and <a class="el" href="group__iic__v3__1.html#ga7a9318f43afc81c1dbd30a27587ba51d">XIic_WriteReg</a>.</p>
207
 
208
<p>Referenced by <a class="el" href="xiic__low__level__eeprom__example_8c.html#ad3c29e4ee8b1f6749a579636a178c069">ReadWriteVerify()</a>.</p>
209
 
210
</div>
211
</div>
212
<a class="anchor" id="a8db240f5cab3c37c56c8db4e0ad37ebd"></a>
213
<div class="memitem">
214
<div class="memproto">
215
      <table class="memname">
216
        <tr>
217
          <td class="memname">int IicLowLevelEeprom </td>
218
          <td>(</td>
219
          <td class="paramname"></td><td>)</td>
220
          <td></td>
221
        </tr>
222
      </table>
223
</div><div class="memdoc">
224
 
225
<p>The function uses the low level driver of IIC to read and write to the IIC EEPROM board. </p>
226
<p>The addresses tested are from 128 to 192.</p>
227
<dl class="params"><dt>Parameters</dt><dd>
228
  <table class="params">
229
    <tr><td class="paramname">None.</td><td></td></tr>
230
  </table>
231
  </dd>
232
</dl>
233
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, XST_FAILURE if unsuccessful.</dd></dl>
234
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>
235
 
236
<p>References <a class="el" href="xiic__low__level__eeprom__example_8c.html#a5c87929a9d1ad69044b17cde4cf03c0a">EepromReadByte()</a>, and <a class="el" href="xiic__low__level__eeprom__example_8c.html#ad3c29e4ee8b1f6749a579636a178c069">ReadWriteVerify()</a>.</p>
237
 
238
<p>Referenced by <a class="el" href="xiic__low__level__eeprom__example_8c.html#a840291bc02cba5474a4cb46a9b9566fe">main()</a>.</p>
239
 
240
</div>
241
</div>
242
<a class="anchor" id="a840291bc02cba5474a4cb46a9b9566fe"></a>
243
<div class="memitem">
244
<div class="memproto">
245
      <table class="memname">
246
        <tr>
247
          <td class="memname">int main </td>
248
          <td>(</td>
249
          <td class="paramtype">void&#160;</td>
250
          <td class="paramname"></td><td>)</td>
251
          <td></td>
252
        </tr>
253
      </table>
254
</div><div class="memdoc">
255
 
256
<p>Main function to call the low level EEPROM example. </p>
257
<dl class="params"><dt>Parameters</dt><dd>
258
  <table class="params">
259
    <tr><td class="paramname">None.</td><td></td></tr>
260
  </table>
261
  </dd>
262
</dl>
263
<dl class="section return"><dt>Returns</dt><dd>XST_SUCCESS if successful, XST_FAILURE if unsuccessful.</dd></dl>
264
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>
265
 
266
<p>References <a class="el" href="xiic__low__level__eeprom__example_8c.html#a8db240f5cab3c37c56c8db4e0ad37ebd">IicLowLevelEeprom()</a>.</p>
267
 
268
</div>
269
</div>
270
<a class="anchor" id="ad3c29e4ee8b1f6749a579636a178c069"></a>
271
<div class="memitem">
272
<div class="memproto">
273
      <table class="memname">
274
        <tr>
275
          <td class="memname">int ReadWriteVerify </td>
276
          <td>(</td>
277
          <td class="paramtype">AddressType&#160;</td>
278
          <td class="paramname"><em>Address</em></td><td>)</td>
279
          <td></td>
280
        </tr>
281
      </table>
282
</div><div class="memdoc">
283
 
284
<p>This function writes, reads, and verifies the read to the IIC EEPROM. </p>
285
<p>It does the write as a single page write, performs a buffered read, and also performs byte reads.</p>
286
<dl class="params"><dt>Parameters</dt><dd>
287
  <table class="params">
288
    <tr><td class="paramname">Address</td><td>is the starting address of the page in the EEPROM device to which the data is to be written.</td></tr>
289
  </table>
290
  </dd>
291
</dl>
292
<dl class="section return"><dt>Returns</dt><dd>XST_FAILURE if the test fails, XST_SUCCESS if the test passes.</dd></dl>
293
<dl class="section note"><dt>Note</dt><dd>None. </dd></dl>
294
 
295
<p>References <a class="el" href="xiic__low__level__eeprom__example_8c.html#a5c87929a9d1ad69044b17cde4cf03c0a">EepromReadByte()</a>, and <a class="el" href="xiic__low__level__eeprom__example_8c.html#a16a37ddca6337489a7c9deadddfc1547">EepromWriteByte()</a>.</p>
296
 
297
<p>Referenced by <a class="el" href="xiic__low__level__eeprom__example_8c.html#a8db240f5cab3c37c56c8db4e0ad37ebd">IicLowLevelEeprom()</a>.</p>
298
 
299
</div>
300
</div>
301
</div><!-- contents -->
302
</div><!-- doc-content -->
303
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
304
  <ul>
305
    <li class="footer">Copyright &copy; 2015 Xilinx Inc. All rights reserved.</li>
306
  </ul>
307
</div>
308
</body>
309
</html>

powered by: WebSVN 2.1.0

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