Writes data from a buffer into OTP, or reads data from OTP into a buffer The buffer must be aligned to 2 bytes or 4 bytes according to the IS_ECC flag. This method will read and write rows until the first row it encounters that fails a key or permission check at which it will return BOOTROM_ERROR_NOT_PERMITTED. Writing will also stop at the first row where an attempt is made to set an OTP bit from a 1 to a 0, and BOOTROM_ERROR_UNSUPPORTED_MODIFICATION will be returned. If all rows are read/written successfully, then BOOTROM_OK will be returned.
OTP command to execute - 0x0000ffff - ROW_NUMBER: 16 low bits are row number (0-4095) - 0x00010000 - IS_WRITE: if set, do a write (not a read) - 0x00020000 - IS_ECC: if this bit is set, each value in the buffer is 2 bytes and ECC is used when read/writing from 24 bit value in OTP. If this bit is not set, each value in the buffer is 4 bytes, the low 24-bits of which are written to or read from OTP.
Examples
rom_func_otp_access() is referenced by 1 libraries and example projects: