Skip to content

Commit dd0e032

Browse files
feilongflnandojve
authored andcommitted
gd32e10x: apply patches for hal
apply fllowing patches for hal: - drop I2CCLK_MAX/I2CCLK_MIN - add `gd32_` prefix for timer_init - add ifdef to BIT macro - remove nvic_vector_table_set function call Signed-off-by: YuLong Yao <[email protected]>
1 parent 74ad25d commit dd0e032

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

gd32e10x/cmsis/gd/gd32e10x/include/gd32e10x.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrStatus;
195195
#define REG32(addr) (*(volatile uint32_t *)(uint32_t)(addr))
196196
#define REG16(addr) (*(volatile uint16_t *)(uint32_t)(addr))
197197
#define REG8(addr) (*(volatile uint8_t *)(uint32_t)(addr))
198+
#ifndef BIT
198199
#define BIT(x) ((uint32_t)((uint32_t)0x01U<<(x)))
200+
#endif /* BIT */
201+
199202
#define BITS(start, end) ((0xFFFFFFFFUL << (start)) & (0xFFFFFFFFUL >> (31U - (uint32_t)(end))))
200203
#define GET_BITS(regval, start, end) (((regval) & BITS((start),(end))) >> (start))
201204

gd32e10x/cmsis/gd/gd32e10x/source/system_gd32e10x.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,6 @@ void SystemInit (void)
145145
/* configure the system clock source, PLL Multiplier, AHB/APBx prescalers and Flash settings */
146146
system_clock_config();
147147

148-
#ifdef VECT_TAB_SRAM
149-
nvic_vector_table_set(NVIC_VECTTAB_RAM,VECT_TAB_OFFSET);
150-
#else
151-
nvic_vector_table_set(NVIC_VECTTAB_FLASH,VECT_TAB_OFFSET);
152-
#endif
153148

154149
}
155150

gd32e10x/standard_peripheral/include/gd32e10x_i2c.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,11 @@ typedef enum {
309309
#define I2C_ADDFORMAT_7BITS ((uint32_t)0x00000000U) /*!< address format is 7 bits */
310310
#define I2C_ADDFORMAT_10BITS I2C_SADDR0_ADDFORMAT /*!< address format is 10 bits */
311311

312+
#define I2CCLK_MAX ((uint32_t)0x0000003FU)/*!< i2cclk maximum value */
313+
#define I2CCLK_MIN ((uint32_t)0x00000002U)/*!< i2cclk minimum value for standard mode */
314+
#define I2CCLK_FM_MIN ((uint32_t)0x00000008U)/*!< i2cclk minimum value for fast mode */
315+
#define I2CCLK_FM_PLUS_MIN ((uint32_t)0x00000018U)/*!< i2cclk minimum value for fast mode plus */
316+
312317
/* function declarations */
313318
/* reset I2C */
314319
void i2c_deinit(uint32_t i2c_periph);

gd32e10x/standard_peripheral/include/gd32e10x_timer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ void timer_deinit(uint32_t timer_periph);
591591
/* initialize TIMER init parameter struct */
592592
void timer_struct_para_init(timer_parameter_struct* initpara);
593593
/* initialize TIMER counter */
594-
void timer_init(uint32_t timer_periph, timer_parameter_struct* initpara);
594+
void gd32_timer_init(uint32_t timer_periph, timer_parameter_struct* initpara);
595595
/* enable a timer */
596596
void timer_enable(uint32_t timer_periph);
597597
/* disable a timer */

gd32e10x/standard_peripheral/source/gd32e10x_i2c.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ OF SUCH DAMAGE.
3939
#include "gd32e10x_i2c.h"
4040

4141
/* I2C register bit mask */
42-
#define I2CCLK_MAX ((uint32_t)0x0000003FU) /*!< i2cclk maximum value */
43-
#define I2CCLK_MIN ((uint32_t)0x00000002U) /*!< i2cclk minimum value */
4442
#define I2C_FLAG_MASK ((uint32_t)0x0000FFFFU) /*!< i2c flag mask */
4543
#define I2C_ADDRESS_MASK ((uint32_t)0x000003FFU) /*!< i2c address mask */
4644
#define I2C_ADDRESS2_MASK ((uint32_t)0x000000FEU) /*!< the second i2c address mask */

gd32e10x/standard_peripheral/source/gd32e10x_timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ void timer_struct_para_init(timer_parameter_struct* initpara)
157157
\param[out] none
158158
\retval none
159159
*/
160-
void timer_init(uint32_t timer_periph, timer_parameter_struct* initpara)
160+
void gd32_timer_init(uint32_t timer_periph, timer_parameter_struct* initpara)
161161
{
162162
/* configure the counter prescaler value */
163163
TIMER_PSC(timer_periph) = (uint16_t)initpara->prescaler;

0 commit comments

Comments
 (0)