/[H8]/trunk/docs/Microchip TCP_IP stack/Include/TCPIP Stack/XEEPROM.h
ViewVC logotype

Annotation of /trunk/docs/Microchip TCP_IP stack/Include/TCPIP Stack/XEEPROM.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 15 - (hide annotations) (download)
Thu Apr 19 09:01:15 2007 UTC (17 years, 3 months ago) by hedin
File MIME type: text/plain
File size: 9895 byte(s)
added the TCP/IP stack, source code.
1 hedin 15 /*********************************************************************
2     *
3     * External serial data EEPROM Access Defs.
4     *
5     *********************************************************************
6     * FileName: XEEPROM.h
7     * Dependencies: None
8     * Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F
9     * Complier: Microchip C18 v3.02 or higher
10     * Microchip C30 v2.01 or higher
11     * Company: Microchip Technology, Inc.
12     *
13     * Software License Agreement
14     *
15     * Copyright © 2002-2007 Microchip Technology Inc. All rights
16     * reserved.
17     *
18     * Microchip licenses to you the right to use, modify, copy, and
19     * distribute:
20     * (i) the Software when embedded on a Microchip microcontroller or
21     * digital signal controller product (“Device”) which is
22     * integrated into Licensee’s product; or
23     * (ii) ONLY the Software driver source files ENC28J60.c and
24     * ENC28J60.h ported to a non-Microchip device used in
25     * conjunction with a Microchip ethernet controller for the
26     * sole purpose of interfacing with the ethernet controller.
27     *
28     * You should refer to the license agreement accompanying this
29     * Software for additional information regarding your rights and
30     * obligations.
31     *
32     * THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT
33     * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
34     * LIMITATION, ANY WARRANTY OF MERCHANTABILITY, FITNESS FOR A
35     * PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL
36     * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR
37     * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF
38     * PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS
39     * BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE
40     * THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, OR OTHER
41     * SIMILAR COSTS, WHETHER ASSERTED ON THE BASIS OF CONTRACT, TORT
42     * (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR OTHERWISE.
43     *
44     *
45     * Author Date Comment
46     *~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47     * Nilesh Rajbharti 5/20/02 Original (Rev. 1.0)
48     ********************************************************************/
49     #ifndef __XEEPROM_H
50     #define __XEEPROM_H
51    
52    
53     typedef unsigned short int XEE_ADDR;
54    
55     typedef BOOL XEE_RESULT;
56     #define XEE_SUCCESS FALSE
57    
58     /*********************************************************************
59     * Function: void XEEInit(void)
60     *
61     * PreCondition: None
62     *
63     * Input: baud - SSPADD value for bit rate.
64     *
65     * Output: None
66     *
67     * Side Effects: None
68     *
69     * Overview: Initialize I2C module to communicate to serial
70     * EEPROM.
71     *
72     * Note: None
73     ********************************************************************/
74     void XEEInit(void);
75    
76    
77    
78    
79     /*********************************************************************
80     * Function: XEE_RESULT XEEBeginWrite(XEE_ADDR address)
81     *
82     * PreCondition: XEEInit() is already called.
83     *
84     * Input: control - data EEPROM control code
85     * address - address to where to write
86     *
87     * Output: XEE_SUCCESS if successful
88     * other value if failed.
89     *
90     * Side Effects: None
91     *
92     * Overview: Sets up internal address counter of EEPROM.
93     *
94     * Note: This function does not release the I2C bus.
95     * User must close XEEEndWrite() after this function
96     * is called to relase the I2C bus.
97     ********************************************************************/
98     XEE_RESULT XEEBeginWrite(XEE_ADDR address);
99    
100    
101    
102     /*********************************************************************
103     * Function: XEE_RESULT XEEWrite(unsigned char val)
104     *
105     * PreCondition: XEEInit() && XEEBeginWrite() are already called.
106     *
107     * Input: val to be written
108     *
109     * Output: XEE_SUCCESS if successful
110     * other value if failed.
111     *
112     * Side Effects: None
113     *
114     * Overview: Writes given value 'val' at current address.
115     * Current address is set by XEEBeginWrite()
116     * and is incremented by every XEEWrite().
117     *
118     * Note: This function does not initiate the write cycle;
119     * it simply loads given value into internal page buffer.
120     * This function does not release the I2C bus.
121     * User must close XEEEndWrite() after this function
122     * is called to relase the I2C bus.
123     ********************************************************************/
124     XEE_RESULT XEEWrite(unsigned char val);
125    
126    
127    
128     /*********************************************************************
129     * Function: XEE_RESULT XEEEndWrite(void)
130     *
131     * PreCondition: XEEInit() && XEEBeginWrite() are already called.
132     *
133     * Input: None
134     *
135     * Output: XEE_SUCCESS if successful
136     * other value if failed.
137     *
138     * Side Effects: None
139     *
140     * Overview: Instructs EEPROM to begin write cycle.
141     *
142     * Note: Call this function after either page full of bytes
143     * written or no more bytes are left to load.
144     * This function initiates the write cycle.
145     * User must call for XEEWait() to ensure that write
146     * cycle is finished before calling any other
147     * routine.
148     ********************************************************************/
149     XEE_RESULT XEEEndWrite(void);
150    
151    
152     /*********************************************************************
153     * Function: XEE_RESULT XEEBeginRead(unsigned char control,
154     * XEE_ADDR address)
155     *
156     * PreCondition: XEEInit() is already called.
157     *
158     * Input: control - EEPROM control and address code.
159     * address - Address at which read is to be performed.
160     *
161     * Output: XEE_SUCCESS if successful
162     * other value if failed.
163     *
164     * Side Effects: None
165     *
166     * Overview: Sets internal address counter to given address.
167     * Puts EEPROM in sequential read mode.
168     *
169     * Note: This function does not release I2C bus.
170     * User must call XEEEndRead() when read is not longer
171     * needed; I2C bus will released after XEEEndRead()
172     * is called.
173     ********************************************************************/
174     XEE_RESULT XEEBeginRead(XEE_ADDR address);
175    
176    
177    
178     /*********************************************************************
179     * Function: XEE_RESULT XEERead(void)
180     *
181     * PreCondition: XEEInit() && XEEBeginRead() are already called.
182     *
183     * Input: None
184     *
185     * Output: XEE_SUCCESS if successful
186     * other value if failed.
187     *
188     * Side Effects: None
189     *
190     * Overview: Reads next byte from EEPROM; internal address
191     * is incremented by one.
192     *
193     * Note: This function does not release I2C bus.
194     * User must call XEEEndRead() when read is not longer
195     * needed; I2C bus will released after XEEEndRead()
196     * is called.
197     ********************************************************************/
198     unsigned char XEERead(void);
199    
200    
201     /*********************************************************************
202     * Function: XEE_RESULT XEEEndRead(void)
203     *
204     * PreCondition: XEEInit() && XEEBeginRead() are already called.
205     *
206     * Input: None
207     *
208     * Output: XEE_SUCCESS if successful
209     * other value if failed.
210     *
211     * Side Effects: None
212     *
213     * Overview: Ends sequential read cycle.
214     *
215     * Note: This function ends seuential cycle that was in
216     * progress. It releases I2C bus.
217     ********************************************************************/
218     XEE_RESULT XEEEndRead(void);
219    
220    
221     /*********************************************************************
222     * Function: XEE_RESULT XEEReadArray(unsigned char control,
223     * XEE_ADDR address,
224     * unsigned char *buffer,
225     * unsigned char length)
226     *
227     * PreCondition: XEEInit() is already called.
228     *
229     * Input: control - EEPROM control and address code.
230     * address - Address from where array is to be read
231     * buffer - Caller supplied buffer to hold the data
232     * length - Number of bytes to read.
233     *
234     * Output: XEE_SUCCESS if successful
235     * other value if failed.
236     *
237     * Side Effects: None
238     *
239     * Overview: Reads desired number of bytes in sequential mode.
240     * This function performs all necessary steps
241     * and releases the bus when finished.
242     *
243     * Note: None
244     ********************************************************************/
245     XEE_RESULT XEEReadArray(XEE_ADDR address,
246     unsigned char *buffer,
247     unsigned char length);
248    
249    
250    
251     /*********************************************************************
252     * Function: BOOL XEEIsBusy(void)
253     *
254     * PreCondition: XEEInit() is already called.
255     *
256     * Input: None
257     *
258     * Output: FALSE if EEPROM is not busy
259     * TRUE if EEPROM is busy or operation failed
260     *
261     * Side Effects: None
262     *
263     * Overview: Requests ACK from EEPROM or checks status register
264     *
265     * Note: None
266     ********************************************************************/
267     BOOL XEEIsBusy(void);
268    
269    
270     #endif

  ViewVC Help
Powered by ViewVC 1.1.20