forked from PX4/PX4-Autopilot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path00014-BACKPORT-i2c-hotfix.patch
325 lines (290 loc) · 9.84 KB
/
00014-BACKPORT-i2c-hotfix.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
diff --git NuttX/nuttx/arch/arm/src/stm32/stm32_i2c.c NuttX/nuttx/arch/arm/src/stm32/stm32_i2c.c
index 631ba66..669e0db 100644
--- NuttX/nuttx/arch/arm/src/stm32/stm32_i2c.c
+++ NuttX/nuttx/arch/arm/src/stm32/stm32_i2c.c
@@ -7,7 +7,7 @@
*
* With extensions, modifications by:
*
- * Copyright (C) 2011-2014, 2016 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-2014, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <[email protected]>
*
* Redistribution and use in source and binary forms, with or without
@@ -670,15 +670,15 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
do
{
+ /* Calculate the elapsed time */
+
+ elapsed = clock_systimer() - start;
+
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
*/
stm32_i2c_isr(priv);
-
- /* Calculate the elapsed time */
-
- elapsed = clock_systimer() - start;
}
/* Loop until the transfer is complete. */
@@ -729,6 +729,10 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
start = clock_systimer();
do
{
+ /* Calculate the elapsed time */
+
+ elapsed = clock_systimer() - start;
+
/* Check for STOP condition */
cr1 = stm32_i2c_getreg(priv, STM32_I2C_CR1_OFFSET);
@@ -744,10 +748,6 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
{
return;
}
-
- /* Calculate the elapsed time */
-
- elapsed = clock_systimer() - start;
}
/* Loop until the stop is complete or a timeout occurs. */
diff --git NuttX/nuttx/arch/arm/src/stm32/stm32_i2c_alt.c NuttX/nuttx/arch/arm/src/stm32/stm32_i2c_alt.c
index 545a647..981edb6 100644
--- NuttX/nuttx/arch/arm/src/stm32/stm32_i2c_alt.c
+++ NuttX/nuttx/arch/arm/src/stm32/stm32_i2c_alt.c
@@ -7,7 +7,7 @@
*
* With extensions, modifications by:
*
- * Copyright (C) 2011-2014, 2016 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-2014, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <[email protected]>
*
* Copyright( C) 2014 Patrizio Simona. All rights reserved.
@@ -678,15 +678,15 @@ static int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
do
{
+ /* Calculate the elapsed time */
+
+ elapsed = clock_systimer() - start;
+
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
*/
stm32_i2c_isr(priv);
-
- /* Calculate the elapsed time */
-
- elapsed = clock_systimer() - start;
}
/* Loop until the transfer is complete. */
@@ -737,6 +737,10 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
start = clock_systimer();
do
{
+ /* Calculate the elapsed time */
+
+ elapsed = clock_systimer() - start;
+
/* Check for STOP condition */
cr1 = stm32_i2c_getreg(priv, STM32_I2C_CR1_OFFSET);
@@ -753,9 +757,6 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
return;
}
- /* Calculate the elapsed time */
-
- elapsed = clock_systimer() - start;
}
/* Loop until the stop is complete or a timeout occurs. */
diff --git NuttX/nuttx/arch/arm/src/stm32/stm32f30xxx_i2c.c NuttX/nuttx/arch/arm/src/stm32/stm32f30xxx_i2c.c
index 312e0b4..b2da861 100644
--- NuttX/nuttx/arch/arm/src/stm32/stm32f30xxx_i2c.c
+++ NuttX/nuttx/arch/arm/src/stm32/stm32f30xxx_i2c.c
@@ -7,7 +7,7 @@
*
* With extensions and modifications for the F1, F2, and F4 by:
*
- * Copyright (C) 2011-2013, 2016 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-2013, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregroy Nutt <[email protected]>
*
* And this version for the STM32 F3 by
@@ -704,15 +704,15 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
do
{
+ /* Calculate the elapsed time */
+
+ elapsed = clock_systimer() - start;
+
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
*/
stm32_i2c_isr(priv);
-
- /* Calculate the elapsed time */
-
- elapsed = clock_systimer() - start;
}
/* Loop until the transfer is complete. */
@@ -844,6 +844,10 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
start = clock_systimer();
do
{
+ /* Calculate the elapsed time */
+
+ elapsed = clock_systimer() - start;
+
/* Check for STOP condition */
cr = stm32_i2c_getreg32(priv, STM32_I2C_CR2_OFFSET);
@@ -860,9 +864,6 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
return;
}
- /* Calculate the elapsed time */
-
- elapsed = clock_systimer() - start;
}
/* Loop until the stop is complete or a timeout occurs. */
diff --git NuttX/nuttx/arch/arm/src/stm32/stm32f40xxx_i2c.c NuttX/nuttx/arch/arm/src/stm32/stm32f40xxx_i2c.c
index 2bb715c..e91058a 100644
--- NuttX/nuttx/arch/arm/src/stm32/stm32f40xxx_i2c.c
+++ NuttX/nuttx/arch/arm/src/stm32/stm32f40xxx_i2c.c
@@ -7,7 +7,7 @@
*
* With extensions, modifications by:
*
- * Copyright (C) 2011-2014, 2016 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-2014, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <[email protected]>
*
* Redistribution and use in source and binary forms, with or without
@@ -672,15 +672,15 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
do
{
+ /* Calculate the elapsed time */
+
+ elapsed = clock_systimer() - start;
+
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
*/
stm32_i2c_isr(priv);
-
- /* Calculate the elapsed time */
-
- elapsed = clock_systimer() - start;
}
/* Loop until the transfer is complete. */
@@ -731,6 +731,10 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
start = clock_systimer();
do
{
+ /* Calculate the elapsed time */
+
+ elapsed = clock_systimer() - start;
+
/* Check for STOP condition */
cr1 = stm32_i2c_getreg(priv, STM32_I2C_CR1_OFFSET);
@@ -747,9 +751,6 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
return;
}
- /* Calculate the elapsed time */
-
- elapsed = clock_systimer() - start;
}
/* Loop until the stop is complete or a timeout occurs. */
diff --git NuttX/nuttx/arch/arm/src/stm32f7/stm32_i2c.c NuttX/nuttx/arch/arm/src/stm32f7/stm32_i2c.c
index d089db9..fd73457 100644
--- NuttX/nuttx/arch/arm/src/stm32f7/stm32_i2c.c
+++ NuttX/nuttx/arch/arm/src/stm32f7/stm32_i2c.c
@@ -7,7 +7,7 @@
*
* With extensions and modifications for the F1, F2, and F4 by:
*
- * Copyright (C) 2016 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2016-2017 Gregory Nutt. All rights reserved.
* Authors: Gregroy Nutt <[email protected]>
* John Wharington
* David Sidrane <[email protected]>
@@ -897,15 +897,15 @@ static inline int stm32_i2c_sem_waitdone(FAR struct stm32_i2c_priv_s *priv)
do
{
+ /* Calculate the elapsed time */
+
+ elapsed = clock_systimer() - start;
+
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
*/
stm32_i2c_isr(priv);
-
- /* Calculate the elapsed time */
-
- elapsed = clock_systimer() - start;
}
/* Loop until the transfer is complete. */
@@ -1034,6 +1034,10 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
start = clock_systimer();
do
{
+ /* Calculate the elapsed time */
+
+ elapsed = clock_systimer() - start;
+
/* Check for STOP condition */
cr = stm32_i2c_getreg32(priv, STM32_I2C_CR2_OFFSET);
@@ -1050,9 +1054,6 @@ static inline void stm32_i2c_sem_waitstop(FAR struct stm32_i2c_priv_s *priv)
return;
}
- /* Calculate the elapsed time */
-
- elapsed = clock_systimer() - start;
}
/* Loop until the stop is complete or a timeout occurs. */
diff --git NuttX/nuttx/arch/arm/src/stm32l4/stm32l4_i2c.c NuttX/nuttx/arch/arm/src/stm32l4/stm32l4_i2c.c
index eed199f..be46524 100644
--- NuttX/nuttx/arch/arm/src/stm32l4/stm32l4_i2c.c
+++ NuttX/nuttx/arch/arm/src/stm32l4/stm32l4_i2c.c
@@ -4,7 +4,7 @@
*
* Copyright (C) 2011 Uros Platise. All rights reserved.
* Author: Uros Platise <[email protected]>
- * Copyright (C) 2011-2013, 2016 Gregory Nutt. All rights reserved.
+ * Copyright (C) 2011-2013, 2016-2017 Gregory Nutt. All rights reserved.
* Author: Gregroy Nutt <[email protected]>
* Author: John Wharington
* Author: Sebastien Lorquet
@@ -648,15 +648,15 @@ static inline int stm32l4_i2c_sem_waitdone(FAR struct stm32l4_i2c_priv_s *priv)
do
{
+ /* Calculate the elapsed time */
+
+ elapsed = clock_systimer() - start;
+
/* Poll by simply calling the timer interrupt handler until it
* reports that it is done.
*/
stm32l4_i2c_isr(priv);
-
- /* Calculate the elapsed time */
-
- elapsed = clock_systimer() - start;
}
/* Loop until the transfer is complete. */
@@ -788,6 +788,10 @@ static inline void stm32l4_i2c_sem_waitstop(FAR struct stm32l4_i2c_priv_s *priv)
start = clock_systimer();
do
{
+ /* Calculate the elapsed time */
+
+ elapsed = clock_systimer() - start;
+
/* Check for STOP condition */
cr = stm32l4_i2c_getreg32(priv, STM32L4_I2C_CR2_OFFSET);
@@ -804,9 +808,6 @@ static inline void stm32l4_i2c_sem_waitstop(FAR struct stm32l4_i2c_priv_s *priv)
return;
}
- /* Calculate the elapsed time */
-
- elapsed = clock_systimer() - start;
}
/* Loop until the stop is complete or a timeout occurs. */