if (!id_bit && !comp_bit) { /* Both bits are valid, take the direction given */
retval = bdir ? 0x04 : 0;
} else { /* Only one bit is valid, take that direction */
bdir = id_bit;
retval = id_bit ? 0x05 : 0x02;
}
/** *w1_read_8()-Reads8bits. *@dev:themasterdevice * *Return:thebyteread
*/
u8 w1_read_8(struct w1_master *dev)
{ int i;
u8 res = 0;
if (dev->bus_master->read_byte)
res = dev->bus_master->read_byte(dev->bus_master->data); else for (i = 0; i < 8; ++i)
res |= (w1_touch_bit(dev,1) << i);
return res;
}
EXPORT_SYMBOL_GPL(w1_read_8);
/** *w1_write_block()-Writesaseriesofbytes. *@dev:themasterdevice *@buf:pointertothedatatowrite *@len:thenumberofbytestowrite
*/ void w1_write_block(struct w1_master *dev, const u8 *buf, int len)
{ int i;
if (dev->bus_master->write_block) {
w1_pre_write(dev);
dev->bus_master->write_block(dev->bus_master->data, buf, len);
} else for (i = 0; i < len; ++i)
w1_write_8(dev, buf[i]); /* calls w1_pre_write */
w1_post_write(dev);
}
EXPORT_SYMBOL_GPL(w1_write_block);
/** *w1_touch_block()-Touchesaseriesofbytes. *@dev:themasterdevice *@buf:pointertothedatatowrite *@len:thenumberofbytestowrite
*/ void w1_touch_block(struct w1_master *dev, u8 *buf, int len)
{ int i, j;
u8 tmp;
for (i = 0; i < len; ++i) {
tmp = 0; for (j = 0; j < 8; ++j) { if (j == 7)
w1_pre_write(dev);
tmp |= w1_touch_bit(dev, (buf[i] >> j) & 0x1) << j;
}
/** *w1_read_block()-Readsaseriesofbytes. *@dev:themasterdevice *@buf:pointertothebuffertofill *@len:thenumberofbytestoread *Return:thenumberofbytesread
*/
u8 w1_read_block(struct w1_master *dev, u8 *buf, int len)
{ int i;
u8 ret;
if (dev->bus_master->read_block)
ret = dev->bus_master->read_block(dev->bus_master->data, buf, len); else { for (i = 0; i < len; ++i)
buf[i] = w1_read_8(dev);
ret = len;
}
return ret;
}
EXPORT_SYMBOL_GPL(w1_read_block);
/** *w1_reset_bus()-Issuesaresetbussequence. *@dev:themasterdevice *Return:0=Devicepresent,1=Nodevicepresentorerror
*/ int w1_reset_bus(struct w1_master *dev)
{ int result; unsignedlong flags = 0;
if(w1_disable_irqs) local_irq_save(flags);
if (dev->bus_master->reset_bus)
result = dev->bus_master->reset_bus(dev->bus_master->data) & 0x1; else {
dev->bus_master->write_bit(dev->bus_master->data, 0); /* minimum 480, max ? us *beniceandsleep,except18b20speclists960usmaximum, *sountilwecansleepwithmicrosecondaccuracy,spin. *Feelfreetocomeupwithsomeotherwaytogiveupthe *cpuforsuchashortamountoftimeANDgetitbackin *themaximumamountoftime.
*/
w1_delay(500);
dev->bus_master->write_bit(dev->bus_master->data, 1);
w1_delay(70);
result = dev->bus_master->read_bit(dev->bus_master->data) & 0x1; /* minimum 70 (above) + 430 = 500 us *Therearen'tanytimingrequirementsbetweenaresetand *thefollowingtransactions.Sleepingissafehere.
*/ /* w1_delay(430); min required time */
msleep(1);
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.15 Sekunden
(vorverarbeitet am 2026-09-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.