My Marlin configs for Fabrikator Mini and CTC i3 Pro B
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

lpc17xx_wdt.h 4.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /**********************************************************************
  2. * $Id$ lpc17xx_wdt.h 2010-05-21
  3. *//**
  4. * @file lpc17xx_wdt.h
  5. * @brief Contains all macro definitions and function prototypes
  6. * support for WDT firmware library on LPC17xx
  7. * @version 2.0
  8. * @date 21. May. 2010
  9. * @author NXP MCU SW Application Team
  10. *
  11. * Copyright(C) 2010, NXP Semiconductor
  12. * All rights reserved.
  13. *
  14. ***********************************************************************
  15. * Software that is described herein is for illustrative purposes only
  16. * which provides customers with programming information regarding the
  17. * products. This software is supplied "AS IS" without any warranties.
  18. * NXP Semiconductors assumes no responsibility or liability for the
  19. * use of the software, conveys no license or title under any patent,
  20. * copyright, or mask work right to the product. NXP Semiconductors
  21. * reserves the right to make changes in the software without
  22. * notification. NXP Semiconductors also make no representation or
  23. * warranty that such application will be suitable for the specified
  24. * use without further testing or modification.
  25. * Permission to use, copy, modify, and distribute this software and its
  26. * documentation is hereby granted, under NXP Semiconductors'
  27. * relevant copyright in the software, without fee, provided that it
  28. * is used in conjunction with NXP Semiconductors microcontrollers. This
  29. * copyright, permission, and disclaimer notice must appear in all copies of
  30. * this code.
  31. **********************************************************************/
  32. /* Peripheral group ----------------------------------------------------------- */
  33. /** @defgroup WDT WDT (Watch-Dog Timer)
  34. * @ingroup LPC1700CMSIS_FwLib_Drivers
  35. * @{
  36. */
  37. #ifndef LPC17XX_WDT_H_
  38. #define LPC17XX_WDT_H_
  39. /* Includes ------------------------------------------------------------------- */
  40. #include "LPC17xx.h"
  41. #include "lpc_types.h"
  42. #ifdef __cplusplus
  43. extern "C"
  44. {
  45. #endif
  46. /* Private Macros ------------------------------------------------------------- */
  47. /** @defgroup WDT_Private_Macros WDT Private Macros
  48. * @{
  49. */
  50. /* --------------------- BIT DEFINITIONS -------------------------------------- */
  51. /** WDT interrupt enable bit */
  52. #define WDT_WDMOD_WDEN ((uint32_t)(1<<0))
  53. /** WDT interrupt enable bit */
  54. #define WDT_WDMOD_WDRESET ((uint32_t)(1<<1))
  55. /** WDT time out flag bit */
  56. #define WDT_WDMOD_WDTOF ((uint32_t)(1<<2))
  57. /** WDT Time Out flag bit */
  58. #define WDT_WDMOD_WDINT ((uint32_t)(1<<3))
  59. /** WDT Mode */
  60. #define WDT_WDMOD(n) ((uint32_t)(1<<1))
  61. /** Define divider index for microsecond ( us ) */
  62. #define WDT_US_INDEX ((uint32_t)(1000000))
  63. /** WDT Time out minimum value */
  64. #define WDT_TIMEOUT_MIN ((uint32_t)(0xFF))
  65. /** WDT Time out maximum value */
  66. #define WDT_TIMEOUT_MAX ((uint32_t)(0xFFFFFFFF))
  67. /** Watchdog mode register mask */
  68. #define WDT_WDMOD_MASK (uint8_t)(0x02)
  69. /** Watchdog timer constant register mask */
  70. #define WDT_WDTC_MASK (uint8_t)(0xFFFFFFFF)
  71. /** Watchdog feed sequence register mask */
  72. #define WDT_WDFEED_MASK (uint8_t)(0x000000FF)
  73. /** Watchdog timer value register mask */
  74. #define WDT_WDCLKSEL_MASK (uint8_t)(0x03)
  75. /** Clock selected from internal RC */
  76. #define WDT_WDCLKSEL_RC (uint8_t)(0x00)
  77. /** Clock selected from PCLK */
  78. #define WDT_WDCLKSEL_PCLK (uint8_t)(0x01)
  79. /** Clock selected from external RTC */
  80. #define WDT_WDCLKSEL_RTC (uint8_t)(0x02)
  81. /* ---------------- CHECK PARAMETER DEFINITIONS ---------------------------- */
  82. /* Macro check clock source selection */
  83. #define PARAM_WDT_CLK_OPT(OPTION) ((OPTION ==WDT_CLKSRC_IRC)||(OPTION ==WDT_CLKSRC_PCLK)\
  84. ||(OPTION ==WDT_CLKSRC_RTC))
  85. /* Macro check WDT mode */
  86. #define PARAM_WDT_MODE_OPT(OPTION) ((OPTION ==WDT_MODE_INT_ONLY)||(OPTION ==WDT_MODE_RESET))
  87. /**
  88. * @}
  89. */
  90. /* Public Types --------------------------------------------------------------- */
  91. /** @defgroup WDT_Public_Types WDT Public Types
  92. * @{
  93. */
  94. /** @brief Clock source option for WDT */
  95. typedef enum {
  96. WDT_CLKSRC_IRC = 0, /*!< Clock source from Internal RC oscillator */
  97. WDT_CLKSRC_PCLK = 1, /*!< Selects the APB peripheral clock (PCLK) */
  98. WDT_CLKSRC_RTC = 2 /*!< Selects the RTC oscillator */
  99. } WDT_CLK_OPT;
  100. /** @brief WDT operation mode */
  101. typedef enum {
  102. WDT_MODE_INT_ONLY = 0, /*!< Use WDT to generate interrupt only */
  103. WDT_MODE_RESET = 1 /*!< Use WDT to generate interrupt and reset MCU */
  104. } WDT_MODE_OPT;
  105. /**
  106. * @}
  107. */
  108. /* Public Functions ----------------------------------------------------------- */
  109. /** @defgroup WDT_Public_Functions WDT Public Functions
  110. * @{
  111. */
  112. void WDT_Init (WDT_CLK_OPT ClkSrc, WDT_MODE_OPT WDTMode);
  113. void WDT_Start(uint32_t TimeOut);
  114. void WDT_Feed (void);
  115. void WDT_UpdateTimeOut ( uint32_t TimeOut);
  116. FlagStatus WDT_ReadTimeOutFlag (void);
  117. void WDT_ClrTimeOutFlag (void);
  118. uint32_t WDT_GetCurrentCount(void);
  119. /**
  120. * @}
  121. */
  122. #ifdef __cplusplus
  123. }
  124. #endif
  125. #endif /* LPC17XX_WDT_H_ */
  126. /**
  127. * @}
  128. */
  129. /* --------------------------------- End Of File ------------------------------ */