/* automatically generated by rust-bindgen 0.72.1 */

pub const TMR0_CH_A: u32 = 0;
pub const TMR0_CH_B: u32 = 1;
pub const TMR0_CLK_SRC_INTERN_CLK: u32 = 0;
pub const TMR0_CLK_SRC_SPEC_EVT: u32 = 512;
pub const TMR0_CLK_SRC_LRC: u32 = 256;
pub const TMR0_CLK_SRC_XTAL32: u32 = 1280;
pub const TMR0_CLK_DIV1: u32 = 0;
pub const TMR0_CLK_DIV2: u32 = 16;
pub const TMR0_CLK_DIV4: u32 = 32;
pub const TMR0_CLK_DIV8: u32 = 48;
pub const TMR0_CLK_DIV16: u32 = 64;
pub const TMR0_CLK_DIV32: u32 = 80;
pub const TMR0_CLK_DIV64: u32 = 96;
pub const TMR0_CLK_DIV128: u32 = 112;
pub const TMR0_CLK_DIV256: u32 = 128;
pub const TMR0_CLK_DIV512: u32 = 144;
pub const TMR0_CLK_DIV1024: u32 = 160;
pub const TMR0_FUNC_CMP: u32 = 0;
pub const TMR0_FUNC_CAPT: u32 = 32770;
pub const TMR0_INT_CMP_A: u32 = 4;
pub const TMR0_INT_CMP_B: u32 = 262144;
pub const TMR0_INT_OVF_A: u32 = 8;
pub const TMR0_INT_OVF_B: u32 = 524288;
pub const TMR0_INT_ALL: u32 = 786444;
pub const TMR0_FLAG_CMP_A: u32 = 1;
pub const TMR0_FLAG_CMP_B: u32 = 65536;
pub const TMR0_FLAG_REPEAT_CAPT_A: u32 = 4;
pub const TMR0_FLAG_REPEAT_CAPT_B: u32 = 262144;
pub const TMR0_FLAG_OVF_A: u32 = 2;
pub const TMR0_FLAG_OVF_B: u32 = 131072;
pub const TMR0_FLAG_ALL: u32 = 458759;
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 TMR0"]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct CM_TMR0_TypeDef {
    pub CNTAR: u32,
    pub CNTBR: u32,
    pub CMPAR: u32,
    pub CMPBR: u32,
    pub BCONR: u32,
    pub STFLR: u32,
}
#[doc = " @brief TMR0 initialization structure definition\n @note  The 'u32ClockDiv' is invalid when the value of 'u32ClockSrc' is \"TMR0_CLK_SRC_SPEC_EVT\"."]
#[repr(C)]
#[derive(Debug, Copy, Clone, PartialEq)]
pub struct stc_tmr0_init_t {
    #[doc = "< Specifies the clock source of TMR0 channel.\nThis parameter can be a value of @ref TMR0_Clock_Source"]
    pub u32ClockSrc: u32,
    #[doc = "< Specifies the clock division of TMR0 channel.\nThis parameter can be a value of @ref TMR0_Clock_Division"]
    pub u32ClockDiv: u32,
    #[doc = "< Specifies the function of TMR0 channel.\nThis parameter can be a value of @ref TMR0_Function"]
    pub u32Func: u32,
    #[doc = "< Specifies the compare value of TMR0 channel.\nThis parameter can be a value of half-word"]
    pub u16CompareValue: u16,
}
unsafe extern "C" {
    #[doc = "Global function prototypes (definition in C source)\n/\n/**\n @addtogroup TMR0_Global_Functions\n @{"]
    pub fn TMR0_DeInit(TMR0x: *mut CM_TMR0_TypeDef) -> i32;
    pub fn TMR0_Init(
        TMR0x: *mut CM_TMR0_TypeDef,
        u32Ch: u32,
        pstcTmr0Init: *const stc_tmr0_init_t,
    ) -> i32;
    pub fn TMR0_StructInit(pstcTmr0Init: *mut stc_tmr0_init_t) -> i32;
    pub fn TMR0_Start(TMR0x: *mut CM_TMR0_TypeDef, u32Ch: u32);
    pub fn TMR0_Stop(TMR0x: *mut CM_TMR0_TypeDef, u32Ch: u32);
    pub fn TMR0_SetCountValue(TMR0x: *mut CM_TMR0_TypeDef, u32Ch: u32, u16Value: u16);
    pub fn TMR0_GetCountValue(TMR0x: *const CM_TMR0_TypeDef, u32Ch: u32) -> u16;
    pub fn TMR0_SetCompareValue(TMR0x: *mut CM_TMR0_TypeDef, u32Ch: u32, u16Value: u16);
    pub fn TMR0_GetCompareValue(TMR0x: *const CM_TMR0_TypeDef, u32Ch: u32) -> u16;
    pub fn TMR0_SetClockSrc(TMR0x: *mut CM_TMR0_TypeDef, u32Ch: u32, u32Src: u32);
    pub fn TMR0_SetClockDiv(TMR0x: *mut CM_TMR0_TypeDef, u32Ch: u32, u32Div: u32);
    pub fn TMR0_SetFunc(TMR0x: *mut CM_TMR0_TypeDef, u32Ch: u32, u32Func: u32);
    pub fn TMR0_HWCaptureCondCmd(
        TMR0x: *mut CM_TMR0_TypeDef,
        u32Ch: u32,
        enNewState: en_functional_state_t,
    );
    pub fn TMR0_HWStartCondCmd(
        TMR0x: *mut CM_TMR0_TypeDef,
        u32Ch: u32,
        enNewState: en_functional_state_t,
    );
    pub fn TMR0_HWStopCondCmd(
        TMR0x: *mut CM_TMR0_TypeDef,
        u32Ch: u32,
        enNewState: en_functional_state_t,
    );
    pub fn TMR0_HWClearCondCmd(
        TMR0x: *mut CM_TMR0_TypeDef,
        u32Ch: u32,
        enNewState: en_functional_state_t,
    );
    pub fn TMR0_IntCmd(
        TMR0x: *mut CM_TMR0_TypeDef,
        u32IntType: u32,
        enNewState: en_functional_state_t,
    );
    pub fn TMR0_GetStatus(TMR0x: *const CM_TMR0_TypeDef, u32Flag: u32) -> en_flag_status_t;
    pub fn TMR0_ClearStatus(TMR0x: *mut CM_TMR0_TypeDef, u32Flag: u32);
}
