選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 

72 行
2.2 KiB

  1. /*
  2. * Copyright (c) 2015, Freescale Semiconductor, Inc.
  3. * Copyright 2016-2019 NXP
  4. * All rights reserved.
  5. *
  6. * SPDX-License-Identifier: BSD-3-Clause
  7. */
  8. #include "fsl_sim.h"
  9. /* Component ID definition, used by tools. */
  10. #ifndef FSL_COMPONENT_ID
  11. #define FSL_COMPONENT_ID "platform.drivers.sim"
  12. #endif
  13. /*******************************************************************************
  14. * Codes
  15. ******************************************************************************/
  16. #if (defined(FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR) && FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR)
  17. /*!
  18. * brief Sets the USB voltage regulator setting.
  19. *
  20. * This function configures whether the USB voltage regulator is enabled in
  21. * normal RUN mode, STOP/VLPS/LLS/VLLS modes, and VLPR/VLPW modes. The configurations
  22. * are passed in as mask value of \ref _sim_usb_volt_reg_enable_mode. For example, to enable
  23. * USB voltage regulator in RUN/VLPR/VLPW modes and disable in STOP/VLPS/LLS/VLLS mode,
  24. * use:
  25. *
  26. * SIM_SetUsbVoltRegulatorEnableMode(kSIM_UsbVoltRegEnable | kSIM_UsbVoltRegEnableInLowPower);
  27. *
  28. * param mask USB voltage regulator enable setting.
  29. */
  30. void SIM_SetUsbVoltRegulatorEnableMode(uint32_t mask)
  31. {
  32. SIM->SOPT1CFG |= (SIM_SOPT1CFG_URWE_MASK | SIM_SOPT1CFG_UVSWE_MASK | SIM_SOPT1CFG_USSWE_MASK);
  33. SIM->SOPT1 = (SIM->SOPT1 & ~(uint32_t)kSIM_UsbVoltRegEnableInAllModes) | mask;
  34. }
  35. #endif /* FSL_FEATURE_SIM_OPT_HAS_USB_VOLTAGE_REGULATOR */
  36. /*!
  37. * brief Gets the unique identification register value.
  38. *
  39. * param uid Pointer to the structure to save the UID value.
  40. */
  41. void SIM_GetUniqueId(sim_uid_t *uid)
  42. {
  43. #if defined(SIM_UIDH)
  44. uid->H = SIM->UIDH;
  45. #endif
  46. #if (defined(FSL_FEATURE_SIM_HAS_UIDM) && FSL_FEATURE_SIM_HAS_UIDM)
  47. uid->M = SIM->UIDM;
  48. #else
  49. uid->MH = SIM->UIDMH;
  50. uid->ML = SIM->UIDML;
  51. #endif /* FSL_FEATURE_SIM_HAS_UIDM */
  52. uid->L = SIM->UIDL;
  53. }
  54. #if (defined(FSL_FEATURE_SIM_HAS_RF_MAC_ADDR) && FSL_FEATURE_SIM_HAS_RF_MAC_ADDR)
  55. /*!
  56. * brief Gets the RF address register value.
  57. *
  58. * param info Pointer to the structure to save the RF address value.
  59. */
  60. void SIM_GetRfAddr(sim_rf_addr_t *info)
  61. {
  62. info->rfAddrL = SIM->RFADDRL;
  63. info->rfAddrH = SIM->RFADDRH;
  64. }
  65. #endif /* FSL_FEATURE_SIM_HAS_RF_MAC_ADDR */