dvk.c 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /**************************************************************************//**
  2. * @file
  3. * @brief DVK board support package, initialization
  4. * @author Energy Micro AS
  5. * @version 2.0.1
  6. ******************************************************************************
  7. * @section License
  8. * <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
  9. *******************************************************************************
  10. *
  11. * Permission is granted to anyone to use this software for any purpose,
  12. * including commercial applications, and to alter it and redistribute it
  13. * freely, subject to the following restrictions:
  14. *
  15. * 1. The origin of this software must not be misrepresented; you must not
  16. * claim that you wrote the original software.
  17. * 2. Altered source versions must be plainly marked as such, and must not be
  18. * misrepresented as being the original software.
  19. * 3. This notice may not be removed or altered from any source distribution.
  20. * 4. The source and compiled code may only be used on Energy Micro "EFM32"
  21. * microcontrollers and "EFR4" radios.
  22. *
  23. * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
  24. * obligation to support this Software. Energy Micro AS is providing the
  25. * Software "AS IS", with no express or implied warranties of any kind,
  26. * including, but not limited to, any implied warranties of merchantability
  27. * or fitness for any particular purpose or warranties against infringement
  28. * of any proprietary rights of a third party.
  29. *
  30. * Energy Micro AS will not be liable for any consequential, incidental, or
  31. * special damages, or any other relief, or for any claim by any third party,
  32. * arising from your use of this Software.
  33. *
  34. *****************************************************************************/
  35. #include "efm32.h"
  36. #include "dvk.h"
  37. /***************************************************************************//**
  38. * @addtogroup BSP
  39. * @{
  40. ******************************************************************************/
  41. /**************************************************************************//**
  42. * @brief Initializes DVK, configures board control access
  43. *****************************************************************************/
  44. bool DVK_init(void)
  45. {
  46. bool ret;
  47. #ifdef DVK_EBI_CONTROL
  48. ret = DVK_EBI_init();
  49. #endif
  50. #ifdef DVK_SPI_CONTROL
  51. ret = DVK_SPI_init();
  52. #endif
  53. if ( ret == false )
  54. {
  55. /* Board is configured in wrong mode, please restart KIT! */
  56. while(1);
  57. }
  58. /* Inform AEM application that we are in Energy Mode 0 by default */
  59. DVK_setEnergyMode(0);
  60. return ret;
  61. }
  62. /**************************************************************************//**
  63. * @brief Disables DVK, free up resources
  64. *****************************************************************************/
  65. void DVK_disable(void)
  66. {
  67. #ifdef DVK_EBI_CONTROL
  68. /* Handover bus control */
  69. DVK_disableBus();
  70. /* Disable EBI interface */
  71. DVK_EBI_disable();
  72. #endif
  73. #ifdef DVK_SPI_CONTROL
  74. DVK_SPI_disable();
  75. #endif
  76. }
  77. /** @} (end group BSP) */