diff options
author | Evgeniy Polyakov <zbr@ioremap.net> | 2009-01-07 21:09:01 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-08 11:31:13 -0500 |
commit | 9be62e0b2fadaf5ffeb32fd1b910ef1fe6bd43db (patch) | |
tree | 86d39cd9790a83275380d5f37495d76888c3153b /drivers/w1/w1_io.c | |
parent | 610705e780395ef30a1b8e53de150c37381ca31f (diff) |
w1: add touch block command
Writes and returns sampled data back to userspace.
Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/w1/w1_io.c')
-rw-r--r-- | drivers/w1/w1_io.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/drivers/w1/w1_io.c b/drivers/w1/w1_io.c index 5139c25ca96..442bd8bbd4a 100644 --- a/drivers/w1/w1_io.c +++ b/drivers/w1/w1_io.c | |||
@@ -238,7 +238,6 @@ EXPORT_SYMBOL_GPL(w1_read_8); | |||
238 | * @param dev the master device | 238 | * @param dev the master device |
239 | * @param buf pointer to the data to write | 239 | * @param buf pointer to the data to write |
240 | * @param len the number of bytes to write | 240 | * @param len the number of bytes to write |
241 | * @return the byte read | ||
242 | */ | 241 | */ |
243 | void w1_write_block(struct w1_master *dev, const u8 *buf, int len) | 242 | void w1_write_block(struct w1_master *dev, const u8 *buf, int len) |
244 | { | 243 | { |
@@ -256,6 +255,31 @@ void w1_write_block(struct w1_master *dev, const u8 *buf, int len) | |||
256 | EXPORT_SYMBOL_GPL(w1_write_block); | 255 | EXPORT_SYMBOL_GPL(w1_write_block); |
257 | 256 | ||
258 | /** | 257 | /** |
258 | * Touches a series of bytes. | ||
259 | * | ||
260 | * @param dev the master device | ||
261 | * @param buf pointer to the data to write | ||
262 | * @param len the number of bytes to write | ||
263 | */ | ||
264 | void w1_touch_block(struct w1_master *dev, u8 *buf, int len) | ||
265 | { | ||
266 | int i, j; | ||
267 | u8 tmp; | ||
268 | |||
269 | for (i = 0; i < len; ++i) { | ||
270 | tmp = 0; | ||
271 | for (j = 0; j < 8; ++j) { | ||
272 | if (j == 7) | ||
273 | w1_pre_write(dev); | ||
274 | tmp |= w1_touch_bit(dev, (buf[i] >> j) & 0x1) << j; | ||
275 | } | ||
276 | |||
277 | buf[i] = tmp; | ||
278 | } | ||
279 | } | ||
280 | EXPORT_SYMBOL_GPL(w1_touch_block); | ||
281 | |||
282 | /** | ||
259 | * Reads a series of bytes. | 283 | * Reads a series of bytes. |
260 | * | 284 | * |
261 | * @param dev the master device | 285 | * @param dev the master device |