dvk.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /**************************************************************************//**
  2. * @file
  3. * @brief DVK Board Support, master header file
  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. #ifndef __DVK_H
  36. #define __DVK_H
  37. /***************************************************************************//**
  38. * @addtogroup BSP
  39. * @{
  40. ******************************************************************************/
  41. #include <stdint.h>
  42. #include <stdbool.h>
  43. #include "dvk_boardcontrol.h"
  44. #include "dvk_bcregisters.h"
  45. /* onelife: Add missing define */
  46. #define NULL ((void *)0)
  47. /* IF not user overrides default, try to decide DVK access interface based on
  48. * part number */
  49. #ifndef DVK_SPI_CONTROL
  50. #ifndef DVK_EBI_CONTROL
  51. #if defined(EFM32G200F16)
  52. #define DVK_SPI_CONTROL
  53. #elif defined(EFM32G200F32)
  54. #define DVK_SPI_CONTROL
  55. #elif defined(EFM32G200F64)
  56. #define DVK_SPI_CONTROL
  57. #elif defined(EFM32G210F128)
  58. #define DVK_SPI_CONTROL
  59. #elif defined(EFM32G230F128)
  60. #define DVK_SPI_CONTROL
  61. #elif defined(EFM32G230F32)
  62. #define DVK_SPI_CONTROL
  63. #elif defined(EFM32G230F64)
  64. #define DVK_SPI_CONTROL
  65. #elif defined(EFM32G280F128)
  66. #define DVK_EBI_CONTROL
  67. #elif defined(EFM32G280F32)
  68. #define DVK_EBI_CONTROL
  69. #elif defined(EFM32G280F64)
  70. #define DVK_EBI_CONTROL
  71. #elif defined(EFM32G290F128)
  72. #define DVK_EBI_CONTROL
  73. #elif defined(EFM32G290F32)
  74. #define DVK_EBI_CONTROL
  75. #elif defined(EFM32G290F64)
  76. #define DVK_EBI_CONTROL
  77. #elif defined(EFM32G840F128)
  78. #define DVK_SPI_CONTROL
  79. #elif defined(EFM32G840F32)
  80. #define DVK_SPI_CONTROL
  81. #elif defined(EFM32G840F64)
  82. #define DVK_SPI_CONTROL
  83. #elif defined(EFM32G880F128)
  84. #define DVK_SPI_CONTROL
  85. #elif defined(EFM32G880F32)
  86. #define DVK_SPI_CONTROL
  87. #elif defined(EFM32G880F64)
  88. #define DVK_SPI_CONTROL
  89. #elif defined(EFM32G890F128)
  90. #define DVK_SPI_CONTROL
  91. #elif defined(EFM32G890F32)
  92. #define DVK_SPI_CONTROL
  93. #elif defined(EFM32G890F64)
  94. #define DVK_SPI_CONTROL
  95. #else
  96. #define DVK_SPI_CONTROL
  97. #endif
  98. #endif
  99. #endif
  100. #ifdef __cplusplus
  101. extern "C" {
  102. #endif
  103. /* EBI access */
  104. bool DVK_EBI_init(void);
  105. void DVK_EBI_disable(void);
  106. void DVK_EBI_configure(void);
  107. void DVK_EBI_writeRegister(volatile uint16_t *addr, uint16_t data);
  108. uint16_t DVK_EBI_readRegister(volatile uint16_t *addr);
  109. /* SPI access */
  110. bool DVK_SPI_init(void);
  111. void DVK_SPI_disable(void);
  112. void DVK_SPI_writeRegister(volatile uint16_t *addr, uint16_t data);
  113. uint16_t DVK_SPI_readRegister(volatile uint16_t *addr);
  114. /* Accodring to configuration, use either SPI or EBI */
  115. #ifdef DVK_EBI_CONTROL
  116. #define DVK_writeRegister(A, B) DVK_EBI_writeRegister(A, B)
  117. #define DVK_readRegister(A) DVK_EBI_readRegister(A)
  118. #endif
  119. #ifdef DVK_SPI_CONTROL
  120. #define DVK_writeRegister(A, B) DVK_SPI_writeRegister(A, B)
  121. #define DVK_readRegister(A) DVK_SPI_readRegister(A)
  122. #endif
  123. /* General initialization routines */
  124. bool DVK_init(void);
  125. void DVK_disable(void);
  126. #ifdef __cplusplus
  127. }
  128. #endif
  129. /** @} (end group BSP) */
  130. #endif