Skip to content

Commit 2ebf5b0

Browse files
HaiLonggmarull
authored andcommitted
gd32l23x: patch HAL
Patch GD32L23X according to the requirements listed in the README. This skip the i2c requirements, GD32L23X i2c have different implement. Signed-off-by: HaiLong <[email protected]>
1 parent 88a7584 commit 2ebf5b0

File tree

6 files changed

+52
-8
lines changed

6 files changed

+52
-8
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,13 @@ conflict resolution. See below list with the proposed solution:
115115
two step work. First move I2CCLK_MAX and I2CCLK_MIN marco from i2c source
116116
file to header file. Then split the I2CCLK_MIN for each supported transfer
117117
mode.
118+
119+
- gd32l23x
120+
121+
- `SystemInit` function in `system_gd32l23x.c` contain an invalid usage of
122+
`nvic_vector_table_set` function, just remove it.
123+
124+
- `gd32l23x_libopt.h` file not exist, add it manually.
125+
126+
- i2c have different implement than current gd32 i2c driver. no need to patch
127+
upper i2c speed requirement.

gd32l23x/cmsis/gd/gd32l23x/include/gd32l23x.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,9 @@ typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrStatus;
185185
#define REG32(addr) (*(volatile uint32_t *)(uint32_t)(addr))
186186
#define REG16(addr) (*(volatile uint16_t *)(uint32_t)(addr))
187187
#define REG8(addr) (*(volatile uint8_t *)(uint32_t)(addr))
188+
#ifndef BIT
188189
#define BIT(x) ((uint32_t)((uint32_t)0x01U<<(x)))
190+
#endif
189191
#define BITS(start, end) ((0xFFFFFFFFUL << (start)) & (0xFFFFFFFFUL >> (31U - (uint32_t)(end))))
190192
#define GET_BITS(regval, start, end) (((regval) & BITS((start),(end))) >> (start))
191193

gd32l23x/cmsis/gd/gd32l23x/source/system_gd32l23x.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,6 @@ void SystemInit(void)
9999

100100
/* configure system clock */
101101
system_clock_config();
102-
103-
#ifdef VECT_TAB_SRAM
104-
nvic_vector_table_set(NVIC_VECTTAB_RAM, VECT_TAB_OFFSET);
105-
#else
106-
nvic_vector_table_set(NVIC_VECTTAB_FLASH, VECT_TAB_OFFSET);
107-
#endif
108102
}
109103

110104
/*!
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Copyright (c) 2022 BrainCo Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef GD32L23X_LIBOPT_H
8+
#define GD32L23X_LIBOPT_H
9+
10+
#include "gd32l23x_adc.h"
11+
#include "gd32l23x_cau.h"
12+
#include "gd32l23x_cmp.h"
13+
#include "gd32l23x_crc.h"
14+
#include "gd32l23x_ctc.h"
15+
#include "gd32l23x_dac.h"
16+
#include "gd32l23x_dbg.h"
17+
#include "gd32l23x_dma.h"
18+
#include "gd32l23x_exti.h"
19+
#include "gd32l23x_fmc.h"
20+
#include "gd32l23x_fwdgt.h"
21+
#include "gd32l23x_gpio.h"
22+
#include "gd32l23x_i2c.h"
23+
#include "gd32l23x_lptimer.h"
24+
#include "gd32l23x_lpuart.h"
25+
#include "gd32l23x_misc.h"
26+
#include "gd32l23x_pmu.h"
27+
#include "gd32l23x_rcu.h"
28+
#include "gd32l23x_rtc.h"
29+
#include "gd32l23x_slcd.h"
30+
#include "gd32l23x_spi.h"
31+
#include "gd32l23x_syscfg.h"
32+
#include "gd32l23x_timer.h"
33+
#include "gd32l23x_trng.h"
34+
#include "gd32l23x_usart.h"
35+
#include "gd32l23x_vref.h"
36+
#include "gd32l23x_wwdgt.h"
37+
38+
#endif /* GD32L23X_LIBOPT_H */

gd32l23x/standard_peripheral/include/gd32l23x_timer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ void timer_deinit(uint32_t timer_periph);
473473
/* initialize TIMER init parameter struct */
474474
void timer_struct_para_init(timer_parameter_struct *initpara);
475475
/* initialize TIMER counter */
476-
void timer_init(uint32_t timer_periph, timer_parameter_struct *initpara);
476+
void gd32_timer_init(uint32_t timer_periph, timer_parameter_struct *initpara);
477477
/* enable a TIMER */
478478
void timer_enable(uint32_t timer_periph);
479479
/* disable a TIMER */

gd32l23x/standard_peripheral/source/gd32l23x_timer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void timer_struct_para_init(timer_parameter_struct *initpara)
106106
\param[out] none
107107
\retval none
108108
*/
109-
void timer_init(uint32_t timer_periph, timer_parameter_struct *initpara)
109+
void gd32_timer_init(uint32_t timer_periph, timer_parameter_struct *initpara)
110110
{
111111
/* configure the counter prescaler value */
112112
TIMER_PSC(timer_periph) = (uint16_t)initpara->prescaler;

0 commit comments

Comments
 (0)