efm32_system.c 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /***************************************************************************//**
  2. * @file
  3. * @brief System utilities peripheral API for EFM32.
  4. * @author Energy Micro AS
  5. * @version 1.3.0
  6. *******************************************************************************
  7. * @section License
  8. * <b>(C) Copyright 2010 Energy Micro AS, http://www.energymicro.com</b>
  9. *******************************************************************************
  10. *
  11. * This source code is the property of Energy Micro AS. The source and compiled
  12. * code may only be used on Energy Micro "EFM32" microcontrollers.
  13. *
  14. * This copyright notice may not be removed from the source code nor changed.
  15. *
  16. * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
  17. * obligation to support this Software. Energy Micro AS is providing the
  18. * Software "AS IS", with no express or implied warranties of any kind,
  19. * including, but not limited to, any implied warranties of merchantability
  20. * or fitness for any particular purpose or warranties against infringement
  21. * of any proprietary rights of a third party.
  22. *
  23. * Energy Micro AS will not be liable for any consequential, incidental, or
  24. * special damages, or any other relief, or for any claim by any third party,
  25. * arising from your use of this Software.
  26. *
  27. ******************************************************************************/
  28. #include "efm32.h"
  29. #include "efm32_system.h"
  30. #include "efm32_assert.h"
  31. /***************************************************************************//**
  32. * @addtogroup EFM32_Library
  33. * @{
  34. ******************************************************************************/
  35. /***************************************************************************//**
  36. * @addtogroup SYSTEM
  37. * @brief EFM32 system utilities.
  38. * @{
  39. ******************************************************************************/
  40. /*******************************************************************************
  41. ************************** GLOBAL FUNCTIONS *******************************
  42. ******************************************************************************/
  43. /***************************************************************************//**
  44. * @brief
  45. * Get chip major/minor revision.
  46. *
  47. * @param[out] rev
  48. * Location to place chip revision info.
  49. ******************************************************************************/
  50. void SYSTEM_ChipRevisionGet(SYSTEM_ChipRevision_TypeDef *rev)
  51. {
  52. uint8_t tmp;
  53. EFM_ASSERT(rev);
  54. rev->major = (ROMTABLE->PID0 & _ROMTABLE_PID0_REVMAJOR_MASK) >> _ROMTABLE_PID0_REVMAJOR_SHIFT;
  55. tmp = (ROMTABLE->PID2 & _ROMTABLE_PID2_REVMINORMSB_MASK);
  56. tmp |= ((ROMTABLE->PID3 & _ROMTABLE_PID3_REVMINORLSB_MASK) >> _ROMTABLE_PID3_REVMINORLSB_SHIFT);
  57. rev->minor = tmp;
  58. }
  59. /** @} (end addtogroup SYSTEM) */
  60. /** @} (end addtogroup EFM32_Library) */