Implementation of 1-Wire with added Alarm Search Functionality

Dependents:   Max32630_One_Wire_Interface

Committer:
j3
Date:
Tue Dec 13 13:31:30 2016 -0800
Revision:
139:f0e0a7976846
Parent:
113:13e2865603df
Merge from svn

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IanBenzMaxim 113:13e2865603df 1 /******************************************************************//**
IanBenzMaxim 113:13e2865603df 2 * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved.
IanBenzMaxim 113:13e2865603df 3 *
IanBenzMaxim 113:13e2865603df 4 * Permission is hereby granted, free of charge, to any person obtaining a
IanBenzMaxim 113:13e2865603df 5 * copy of this software and associated documentation files (the "Software"),
IanBenzMaxim 113:13e2865603df 6 * to deal in the Software without restriction, including without limitation
IanBenzMaxim 113:13e2865603df 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
IanBenzMaxim 113:13e2865603df 8 * and/or sell copies of the Software, and to permit persons to whom the
IanBenzMaxim 113:13e2865603df 9 * Software is furnished to do so, subject to the following conditions:
IanBenzMaxim 113:13e2865603df 10 *
IanBenzMaxim 113:13e2865603df 11 * The above copyright notice and this permission notice shall be included
IanBenzMaxim 113:13e2865603df 12 * in all copies or substantial portions of the Software.
IanBenzMaxim 113:13e2865603df 13 *
IanBenzMaxim 113:13e2865603df 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
IanBenzMaxim 113:13e2865603df 15 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
IanBenzMaxim 113:13e2865603df 16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IanBenzMaxim 113:13e2865603df 17 * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
IanBenzMaxim 113:13e2865603df 18 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
IanBenzMaxim 113:13e2865603df 19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
IanBenzMaxim 113:13e2865603df 20 * OTHER DEALINGS IN THE SOFTWARE.
IanBenzMaxim 113:13e2865603df 21 *
IanBenzMaxim 113:13e2865603df 22 * Except as contained in this notice, the name of Maxim Integrated
IanBenzMaxim 113:13e2865603df 23 * Products, Inc. shall not be used except as stated in the Maxim Integrated
IanBenzMaxim 113:13e2865603df 24 * Products, Inc. Branding Policy.
IanBenzMaxim 113:13e2865603df 25 *
IanBenzMaxim 113:13e2865603df 26 * The mere transfer of this software does not imply any licenses
IanBenzMaxim 113:13e2865603df 27 * of trade secrets, proprietary technology, copyrights, patents,
IanBenzMaxim 113:13e2865603df 28 * trademarks, maskwork rights, or any other form of intellectual
IanBenzMaxim 113:13e2865603df 29 * property whatsoever. Maxim Integrated Products, Inc. retains all
IanBenzMaxim 113:13e2865603df 30 * ownership rights.
IanBenzMaxim 113:13e2865603df 31 **********************************************************************/
IanBenzMaxim 113:13e2865603df 32
IanBenzMaxim 113:13e2865603df 33 #ifndef OneWire_Authenticators_DS28E25
IanBenzMaxim 113:13e2865603df 34 #define OneWire_Authenticators_DS28E25
IanBenzMaxim 113:13e2865603df 35
IanBenzMaxim 113:13e2865603df 36 #include "DS28E15_22_25.h"
IanBenzMaxim 113:13e2865603df 37
IanBenzMaxim 113:13e2865603df 38 namespace OneWire
j3 139:f0e0a7976846 39 {
IanBenzMaxim 113:13e2865603df 40 /// Interface to the DS28E25 and DS28EL25 (low power) authenticators.
IanBenzMaxim 113:13e2865603df 41 class DS28E25 : public DS28E15_22_25
IanBenzMaxim 113:13e2865603df 42 {
j3 139:f0e0a7976846 43 public:
j3 139:f0e0a7976846 44 // DS28E15_22_25 traits
j3 139:f0e0a7976846 45 static const unsigned int memoryPages = 16;
j3 139:f0e0a7976846 46 static const unsigned int protectionBlocks = 8;
j3 139:f0e0a7976846 47
IanBenzMaxim 113:13e2865603df 48 /// @param owMaster 1-Wire Master to use for communication with DS28E15.
IanBenzMaxim 113:13e2865603df 49 /// @param lowVoltage Enable low voltage timing.
IanBenzMaxim 113:13e2865603df 50 DS28E25(RandomAccessRomIterator & selector, bool lowVoltage = false)
j3 139:f0e0a7976846 51 : DS28E15_22_25(selector, lowVoltage) { }
j3 139:f0e0a7976846 52
j3 139:f0e0a7976846 53 /// Perform Write Scratchpad operation on the device.
j3 139:f0e0a7976846 54 /// @note 1-Wire ROM selection should have already occurred.
j3 139:f0e0a7976846 55 /// @param[in] data Data to write to the scratchpad.
j3 139:f0e0a7976846 56 CmdResult writeScratchpad(const Scratchpad & data) const;
j3 139:f0e0a7976846 57
j3 139:f0e0a7976846 58 /// Perform a Read Scratchpad operation on the device.
j3 139:f0e0a7976846 59 /// @note 1-Wire ROM selection should have already occurred.
j3 139:f0e0a7976846 60 /// @param[out] data Buffer to read data from the scratchpad into.
j3 139:f0e0a7976846 61 CmdResult readScratchpad(Scratchpad & data) const;
j3 139:f0e0a7976846 62
j3 139:f0e0a7976846 63 /// Read the status of a memory protection block using the Read Status command.
j3 139:f0e0a7976846 64 /// @note 1-Wire ROM selection should have already occurred.
j3 139:f0e0a7976846 65 /// @param blockNum Block number to to read status of.
j3 139:f0e0a7976846 66 /// @param[out] protection Receives protection status read from device.
j3 139:f0e0a7976846 67 CmdResult readBlockProtection(unsigned int blockNum, BlockProtection & protection) const;
j3 139:f0e0a7976846 68
j3 139:f0e0a7976846 69 /// Read the personality bytes using the Read Status command.
j3 139:f0e0a7976846 70 /// @note 1-Wire ROM selection should have already occurred.
j3 139:f0e0a7976846 71 /// @param[out] personality Receives personality read from device.
j3 139:f0e0a7976846 72 CmdResult readPersonality(Personality & personality) const;
j3 139:f0e0a7976846 73
j3 139:f0e0a7976846 74 /// Write memory segment with authentication using the Authenticated Write Memory command.
j3 139:f0e0a7976846 75 /// @note 1-Wire ROM selection should have already occurred.
j3 139:f0e0a7976846 76 /// @param MacCoproc Coprocessor to use for Write MAC computation.
j3 139:f0e0a7976846 77 /// @param pageNum Page number for write operation.
j3 139:f0e0a7976846 78 /// @param segmentNum Segment number within page for write operation.
j3 139:f0e0a7976846 79 /// @param[in] newData New data to write to the segment.
j3 139:f0e0a7976846 80 /// @param[in] oldData Existing data contained in the segment.
j3 139:f0e0a7976846 81 /// @param continuing True to continue writing with the next sequential segment.
j3 139:f0e0a7976846 82 /// False to begin a new command.
j3 139:f0e0a7976846 83 CmdResult writeAuthSegment(const ISha256MacCoproc & MacCoproc,
j3 139:f0e0a7976846 84 unsigned int pageNum,
j3 139:f0e0a7976846 85 unsigned int segmentNum,
j3 139:f0e0a7976846 86 const Segment & newData,
j3 139:f0e0a7976846 87 const Segment & oldData,
j3 139:f0e0a7976846 88 bool continuing = false);
j3 139:f0e0a7976846 89
j3 139:f0e0a7976846 90 /// Write memory segment with authentication using the Authenticated Write Memory command.
j3 139:f0e0a7976846 91 /// @note 1-Wire ROM selection should have already occurred.
j3 139:f0e0a7976846 92 /// @param pageNum Page number for write operation.
j3 139:f0e0a7976846 93 /// @param segmentNum Segment number within page for write operation.
j3 139:f0e0a7976846 94 /// @param[in] newData New data to write to the segment.
j3 139:f0e0a7976846 95 /// @param[in] mac Write MAC computed for this operation.
j3 139:f0e0a7976846 96 /// @param continuing True to continue writing with the next sequential segment.
j3 139:f0e0a7976846 97 /// False to begin a new command.
j3 139:f0e0a7976846 98 CmdResult writeAuthSegmentMac(unsigned int pageNum,
j3 139:f0e0a7976846 99 unsigned int segmentNum,
j3 139:f0e0a7976846 100 const Segment & newData,
j3 139:f0e0a7976846 101 const Mac & mac,
j3 139:f0e0a7976846 102 bool continuing = false);
j3 139:f0e0a7976846 103
j3 139:f0e0a7976846 104 /// Read the status of all memory protection blocks using the Read Status command.
j3 139:f0e0a7976846 105 /// @note 1-Wire ROM selection should have already occurred.
j3 139:f0e0a7976846 106 /// @param[out] protection Receives protection statuses read from device.
j3 139:f0e0a7976846 107 CmdResult readAllBlockProtection(array<BlockProtection, protectionBlocks> & protection) const;
IanBenzMaxim 113:13e2865603df 108 };
IanBenzMaxim 113:13e2865603df 109 }
IanBenzMaxim 113:13e2865603df 110
IanBenzMaxim 113:13e2865603df 111 #endif