/* automatically generated by rust-bindgen 0.72.1 */

pub const USART_FLAG_RX_FULL: u32 = 32;
pub const USART_FLAG_OVERRUN: u32 = 8;
pub const USART_FLAG_TX_CPLT: u32 = 64;
pub const USART_FLAG_TX_EMPTY: u32 = 128;
pub const USART_FLAG_FRAME_ERR: u32 = 2;
pub const USART_FLAG_PARITY_ERR: u32 = 1;
pub const USART_FLAG_MX_PROCESSOR: u32 = 65536;
pub const USART_FLAG_RX_TIMEOUT: u32 = 256;
pub const USART_FLAG_LIN_ERR: u32 = 16;
pub const USART_FLAG_LIN_WKUP: u32 = 512;
pub const USART_FLAG_LIN_BREAK: u32 = 1024;
pub const USART_FLAG_TX_END: u32 = 2048;
pub const USART_FLAG_ALL: u32 = 69627;
pub const USART_TRANS_DATA: u32 = 0;
pub const USART_TRANS_ID: u32 = 512;
pub const USART_TX: u32 = 8;
pub const USART_RX: u32 = 4;
pub const USART_INT_RX: u32 = 32;
pub const USART_INT_TX_CPLT: u32 = 64;
pub const USART_INT_TX_EMPTY: u32 = 128;
pub const USART_RX_TIMEOUT: u32 = 1;
pub const USART_INT_RX_TIMEOUT: u32 = 2;
pub const USART_INT_TX_END: u32 = 256;
pub const USART_LIN: u32 = 1073741824;
pub const USART_LIN_WKUP: u32 = 16777216;
pub const USART_LIN_ERR: u32 = 524288;
pub const USART_LIN_BREAK: u32 = 2097152;
pub const USART_LIN_INT_ERR: u32 = 262144;
pub const USART_LIN_INT_BREAK: u32 = 1048576;
pub const USART_LIN_INT_WKUP: u32 = 131072;
pub const USART_FUNC_ALL: u32 = 1094582767;
pub const USART_PARITY_NONE: u32 = 0;
pub const USART_PARITY_EVEN: u32 = 1024;
pub const USART_PARITY_ODD: u32 = 1536;
pub const USART_DATA_WIDTH_8BIT: u32 = 0;
pub const USART_DATA_WIDTH_9BIT: u32 = 4096;
pub const USART_OVER_SAMPLE_16BIT: u32 = 0;
pub const USART_OVER_SAMPLE_8BIT: u32 = 32768;
pub const USART_FIRST_BIT_LSB: u32 = 0;
pub const USART_FIRST_BIT_MSB: u32 = 268435456;
pub const USART_START_BIT_LOW: u32 = 0;
pub const USART_START_BIT_FALLING: u32 = 2147483648;
pub const USART_CLK_SRC_INTERNCLK: u32 = 0;
pub const USART_CLK_SRC_EXTCLK: u32 = 4096;
pub const USART_CK_OUTPUT_DISABLE: u32 = 0;
pub const USART_CK_OUTPUT_ENABLE: u32 = 2048;
pub const USART_STOPBIT_1BIT: u32 = 0;
pub const USART_STOPBIT_2BIT: u32 = 8192;
pub const USART_HW_FLOWCTRL_CTS: u32 = 512;
pub const USART_HW_FLOWCTRL_RTS: u32 = 256;
pub const USART_HW_FLOWCTRL_NONE: u32 = 0;
pub const USART_HW_FLOWCTRL_RTS_CTS: u32 = 768;
pub const USART_CLK_DIV1: u32 = 0;
pub const USART_CLK_DIV4: u32 = 1;
pub const USART_CLK_DIV16: u32 = 2;
pub const USART_CLK_DIV64: u32 = 3;
pub const USART_CLK_DIV128: u32 = 16;
pub const USART_CLK_DIV256: u32 = 17;
pub const USART_CLK_DIV512: u32 = 18;
pub const USART_CLK_DIV1024: u32 = 19;
pub const USART_MAX_TIMEOUT: u32 = 4294967295;
pub const USART_SC_ETU_CLK32: u32 = 0;
pub const USART_SC_ETU_CLK64: u32 = 2097152;
pub const USART_SC_ETU_CLK128: u32 = 6291456;
pub const USART_SC_ETU_CLK256: u32 = 10485760;
pub const USART_SC_ETU_CLK372: u32 = 12582912;
pub const USART_STOP_MD_FILTER_LVL1: u32 = 0;
pub const USART_STOP_MD_FILTER_LVL2: u32 = 1;
pub const USART_STOP_MD_FILTER_LVL3: u32 = 2;
pub const USART_STOP_MD_FILTER_LVL4: u32 = 3;
pub const USART_LIN_BMC_CLK_DIV1: u32 = 0;
pub const USART_LIN_BMC_CLK_DIV2: u32 = 4;
pub const USART_LIN_BMC_CLK_DIV4: u32 = 8;
pub const USART_LIN_BMC_CLK_DIV8: u32 = 12;
pub const USART_LIN_SEND_BREAK_MD_SBK: u32 = 0;
pub const USART_LIN_SEND_BREAK_MD_TDR: u32 = 131072;
pub const USART_LIN_DETECT_BREAK_10BIT: u32 = 0;
pub const USART_LIN_DETECT_BREAK_11BIT: u32 = 32;
pub const USART_LIN_SEND_BREAK_10BIT: u32 = 0;
pub const USART_LIN_SEND_BREAK_11BIT: u32 = 64;
pub const USART_LIN_SEND_BREAK_13BIT: u32 = 128;
pub const USART_LIN_SEND_BREAK_14BIT: u32 = 192;
#[doc = " @brief Single precision floating point number (4 byte)"]
pub type float32_t = f32;
pub const en_functional_state_t_DISABLE: en_functional_state_t = 0;
pub const en_functional_state_t_ENABLE: en_functional_state_t = 1;
#[doc = " @brief Functional state"]
pub type en_functional_state_t = ::core::ffi::c_uint;
pub const en_flag_status_t_RESET: en_flag_status_t = 0;
pub const en_flag_status_t_SET: en_flag_status_t = 1;
#[doc = " @brief Flag status"]
pub type en_flag_status_t = ::core::ffi::c_uint;
#[doc = " @brief USART"]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct CM_USART_TypeDef {
    pub SR: u32,
    pub TDR: u16,
    pub RDR: u16,
    pub BRR: u32,
    pub CR1: u32,
    pub CR2: u32,
    pub CR3: u32,
    pub PR: u32,
    pub LBMC: u32,
}
#[doc = " @brief clock synchronization mode initialization structure definition\n @note The parameter(u32ClockDiv/u32CKOutput/u32Baudrate) is valid when clock source is the internal clock."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct stc_usart_clocksync_init_t {
    #[doc = "< Clock Source.\nThis parameter can be a value of @ref USART_Clock_Source"]
    pub u32ClockSrc: u32,
    #[doc = "< Clock division.\nThis parameter can be a value of @ref USART_Clock_Division."]
    pub u32ClockDiv: u32,
    #[doc = "< USART baudrate.\nThis parameter is valid when clock source is the internal clock."]
    pub u32Baudrate: u32,
    #[doc = "< Significant bit.\nThis parameter can be a value of @ref USART_First_Bit"]
    pub u32FirstBit: u32,
    #[doc = "< Hardware flow control.\nThis parameter can be a value of @ref USART_Hardware_Flow_Control"]
    pub u32HWFlowControl: u32,
}
#[doc = " @brief UART multiple-processor initialization structure definition\n @note The parameter(u32ClockDiv/u32CKOutput/u32Baudrate) is valid when clock source is the internal clock."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct stc_usart_multiprocessor_init_t {
    #[doc = "< Clock Source.\nThis parameter can be a value of @ref USART_Clock_Source"]
    pub u32ClockSrc: u32,
    #[doc = "< Clock division.\nThis parameter can be a value of @ref USART_Clock_Division."]
    pub u32ClockDiv: u32,
    #[doc = "< USART_CK output selection.\nThis parameter can be a value of @ref USART_CK_Output_Selection."]
    pub u32CKOutput: u32,
    #[doc = "< USART baudrate.\nThis parameter is valid when clock source is the internal clock."]
    pub u32Baudrate: u32,
    #[doc = "< Data width.\nThis parameter can be a value of @ref USART_Data_Width_Bit"]
    pub u32DataWidth: u32,
    #[doc = "< Stop Bits.\nThis parameter can be a value of @ref USART_Stop_Bit"]
    pub u32StopBit: u32,
    #[doc = "< Oversampling Bits.\nThis parameter can be a value of @ref USART_Over_Sample_Bit"]
    pub u32OverSampleBit: u32,
    #[doc = "< Significant bit.\nThis parameter can be a value of @ref USART_First_Bit"]
    pub u32FirstBit: u32,
    #[doc = "< Start Bit Detect Polarity.\nThis parameter can be a value of @ref USART_Start_Bit_Polarity"]
    pub u32StartBitPolarity: u32,
    #[doc = "< Hardware flow control.\nThis parameter can be a value of @ref USART_Hardware_Flow_Control"]
    pub u32HWFlowControl: u32,
}
#[doc = " @brief UART mode initialization structure definition\n @note The parameter(u32ClockDiv/u32CKOutput/u32Baudrate) is valid when clock source is the internal clock."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct stc_usart_uart_init_t {
    #[doc = "< Clock Source.\nThis parameter can be a value of @ref USART_Clock_Source"]
    pub u32ClockSrc: u32,
    #[doc = "< Clock division.\nThis parameter can be a value of @ref USART_Clock_Division."]
    pub u32ClockDiv: u32,
    #[doc = "< USART_CK output selection.\nThis parameter can be a value of @ref USART_CK_Output_Selection."]
    pub u32CKOutput: u32,
    #[doc = "< USART baudrate.\nThis parameter is valid when clock source is the internal clock."]
    pub u32Baudrate: u32,
    #[doc = "< Data width.\nThis parameter can be a value of @ref USART_Data_Width_Bit"]
    pub u32DataWidth: u32,
    #[doc = "< Stop Bits.\nThis parameter can be a value of @ref USART_Stop_Bit"]
    pub u32StopBit: u32,
    #[doc = "< Parity format.\nThis parameter can be a value of @ref USART_Parity_Control"]
    pub u32Parity: u32,
    #[doc = "< Oversampling Bits.\nThis parameter can be a value of @ref USART_Over_Sample_Bit"]
    pub u32OverSampleBit: u32,
    #[doc = "< Significant bit.\nThis parameter can be a value of @ref USART_First_Bit"]
    pub u32FirstBit: u32,
    #[doc = "< Start Bit Detect Polarity.\nThis parameter can be a value of @ref USART_Start_Bit_Polarity"]
    pub u32StartBitPolarity: u32,
    #[doc = "< Hardware flow control.\nThis parameter can be a value of @ref USART_Hardware_Flow_Control"]
    pub u32HWFlowControl: u32,
}
#[doc = " @brief LIN mode initialization structure definition\n @note The parameter(u32ClockDiv/u32CKOutput/u32Baudrate) is valid when clock source is the internal clock."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct stc_usart_lin_init_t {
    #[doc = "< Clock Source.\nThis parameter can be a value of @ref USART_Clock_Source"]
    pub u32ClockSrc: u32,
    #[doc = "< Clock division.\nThis parameter can be a value of @ref USART_Clock_Division."]
    pub u32ClockDiv: u32,
    #[doc = "< USART_CK output selection.\nThis parameter can be a value of @ref USART_CK_Output_Selection."]
    pub u32CKOutput: u32,
    #[doc = "< USART baudrate.\nThis parameter is valid when clock source is the internal clock."]
    pub u32Baudrate: u32,
    #[doc = "< Oversampling Bits.\nThis parameter can be a value of @ref USART_Over_Sample_Bit"]
    pub u32OverSampleBit: u32,
    #[doc = "< BMC clock division.\nThis parameter can be a value of @ref USART_LIN_BMC_Clock_Division.\n@note The clock division is valid when clock source is the internal clock."]
    pub u32BmcClockDiv: u32,
    #[doc = "< Detect break length.\nThis parameter can be a value of @ref USART_LIN_Detect_Break_Length"]
    pub u32DetectBreakLen: u32,
    #[doc = "< Send break length.\nThis parameter can be a value of @ref USART_LIN_Send_Break_Length"]
    pub u32SendBreakLen: u32,
    #[doc = "< Send break mode.\nThis parameter can be a value of @ref USART_LIN_Send_Break_Mode"]
    pub u32SendBreakMode: u32,
}
#[doc = " @brief Smartcard mode initialization structure definition"]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct stc_usart_smartcard_init_t {
    #[doc = "< Clock division. This parameter can be a value of @ref USART_Clock_Division.\n@note This parameter is valid when clock source is the internal clock."]
    pub u32ClockDiv: u32,
    #[doc = "< USART_CK output selection. This parameter can be a value of @ref USART_CK_Output_Selection.\n@note This parameter is valid when clock source is the internal clock."]
    pub u32CKOutput: u32,
    #[doc = "< USART baudrate.\nThis parameter is calculated according with smartcard default ETU and clock."]
    pub u32Baudrate: u32,
    #[doc = "< Significant bit.\nThis parameter can be a value of @ref USART_First_Bit"]
    pub u32FirstBit: u32,
}
unsafe extern "C" {
    #[doc = "Global function prototypes (definition in C source)\n/\n/**\n @addtogroup USART_Global_Functions\n @{"]
    pub fn USART_ClockSync_StructInit(pstcClockSyncInit: *mut stc_usart_clocksync_init_t) -> i32;
    pub fn USART_ClockSync_Init(
        USARTx: *mut CM_USART_TypeDef,
        pstcClockSyncInit: *const stc_usart_clocksync_init_t,
        pf32Error: *mut float32_t,
    ) -> i32;
    pub fn USART_MultiProcessor_StructInit(
        pstcMultiProcessorInit: *mut stc_usart_multiprocessor_init_t,
    ) -> i32;
    pub fn USART_MultiProcessor_Init(
        USARTx: *mut CM_USART_TypeDef,
        pstcMultiProcessorInit: *const stc_usart_multiprocessor_init_t,
        pf32Error: *mut float32_t,
    ) -> i32;
    pub fn USART_UART_StructInit(pstcUartInit: *mut stc_usart_uart_init_t) -> i32;
    pub fn USART_UART_Init(
        USARTx: *mut CM_USART_TypeDef,
        pstcUartInit: *const stc_usart_uart_init_t,
        pf32Error: *mut float32_t,
    ) -> i32;
    pub fn USART_HalfDuplex_Init(
        USARTx: *mut CM_USART_TypeDef,
        pstcUartInit: *const stc_usart_uart_init_t,
        pf32Error: *mut float32_t,
    ) -> i32;
    pub fn USART_LIN_StructInit(pstcLinInit: *mut stc_usart_lin_init_t) -> i32;
    pub fn USART_LIN_Init(
        USARTx: *mut CM_USART_TypeDef,
        pstcLinInit: *const stc_usart_lin_init_t,
        pf32Error: *mut float32_t,
    ) -> i32;
    pub fn USART_SmartCard_StructInit(pstcSmartCardInit: *mut stc_usart_smartcard_init_t) -> i32;
    pub fn USART_SmartCard_Init(
        USARTx: *mut CM_USART_TypeDef,
        pstcSmartCardInit: *const stc_usart_smartcard_init_t,
        pf32Error: *mut float32_t,
    ) -> i32;
    pub fn USART_DeInit(USARTx: *mut CM_USART_TypeDef) -> i32;
    pub fn USART_FuncCmd(
        USARTx: *mut CM_USART_TypeDef,
        u32Func: u32,
        enNewState: en_functional_state_t,
    );
    pub fn USART_GetFuncState(USARTx: *mut CM_USART_TypeDef, u32Func: u32)
        -> en_functional_state_t;
    pub fn USART_GetStatus(USARTx: *const CM_USART_TypeDef, u32Flag: u32) -> en_flag_status_t;
    pub fn USART_ClearStatus(USARTx: *mut CM_USART_TypeDef, u32Flag: u32);
    pub fn USART_SetParity(USARTx: *mut CM_USART_TypeDef, u32Parity: u32);
    pub fn USART_GetParity(USARTx: *mut CM_USART_TypeDef) -> u32;
    pub fn USART_SetFirstBit(USARTx: *mut CM_USART_TypeDef, u32FirstBit: u32);
    pub fn USART_SetStopBit(USARTx: *mut CM_USART_TypeDef, u32StopBit: u32);
    pub fn USART_GetStopBit(USARTx: *mut CM_USART_TypeDef) -> u32;
    pub fn USART_SetDataWidth(USARTx: *mut CM_USART_TypeDef, u32DataWidth: u32);
    pub fn USART_GetDataWidth(USARTx: *mut CM_USART_TypeDef) -> u32;
    pub fn USART_SetOverSampleBit(USARTx: *mut CM_USART_TypeDef, u32OverSampleBit: u32);
    pub fn USART_SetStartBitPolarity(USARTx: *mut CM_USART_TypeDef, u32Polarity: u32);
    pub fn USART_SetTransType(USARTx: *mut CM_USART_TypeDef, u16Type: u16);
    pub fn USART_SetClockDiv(USARTx: *mut CM_USART_TypeDef, u32ClockDiv: u32);
    pub fn USART_GetClockDiv(USARTx: *const CM_USART_TypeDef) -> u32;
    pub fn USART_SetClockSrc(USARTx: *mut CM_USART_TypeDef, u32ClockSrc: u32);
    pub fn USART_GetClockSrc(USARTx: *const CM_USART_TypeDef) -> u32;
    pub fn USART_FilterCmd(USARTx: *mut CM_USART_TypeDef, enNewState: en_functional_state_t);
    pub fn USART_SilenceCmd(USARTx: *mut CM_USART_TypeDef, enNewState: en_functional_state_t);
    pub fn USART_SetHWFlowControl(USARTx: *mut CM_USART_TypeDef, u32HWFlowControl: u32);
    pub fn USART_GetHWFlowControl(USARTx: *mut CM_USART_TypeDef) -> u32;
    pub fn USART_ReadData(USARTx: *const CM_USART_TypeDef) -> u16;
    pub fn USART_WriteData(USARTx: *mut CM_USART_TypeDef, u16Data: u16);
    pub fn USART_WriteID(USARTx: *mut CM_USART_TypeDef, u16ID: u16);
    pub fn USART_SetBaudrate(
        USARTx: *mut CM_USART_TypeDef,
        u32Baudrate: u32,
        pf32Error: *mut float32_t,
    ) -> i32;
    pub fn USART_SmartCard_SetEtuClock(USARTx: *mut CM_USART_TypeDef, u32EtuClock: u32);
    pub fn USART_StopModeNoiseFilterCmd(
        USARTx: *const CM_USART_TypeDef,
        enNewState: en_functional_state_t,
    );
    pub fn USART_SetStopModeNoiseFilter(USARTx: *const CM_USART_TypeDef, u32Level: u32);
    pub fn USART_LIN_LoopbackCmd(USARTx: *mut CM_USART_TypeDef, enNewState: en_functional_state_t);
    pub fn USART_LIN_SetBmcClockDiv(USARTx: *mut CM_USART_TypeDef, u32ClockDiv: u32);
    pub fn USART_LIN_RequestBreakSending(USARTx: *mut CM_USART_TypeDef);
    pub fn USART_LIN_GetRequestBreakStatus(USARTx: *const CM_USART_TypeDef) -> en_flag_status_t;
    pub fn USART_LIN_SetBreakMode(USARTx: *mut CM_USART_TypeDef, u32Mode: u32);
    pub fn USART_LIN_GetBreakMode(USARTx: *const CM_USART_TypeDef) -> u32;
    pub fn USART_LIN_GetMeasureCount(USARTx: *const CM_USART_TypeDef) -> u32;
    pub fn USART_LIN_GetMeasureBaudrate(USARTx: *const CM_USART_TypeDef) -> u32;
    pub fn USART_LIN_SetDetectBreakLen(USARTx: *mut CM_USART_TypeDef, u32Len: u32);
    pub fn USART_LIN_SetSendBreakLen(USARTx: *mut CM_USART_TypeDef, u32Len: u32);
    pub fn USART_UART_Trans(
        USARTx: *mut CM_USART_TypeDef,
        pvBuf: *const ::core::ffi::c_void,
        u32Len: u32,
        u32Timeout: u32,
    ) -> i32;
    pub fn USART_UART_Receive(
        USARTx: *const CM_USART_TypeDef,
        pvBuf: *mut ::core::ffi::c_void,
        u32Len: u32,
        u32Timeout: u32,
    ) -> i32;
    pub fn USART_ClockSync_Trans(
        USARTx: *mut CM_USART_TypeDef,
        au8Buf: *const u8,
        u32Len: u32,
        u32Timeout: u32,
    ) -> i32;
    pub fn USART_ClockSync_Receive(
        USARTx: *mut CM_USART_TypeDef,
        au8Buf: *mut u8,
        u32Len: u32,
        u32Timeout: u32,
    ) -> i32;
    pub fn USART_ClockSync_TransReceive(
        USARTx: *mut CM_USART_TypeDef,
        au8TxBuf: *const u8,
        au8RxBuf: *mut u8,
        u32Len: u32,
        u32Timeout: u32,
    ) -> i32;
}
