summaryrefslogtreecommitdiff
path: root/firmware/target
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target')
-rw-r--r--firmware/target/arm/s5l8700/i2c-s5l8700.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/firmware/target/arm/s5l8700/i2c-s5l8700.c b/firmware/target/arm/s5l8700/i2c-s5l8700.c
index a5661c5848..49dd0b98c0 100644
--- a/firmware/target/arm/s5l8700/i2c-s5l8700.c
+++ b/firmware/target/arm/s5l8700/i2c-s5l8700.c
@@ -58,7 +58,7 @@ void i2c_init(void)
58 (0 << 6) | /* CLKSEL = PCLK/16 */ 58 (0 << 6) | /* CLKSEL = PCLK/16 */
59 (1 << 5) | /* INT_EN */ 59 (1 << 5) | /* INT_EN */
60 (1 << 4) | /* IRQ clear */ 60 (1 << 4) | /* IRQ clear */
61 (7 << 0); /* CK_REG */ 61 (3 << 0); /* CK_REG */
62 62
63 /* serial output on */ 63 /* serial output on */
64 IICSTAT = (1 << 4); 64 IICSTAT = (1 << 4);
@@ -72,7 +72,7 @@ int i2c_write(unsigned char slave, int address, int len, const unsigned char *da
72 /* START */ 72 /* START */
73 IICDS = slave & ~1; 73 IICDS = slave & ~1;
74 IICSTAT = 0xF0; 74 IICSTAT = 0xF0;
75 IICCON = 0xB7; 75 IICCON = 0xB3;
76 while ((IICCON & 0x10) == 0) 76 while ((IICCON & 0x10) == 0)
77 if (TIME_AFTER(current_tick, timeout)) 77 if (TIME_AFTER(current_tick, timeout))
78 { 78 {
@@ -84,7 +84,7 @@ int i2c_write(unsigned char slave, int address, int len, const unsigned char *da
84 if (address >= 0) { 84 if (address >= 0) {
85 /* write address */ 85 /* write address */
86 IICDS = address; 86 IICDS = address;
87 IICCON = 0xB7; 87 IICCON = 0xB3;
88 while ((IICCON & 0x10) == 0) 88 while ((IICCON & 0x10) == 0)
89 if (TIME_AFTER(current_tick, timeout)) 89 if (TIME_AFTER(current_tick, timeout))
90 { 90 {
@@ -96,7 +96,7 @@ int i2c_write(unsigned char slave, int address, int len, const unsigned char *da
96 /* write data */ 96 /* write data */
97 while (len--) { 97 while (len--) {
98 IICDS = *data++; 98 IICDS = *data++;
99 IICCON = 0xB7; 99 IICCON = 0xB3;
100 while ((IICCON & 0x10) == 0) 100 while ((IICCON & 0x10) == 0)
101 if (TIME_AFTER(current_tick, timeout)) 101 if (TIME_AFTER(current_tick, timeout))
102 { 102 {
@@ -107,7 +107,7 @@ int i2c_write(unsigned char slave, int address, int len, const unsigned char *da
107 107
108 /* STOP */ 108 /* STOP */
109 IICSTAT = 0xD0; 109 IICSTAT = 0xD0;
110 IICCON = 0xB7; 110 IICCON = 0xB3;
111 while ((IICSTAT & (1 << 5)) != 0) 111 while ((IICSTAT & (1 << 5)) != 0)
112 if (TIME_AFTER(current_tick, timeout)) 112 if (TIME_AFTER(current_tick, timeout))
113 { 113 {
@@ -128,7 +128,7 @@ int i2c_read(unsigned char slave, int address, int len, unsigned char *data)
128 /* START */ 128 /* START */
129 IICDS = slave & ~1; 129 IICDS = slave & ~1;
130 IICSTAT = 0xF0; 130 IICSTAT = 0xF0;
131 IICCON = 0xB7; 131 IICCON = 0xB3;
132 while ((IICCON & 0x10) == 0) 132 while ((IICCON & 0x10) == 0)
133 if (TIME_AFTER(current_tick, timeout)) 133 if (TIME_AFTER(current_tick, timeout))
134 { 134 {
@@ -138,7 +138,7 @@ int i2c_read(unsigned char slave, int address, int len, unsigned char *data)
138 138
139 /* write address */ 139 /* write address */
140 IICDS = address; 140 IICDS = address;
141 IICCON = 0xB7; 141 IICCON = 0xB3;
142 while ((IICCON & 0x10) == 0) 142 while ((IICCON & 0x10) == 0)
143 if (TIME_AFTER(current_tick, timeout)) 143 if (TIME_AFTER(current_tick, timeout))
144 { 144 {
@@ -150,7 +150,7 @@ int i2c_read(unsigned char slave, int address, int len, unsigned char *data)
150 /* (repeated) START */ 150 /* (repeated) START */
151 IICDS = slave | 1; 151 IICDS = slave | 1;
152 IICSTAT = 0xB0; 152 IICSTAT = 0xB0;
153 IICCON = 0xB7; 153 IICCON = 0xB3;
154 while ((IICCON & 0x10) == 0) 154 while ((IICCON & 0x10) == 0)
155 if (TIME_AFTER(current_tick, timeout)) 155 if (TIME_AFTER(current_tick, timeout))
156 { 156 {
@@ -159,7 +159,7 @@ int i2c_read(unsigned char slave, int address, int len, unsigned char *data)
159 } 159 }
160 160
161 while (len--) { 161 while (len--) {
162 IICCON = (len == 0) ? 0x37 : 0xB7; /* NACK or ACK */ 162 IICCON = (len == 0) ? 0x33 : 0xB3; /* NAK or ACK */
163 while ((IICCON & 0x10) == 0) 163 while ((IICCON & 0x10) == 0)
164 if (TIME_AFTER(current_tick, timeout)) 164 if (TIME_AFTER(current_tick, timeout))
165 { 165 {
@@ -171,7 +171,7 @@ int i2c_read(unsigned char slave, int address, int len, unsigned char *data)
171 171
172 /* STOP */ 172 /* STOP */
173 IICSTAT = 0x90; 173 IICSTAT = 0x90;
174 IICCON = 0xB7; 174 IICCON = 0xB3;
175 while ((IICSTAT & (1 << 5)) != 0) 175 while ((IICSTAT & (1 << 5)) != 0)
176 if (TIME_AFTER(current_tick, timeout)) 176 if (TIME_AFTER(current_tick, timeout))
177 { 177 {