# Update History
------
## V2.2.0  Sep 30, 2023
#### documents
#### drivers
- ##### bsp/sk_hc32m120_lqfp48
  - Modify the brief of function BSP_CLK_Init : 64MHz -> 48MHz
- ##### cmsis/Device
  - Modify headfile file based on reference manual Rev1.12
- ##### hc32_ll_driver
  - **generic**
    - Modify version as 2.2.0
    - Modify typo
    - Add __NO_OPTIMIZE configuration item
    - Add attribute for __RAM_FUNC definition
  - **interrupts_share**
    - The BCSTR register of TimerA and TimerB are split into BCSTRH and BCSTRL
    - Update EMB_INTEN_PORTINTEN to EMB_INTEN_PORTININTEN
    - Update EMB_INTEN_PWMINTEN to EMB_INTEN_PWMSINTEN
  - **adc**
    - API fixed: ADC_DeInit()
    - Modify typo
  - **clk**
    - Modify typo
    - Modify API CLK_LrcCmd(), use DDL_DelayUS() to replace CLK_Delay()
    - Modify API CLK_XtalCmd(), to wait flag
  - **cmp**
    - Modify typo
    - Add assert for CIEN bit in GetCmpFuncStatusAndDisFunc function
  - **crc**
    - Reconstruct interface function relate to calculate CRC
    - Modify return type of function CRC_DeInit
    - Modify comment
    - Delete and modify some of group/function relate to calculate CRC
    - Optimize CRC_DeInit function
    - Modify typo
  - **ctc**
    - Modify typo
    - Modify the init assignment of i32Ret in CTC_DeInit()
  - **dbgc**
    - Add hc32_ll_dbgc driver
  - **dma**
    - Add API DMA_SetDataWidth()
    - Modify typo
    - Modify blocksize assert, 256U is valid
    - Optimize set blocksize & repeat count process
  - **efm**
    - Modify API EFM_Program()
    - Add system clock src assert to API EFM_SequenceProgram()
    - Modify typo
    - Modify API EFM_WriteSecurityCode(), switch to read_only mode before exit
    - Refine EFM_SequenceProgram() & EFM_ChipErase(), and put them in RAM
  - **emb**
    - Update EMB_CTL_CMPEN0~1 to EMB_CTL_CMPEN1~2
    - Update EMB_INTEN_PORTINTEN to EMB_INTEN_PORTININTEN
    - Update EMB_INTEN_PWMINTEN to EMB_INTEN_PWMSINTEN
    - Function EMB_TMR4_Init don't call EMB_DeInit
  - **gpio**
    - Rename GPIO_ExIntCmd() as GPIO_ExtIntCmd
    - Optimize API: GPIO_Init(), GPIO_SetFunc(), GPIO_InputMOSCmd(), GPIO_ExtIntCmd()
  - **i2c**
    - Modify typo
    - Move macro define I2C_SRC_CLK to head file
    - Disable slave address function in I2C_Init()
  - **interrupts**
    - Remove space line
  - **pwc**
    - Modify group PWC_Stop_Type
    - Add function PWC_LVD_DeInit
    - Modify typo
    - Add api PWC_LVD_DeInit()
    - Bug fixed# PWC_LVD_Cmd()
    - Modify API PWC_STOP_Enter() & add assert IS_PWC_STOP_TYPE()
  - **spi**
    - Add SPI_SetSckPolarity,SPI_SetSckPhase functions
    - Add group SPI_SCK_Polarity_Define, SPI_SCK_Phase_Define
    - Modify return type of fuction SPI_DeInit
    - Modify SPI_GetStatus,SPI_TxRx,SPI_Tx function
  - **swdt**
    - Optimize SWDT_ClearStatus function timeout
  - **tmr0**
    - Modify typo
  - **tmr2**
    - Modify typo
  - **tmr4**
    - Add the macros group @ref TMR4_OC_Output_Polarity
    - Modify typo
    - TMR4_OC_Buffer_Object group add macro-definition: TMR4_OC_BUF_NONE
    - Modify API TMR4_DeInit
    - Fix spell error about "response" that in function name
    - Add function comments: macros group @ref TMR4_OC_Channel
    - Modify function return value comments: TMR4_OC_GetPolarity
    - Modify function parameter comments: TMR4_PWM_SetPolarity
    - Modify function: TMR4_DeInit, TMR4_OC_DeInit, TMR4_PWM_DeInit, TMR4_EVT_DeInit
    - Modify macro-definition: IS_TMR4_OC_BUF_OBJECT
    - Fix magic number of function:  TMR4_OC_StructInit
    - Modify fuction:TMR4_PWM_Init
    - Modify comment
  - **tmra**
    - Modify typo
    - Update about split 16bit register TMRA_BCSTR into two 8bit registers TMRA_BCSTRH and TMRA_BCSTRL
    - Delete union in stc_tmra_init_t structure
    - Modify some of member type of struct stc_tmra_init_t and relate fuction about these member
    - Modify macro-definition value for group TMRA_Interrupt_Type/TMRA_Status_Flag
    - Rename marco definition IS_TMRA_CMPVAL_BUF_COND to IS_TMRA_BUF_TRANS_COND
  - **tmrb**
    - Modify typo
    - Delete union in stc_tmrb_init_t structure
    - Split register BCSTR,modify definition relate to Bit of BCSTR
    - Modify some of member type of struct stc_tmrb_init_t and relate fuction about these member
    - Split register BCSTR,modify function relate to BCSTR
    - Refine code due to some of member type of struct stc_tmrb_init_t is modified
  - **usart**
    - Change macro-definition: USART_DR_MPID -> USART_TDR_MPID
    - Modify USART_SetTransType parameter: u32Type -> u16Type
    - Modify return type of function USART_DeInit
    - Add function note: USART_FuncCmd
    - Modify typo
    - Split register USART_DR to USART_RDR and USART_TDR
    - Delete function: USART_GetUsartClockDiv
    - Fix MISRAC2012 warning: USART_GetUsartClockFreq
    - Code Refine
    - Modify return type of function USART_DeInit()
    - API refined: USART_SetBaudrate()
  - **utility**
    - Modify register USART DR to USART TDR
    - Prohibit DDL_DelayMS and DDL_DelayUS functions from being optimized
#### midwares
- ##### hc32/iec60730_class_b_stl
  - Modify register USART DR to USART TDR
#### projects
- ##### sk_hc32m120_lqfp48/applications
  - **functional_safety/iec60730_class_b**
    - Refine code due to some of member type of struct stc_tmrb_init_t is changed
  - **iap/iap_app**
    - Rename function CRC_CalculateData8 to CRC_CRC16_Calculate
  - **iap/iap_boot**
    - Rename function CRC_CalculateData8 to CRC_CRC16_Calculate
- ##### sk_hc32m120_lqfp48/examples
  - **cmp/cmp_normal_blankwindow**
    - Modify member type of struct sw_countïŒuint16_t->uint8_t
  - **crc/crc_hw_accumulate_check**
    - Add crc_hw_accumulate_check example
  - **crc/crc_hw_encode_hw_check**
    - Reconstruct interface function of calculate CRC
    - Define initial value for calculate CRC
  - **crc/crc_hw_encode_sw_check**
    - Reconstruct interface function of calculate CRC
    - Optimize code for software calculate CRC
  - **dmac/dmac_base**
    - Add DMA2_Error_IrqCallback function
  - **efm/efm_chip_erase**
    - Add efm_chip_erase example
  - **efm/efm_sequence_program**
    - Re-structure
    - Include bsp head file and "string.h"
  - **emb/emb_cmp_brake_timer4**
    - Typo: hander -> handler
  - **emb/emb_osc_brake_timer4**
    - Typo: hander -> handler
  - **emb/emb_port_brake_timer4**
    - Typo: hander -> handler
  - **emb/emb_pwm_brake_timer4**
    - Typo: hander -> handler
  - **i2c/i2c_master_polling**
    - Add definition I2C_ADDR_MD as address condition select
  - **i2c/i2c_slave_int**
    - Add definition I2C_ADDR_MD as address condition select
  - **i2c/i2c_slave_polling**
    - Add definition I2C_ADDR_MD as address condition select
  - **spi/spi_dma**
    - Modify the IO properties of SPI
  - **spi/spi_int**
    - Modify the IO properties of SPI
    - Modify rx interrupt priority of SPI
  - **spi/spi_polling**
    - Modify the IO properties of SPI
    - Replace the tx&rx function of SPI
  - **timer2/timer2_capture**
    - Refine code due to some of member's type of struct stc_tmra_init_t is changed
  - **timer2/timer2_clock_source**
    - Refine code due to some of member's type of struct stc_tmra_init_t is changed
  - **timer4/timer4_event_compare**
    - Update TMR4 event: EVT_SRC_TMR4_SCMP_UH -> EVT_SRC_TMR4_SCMP0
  - **timer4/timer4_event_delay**
    - Update TMR4 event: EVT_SRC_TMR4_SCMP_UH -> EVT_SRC_TMR4_SCMP0
  - **timer4/timer4_pwm_through**
    - Modify the initial configuration to achieve 0% or 100% duty cycle
  - **timera/timera_base_timer**
    - Refine code due to some of member's type of struct stc_tmra_init_t is changed
  - **timera/timera_capture**
    - Refine code due to some of member's type of struct stc_tmra_init_t is changed
  - **timera/timera_compare_value_buffer**
    - Refine code due to some of member's type of struct stc_tmra_init_t is changed
  - **timera/timera_pwm**
    - Refine code due to some of member's type of struct stc_tmra_init_t is changed
  - **timerb/timerb_base_timer**
    - Modify member type of struct sw_countïŒuint16_t->uint8_t
  - **timerb/timerb_base_timer_32bit**
    - Modify member type of struct sw_countïŒuint16_t->uint8_t
    - Modify parameter type of u8CountSrcïŒuint16_t->uint8_t
  - **timerb/timerb_input_capture**
    - Modify member type of struct sw_countïŒuint16_t->uint8_t
  - **timerb/timerb_output_compare**
    - Modify member type of struct sw_countïŒuint16_t->uint8_t
  - **timerb/timerb_period_measure**
    - Modify member type of struct sw_countïŒuint16_t->uint8_t
  - **usart/usart_clocksync_dma**
    - Add usart_clocksync_dma example
  - **usart/usart_lin**
    - Modify member type of struct sw_countïŒuint16_t->uint8_t
    - Split register BCSTR to BCSTRL and BCSTRH
  - **usart/usart_uart_dma**
    - Split register USART_DR to USART_RDR and USART_TDR
  - **usart/usart_uart_multiprocessor**
    - Optimize the RX process
#### utils
------
## V2.1.0  Jan 15, 2023
#### documents
#### drivers
- ##### bsp/sk_hc32m120_lqfp48
  - Add XTAL IO define
- ##### cmsis/Device
  - Modify headfile file based on reference manual Rev1.11
  - Delete the __low_level_init function of IAR and $Sub$$main function of MDK
- ##### hc32_ll_driver
  - **generic**
    - Modify version as 2.1.0
    - Implemented the definition of __NO_INIT for AC6 and ARM Compiler
    - ARM Compiler suppress warning message: diag_1296
  - **adc**
    - Modify macro group definition: ADC_Scan_Mode
  - **aos**
    - Modified parameters name of API AOS_CommonTriggerCmd() and AOS_SetTriggerEventSrc()
    - Macro name modified: from IS_AOS_TRIG_SEL to IS_AOS_TARGET
    - Modified parameters name and comments of AOS_CommonTriggerCmd() and AOS_SetTriggerEventSrc()
  - **clk**
    - Refine stc_clock_freq_t
    - Add ADC clock assert
  - **cmp**
    - Modify structure stc_cmp_window_init_t
    - Modify macro define for API
  - **crc**
    - Add waiting time after write CRC data
  - **dma**
    - Code refine
    - Modify DMA_StructInit() default value
    - Modify API DMA_DeInit and add LLP address assert
  - **efm**
    - Add Flash protect level define
    - Code refine
    - Remove redundant code
    - Add API EFM_Protect_Enable & EFM_WriteSecurityCode
    - Modify API EFM_Read & EFM_Program
  - **emb**
    - Modify structure comments:stc_emb_monitor_tmr_pwm_t
    - Optimize function: EMB_TMR4_Init
  - **gpio**
    - Add API GPIO_ExIntCmd()
  - **i2c**
    - Add API I2C_SlaveAddrCmd()
    - Add API I2C_SlaveAddrCmd(), modify API I2C_SlaveAddrConfig()
  - **interrupts**
    - Add macro-definition: EIRQFR_REG/NMIENR_REG/INTWKEN_REG
    - Remove redundant code
  - **pwc**
    - Refine API PWC_STOP_Enter()
    - Optimize API PWC_STOP_ClockSelect() & comment
    - Remove redundant code
  - **spi**
    - Modify API SPI_TxRx(),SPI_Tx()
  - **tmr2**
    - Deleted redundant comments
  - **tmr4**
    - Update API parameter u16IntType to u32IntType
    - Modify macro-define: TMR4_OCSR_MASK
    - Re-name parameter u16IntType to u32IntType
    - Add RCSR register data type
  - **tmra**
    - Comments optimization
  - **usart**
    - Optimize UART DIV_Fraction calculation time
  - **utility**
    - Support re-target printf for IAR EW version 9 or later
#### midwares
- ##### hc32/iec60730_class_b_stl
  - Optimize macros definitions
  - Modify USART_SR_TXE to USART_SR_TC in STL_ConsoleOutputChar()
  - Fix warning: MISRAC2012-Rule-18.4
  - Fix bug: Reading CC Build CRC32 value is error in release project
#### projects
- ##### sk_hc32m120_lqfp48/applications
  - **iap/iap_boot**
    - Delete PWC_HighSpeedToLowSpeed in IAP_CLK_DeInit
  - **iap/iap_ymodem_boot**
    - Add print strings for download and upload completion
    - Delete PWC_HighSpeedToLowSpeed in IAP_CLK_DeInit
- ##### sk_hc32m120_lqfp48/examples
  - **adc/adc_awd**
    - Comment fixed
  - **adc/adc_extended_channel**
    - Some delay is needed after cofiguration if internal analog source is internal reference voltage
    - Print log in function AdcPolling() fixed
  - **clk/clk_switch_sysclk**
    - Configure XTAL IO as analog function
  - **clk/clk_xtalstop_detect**
    - Configure XTAL IO as analog function
  - **cmp/cmp_normal_blankwindow**
    - Modify for driver update
  - **cmp/cmp_normal_int**
    - Modify for driver update
  - **cmp/cmp_window**
    - Modify for driver update
  - **ctc/ctc_ctcref_trimming**
    - Configure XTAL IO as analog function
  - **ctc/ctc_xtal_trimming**
    - Configure XTAL IO as analog function
  - **dmac/dmac_link_list_pointer**
    - Code refine
  - **emb/emb_osc_brake_timer4**
    - Configure XTAL IO as analog function
  - **icg/icg_nmi_pin_hw_startup**
    - Add NMI pin init
  - **icg/icg_swdt_interrupt_hw_startup**
    - Exchange LED color
  - **intc/intc_nmi_xtalstop**
    - Configure XTAL IO as analog function
  - **pwc/pwc_lvd_ex**
    - Add filter configure to LVD initialize
  - **pwc/pwc_stop_wake**
    - Code refine
  - **swdt/swdt_interrupt_sw_startup**
    - Exchange LED color
  - **timer2/timer2_capture**
    - Macro definition fixed
  - **timera/timera_base_timer**
    - Comments fixed
  - **timera/timera_capture**
    - TMRA_IrqCallback(): comment fixed, print log fixed
  - **usart/usart_clocksync_int**
    - Read USART_DR.RDR when USART overrun error occur
  - **usart/usart_uart_dma**
    - Read USART_DR.RDR when USART overrun error occur
  - **usart/usart_uart_halfduplex_int**
    - Read USART_DR.RDR when USART overrun error occur
  - **usart/usart_uart_int**
    - Read USART_DR.RDR when USART overrun error occur
  - **usart/usart_uart_multiprocessor**
    - Read USART_DR.RDR when USART overrun error occur
  - **usart/usart_uart_polling**
    - Read USART_DR.RDR when USART overrun error occur
#### utils
------
## V2.0.0  Mar 31, 2022
- Initial release.