board.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /******************************************************************//**
  2. * @file drv_dma.h
  3. * @brief USART driver of RT-Thread RTOS for EFM32
  4. * COPYRIGHT (C) 2011, RT-Thread Development Team
  5. * @author onelife
  6. * @version 0.4 beta
  7. **********************************************************************
  8. * @section License
  9. * The license and distribution terms for this file may be found in the file LICENSE in this
  10. * distribution or at http://www.rt-thread.org/license/LICENSE
  11. **********************************************************************
  12. * @section Change Logs
  13. * Date Author Notes
  14. * 2010-12-21 onelife Initial creation for EFM32
  15. *********************************************************************/
  16. #ifndef __BOARD_H__
  17. #define __BOARD_H__
  18. #if defined(EFM32G890F128)
  19. #elif defined(EFM32G290F128)
  20. #elif defined(EFM32G230F128)
  21. #else
  22. #error Unknown MCU type
  23. #endif
  24. /* Includes -------------------------------------------------------------------*/
  25. #include <efm32.h>
  26. #include <efm32_chip.h>
  27. #include <efm32_cmu.h>
  28. #include <efm32_rmu.h>
  29. #include <efm32_dma.h>
  30. #include <efm32_rtc.h>
  31. #include <efm32_timer.h>
  32. #include <efm32_gpio.h>
  33. #include <efm32_acmp.h>
  34. #include <efm32_adc.h>
  35. #include <efm32_usart.h>
  36. #include <efm32_i2c.h>
  37. #include <rtthread.h>
  38. /* Exported types -------------------------------------------------------------*/
  39. /* Exported constants ---------------------------------------------------------*/
  40. /* Exported variables ----------------------------------------------------------*/
  41. extern rt_uint32_t rt_system_status;
  42. /* Exported macro -------------------------------------------------------------*/
  43. #define DEBUG_EFM
  44. #define DEBUG_EFM_USER
  45. #define EFM32_NO_DATA (0)
  46. #define EFM32_NO_OFFSET (-1)
  47. #define EFM32_NO_POINTER (RT_NULL)
  48. #define EFM32_SRAM_END (RAM_MEM_BASE + SRAM_SIZE)
  49. #define EFM32_BASE_PRI_DEFAULT (0x0UL << 5)
  50. #define EFM32_IRQ_PRI_DEFAULT (0x4UL << 5)
  51. #if (defined(EFM32_G890_STK) || defined(EFM32_G290_DK))
  52. #define EFM32_HFXO_FREQUENCY (32000000)
  53. #else
  54. #define EFM32_HFXO_FREQUENCY (00000000)
  55. #endif
  56. #define UART_BAUDRATE (115200)
  57. #define SERIAL_RX_BUFFER_SIZE (64)
  58. #define IIC_RX_BUFFER_SIZE (32)
  59. #define ADC_INIT_REF adcRef2V5
  60. #define ADC_INIT_CH adcSingleInpCh5
  61. #define ADC_CONVERT_FREQUENCY (7000000)
  62. #if (RT_CONSOLE_DEVICE == 0x0UL)
  63. #define CONSOLE_DEVICE RT_USART0_NAME
  64. #elif (RT_CONSOLE_DEVICE == 0x1UL)
  65. #define CONSOLE_DEVICE RT_USART1_NAME
  66. #elif (RT_CONSOLE_DEVICE == 0x2UL)
  67. #define CONSOLE_DEVICE RT_USART2_NAME
  68. #else
  69. #define CONSOLE_DEVICE "no"
  70. #endif
  71. /*! fixme: move the following define to Rtdef.h */
  72. #define RT_DEVICE_CTRL_USART_RBUFFER (0xF1) /*!< set USART rx buffer */
  73. #define RT_DEVICE_CTRL_IIC_SETTING (0xF2) /*!< change IIC setting */
  74. #define RT_DEVICE_CTRL_TIMER_PERIOD (0xF3) /*!< set Timer timeout period */
  75. #define RT_DEVICE_CTRL_ADC_MODE (0xF4) /*!< change ADC mode */
  76. #define RT_DEVICE_CTRL_ADC_RESULT (0xF5) /*!< get ADC result */
  77. #define RT_DEVICE_CTRL_ACMP_INIT (0xF6) /*!< Initialize ACMP */
  78. #define RT_DEVICE_CTRL_ACMP_OUTPUT (0xF7) /*!< get ACMP output */
  79. /* Exported functions --------------------------------------------------------- */
  80. void rt_hw_board_init(void);
  81. void rt_hw_driver_init(void);
  82. #endif /*__BOARD_H__ */