This is an automated email from the ASF dual-hosted git repository. janc pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mynewt-core.git
commit a11c5b15234cd0d3454500351a61f46cf4c5c0cf Author: Szymon Janc <[email protected]> AuthorDate: Wed Jun 7 15:43:47 2023 +0200 mcu/nrf5340/tfm: Add FICR XOSC32TRIM read function New NSC function tfm_ficr_xosc32mtrim_read reads XOSC32TRIM from FICR register. --- hw/mcu/nordic/nrf5340/tfm/include/tfm/tfm.h | 9 +++++++++ hw/mcu/nordic/nrf5340/tfm/pkg.yml | 1 + hw/mcu/nordic/nrf5340/tfm/src/tfm.c | 8 ++++++++ 3 files changed, 18 insertions(+) diff --git a/hw/mcu/nordic/nrf5340/tfm/include/tfm/tfm.h b/hw/mcu/nordic/nrf5340/tfm/include/tfm/tfm.h index 843eee154..5e50d0c57 100644 --- a/hw/mcu/nordic/nrf5340/tfm/include/tfm/tfm.h +++ b/hw/mcu/nordic/nrf5340/tfm/include/tfm/tfm.h @@ -78,3 +78,12 @@ int SECURE_CALL tfm_gpio_pin_mcu_select(uint32_t pin_number, nrf_gpio_pin_mcusel * @return 0 on success */ int SECURE_CALL tfm_uicr_protect_device(uint8_t *approtect, uint8_t *secure_approtect, uint8_t *erase_protect); + +/** + * Read FICR XOSC32TRIM word + * + * @param xosc32mtrim - buffer for xosc32mtrim value + * @return 0 on success + * TFM_ERR_ACCESS_DENIED - when read is denied by secure code + */ +int SECURE_CALL tfm_ficr_xosc32mtrim_read(uint32_t *xosc32mtrim); diff --git a/hw/mcu/nordic/nrf5340/tfm/pkg.yml b/hw/mcu/nordic/nrf5340/tfm/pkg.yml index 37d3c9756..bfd8e11e0 100644 --- a/hw/mcu/nordic/nrf5340/tfm/pkg.yml +++ b/hw/mcu/nordic/nrf5340/tfm/pkg.yml @@ -37,3 +37,4 @@ pkg.lflags.(MCU_APP_SECURE && TFM_EXPORT_NSC): - -utfm_uicr_otp_write - -utfm_gpio_pin_mcu_select - -utfm_uicr_protect_device + - -utfm_ficr_xosc32mtrim_read diff --git a/hw/mcu/nordic/nrf5340/tfm/src/tfm.c b/hw/mcu/nordic/nrf5340/tfm/src/tfm.c index f698ba020..22573db65 100644 --- a/hw/mcu/nordic/nrf5340/tfm/src/tfm.c +++ b/hw/mcu/nordic/nrf5340/tfm/src/tfm.c @@ -102,3 +102,11 @@ tfm_gpio_pin_mcu_select(uint32_t pin_number, nrf_gpio_pin_mcusel_t mcu_sel) return err; } + +int SECURE_CALL +tfm_ficr_xosc32mtrim_read(uint32_t *xosc32mtrim) +{ + *xosc32mtrim = NRF_FICR_S->XOSC32MTRIM; + + return 0; +}
