コード例 #1
0
        /// <summary> Lock the specifed page in the current memory bank.  Not supported
        /// by all devices.  See the method 'canLockPage()'.
        ///
        /// </summary>
        /// <param name="page">  number of page to lock
        ///
        /// </param>
        /// <throws>  OneWireIOException </throws>
        /// <throws>  OneWireException </throws>
        public virtual void  setPageWriteOnce(int page)
        {
            byte[] wr_byte = new byte[1];

            wr_byte[0] = WRITEONCE_FLAG;

            register.write(page, wr_byte, 0, 1);

            // read back to verify
            if (!isPageWriteOnce(page))
            {
                throw new OneWireIOException("Failed to set page to write-once mode.");
            }
        }
コード例 #2
0
        //--------
        //-------- OTPMemoryBank I/O methods
        //--------

        /// <summary> Lock the specifed page in the current memory bank.  Not supported
        /// by all devices.  See the method 'canLockPage()'.
        ///
        /// </summary>
        /// <param name="page">  number of page to lock
        ///
        /// </param>
        /// <throws>  OneWireIOException </throws>
        /// <throws>  OneWireException </throws>
        public virtual void  lockPage(int page)
        {
            byte[] wr_byte = new byte[1];

            wr_byte[0] = LOCKED_FLAG;

            mbLock.write(page, wr_byte, 0, 1);

            // read back to verify
            if (!isPageLocked(page))
            {
                sp.forceVerify();

                throw new OneWireIOException("Read back from write incorrect, could not lock page");
            }
        }