Skip to content

Commit 933044c

Browse files
committed
[bsp][hpmicro] Add rt_hw_us_delay hook and update board delays
1 parent e908b9b commit 933044c

12 files changed

Lines changed: 83 additions & 32 deletions

File tree

bsp/hpmicro/hpm5300evk/board/board.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
#include "hpm_i2c_drv.h"
1515
#include "hpm_pcfg_drv.h"
1616
#include <rtconfig.h>
17-
18-
17+
#include <rthw.h>
1918
/**
2019
* @brief FLASH configuration option definitions:
2120
* option[0]:
@@ -231,12 +230,15 @@ void board_init_clock(void)
231230

232231
void board_delay_us(uint32_t us)
233232
{
234-
clock_cpu_delay_us(us);
233+
rt_hw_us_delay(us);
235234
}
236235

237236
void board_delay_ms(uint32_t ms)
238237
{
239-
clock_cpu_delay_ms(ms);
238+
while (ms--)
239+
{
240+
rt_hw_us_delay(1000);
241+
}
240242
}
241243

242244
#if !defined(NO_BOARD_TIMER_SUPPORT) || !NO_BOARD_TIMER_SUPPORT

bsp/hpmicro/hpm5301evklite/board/board.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#include "hpm_i2c_drv.h"
1515
#include "hpm_pcfg_drv.h"
1616
#include <rtconfig.h>
17-
17+
#include <rthw.h>
1818
/**
1919
* @brief FLASH configuration option definitions:
2020
* option[0]:
@@ -233,12 +233,15 @@ void board_init_clock(void)
233233

234234
void board_delay_us(uint32_t us)
235235
{
236-
clock_cpu_delay_us(us);
236+
rt_hw_us_delay(us);
237237
}
238238

239239
void board_delay_ms(uint32_t ms)
240240
{
241-
clock_cpu_delay_ms(ms);
241+
while (ms--)
242+
{
243+
rt_hw_us_delay(1000);
244+
}
242245
}
243246

244247
#if !defined(NO_BOARD_TIMER_SUPPORT) || !NO_BOARD_TIMER_SUPPORT

bsp/hpmicro/hpm5e00evk/board/board.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
#include "hpm_enet_drv.h"
1919
#include "hpm_usb_drv.h"
2020
#include "hpm_pcfg_drv.h"
21+
#include <rtconfig.h>
22+
#include <rthw.h>
2123

2224
/**
2325
* @brief FLASH configuration option definitions:
@@ -178,12 +180,15 @@ void board_init(void)
178180

179181
void board_delay_us(uint32_t us)
180182
{
181-
clock_cpu_delay_us(us);
183+
rt_hw_us_delay(us);
182184
}
183185

184186
void board_delay_ms(uint32_t ms)
185187
{
186-
clock_cpu_delay_ms(ms);
188+
while (ms--)
189+
{
190+
rt_hw_us_delay(1000);
191+
}
187192
}
188193

189194
#if !defined(NO_BOARD_TIMER_SUPPORT) || !NO_BOARD_TIMER_SUPPORT

bsp/hpmicro/hpm6200evk/board/board.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "hpm_pllctlv2_drv.h"
2121
#include "hpm_pcfg_drv.h"
2222
#include <rtconfig.h>
23+
#include <rthw.h>
2324
/**
2425
* @brief FLASH configuration option definitions:
2526
* option[0]:
@@ -190,12 +191,15 @@ void board_init_core1(void)
190191

191192
void board_delay_us(uint32_t us)
192193
{
193-
clock_cpu_delay_us(us);
194+
rt_hw_us_delay(us);
194195
}
195196

196197
void board_delay_ms(uint32_t ms)
197198
{
198-
clock_cpu_delay_ms(ms);
199+
while (ms--)
200+
{
201+
rt_hw_us_delay(1000);
202+
}
199203
}
200204

201205
#if !defined(NO_BOARD_TIMER_SUPPORT) || !NO_BOARD_TIMER_SUPPORT

bsp/hpmicro/hpm6300evk/board/board.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
#include "hpm_debug_console.h"
2626
#include <rtconfig.h>
27-
27+
#include <rthw.h>
2828
/**
2929
* @brief FLASH configuration option definitions:
3030
* option[0]:
@@ -193,12 +193,15 @@ uint32_t board_init_femc_clock(void)
193193

194194
void board_delay_us(uint32_t us)
195195
{
196-
clock_cpu_delay_us(us);
196+
rt_hw_us_delay(us);
197197
}
198198

199199
void board_delay_ms(uint32_t ms)
200200
{
201-
clock_cpu_delay_ms(ms);
201+
while (ms--)
202+
{
203+
rt_hw_us_delay(1000);
204+
}
202205
}
203206

204207
#if !defined(NO_BOARD_TIMER_SUPPORT) || !NO_BOARD_TIMER_SUPPORT

bsp/hpmicro/hpm6750evk/board/board.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
#include "hpm_pllctl_drv.h"
2424
#include "hpm_enet_drv.h"
2525
#include "hpm_pcfg_drv.h"
26-
#include <rtconfig.h>
2726
#if defined(ENET_MULTIPLE_PORT) && ENET_MULTIPLE_PORT
2827
#include "hpm_enet_phy_common.h"
28+
#include <rtconfig.h>
29+
#include <rthw.h>
2930
#endif
3031

3132
/**
@@ -311,12 +312,15 @@ void board_panel_para_to_lcdc(lcdc_config_t *config)
311312

312313
void board_delay_ms(uint32_t ms)
313314
{
314-
clock_cpu_delay_ms(ms);
315+
while (ms--)
316+
{
317+
rt_hw_us_delay(1000);
318+
}
315319
}
316320

317321
void board_delay_us(uint32_t us)
318322
{
319-
clock_cpu_delay_us(us);
323+
rt_hw_us_delay(us);
320324
}
321325

322326
#if !defined(NO_BOARD_TIMER_SUPPORT) || !NO_BOARD_TIMER_SUPPORT

bsp/hpmicro/hpm6750evk2/board/board.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
#include "hpm_pllctl_drv.h"
2424
#include "hpm_enet_drv.h"
2525
#include "hpm_pcfg_drv.h"
26-
#include <rtconfig.h>
2726
#if defined(ENET_MULTIPLE_PORT) && ENET_MULTIPLE_PORT
2827
#include "hpm_enet_phy_common.h"
28+
#include <rtconfig.h>
29+
#include <rthw.h>
2930
#endif
3031

3132
/**
@@ -311,12 +312,15 @@ void board_panel_para_to_lcdc(lcdc_config_t *config)
311312

312313
void board_delay_ms(uint32_t ms)
313314
{
314-
clock_cpu_delay_ms(ms);
315+
while (ms--)
316+
{
317+
rt_hw_us_delay(1000);
318+
}
315319
}
316320

317321
void board_delay_us(uint32_t us)
318322
{
319-
clock_cpu_delay_us(us);
323+
rt_hw_us_delay(us);
320324
}
321325

322326
#if !defined(NO_BOARD_TIMER_SUPPORT) || !NO_BOARD_TIMER_SUPPORT

bsp/hpmicro/hpm6750evkmini/board/board.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "hpm_pcfg_drv.h"
2525
#include "hpm_enet_drv.h"
2626
#include <rtconfig.h>
27-
27+
#include <rthw.h>
2828
static bool invert_led_level;
2929

3030
/**
@@ -369,12 +369,15 @@ void board_panel_para_to_lcdc(lcdc_config_t *config)
369369

370370
void board_delay_ms(uint32_t ms)
371371
{
372-
clock_cpu_delay_ms(ms);
372+
while (ms--)
373+
{
374+
rt_hw_us_delay(1000);
375+
}
373376
}
374377

375378
void board_delay_us(uint32_t us)
376379
{
377-
clock_cpu_delay_us(us);
380+
rt_hw_us_delay(us);
378381
}
379382

380383
#if !defined(NO_BOARD_TIMER_SUPPORT) || !NO_BOARD_TIMER_SUPPORT

bsp/hpmicro/hpm6800evk/board/board.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "hpm_mipi_dsi_drv.h"
2828
#include "hpm_mipi_dsi_phy_drv.h"
2929
#include <rtconfig.h>
30-
30+
#include <rthw.h>
3131
/**
3232
* @brief FLASH configuration option definitions:
3333
* option[0]:
@@ -191,12 +191,15 @@ void board_init(void)
191191

192192
void board_delay_us(uint32_t us)
193193
{
194-
clock_cpu_delay_us(us);
194+
rt_hw_us_delay(us);
195195
}
196196

197197
void board_delay_ms(uint32_t ms)
198198
{
199-
clock_cpu_delay_ms(ms);
199+
while (ms--)
200+
{
201+
rt_hw_us_delay(1000);
202+
}
200203
}
201204

202205
#if !defined(NO_BOARD_TIMER_SUPPORT) || !NO_BOARD_TIMER_SUPPORT

bsp/hpmicro/hpm6e00evk/board/board.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#include "hpm_esc_drv.h"
2424
#include "hpm_tsw_drv.h"
2525
#include <rtconfig.h>
26-
26+
#include <rthw.h>
2727
/**
2828
* @brief FLASH configuration option definitions:
2929
* option[0]:
@@ -219,12 +219,15 @@ uint32_t board_init_femc_clock(void)
219219

220220
void board_delay_us(uint32_t us)
221221
{
222-
clock_cpu_delay_us(us);
222+
rt_hw_us_delay(us);
223223
}
224224

225225
void board_delay_ms(uint32_t ms)
226226
{
227-
clock_cpu_delay_ms(ms);
227+
while (ms--)
228+
{
229+
rt_hw_us_delay(1000);
230+
}
228231
}
229232

230233
#if !defined(NO_BOARD_TIMER_SUPPORT) || !NO_BOARD_TIMER_SUPPORT

0 commit comments

Comments
 (0)