hpl_usart_config.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. /* Auto-generated config file hpl_usart_config.h */
  2. #ifndef HPL_USART_CONFIG_H
  3. #define HPL_USART_CONFIG_H
  4. // <<< Use Configuration Wizard in Context Menu >>>
  5. #include <peripheral_clk_config.h>
  6. #ifndef CONF_USART_1_ENABLE
  7. #define CONF_USART_1_ENABLE 1
  8. #endif
  9. // <h> Basic Configuration
  10. // <o> Frame parity
  11. // <0x0=>Even parity
  12. // <0x1=>Odd parity
  13. // <0x2=>Parity forced to 0
  14. // <0x3=>Parity forced to 1
  15. // <0x4=>No parity
  16. // <i> Parity bit mode for USART frame
  17. // <id> usart_parity
  18. #ifndef CONF_USART_1_PARITY
  19. #define CONF_USART_1_PARITY 0x4
  20. #endif
  21. // <o> Character Size
  22. // <0x0=>5 bits
  23. // <0x1=>6 bits
  24. // <0x2=>7 bits
  25. // <0x3=>8 bits
  26. // <i> Data character size in USART frame
  27. // <id> usart_character_size
  28. #ifndef CONF_USART_1_CHSIZE
  29. #define CONF_USART_1_CHSIZE 0x3
  30. #endif
  31. // <o> Stop Bit
  32. // <0=>1 stop bit
  33. // <1=>1.5 stop bits
  34. // <2=>2 stop bits
  35. // <i> Number of stop bits in USART frame
  36. // <id> usart_stop_bit
  37. #ifndef CONF_USART_1_SBMODE
  38. #define CONF_USART_1_SBMODE 0
  39. #endif
  40. // <o> Clock Output Select
  41. // <0=>The USART does not drive the SCK pin
  42. // <1=>The USART drives the SCK pin if USCLKS does not select the external clock SCK
  43. // <i> Clock Output Select in USART sck, if in usrt master mode, please drive SCK.
  44. // <id> usart_clock_output_select
  45. #ifndef CONF_USART_1_CLKO
  46. #define CONF_USART_1_CLKO 0
  47. #endif
  48. // <o> Baud rate <1-3000000>
  49. // <i> USART baud rate setting
  50. // <id> usart_baud_rate
  51. #ifndef CONF_USART_1_BAUD
  52. #define CONF_USART_1_BAUD 9600
  53. #endif
  54. // </h>
  55. // <e> Advanced configuration
  56. // <id> usart_advanced
  57. #ifndef CONF_USART_1_ADVANCED_CONFIG
  58. #define CONF_USART_1_ADVANCED_CONFIG 0
  59. #endif
  60. // <o> Channel Mode
  61. // <0=>Normal Mode
  62. // <1=>Automatic Echo
  63. // <2=>Local Loopback
  64. // <3=>Remote Loopback
  65. // <i> Channel mode in USART frame
  66. // <id> usart_channel_mode
  67. #ifndef CONF_USART_1_CHMODE
  68. #define CONF_USART_1_CHMODE 0
  69. #endif
  70. // <q> 9 bits character enable
  71. // <i> Enable 9 bits character, this has high priority than 5/6/7/8 bits.
  72. // <id> usart_9bits_enable
  73. #ifndef CONF_USART_1_MODE9
  74. #define CONF_USART_1_MODE9 0
  75. #endif
  76. // <o> Variable Sync
  77. // <0=>User defined configuration
  78. // <1=>sync field is updated when a character is written into US_THR
  79. // <i> Variable Synchronization of Command/Data Sync Start Frarm Delimiter
  80. // <id> variable_sync
  81. #ifndef CONF_USART_1_VAR_SYNC
  82. #define CONF_USART_1_VAR_SYNC 0
  83. #endif
  84. // <o> Oversampling Mode
  85. // <0=>16 Oversampling
  86. // <1=>8 Oversampling
  87. // <i> Oversampling Mode in UART mode
  88. // <id> usart__oversampling_mode
  89. #ifndef CONF_USART_1_OVER
  90. #define CONF_USART_1_OVER 0
  91. #endif
  92. // <o> Inhibit Non Ack
  93. // <0=>The NACK is generated
  94. // <1=>The NACK is not generated
  95. // <i> Inhibit Non Acknowledge
  96. // <id> usart__inack
  97. #ifndef CONF_USART_1_INACK
  98. #define CONF_USART_1_INACK 1
  99. #endif
  100. // <o> Disable Successive NACK
  101. // <0=>NACK is sent on the ISO line as soon as a parity error occurs
  102. // <1=>Many parity errors generate a NACK on the ISO line
  103. // <i> Disable Successive NACK
  104. // <id> usart_dsnack
  105. #ifndef CONF_USART_1_DSNACK
  106. #define CONF_USART_1_DSNACK 0
  107. #endif
  108. // <o> Inverted Data
  109. // <0=>Data isn't inverted, nomal mode
  110. // <1=>Data is inverted
  111. // <i> Inverted Data
  112. // <id> usart_invdata
  113. #ifndef CONF_USART_1_INVDATA
  114. #define CONF_USART_1_INVDATA 0
  115. #endif
  116. // <o> Maximum Number of Automatic Iteration <0-7>
  117. // <i> Defines the maximum number of iterations in mode ISO7816, protocol T = 0.
  118. // <id> usart_max_iteration
  119. #ifndef CONF_USART_1_MAX_ITERATION
  120. #define CONF_USART_1_MAX_ITERATION 0
  121. #endif
  122. // <q> Receive Line Filter enable
  123. // <i> whether the USART filters the receive line using a three-sample filter
  124. // <id> usart_receive_filter_enable
  125. #ifndef CONF_USART_1_FILTER
  126. #define CONF_USART_1_FILTER 0
  127. #endif
  128. // <q> Manchester Encoder/Decoder Enable
  129. // <i> whether the USART Manchester Encoder/Decoder
  130. // <id> usart_manchester_filter_enable
  131. #ifndef CONF_USART_1_MAN
  132. #define CONF_USART_1_MAN 0
  133. #endif
  134. // <o> Manchester Synchronization Mode
  135. // <0=>The Manchester start bit is a 0 to 1 transition
  136. // <1=>The Manchester start bit is a 1 to 0 transition
  137. // <i> Manchester Synchronization Mode
  138. // <id> usart_manchester_synchronization_mode
  139. #ifndef CONF_USART_1_MODSYNC
  140. #define CONF_USART_1_MODSYNC 0
  141. #endif
  142. // <o> Start Frame Delimiter Selector
  143. // <0=>Start frame delimiter is COMMAND or DATA SYNC
  144. // <1=>Start frame delimiter is one bit
  145. // <i> Start Frame Delimiter Selector
  146. // <id> usart_start_frame_delimiter
  147. #ifndef CONF_USART_1_ONEBIT
  148. #define CONF_USART_1_ONEBIT 0
  149. #endif
  150. // <o> Fractional Part <0-7>
  151. // <i> Fractional part of the baud rate if baud rate generator is in fractional mode
  152. // <id> usart_arch_fractional
  153. #ifndef CONF_USART_1_FRACTIONAL
  154. #define CONF_USART_1_FRACTIONAL 0x0
  155. #endif
  156. // <o> Data Order
  157. // <0=>LSB is transmitted first
  158. // <1=>MSB is transmitted first
  159. // <i> Data order of the data bits in the frame
  160. // <id> usart_arch_msbf
  161. #ifndef CONF_USART_1_MSBF
  162. #define CONF_USART_1_MSBF 0
  163. #endif
  164. // </e>
  165. #define CONF_USART_1_MODE 0x0
  166. // Calculate BAUD register value in UART mode
  167. #if CONF_USART1_CK_SRC < 3
  168. #ifndef CONF_USART_1_BAUD_CD
  169. #define CONF_USART_1_BAUD_CD ((CONF_USART1_FREQUENCY) / CONF_USART_1_BAUD / 8 / (2 - CONF_USART_1_OVER))
  170. #endif
  171. #ifndef CONF_USART_1_BAUD_FP
  172. #define CONF_USART_1_BAUD_FP \
  173. ((CONF_USART1_FREQUENCY) / CONF_USART_1_BAUD / (2 - CONF_USART_1_OVER) - 8 * CONF_USART_1_BAUD_CD)
  174. #endif
  175. #elif CONF_USART1_CK_SRC == 3
  176. // No division is active. The value written in US_BRGR has no effect.
  177. #ifndef CONF_USART_1_BAUD_CD
  178. #define CONF_USART_1_BAUD_CD 1
  179. #endif
  180. #ifndef CONF_USART_1_BAUD_FP
  181. #define CONF_USART_1_BAUD_FP 1
  182. #endif
  183. #endif
  184. // <<< end of configuration section >>>
  185. #endif // HPL_USART_CONFIG_H