/* Specifies the ouput polarity of the PWM at the specified state of counter.  */
void TMRA_PWM_SetPolarity(CM_TMRA_TypeDef *TMRAx, uint32_t u32Ch, uint8_t u8CountState, uint16_t u16Polarity)
/* Specifies the ouput polarity of the PWM at the specified state of counter.  */
void TMRA_PWM_SetPolarity(CM_TMRA_TypeDef *TMRAx, uint32_t u32Ch, uint8_t u8CountState, uint16_t u16Polarity)
{
    uint32_t u32PCONRAddr;
    DDL_ASSERT(IS_TMRA_UNIT_CH(TMRAx, u32Ch));
    DDL_ASSERT(IS_TMRA_PWM_POLARITY(u8CountState, u16Polarity));
    u32PCONRAddr = (uint32_t)&TMRAx->PCONR1 + (u32Ch * 4U);
    MODIFY_REG16(RW_MEM16(u32PCONRAddr),
                 (uint16_t)TMRA_PWM_POLARITY_MASK << (u8CountState * 2U),
                 u16Polarity << (u8CountState * 2U));
}