lib_otp#
The lib_otp library provides functions for reading from and programming data to the OTP (One Time Programmable) memory available on each tile.
Two implementations of the library are provided. The original lib_otp
implements the API for the XCORE-200 family of devices and earlier, while
lib_otp3
implements it for the xcore.ai family.
To use the library, include either the otp.h
or otp3.h
header
file and link your project using either -lotp
or -lotp3
.
Danger
Incorrect use of this library can result in irreversible damage to the device. It is documented for completeness, and its usage is unnecessary in the vast majority of applications. The most common operations can be performed using XBURN instead, which internally drives this library.
-
struct OTPPorts
- #include <otp.h>
Defines
-
OTP_STATS#
OTP Statistics gathering is disabled by default.
#define OTP_STATS 1 in user defined otp_conf.h to enable
-
OTP_SIZE#
Maximum size of OTP memory.
Functions
-
int otp_program(REFERENCE_PARAM(OTPPorts, ports), unsigned address, const unsigned data[], unsigned size)#
If OTP_STATS is set then the OTP library will record statistics during OTP memory programming.
These statistics can then be used to determine the success/failure status from the programming event. Stats can the be retrieved using function otpstats_get_stats. This function programs a block of OTP memory of defined size at address using default single_ended mode. This function will attempt to repair any failures using the redundancy registers.
-
int otp_program_differential(REFERENCE_PARAM(OTPPorts, ports), unsigned address, const unsigned data[], unsigned size)#
This function programs a block of OTP memory of defined size at address using enhanced differential mode.
This function will attempt to repair any failures using the redundancy registers.
-
int otp_program_no_repair(REFERENCE_PARAM(OTPPorts, ports), unsigned address, const unsigned data[], unsigned size, char failmap[])#
This function programs a block of OTP memory of defined size at address using default single_ended mode.
No attempt to repair unprogrammed/faulty bits will take place using this function however a failure map is returned providing an indication of OTP memory that was not successfully programmed.
- Parameters:
address – [in] : unsigned - the location in OTP memory to write to.
data – [in] : const unsigned[] - an array of data to be written.
size – [in] : unsigned - the amount of data to be written.
failmap – [out] : unsigned [] - location of bits that failed to program successfully.
- Returns:
1 if successful; 0 if failed.
-
int otp_program_differential_no_repair(REFERENCE_PARAM(OTPPorts, ports), unsigned address, const unsigned data[], unsigned size, char failmap[])#
This function programs a block of OTP memory of defined size at address using enhanced differential mode.
No attempt to repair unprogrammed/faulty bits will take place using this function however a failure map is returned providing an indication of OTP memory that was not successfully programmed.
- Parameters:
address – [in] : unsigned - the location in OTP memory to write to.
data – [in] : const unsigned[] - an array of data to be written.
size – [in] : unsigned - the amount of data to be written.
failmap – [out] : unsigned [] - location of bits that failed to program successfully.
- Returns:
1 if successful; 0 if failed.
-
int otp_program_special_register(REFERENCE_PARAM(OTPPorts, ports), unsigned data)#
otp_program_special_register programs a word to the OTP special register.
-
int otp_program_secure_config_register(REFERENCE_PARAM(OTPPorts, ports), unsigned data)#
otp_program_secure_config_register programs a word to the OTP secure config register.
-
int otpprogram_writeword_norepair(REFERENCE_PARAM(OTPPorts, ports), unsigned address, unsigned data)#
-
void otp_read(REFERENCE_PARAM(OTPPorts, ports), unsigned address, unsigned data[], unsigned size)#
otp_read reads a block of OTP data of defined size from address using default single_ended mode.
-
void otp_read_differential(REFERENCE_PARAM(OTPPorts, ports), unsigned address, unsigned data[], unsigned size)#
otp_read_differential reads a block of OTP data of defined size from address using enhanced differential mode.
-
void otp_read_special_register(REFERENCE_PARAM(OTPPorts, ports), REFERENCE_PARAM(unsigned, data))#
otp_read_special_register reads a word from the OTP special register.
Note
xcore.ai does not have a “special register”, and so lib_otp3
will trap
if either otp_read_special_register
or otp_program_special_register
are called.