1 /* 2 * Copyright 2022 NXP 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 #include "fsl_romapi_otp.h" 9 #include "fsl_romapi.h" 10 11 #define OCOTP_API_TREE ((ocotp_driver_t *)(((uint32_t *)ROM_API_TREE_ADDR)[12])) 12 13 /*! 14 * @brief Initialize OCOTP controller 15 */ otp_version(void)16uint32_t otp_version(void) 17 { 18 return (OCOTP_API_TREE->version); 19 } 20 21 /*! 22 * @brief Initialize OCOTP controller 23 */ otp_init(void)24void otp_init(void) 25 { 26 assert(OCOTP_API_TREE); 27 OCOTP_API_TREE->init(); 28 } 29 30 /*! 31 * @brief Deinitialize OCOTP controller 32 */ otp_deinit(void)33status_t otp_deinit(void) 34 { 35 assert(OCOTP_API_TREE); 36 return OCOTP_API_TREE->deinit(); 37 } 38 39 /*! 40 * @brief Reads a efuse word 41 */ otp_fuse_read(uint32_t addr,uint32_t * data)42status_t otp_fuse_read(uint32_t addr, uint32_t *data) 43 { 44 assert(OCOTP_API_TREE); 45 return OCOTP_API_TREE->p_efuse_read(addr, data); 46 } 47 48 /*! 49 * @brief Programs a efuse word 50 */ otp_fuse_program(uint32_t addr,uint32_t data)51status_t otp_fuse_program(uint32_t addr, uint32_t data) 52 { 53 assert(OCOTP_API_TREE); 54 return OCOTP_API_TREE->p_efuse_program(addr, data); 55 } 56