summaryrefslogtreecommitdiff
path: root/common/onewire.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/onewire.c')
-rw-r--r--common/onewire.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/common/onewire.c b/common/onewire.c
index cdb5837255..0b109bbdcd 100644
--- a/common/onewire.c
+++ b/common/onewire.c
@@ -1,4 +1,4 @@
-/* Copyright 2012 The Chromium OS Authors. All rights reserved.
+/* Copyright 2012 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,16 +16,19 @@
* Note that these timing are actually _longer_ than legacy 1-wire standard
* speed because we're running the 1-wire bus at 3.3V instead of 5V.
*/
-#define T_RSTL 602 /* Reset low pulse; 600-960 us */
-#define T_MSP 72 /* Presence detect sample time; 70-75 us */
-#define T_RSTH (68 + 260 + 5 + 2) /* Reset high; tPDHmax + tPDLmax + tRECmin */
-#define T_SLOT 70 /* Timeslot; >67 us */
-#define T_W0L 63 /* Write 0 low; 62-120 us */
-#define T_W1L 7 /* Write 1 low; 5-15 us */
-#define T_RL 7 /* Read low; 5-15 us */
-#define T_MSR 9 /* Read sample time; <15 us. Must be at least 200 ns after
- * T_RL since that's how long the signal takes to be pulled
- * up on our board. */
+#define T_RSTL 602 /* Reset low pulse; 600-960 us */
+#define T_MSP 72 /* Presence detect sample time; 70-75 us */
+#define T_RSTH \
+ (68 + 260 + 5 + 2) /* Reset high; tPDHmax + tPDLmax + tRECmin \
+ */
+#define T_SLOT 70 /* Timeslot; >67 us */
+#define T_W0L 63 /* Write 0 low; 62-120 us */
+#define T_W1L 7 /* Write 1 low; 5-15 us */
+#define T_RL 7 /* Read low; 5-15 us */
+#define T_MSR \
+ 9 /* Read sample time; <15 us. Must be at least 200 ns after \
+ * T_RL since that's how long the signal takes to be pulled \
+ * up on our board. */
/**
* Output low on the bus for <usec> us, then switch back to open-drain input.
@@ -98,7 +101,6 @@ static void writebit(int bit)
interrupt_enable();
udelay(T_SLOT - T_W0L);
}
-
}
int onewire_reset(void)
@@ -133,7 +135,7 @@ int onewire_read(void)
int i;
for (i = 0; i < 8; i++)
- data |= readbit() << i; /* LSB first */
+ data |= readbit() << i; /* LSB first */
return data;
}
@@ -143,5 +145,5 @@ void onewire_write(int data)
int i;
for (i = 0; i < 8; i++)
- writebit((data >> i) & 0x01); /* LSB first */
+ writebit((data >> i) & 0x01); /* LSB first */
}