/* * file otp.h * * API and data structures for OTP driver. * * ============================================================================ * (C) Copyright 2012, Texas Instruments, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * \par */ #ifndef OTP_H_ #define OTP_H_ #ifdef __cplusplus extern "C" { #endif #include /* SMEK, SMPK Defines */ #define OTP_SMEK_SIZE_32BIT_WORDS ((Uint16) 5) /* 4 key words + 1 ECC word */ #define OTP_SMPK_SIZE_32BIT_WORDS ((Uint16) 10) /* 8 hash words + 2 ECC words */ /* eFuse Programming defines */ #define OTP_MAX_WRITE_ATTEMPTS ((Uint16) 0xF) /* OTP status */ typedef enum { /* EFUSE return codes */ /** No error - Instruction completed successfully */ Otp_status_INSTRUCTION_SUCCESSFUL = 0, /** Error: Time-out */ Otp_status_TIMEOUT = 1, /** Error: Autoload - Not enough data to fill scan chain */ Otp_status_AUTOLOAD_NOT_ENOUGH_DATA = 2, /** Error: Autoload - Wrong signature */ Otp_status_AUTOLOAD_WRONG_SIGNATURE = 3, /** Error: Autoload or program operation interrupted */ Otp_status_PROGRAM_INTERRUPTION = 4, /** Value of 5 not used */ /** Error: Write protection bit is set */ Otp_status_WRITE_PROTECT_SET = 6, /** Error: Exceeded max write attempts allowed */ Otp_status_EXCEEDED_MAX_WR_ATTEMPTS = 7, /** Error: Exceeded max control bit write attempts allowed */ Otp_status_EXCEEDED_MAX_CNTRL_BIT_WR_ATTEMPTS = 8, /** Error: Some found to be set by test unprogrammed instruction */ Otp_status_TEST_RAW_SOME_BIT_SET = 9, /** Value of 10 not used */ /** Error: Exceeded max CRA write attempts allowed */ Otp_status_EXCEEDED_MAX_CRA_WR_ATTEMTPS = 11, /** Error: Address previously programmed with same data */ Otp_status_ADDRESS_PROGRAMMED_WITH_SAME_DATA = 12, /** Inform: Program_compare_disable set when programming. */ Otp_status_PROGRAM_COMP_DISABLE_SET_DURING_WR = 13, /** Error: Program aborted due to no row repair but repair bit set */ Otp_status_ABORT_PROGRAM_INVALID_ROW_REPAIR = 14, /** Error: Program instruction executed with improper key value */ Otp_status_IMPROPER_KEY_VALUE = 15, /** Values of 16 and 17 not used */ /** Error: Autoload operation incomplete */ Otp_status_INCOMPLETE_AUTOLOAD = 18, /** Error: Autoload last row stuck */ Otp_status_AUTOLOAD_LAST_ROW_STUCK = 19, /* OTP Driver error codes */ /** Error: The Key Mgr or Key specified is out of the hardware's range */ Otp_status_KEY_MGR_OR_KEY_OUT_OF_RANGE = 20, /** Error: A read protect on a row was attempted without write protect being * set as well */ Otp_status_READ_PROTECT_WITHOUT_WRITE_PROTECT = 21, /** Error: Data read from eFuse just after write was not the same. Write error */ Otp_status_READ_DATA_NOT_SAME_AS_WRITTEN = 22 } Otp_Status; typedef struct { Uint16 maxWrAttempts; /* Once writeProtect is set no further private bit settings can occur. * readProtect cannot be set without writeProtect. An error will be returned if this is attempted */ Bool writeProtect; Bool readProtect; } Otp_writeCfg; /* SMEK APIs */ extern Otp_Status Otp_smekWrite (Uint32 *smekDataPtr, Otp_writeCfg *otpWrCfg); /* SMPK APIs */ extern Otp_Status Otp_smpkWrite (Uint32 *smpkDataPtr, Otp_writeCfg *otpWrCfg); /* OTP APIs */ extern Otp_Status Otp_otpWrite (Uint32 *otpDataPtr, Uint16 otpKeyMgr, Uint16 otpKey, Otp_writeCfg *otpWrCfg); extern Otp_Status Otp_otpSetPrivate (Uint16 otpKeyMgr, Uint16 otpKey, Otp_writeCfg *otpWrCfg); #ifdef __cplusplus } #endif #endif /* OTP_H_ */