hc32f4a0_usart.h 25.9 KB
Newer Older
C
chengy4 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611
/**
 *******************************************************************************
 * @file  hc32f4a0_usart.h
 * @brief This file contains all the functions prototypes of the USART(Universal
 *        Synchronous/Asynchronous Receiver Transmitter) driver library.
 @verbatim
   Change Logs:
   Date             Author          Notes
   2020-06-12       Hongjh          First version
 @endverbatim
 *******************************************************************************
 * Copyright (C) 2020, Huada Semiconductor Co., Ltd. All rights reserved.
 *
 * This software component is licensed by HDSC under BSD 3-Clause license
 * (the "License"); You may not use this file except in compliance with the
 * License. You may obtain a copy of the License at:
 *                    opensource.org/licenses/BSD-3-Clause
 *
 *******************************************************************************
 */
#ifndef __HC32F4A0_USART_H__
#define __HC32F4A0_USART_H__

/* C binding of definitions if building with C++ compiler */
#ifdef __cplusplus
extern "C"
{
#endif

/*******************************************************************************
 * Include files
 ******************************************************************************/
#include "hc32_common.h"
#include "ddl_config.h"

/**
 * @addtogroup HC32F4A0_DDL_Driver
 * @{
 */

/**
 * @addtogroup DDL_USART
 * @{
 */

#if (DDL_USART_ENABLE == DDL_ON)

/*******************************************************************************
 * Global type definitions ('typedef')
 ******************************************************************************/
/**
 * @defgroup USART_Global_Types USART Global Types
 * @{
 */

/**
 * @brief UART mode initialization structure definition
 */
typedef struct
{
    uint32_t u32Baudrate;               /*!< UART baudrate. The baudrate is valid when clock source is PCLK. */

    uint32_t u32ClkMode;                /*!< Clock mode.
                                             This parameter can be a value of @ref USART_Clock_Mode */

    uint32_t u32PclkDiv;                /*!< PCLK division. The PCLK division function is valid when clock source is PCLK.
                                             This parameter can be a value of @ref USART_PCLK_Division */

    uint32_t u32Parity;                 /*!< Parity format.
                                             This parameter can be a value of @ref USART_Parity_Control */

    uint32_t u32DataWidth;              /*!< Data width.
                                             This parameter can be a value of @ref USART_Data_Length_Bits */

    uint32_t u32StopBit;                /*!< Stop Bits.
                                             This parameter can be a value of @ref USART_Stop_Bits */

    uint32_t u32OversamplingBits;       /*!< Oversampling Bits.
                                             This parameter can be a value of @ref USART_Oversampling_Bits */

    uint32_t u32BitDirection;           /*!< Significant bit.
                                             This parameter can be a value of @ref USART_Significant_Bit */

    uint32_t u32NoiseFilterState;       /*!< RX pin noise filter state.
                                             This parameter can be a value of @ref USART_Noise_Filter_State */

    uint32_t u32SbDetectPolarity;       /*!< Start Bit Detect Polarity.
                                             This parameter can be a value of @ref USART_Start_Bit_Detect_Polarity */

    uint32_t u32HwFlowCtrl;             /*!< Hardware flow control.
                                             This parameter can be a value of @ref USART_Hardware_Flow_Control */
} stc_usart_uart_init_t;

/**
 * @brief UART multiple-processor initialization structure definition
 */
typedef struct
{
    uint32_t u32Baudrate;               /*!< UART baudrate. The baudrate is valid when clock source is PCLK. */

    uint32_t u32ClkMode;                /*!< Clock mode.
                                             This parameter can be a value of @ref USART_Clock_Mode */

    uint32_t u32PclkDiv;                /*!< PCLK division. The PCLK division function is valid when clock source is PCLK.
                                             This parameter can be a value of @ref USART_PCLK_Division */

    uint32_t u32DataWidth;              /*!< Data width.
                                             This parameter can be a value of @ref USART_Data_Length_Bits */

    uint32_t u32StopBit;                /*!< Stop Bits.
                                             This parameter can be a value of @ref USART_Stop_Bits */

    uint32_t u32OversamplingBits;       /*!< Oversampling Bits.
                                             This parameter can be a value of @ref USART_Oversampling_Bits */

    uint32_t u32BitDirection;           /*!< Significant bit.
                                             This parameter can be a value of @ref USART_Significant_Bit */

    uint32_t u32NoiseFilterState;       /*!< RX pin noise filter state.
                                             This parameter can be a value of @ref USART_Noise_Filter_State */

    uint32_t u32SbDetectPolarity;       /*!< Start Bit Detect Polarity.
                                             This parameter can be a value of @ref USART_Start_Bit_Detect_Polarity */

    uint32_t u32HwFlowCtrl;             /*!< Hardware flow control.
                                             This parameter can be a value of @ref USART_Hardware_Flow_Control */
} stc_usart_multiprocessor_init_t;

/**
 * @brief LIN mode initialization structure definition
 */
typedef struct
{
    uint32_t u32Baudrate;               /*!< UART baudrate. The baudrate is valid when clock source is PCLK. */

    uint32_t u32ClkMode;                /*!< Clock mode.
                                             This parameter can be a value of @ref USART_Clock_Mode */

    uint32_t u32PclkDiv;                /*!< PCLK division. The PCLK division function is valid when clock source is PCLK.
                                             This parameter can be a value of @ref USART_PCLK_Division */

    uint32_t u32BmcPclkDiv;             /*!< BMC PCLK division. The PCLK division function is valid when clock source is PCLK.
                                             This parameter can be a value of @ref USART_LIN_BMC_PCLK_Division */

    uint32_t u32OversamplingBits;       /*!< Oversampling Bits.
                                             This parameter can be a value of @ref USART_Oversampling_Bits */

    uint32_t u32DetectBreakLen;         /*!< Detect break length.
                                             This parameter can be a value of @ref USART_LIN_Detect_Break_Length */

    uint32_t u32SendBreakLen;           /*!< Send break length.
                                             This parameter can be a value of @ref USART_LIN_Send_Break_Length */

    uint32_t u32SendBreakMode;          /*!< Send break mode.
                                             This parameter can be a value of @ref USART_LIN_Send_Break_Mode */
} stc_usart_lin_init_t;

/**
 * @brief Smart card mode initialization structure definition
 */
typedef struct
{
    uint32_t u32Baudrate;               /*!< UART baudrate */

    uint32_t u32ClkMode;                /*!< Clock mode.
                                             This parameter can be a value of @ref USART_Clock_Mode */

    uint32_t u32PclkDiv;                /*!< PCLK division. The PCLK division function is valid when clock source is PCLK.
                                             This parameter can be a value of @ref USART_PCLK_Division */

    uint32_t u32StopBit;                /*!< Stop Bits.
                                             This parameter can be a value of @ref USART_Stop_Bits */

    uint32_t u32BitDirection;           /*!< Significant bit.
                                             This parameter can be a value of @ref USART_Significant_Bit */
} stc_usart_smartcard_init_t;

/**
 * @brief clock synchronization mode initialization structure definition
 */
typedef struct
{
    uint32_t u32Baudrate;               /*!< UART baudrate. The baudrate is valid when clock source is PCLK. */

    uint32_t u32ClkMode;                /*!< Clock mode.
                                             This parameter can be a value of @ref USART_Clock_Mode */

    uint32_t u32PclkDiv;                /*!< PCLK division. The PCLK division function is valid when clock source is PCLK.
                                             This parameter can be a value of @ref USART_PCLK_Division */

    uint32_t u32BitDirection;           /*!< Significant bit.
                                             This parameter can be a value of @ref USART_Significant_Bit */

    uint32_t u32HwFlowCtrl;             /*!< Hardware flow control.
                                             This parameter can be a value of @ref USART_Hardware_Flow_Control */
} stc_usart_clksync_init_t;

/**
 * @}
 */

/*******************************************************************************
 * Global pre-processor symbols/macros ('#define')
 ******************************************************************************/
/**
 * @defgroup USART_Global_Macros USART Global Macros
 * @{
 */

/**
 * @defgroup USART_Flag USART Flag
 * @{
 */
#define USART_FLAG_PE                       (USART_SR_PE)       /*!< Parity error flag */
#define USART_FLAG_FE                       (USART_SR_FE)       /*!< Framing error flag */
#define USART_FLAG_ORE                      (USART_SR_ORE)      /*!< Overrun error flag */
#define USART_FLAG_BE                       (USART_SR_BE)       /*!< LIN bus error flag */
#define USART_FLAG_RXNE                     (USART_SR_RXNE)     /*!< Receive data register not empty flag */
#define USART_FLAG_TC                       (USART_SR_TC)       /*!< Transmission complete flag */
#define USART_FLAG_TXE                      (USART_SR_TXE)      /*!< Transmit data register empty flag */
#define USART_FLAG_RTOF                     (USART_SR_RTOF)     /*!< Receive timeout flag */
#define USART_FLAG_LBD                      (USART_SR_LBD)      /*!< LIN break signal detection flag */
#define USART_FLAG_WKUP                     (USART_SR_WKUP)     /*!< LIN wakeup signal detection flag */
#define USART_FLAG_MPB                      (USART_SR_MPB)      /*!< Receive processor ID flag */
/**
 * @}
 */

/**
 * @defgroup USART_Transmission_Type USART Transmission Type
 * @{
 */
#define USART_TRANSMISSION_ID               (USART_DR_MPID)
#define USART_TRANSMISSION_DATA             (0UL)
/**
 * @}
 */

/**
 * @defgroup USART_Clear_Flag USART Clear Flag
 * @{
 */
#define USART_CLEAR_FLAG_PE                 (USART_CR1_CPE)     /*!< Clear Parity error flag */
#define USART_CLEAR_FLAG_FE                 (USART_CR1_CFE)     /*!< Clear Framing error flag */
#define USART_CLEAR_FLAG_ORE                (USART_CR1_CORE)    /*!< Clear Overrun error flag */
#define USART_CLEAR_FLAG_RTOF               (USART_CR1_CRTOF)   /*!< Clear RX timeout flag */
#define USART_CLEAR_FLAG_BE                 (USART_CR1_CBE)     /*!< Clear LIN bus error flag */
#define USART_CLEAR_FLAG_WKUP               (USART_CR1_CWKUP)   /*!< Clear LIN wakeup signal flag */
#define USART_CLEAR_FLAG_LBD                (USART_CR1_CLBD)    /*!< Clear LIN break detection flag */
/**
 * @}
 */

/**
 * @defgroup USART_Transmit_Receive_Function USART Transmit/Receive Function
 * @{
 */
#define USART_RX                            (USART_CR1_RE)      /*!< USART RX function */
#define USART_TX                            (USART_CR1_TE)      /*!< USART TX function */
#define USART_RTO                           (USART_CR1_RTOE)    /*!< USART RX timerout function */
#define USART_INT_RX                        (USART_CR1_RIE)     /*!< USART receive data register not empty && receive error interrupt */
#define USART_INT_TXE                       (USART_CR1_TXEIE)   /*!< USART transmit data register empty interrupt */
#define USART_INT_TC                        (USART_CR1_TCIE)    /*!< USART transmission complete interrupt */
#define USART_INT_RTO                       (USART_CR1_RTOIE)   /*!< USART RX timerout interrupt */
/**
 * @}
 */

/**
 * @defgroup USART_LIN_Function USART LIN Function
 * @{
 */
#define USART_LIN                           (USART_CR2_LINEN)   /*!< USART LIN function */
#define USART_LIN_WKUP                      (USART_CR2_WKUPE)   /*!< USART LIN wakeup signal detect function */
#define USART_LIN_INT_WKUP                  (USART_CR2_WKUPIE)  /*!< USART LIN wakeup signal detect interrupt function */
#define USART_LIN_BUSERR                    (USART_CR2_BEE)     /*!< USART LIN bus error detect function */
#define USART_LIN_INT_BUSERR                (USART_CR2_BEIE)    /*!< USART LIN bus error detect interrupt function */
#define USART_LIN_INT_BREAK                 (USART_CR2_LBDIE)   /*!< USART LIN break field detect interrupt function */
/**
 * @}
 */

/**
 * @defgroup USART_Parity_Control USART Parity Control
 * @{
 */
#define USART_PARITY_NONE                   (0UL)               /*!< Parity control disabled */
#define USART_PARITY_EVEN                   (USART_CR1_PCE)     /*!< Parity control enabled and Even Parity is selected */
#define USART_PARITY_ODD                    (USART_CR1_PCE | \
                                             USART_CR1_PS)      /*!< Parity control enabled and Odd Parity is selected */
/**
 * @}
 */

/**
 * @defgroup USART_Data_Length_Bits Data Length Bits
 * @{
 */
#define USART_DATA_LENGTH_8BIT              (0UL)               /*!< 8 bits */
#define USART_DATA_LENGTH_9BIT              (USART_CR1_M)       /*!< 9 bits */
/**
 * @}
 */

/**
 * @defgroup USART_Oversampling_Bits USART Oversampling Bits
 * @{
 */
#define USART_OVERSAMPLING_16BIT            (0UL)               /*!< Oversampling by 16 bits */
#define USART_OVERSAMPLING_8BIT             (USART_CR1_OVER8)   /*!< Oversampling by 8 bits */
/**
 * @}
 */

/**
 * @defgroup USART_Significant_Bit USART Significant Bit
 * @{
 */
#define USART_LSB                           (0UL)               /*!< LSB(Least Significant Bit) */
#define USART_MSB                           (USART_CR1_ML)      /*!< MSB(Most Significant Bit) */
/**
 * @}
 */

/**
 * @defgroup USART_Noise_Filter_State USART Noise Filter State
 * @{
 */
#define USART_NOISE_FILTER_DISABLE          (0UL)               /*!< Disable noise filter */
#define USART_NOISE_FILTER_ENABLE           (USART_CR1_NFE)     /*!< Enable noise filter */
/**
 * @}
 */

/**
 * @defgroup USART_Start_Bit_Detect_Polarity USART Start Bit Detect Polarity
 * @{
 */
#define USART_SB_DETECT_LOW                 (0UL)               /*!< Detect RX pin low level */
#define USART_SB_DETECT_FALLING             (USART_CR1_SBS)     /*!< Detect RX pin falling edge */
/**
 * @}
 */

/**
 * @defgroup USART_LIN_Send_Break_Mode USART LIN Send Break Mode
 * @{
 */
#define USART_LIN_SEND_BREAK_MODE_SBK       (0UL)               /*!< Start send break after USART_CR2 SBK bit set 1 value */
#define USART_LIN_SEND_BREAK_MODE_TDR       (USART_CR2_SBKM)    /*!< Start send break after USART_DR TDR write 0x00 value */
/**
 * @}
 */

/**
 * @defgroup USART_Multiple_Processor_State USART Multiple Processor State
 * @{
 */
#define USART_MULTIPLE_PROCESSOR_DISABLE    (0UL)               /*!< Disable multiple processor function */
#define USART_MULTIPLE_PROCESSOR_ENABLE     (USART_CR2_MPE)     /*!< Enable multiple processor function */
/**
 * @}
 */

/**
 * @defgroup USART_LIN_Detect_Break_Length USART LIN Detect Break Length
 * @{
 */
#define USART_LIN_DETECT_BREAK_10BIT        (0UL)               /*!< Detect break 10-bit */
#define USART_LIN_DETECT_BREAK_11BIT        (USART_CR2_LBDL)    /*!< Detect break 11-bit */
/**
 * @}
 */

/**
 * @defgroup USART_LIN_Send_Break_Length USART LIN Send Break Length
 * @{
 */
#define USART_LIN_SEND_BREAK_10BIT          (0UL)               /*!< Send break 10-bit */
#define USART_LIN_SEND_BREAK_11BIT          (USART_CR2_SBKL_0)  /*!< Send break 11-bit */
#define USART_LIN_SEND_BREAK_13BIT          (USART_CR2_SBKL_1)  /*!< Send break 13-bit */
#define USART_LIN_SEND_BREAK_14BIT          (USART_CR2_SBKL)    /*!< Send break 14-bit */
/**
 * @}
 */

/**
 * @defgroup USART_Clock_Mode USART Clock Mode Selection
 * @{
 */
#define USART_EXTCLK                        (USART_CR2_CLKC_1)  /*!< Select external clock source. */
#define USART_INTERNCLK_OUTPUT              (USART_CR2_CLKC_0)  /*!< Select internal clock source and output clock. */
#define USART_INTERNCLK_NONE_OUTPUT         (0UL)               /*!< Select internal clock source and don't output clock */
/**
 * @}
 */

/**
 * @defgroup USART_Stop_Bits USART Stop Bits
 * @{
 */
#define USART_STOPBIT_1BIT                  (0UL)               /*!< 1 stop bit */
#define USART_STOPBIT_2BIT                  (USART_CR2_STOP)    /*!< 2 stop bit */
/**
 * @}
 */

/**
 * @defgroup USART_DUPLEX_SEL USART Half-duplex/Full-duplex Selection
 * @{
 */
#define USART_FULLDUPLEX_MODE               (0UL)               /*!< USART full-duplex mode */
#define USART_HALFDUPLEX_MODE               (USART_CR3_HDSEL)   /*!< USART half-duplex mode */
/**
 * @}
 */

/**
 * @defgroup USART_Hardware_Flow_Control USART Hardware Flow Control RTS/CTS
 * @{
 */
#define USART_HWFLOWCTRL_NONE               (0UL)               /*!< Disable USART hardware flow controle */
#define USART_HWFLOWCTRL_RTS                (USART_CR3_RTSE)    /*!< USART hardware flow control RTS mode */
#define USART_HWFLOWCTRL_CTS                (USART_CR3_CTSE)    /*!< USART hardware flow control CTS mode */
#define USART_HWFLOWCTRL_RTS_CTS            (USART_CR3_RTSE | \
                                             USART_CR3_CTSE)    /*!< USART hardware flow control RTS and CTS mode */
/**
 * @}
 */

/**
 * @defgroup USART_Smartcard_ETU_Clock USART Smartcard ETU Clock
 * @{
 */
#define USART_SC_ETU_CLK_32                 (0UL)               /*!< 1 etu = 32/f */
#define USART_SC_ETU_CLK_64                 (USART_CR3_BCN_0)   /*!< 1 etu = 64/f */
#define USART_SC_ETU_CLK_128                (USART_CR3_BCN_1 | \
                                             USART_CR3_BCN_0)   /*!< 1 etu = 128/f */
#define USART_SC_ETU_CLK_256                (USART_CR3_BCN_2 | \
                                             USART_CR3_BCN_0)   /*!< 1 etu = 256/f */
#define USART_SC_ETU_CLK_372                (USART_CR3_BCN_2 | \
                                             USART_CR3_BCN_1)   /*!< 1 etu = 372/f */
/**
 * @}
 */

/**
 * @defgroup USART_PCLK_Division USART PCLK Clock Prescaler Division
 * @{
 */
#define USART_PCLK_DIV1                     (0UL)               /*!< PCLK */
#define USART_PCLK_DIV4                     (USART_PR_PSC_0)    /*!< PCLK/4 */
#define USART_PCLK_DIV16                    (USART_PR_PSC_1)    /*!< PCLK/16 */
#define USART_PCLK_DIV64                    (USART_PR_PSC)      /*!< PCLK/64 */
/**
 * @}
 */

/**
 * @defgroup USART_LIN_BMC_PCLK_Division USART LIN Baudrate Measure Counter PCLK Division
 * @{
 */
#define USART_LIN_BMC_PCLK_DIV1             (0UL)               /*!< PCLK */
#define USART_LIN_BMC_PCLK_DIV2             (USART_PR_LBMPSC_0) /*!< PCLK/2 */
#define USART_LIN_BMC_PCLK_DIV4             (USART_PR_LBMPSC_1) /*!< PCLK/4 */
#define USART_LIN_BMC_PCLK_DIV8             (USART_PR_LBMPSC)   /*!< PCLK/8 */
/**
 * @}
 */

/**
 * @defgroup USART_Stop_Mode_Noise_Filter USART Stop Mode Noise_Filter
 * @{
 */
#define USART_STOP_MODE_FILTER_NONE             (0UL)                       /*!< Disable noise filter */
#define USART_STOP_MODE_FILTER_WIDTH_LEVEL_1    (PERIC_USART1_NFC_NFE)      /*!< Filter width level 1 */
#define USART_STOP_MODE_FILTER_WIDTH_LEVEL_2    (PERIC_USART1_NFC_NFE | \
                                                 PERIC_USART1_NFC_NFS_0)    /*!< Filter width level 2 */
#define USART_STOP_MODE_FILTER_WIDTH_LEVEL_3    (PERIC_USART1_NFC_NFE | \
                                                 PERIC_USART1_NFC_NFS_1)    /*!< Filter width level 3 */
#define USART_STOP_MODE_FILTER_WIDTH_LEVEL_4    (PERIC_USART1_NFC_NFE | \
                                                 PERIC_USART1_NFC_NFS)      /*!< Filter width level 4 */
/**
 * @}
 */

/**
 * @}
 */

/*******************************************************************************
 * Global variable definitions ('extern')
 ******************************************************************************/

/*******************************************************************************
  Global function prototypes (definition in C source)
 ******************************************************************************/
/**
 * @addtogroup USART_Global_Functions
 * @{
 */
en_result_t USART_UartInit(M4_USART_TypeDef *USARTx,
                            const stc_usart_uart_init_t *pstcInit);
en_result_t USART_HalfduplexInit(M4_USART_TypeDef *USARTx,
                                    const stc_usart_uart_init_t *pstcInit);
en_result_t USART_UartStructInit(stc_usart_uart_init_t *pstcInit);
en_result_t USART_MultiProcessorInit(M4_USART_TypeDef *USARTx,
                                const stc_usart_multiprocessor_init_t *pstcInit);
en_result_t USART_MultiProcessorStructInit(stc_usart_multiprocessor_init_t *pstcInit);
en_result_t USART_LinInit(M4_USART_TypeDef *USARTx,
                            const stc_usart_lin_init_t *pstcInit);
en_result_t USART_LinStructInit(stc_usart_lin_init_t *pstcInit);
en_result_t USART_SmartcardInit(M4_USART_TypeDef *USARTx,
                                    const stc_usart_smartcard_init_t *pstcInit);
en_result_t USART_SmartcardStructInit(stc_usart_smartcard_init_t *pstcInit);
en_result_t USART_ClkSyncInit(M4_USART_TypeDef *USARTx,
                                const stc_usart_clksync_init_t *pstcInit);
en_result_t USART_ClkSyncStructInit(stc_usart_clksync_init_t *pstcInit);
void USART_DeInit(M4_USART_TypeDef *USARTx);
void USART_FuncCmd(M4_USART_TypeDef *USARTx,
                        uint32_t u32Func,
                        en_functional_state_t enNewState);
en_functional_state_t USART_GetFuncState(const M4_USART_TypeDef *USARTx,
                                            uint32_t u32Func);
en_flag_status_t USART_GetStatus(const M4_USART_TypeDef *USARTx,
                                    uint32_t u32Flag);
void USART_ClearStatus(M4_USART_TypeDef *USARTx, uint32_t u32Flag);
void USART_SetTransmissionType(M4_USART_TypeDef *USARTx, uint32_t u32Type);
uint32_t USART_GetTransmissionType(const M4_USART_TypeDef *USARTx);
void USART_SetParity(M4_USART_TypeDef *USARTx, uint32_t u32Parity);
uint32_t USART_GetParity(const M4_USART_TypeDef *USARTx);
void USART_SetDataWidth(M4_USART_TypeDef *USARTx, uint32_t u32DataWidth);
uint32_t USART_GetDataWidth(const M4_USART_TypeDef *USARTx);
void USART_SetOversmaplingBits(M4_USART_TypeDef *USARTx,
                                        uint32_t u32OversamplingBits);
uint32_t USART_GetOversmaplingBits(const M4_USART_TypeDef *USARTx);
void USART_SetBitDirection(M4_USART_TypeDef *USARTx, uint32_t u32BitDir);
uint32_t USART_GetBitDirection(const M4_USART_TypeDef *USARTx);
void USART_SetSbDetectPolarity(M4_USART_TypeDef *USARTx,
                                        uint32_t u32Polarity);
uint32_t USART_GetSbDetectPolarity(const M4_USART_TypeDef *USARTx);
void USART_SetClockMode(M4_USART_TypeDef *USARTx, uint32_t u32ClkMode);
uint32_t USART_GetClockMode(const M4_USART_TypeDef *USARTx);
void USART_SetStopBits(M4_USART_TypeDef *USARTx, uint32_t u32StopBits);
uint32_t USART_GetStopBits(const M4_USART_TypeDef *USARTx);
uint16_t USART_RecData(const M4_USART_TypeDef *USARTx);
void USART_SendData(M4_USART_TypeDef *USARTx, uint16_t u16Data);
void USART_SendId(M4_USART_TypeDef *USARTx, uint16_t u16ID);
void USART_SilenceCmd(M4_USART_TypeDef *USARTx,
                            en_functional_state_t enNewState);
void USART_LinLoopCmd(M4_USART_TypeDef *USARTx,
                        en_functional_state_t enNewState);
void USART_LinRequestBreakSending(M4_USART_TypeDef *USARTx);
en_flag_status_t USART_GetLinRequestBreakStatus(const M4_USART_TypeDef *USARTx);
void USART_SetLinBreakMode(M4_USART_TypeDef *USARTx, uint32_t u32Mode);
uint32_t USART_GetLinBreakMode(const M4_USART_TypeDef *USARTx);
void USART_SetDuplexMode(M4_USART_TypeDef *USARTx, uint32_t u32Mode);
uint32_t USART_GetDuplexMode(const M4_USART_TypeDef *USARTx);
void USART_SetHwFlowCtrl(M4_USART_TypeDef *USARTx, uint32_t u32HwFlowCtrl);
uint32_t USART_GetHwFlowCtrl(const M4_USART_TypeDef *USARTx);
void USART_SetSmartcardEtuClk(M4_USART_TypeDef *USARTx,
                                    uint32_t u32EtuClk);
uint32_t USART_GetSmartcardEtuClk(const M4_USART_TypeDef *USARTx);
void USART_SetPclkDiv(M4_USART_TypeDef *USARTx,
                                uint32_t u32PclkDiv);
uint32_t USART_GetPclkDiv(const M4_USART_TypeDef *USARTx);
void USART_SetLinBmcPclkDiv(M4_USART_TypeDef *USARTx,
                                        uint32_t u32PclkDiv);
uint32_t USART_GetLinBmcPclkDiv(const M4_USART_TypeDef *USARTx);
void USART_SetStopModeNoiseFilter(const M4_USART_TypeDef *USARTx,
                                            uint32_t u32Filter);
uint32_t USART_GetStopModeNoiseFilter(const M4_USART_TypeDef *USARTx);
void USART_LinFuncCmd(M4_USART_TypeDef *USARTx,
                            uint32_t u32Func,
                            en_functional_state_t enNewState);
en_functional_state_t USART_GetLinFuncState(const M4_USART_TypeDef *USARTx,
                                                    uint32_t u32Func);
uint32_t USART_GetLinMeasureCnt(const M4_USART_TypeDef *USARTx);
uint32_t USART_GetLinMeasureBaudrate(const M4_USART_TypeDef *USARTx);
void USART_SetLinDetectBreakLen(M4_USART_TypeDef *USARTx,
                                        uint32_t u32Len);
uint32_t USART_GetLinDetectBreakLen(const M4_USART_TypeDef *USARTx);
void USART_SetLinSendBreakLen(M4_USART_TypeDef *USARTx, uint32_t u32Len);
uint32_t USART_GetLinSendBreakLen(const M4_USART_TypeDef *USARTx);
en_result_t USART_SetBaudrate(M4_USART_TypeDef *USARTx,
                                    uint32_t u32Baudrate,
                                    float32_t *pf32Err);

/**
 * @}
 */

#endif /* DDL_USART_ENABLE */

/**
 * @}
 */

/**
 * @}
 */

#ifdef __cplusplus
}
#endif

#endif /* __HC32F4A0_USART_H__ */

/*******************************************************************************
 * EOF (not truncated)
 ******************************************************************************/