Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

LOW_linkPassiveSerial Class Reference

Link class for simple passive serial 1-Wire adapters. More...

#include <LOW_linkPassiveSerial.h>

Inheritance diagram for LOW_linkPassiveSerial:

Inheritance graph
[legend]
Collaboration diagram for LOW_linkPassiveSerial:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< LOW_link *> linkPtrVec_t
 Vector type of link class pointers. More...

typedef uint32_t linkID_t
 Type for individual link ID number. More...

enum  strongPullup_t {
  pullUp_16_4 = 0x00, pullUp_65_5, pullUp_131, pullUp_262,
  pullUp_524, pullUp_1048, pullUp_NONE = 0xff
}
 Type for strong pullup period specification. More...


Public Methods

 LOW_linkPassiveSerial (const LOW_portSerialFactory::portSpecifier_t &inSerPortSpec, const bool inAllowProgPulse=false)
 Constructor. More...

 ~LOW_linkPassiveSerial ()
 Destructor. More...

bool operator== (LOW_link &inLink) const
 Comparison based on linkID. More...

Bus touch (write/read) methods required by LOW_Link
bool touchBit (const bool inSendBit, const strongPullup_t inPullup=pullUp_NONE)
 Send 1 bit of communication to the 1-Wire net and return the result 1 bit read from the 1-Wire net. More...

uint8_t touchByte (const uint8_t inSendByte, const strongPullup_t inPullup=pullUp_NONE)
 Send 8 bits of communication to the 1-Wire net and return the result 8 bits read from the 1-Wire net. More...

byteVec_t touchBlock (const byteVec_t &inBytes, const strongPullup_t inPullup=pullUp_NONE)
 Send block of communication to the 1-Wire net and return the resulting bytes read from the 1-Wire net. More...

Bus read methods required by LOW_Link
bool readDataBit (const strongPullup_t inPullup=pullUp_NONE)
 Receive 1 bit from the 1-Wire net by previously sending one bit of read communication to the 1-Wire net. More...

uint8_t readDataByte (const strongPullup_t inPullup=pullUp_NONE)
 Receive 1 byte from the 1-Wire net by previously sending 8 bits of read communication to the 1-Wire net. More...

void readData (byteVec_t &outBytes, const strongPullup_t inPullup=pullUp_NONE)
 Receive a block of bytes from the 1-Wire net by previously sending a block of bytes of read communication to the 1-Wire Net. More...

Bus write methods required by LOW_Link
void writeData (const bool inSendBit, const strongPullup_t inPullup=pullUp_NONE)
 Send 1 bit to the 1-Wire net and verify that the bit read from the 1-Wire net is the same (bus write operation). More...

void writeData (const uint8_t inSendByte, const strongPullup_t inPullup=pullUp_NONE)
 Send 1 byte to the 1-Wire net and verify that the byte read from the 1-Wire net is the same (bus write operation). More...

void writeData (const byteVec_t &inSendBytes, const strongPullup_t inPullup=pullUp_NONE)
 Send block of bytes to the 1-Wire net and verify that the bytes block read from the 1-Wire net are the same (bus write operation). More...

Misc methods required by LOW_Link
void resetLinkAdapter ()
 Reset the adapter. More...

bool resetBus ()
 Reset all of the devices on the 1-Wire net. More...

void strongPullup (const unsigned long inMicroSecs)
 Set the 1-Wire net line level to strong pullup for a specified time. More...

void programPulse ()
 Create a fixed 480 microseconds 12 volt pulse on the 1-Wire net for programming EPROM devices. More...

void doSearchSequence (const LOW_deviceIDRaw &inBranchVector, LOW_deviceIDRaw &outFoundID, LOW_deviceIDRaw &outDiscrVec)
 Discover devices on the bus. More...

Misc methods
linkID_t getID () const
 Get ID of the link. More...

bool getHasExternalPower () const
 Get whether there is an external power line on the segment. More...


Protected Types

enum  semNum_t { counterSemNo = 0, lockSemNo, semaphoreCount }
 Semaphore numbers for semaphore set. More...


Protected Attributes

const linkID_t linkID
 Individual ID of the link adapter. More...

bool hasProgramPulse
 Wether the adapter is capable of 12V Program pulse. More...

const bool hasOverDrive
 Wether the adapter is capable of overdrive bus speed. More...

const bool hasExternalPower
 Wether the attached bus supplies external power. More...

const bool allowProgPulse
 Wether the program pulse should be allowed. More...

LOW_semaphoreSetsemSet
 Semaphore set for locking. More...


Static Protected Attributes

linkID_t linkCounter = 0
 Incremented on instance creation to get individual IDs. More...


Private Methods

void strongPullup (const strongPullup_t inPullup)
 Set the 1-Wire net line level to strong pullup for a specified time. More...


Private Attributes

LOW_portSerialserialPort
 The serial port the adapter is attached to. More...


Static Private Attributes

const int strongPullupEmuTime = 3
 Time to wait for emulation of strong pullup in seconds. More...


Detailed Description

Link class for simple passive serial 1-Wire adapters.

As the passive adapter is not capable of real strong pullups with high current, it is emulated by providing high level on the bus for a relatively long time.

Author:
Harald Roelle, Helmut Reiser

Definition at line 36 of file LOW_linkPassiveSerial.h.


Member Typedef Documentation

typedef uint32_t LOW_link::linkID_t [inherited]
 

Type for individual link ID number.

Definition at line 96 of file LOW_link.h.

typedef std::vector<LOW_link*> LOW_link::linkPtrVec_t [inherited]
 

Vector type of link class pointers.

Definition at line 93 of file LOW_link.h.


Member Enumeration Documentation

enum LOW_link::semNum_t [protected, inherited]
 

Semaphore numbers for semaphore set.

Enumeration values:
counterSemNo 
lockSemNo 
semaphoreCount 

Definition at line 338 of file LOW_link.h.

enum LOW_link::strongPullup_t [inherited]
 

Type for strong pullup period specification.

Enumeration values:
pullUp_16_4  16.4 ms.
pullUp_65_5  65.5 ms.
pullUp_131  131 ms.
pullUp_262  262 ms.
pullUp_524  524 ms.
pullUp_1048  1048 ms.
pullUp_NONE  no pullup.

Definition at line 99 of file LOW_link.h.


Constructor & Destructor Documentation

LOW_linkPassiveSerial::LOW_linkPassiveSerial const LOW_portSerialFactory::portSpecifier_t &    inSerPortSpec,
const bool    inAllowProgPulse = false
 

Constructor.

Parameters:
inSerPortSpec  Specification of serial port the adapter is on.
inAllowProgPulse  Wether the program pulse should be allowed.

Definition at line 36 of file LOW_linkPassiveSerial.cpp.

References LOW_IPCKeyGeneratorFactory::new_IPCKeyGenerator(), LOW_portSerialFactory::new_portSerial(), LOW_semaphoreSetFactory::new_semaphoreSet(), resetBus(), resetLinkAdapter(), LOW_link::semaphoreCount, LOW_link::semSet, and serialPort.

LOW_linkPassiveSerial::~LOW_linkPassiveSerial  
 

Destructor.

Definition at line 52 of file LOW_linkPassiveSerial.cpp.

References LOW_link::semSet, serialPort, and LOW_portSerial::tty_flush().


Member Function Documentation

void LOW_linkPassiveSerial::doSearchSequence const LOW_deviceIDRaw   inBranchVector,
LOW_deviceIDRaw   outFoundID,
LOW_deviceIDRaw   outDiscrVec
[virtual]
 

Discover devices on the bus.

Parameters:
inBranchVector 
outFoundID 
outDiscrVec 

Reimplemented from LOW_link.

Definition at line 280 of file LOW_linkPassiveSerial.cpp.

References LOW_deviceIDRaw::getBit(), readDataBit(), LOW_deviceIDRaw::setBit(), and writeData().

bool LOW_link::getHasExternalPower   const [inherited]
 

Get whether there is an external power line on the segment.

Returns:
Whether there is an external power line on the segment.

Definition at line 133 of file LOW_link.cpp.

References LOW_link::hasExternalPower.

Referenced by LOW_netSegment::LOW_netSegment().

uint32_t LOW_link::getID   const [inherited]
 

Get ID of the link.

Returns:
ID of the link.

Definition at line 127 of file LOW_link.cpp.

References LOW_link::linkID.

bool LOW_link::operator== LOW_link   inLink const [inherited]
 

Comparison based on linkID.

Definition at line 115 of file LOW_link.cpp.

References LOW_link::linkID.

void LOW_linkPassiveSerial::programPulse   [virtual]
 

Create a fixed 480 microseconds 12 volt pulse on the 1-Wire net for programming EPROM devices.

For EPROM programming, only a single slave device should be connected to the 1-Wire bus and the cable must be short, not to exceed a few meters.

Note: One should not attempt generating a programming pulse with a non-EPROM device on the bus; this may damage the device as well as the link controller.

Reimplemented from LOW_link.

Definition at line 266 of file LOW_linkPassiveSerial.cpp.

References LOW_link::allowProgPulse, and LOW_link::hasProgramPulse.

void LOW_linkPassiveSerial::readData byteVec_t   outBytes,
const strongPullup_t    inPullup = pullUp_NONE
[virtual]
 

Receive a block of bytes from the 1-Wire net by previously sending a block of bytes of read communication to the 1-Wire Net.

Note: When the strong pullup is selected it will appear after each byte sent and NOT only after the last byte.

Parameters:
outBytes  Values that were reveived. Read length is determined by the preset length of the vector.
inPullup  Optional strong pullup time following each 8 bit write/read cycle.

Reimplemented from LOW_link.

Definition at line 147 of file LOW_linkPassiveSerial.cpp.

References byteVec_t, and readDataByte().

bool LOW_linkPassiveSerial::readDataBit const strongPullup_t    inPullup = pullUp_NONE [virtual]
 

Receive 1 bit from the 1-Wire net by previously sending one bit of read communication to the 1-Wire net.

Parameters:
inPullup  Optional strong pullup time following the write/read cycle.
Returns:
Bit that was reveived.

Reimplemented from LOW_link.

Definition at line 131 of file LOW_linkPassiveSerial.cpp.

References touchBit().

Referenced by doSearchSequence().

uint8_t LOW_linkPassiveSerial::readDataByte const strongPullup_t    inPullup = pullUp_NONE [virtual]
 

Receive 1 byte from the 1-Wire net by previously sending 8 bits of read communication to the 1-Wire net.

Parameters:
inPullup  Optional strong pullup time following the write/read cycle.
Returns:
Byte that was reveived.

Reimplemented from LOW_link.

Definition at line 139 of file LOW_linkPassiveSerial.cpp.

References touchByte().

Referenced by readData().

bool LOW_linkPassiveSerial::resetBus   [virtual]
 

Reset all of the devices on the 1-Wire net.

Returns:
true: Presense pulse(s) detected, device(s) reset false: No presense pulses detected

Reimplemented from LOW_link.

Definition at line 207 of file LOW_linkPassiveSerial.cpp.

References LOW_portSerial::B10472_speed, LOW_portSerial::B115200_speed, LOW_portSerial::bit1_stopBit, LOW_portSerial::bit6_size, LOW_portSerial::bit8_size, LOW_portSerial::no_parity, LOW_portSerial::none_flowControl, serialPort, LOW_portSerial::tty_configure(), LOW_portSerial::tty_flush(), LOW_portSerial::tty_readByte(), and LOW_portSerial::tty_write().

Referenced by LOW_linkPassiveSerial().

void LOW_linkPassiveSerial::resetLinkAdapter   [virtual]
 

Reset the adapter.

Note: This does not necessarily include a reset on the 1-Wire net. Whether this is done or net is left to the concrete implementation.

Reimplemented from LOW_link.

Definition at line 196 of file LOW_linkPassiveSerial.cpp.

References LOW_portSerial::B115200_speed, LOW_portSerial::bit1_stopBit, LOW_portSerial::bit6_size, LOW_portSerial::no_parity, LOW_portSerial::none_flowControl, serialPort, LOW_portSerial::tty_configure(), and LOW_portSerial::tty_flush().

Referenced by LOW_linkPassiveSerial().

void LOW_linkPassiveSerial::strongPullup const strongPullup_t    inPullup [private]
 

Set the 1-Wire net line level to strong pullup for a specified time.

Adapter for time specification in strongPullup_t.

Parameters:
inPullup  Pullup time.

Definition at line 311 of file LOW_linkPassiveSerial.cpp.

References LOW_link::pullUp_1048, LOW_link::pullUp_131, LOW_link::pullUp_16_4, LOW_link::pullUp_262, LOW_link::pullUp_524, LOW_link::pullUp_65_5, LOW_link::pullUp_NONE, and strongPullup().

void LOW_linkPassiveSerial::strongPullup const unsigned long    inMicroSecs [virtual]
 

Set the 1-Wire net line level to strong pullup for a specified time.

Parameters:
inMicroSecs  Pullup time in micro seconds.

Reimplemented from LOW_link.

Definition at line 256 of file LOW_linkPassiveSerial.cpp.

References LOW_platformMisc::secSleep(), and strongPullupEmuTime.

Referenced by strongPullup(), touchBit(), and touchByte().

bool LOW_linkPassiveSerial::touchBit const bool    inSendBit,
const strongPullup_t    inPullup = pullUp_NONE
[virtual]
 

Send 1 bit of communication to the 1-Wire net and return the result 1 bit read from the 1-Wire net.

Parameters:
inSendBit  Bit to send.
inPullup  Optional strong pullup time following the write/read cycle.
Returns:
Bit that was reveived.

Reimplemented from LOW_link.

Definition at line 67 of file LOW_linkPassiveSerial.cpp.

References serialPort, strongPullup(), LOW_portSerial::tty_flush(), LOW_portSerial::tty_readByte(), and LOW_portSerial::tty_write().

Referenced by readDataBit(), touchByte(), and writeData().

byteVec_t LOW_linkPassiveSerial::touchBlock const byteVec_t   inBytes,
const strongPullup_t    inPullup = pullUp_NONE
[virtual]
 

Send block of communication to the 1-Wire net and return the resulting bytes read from the 1-Wire net.

Note:: When the strong pullup is selected it will appear after each byte sent and NOT only after the last byte.

Parameters:
inBytes  Byte block to send.
inPullup  Optional strong pullup time following each 8 bit write/read cycle.
Returns:
Byte block that was reveived. Length is equal to number of sent bytes.

Reimplemented from LOW_link.

Definition at line 112 of file LOW_linkPassiveSerial.cpp.

References byteVec_t, and touchByte().

Referenced by writeData().

uint8_t LOW_linkPassiveSerial::touchByte const uint8_t    inSendByte,
const strongPullup_t    inPullup = pullUp_NONE
[virtual]
 

Send 8 bits of communication to the 1-Wire net and return the result 8 bits read from the 1-Wire net.

Parameters:
inSendByte  Byte to send.
inPullup  Optional strong pullup time following the 8 bit write/read cycle.
Returns:
Byte that was reveived.

Reimplemented from LOW_link.

Definition at line 94 of file LOW_linkPassiveSerial.cpp.

References strongPullup(), and touchBit().

Referenced by readDataByte(), touchBlock(), and writeData().

void LOW_linkPassiveSerial::writeData const byteVec_t   inSendBytes,
const strongPullup_t    inPullup = pullUp_NONE
[virtual]
 

Send block of bytes to the 1-Wire net and verify that the bytes block read from the 1-Wire net are the same (bus write operation).

Note:: When the strong pullup is selected it will appear after each byte sent and NOT only after the last byte.

Parameters:
inSendBytes  Block of bytes to send.
inPullup  Optional strong pullup time following each 8 bit write/read cycle.

Reimplemented from LOW_link.

Definition at line 179 of file LOW_linkPassiveSerial.cpp.

References byteVec_t, and touchBlock().

void LOW_linkPassiveSerial::writeData const uint8_t    inSendByte,
const strongPullup_t    inPullup = pullUp_NONE
[virtual]
 

Send 1 byte to the 1-Wire net and verify that the byte read from the 1-Wire net is the same (bus write operation).

Parameters:
inSendByte  Byte to send.
inPullup  Optional strong pullup time following the write/read cycle.

Reimplemented from LOW_link.

Definition at line 170 of file LOW_linkPassiveSerial.cpp.

References touchByte().

void LOW_linkPassiveSerial::writeData const bool    inSendBit,
const strongPullup_t    inPullup = pullUp_NONE
[virtual]
 

Send 1 bit to the 1-Wire net and verify that the bit read from the 1-Wire net is the same (bus write operation).

Parameters:
inSendBit  Bit to send.
inPullup  Optional strong pullup time following the write/read cycle.

Reimplemented from LOW_link.

Definition at line 161 of file LOW_linkPassiveSerial.cpp.

References touchBit().

Referenced by doSearchSequence().


Member Data Documentation

const bool LOW_link::allowProgPulse [protected, inherited]
 

Wether the program pulse should be allowed.

Definition at line 354 of file LOW_link.h.

Referenced by programPulse(), and LOW_linkDS2480B::programPulse().

const bool LOW_link::hasExternalPower [protected, inherited]
 

Wether the attached bus supplies external power.

Definition at line 353 of file LOW_link.h.

Referenced by LOW_link::getHasExternalPower().

const bool LOW_link::hasOverDrive [protected, inherited]
 

Wether the adapter is capable of overdrive bus speed.

Definition at line 352 of file LOW_link.h.

bool LOW_link::hasProgramPulse [protected, inherited]
 

Wether the adapter is capable of 12V Program pulse.

Definition at line 351 of file LOW_link.h.

Referenced by programPulse(), LOW_linkDS2480B::programPulse(), and LOW_linkDS2480B::resetBus().

LOW_link::linkID_t LOW_link::linkCounter = 0 [static, protected, inherited]
 

Incremented on instance creation to get individual IDs.

Definition at line 28 of file LOW_link.cpp.

const linkID_t LOW_link::linkID [protected, inherited]
 

Individual ID of the link adapter.

Definition at line 350 of file LOW_link.h.

Referenced by LOW_link::getID(), and LOW_link::operator==().

LOW_semaphoreSet* LOW_link::semSet [protected, inherited]
 

Semaphore set for locking.

Definition at line 355 of file LOW_link.h.

Referenced by LOW_link::commLock::commLock(), LOW_linkDS2480B::LOW_linkDS2480B(), LOW_linkPassiveSerial(), LOW_link::commLock::~commLock(), LOW_linkDS2480B::~LOW_linkDS2480B(), and ~LOW_linkPassiveSerial().

LOW_portSerial* LOW_linkPassiveSerial::serialPort [private]
 

The serial port the adapter is attached to.

Definition at line 113 of file LOW_linkPassiveSerial.h.

Referenced by LOW_linkPassiveSerial(), resetBus(), resetLinkAdapter(), touchBit(), and ~LOW_linkPassiveSerial().

const int LOW_linkPassiveSerial::strongPullupEmuTime = 3 [static, private]
 

Time to wait for emulation of strong pullup in seconds.

Definition at line 105 of file LOW_linkPassiveSerial.h.

Referenced by strongPullup().


The documentation for this class was generated from the following files:
Generated on Sun Jan 12 21:07:57 2003 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001