]> git.ipfire.org Git - u-boot.git/blame - cpu/mpc824x/drivers/i2c/README
* Code cleanup:
[u-boot.git] / cpu / mpc824x / drivers / i2c / README
CommitLineData
327f7a02
WD
1CONTENT:
2
3 i2c.h
4 i2c1.c
5 i2c2.s
6
7WHAT ARE THESE FILES:
8
9These files contain MPC8240 (Kahlua) I2C
10driver routines. The driver routines are not
11written for any specific operating system.
12They serves the purpose of code sample, and
13jump-start for using the MPC8240 I2C unit.
14
15For the reason of correctness of C language
16syntax, these files are compiled by Metaware
17C compiler and assembler.
18
19ENDIAN NOTATION:
20
21The algorithm is designed for big-endian mode,
22software is responsible for byte swapping.
23
24USAGE:
25
261. The host system that is running on MPC8240
27 shall link the files listed here. The memory
28 location of driver routines shall take into
29 account of that driver routines need to run
30 in supervisor mode and they process I2C
31 interrupt.
32
332. The host system is responsible for configuring
34 the MPC8240 including Embedded Utilities Memory
35 Block. All I2C driver functions require the
36 content of Embedded Utilities Memory Block
37 Base Address Register, EUMBBAR, as the first
38 parameter.
39
403. Before I2C unit of MPC8240 can be used,
41 initialize I2C unit by calling I2C_Init
42 with the corresponding parameters.
43
44 Note that the I2CFDR register shall be written
45 once during the initialization. If it is written
46 in the midst of transers, or after I2C STOPs or
47 REPEAT STATRs, depending on the data written,
48 a long reset time may be encountered.
49
504. After I2C unit has been successfully initialized,
51 use the Application level API to send data or
52 receive data upon the desired mode, Master or
53 Slave.
54
555. If the host system is also using the EPIC unit
56 on MPC8240, the system can register the
57 I2C_ISR with the EPIC including other
58 desired resources.
59
60 If the host system does not using the EPIC unit
61 on MPC8240, I2C_Timer_Event function can
62 be called for each desired time interval.
63
64 In both cases, the host system is free to provide
65 its own timer event handler and interrupt service
66 routine.
67
686. The I2C driver routines contains a set
69 of utilities, Set and Get, for host system
70 to query and modify the desired I2C registers.
71
727. It is the host system's responsibility of
73 queueing the I2C I/O request. The host
74 system shall check the I2C_ISR return code
75 for I2C I/O status. If I2C_ISR returns
76 I2CBUFFEMPTY or I2CBUFFFULL, it means
77 I2C unit has completed a I/O request
78 stated by the Application API.
79
808. If the host system has more than one master
81 mode I2C unit I/O requests but doesn't want
82 to be intervented by being addressed as slave,
83 the host system can use the master mode
84 Application API with stop_flag set to 0 in
85 conjunction with is_cnt flag set to 1.
86 The first API call sets both stop_flag and
87 is_cnt to 0, indicating a START condition
88 shall be generated but when the end of
89 transaction is reached, do not generate a
90 STOP condition. Once the host system is
91 informed that the transaction has been
92 completed, the next Application API call
93 shall set is_cnt flag to 1, indicating a
94 repeated START condition shall be generated.
95 The last Application API call shall set
96 stop_flag
97 to 1.
98
999. The I2C_Timer_Event function containes
100 a user defined function pointer. It
101 serves the purpose of providing the
102 host system a way to use its own event
103 handler instead of the I2C_ISR provided
104 here.