Skip to content

Commit e9f911c

Browse files
CopilotBernardXiong
andcommitted
Remove old hwtimer/ktime/cputime subsystems and fix formatting
Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com>
1 parent 9a3daf2 commit e9f911c

File tree

29 files changed

+50
-2616
lines changed

29 files changed

+50
-2616
lines changed

components/drivers/Kconfig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ rsource "ipc/Kconfig"
55

66
rsource "serial/Kconfig"
77
rsource "can/Kconfig"
8-
rsource "cputime/Kconfig"
98
rsource "i2c/Kconfig"
109
rsource "phy/Kconfig"
1110
rsource "misc/Kconfig"
@@ -47,9 +46,7 @@ rsource "pic/Kconfig"
4746
rsource "pin/Kconfig"
4847
rsource "pinctrl/Kconfig"
4948
rsource "clock_time/Kconfig"
50-
rsource "ktime/Kconfig"
5149
rsource "clk/Kconfig"
52-
rsource "hwtimer/Kconfig"
5350
rsource "usb/Kconfig"
5451

5552
endmenu

components/drivers/clock_time/Kconfig

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ if RT_USING_CLOCK_TIME
1212
default y
1313
help
1414
Enable high-resolution software timers built on clock_time devices.
15-
15+
1616
config RT_USING_CLOCK_CPUTIME
1717
bool "Enable CPU time APIs"
1818
default y
@@ -25,26 +25,4 @@ if RT_USING_CLOCK_TIME
2525
help
2626
Enable system boottime (monotonic time since boot) APIs.
2727

28-
# Backward compatibility options
29-
config RT_USING_HWTIMER
30-
bool
31-
default y
32-
help
33-
Legacy option for backward compatibility with hwtimer.
34-
Automatically enabled when RT_USING_CLOCK_TIME is enabled.
35-
36-
config RT_USING_KTIME
37-
bool
38-
default y if RT_USING_CLOCK_HRTIMER
39-
help
40-
Legacy option for backward compatibility with ktime.
41-
Automatically enabled when RT_USING_CLOCK_HRTIMER is enabled.
42-
43-
config RT_USING_CPUTIME
44-
bool
45-
default y if RT_USING_CLOCK_CPUTIME
46-
help
47-
Legacy option for backward compatibility with cputime.
48-
Automatically enabled when RT_USING_CLOCK_CPUTIME is enabled.
49-
5028
endif

components/drivers/clock_time/src/clock_time.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,32 @@ rt_err_t rt_clock_time_device_register(struct rt_clock_time_device *dev,
2727
rt_uint8_t caps)
2828
{
2929
rt_err_t result;
30-
30+
3131
RT_ASSERT(dev != RT_NULL);
3232
RT_ASSERT(name != RT_NULL);
3333
RT_ASSERT(dev->ops != RT_NULL);
34-
34+
3535
/* Initialize parent device structure */
3636
dev->parent.type = RT_Device_Class_Timer;
3737
dev->parent.rx_indicate = RT_NULL;
3838
dev->parent.tx_complete = RT_NULL;
39-
39+
4040
dev->parent.init = RT_NULL;
4141
dev->parent.open = RT_NULL;
4242
dev->parent.close = RT_NULL;
4343
dev->parent.read = RT_NULL;
4444
dev->parent.write = RT_NULL;
4545
dev->parent.control = RT_NULL;
46-
46+
4747
dev->caps = caps;
48-
48+
4949
/* Calculate resolution scale factor */
5050
if (dev->ops->get_freq)
5151
{
5252
rt_uint64_t freq = dev->ops->get_freq();
5353
if (freq > 0)
5454
{
55-
/* res_scale = (1e9 * RT_CLOCK_TIME_RESMUL) / freq
55+
/* res_scale = (1e9 * RT_CLOCK_TIME_RESMUL) / freq
5656
* To avoid overflow, we check if freq is very small.
5757
* For freq >= 1000, this calculation is safe on 64-bit.
5858
* For very small frequencies, limit the scale factor.
@@ -76,24 +76,24 @@ rt_err_t rt_clock_time_device_register(struct rt_clock_time_device *dev,
7676
{
7777
dev->res_scale = RT_CLOCK_TIME_RESMUL;
7878
}
79-
79+
8080
/* Register device */
8181
result = rt_device_register(&dev->parent, name, RT_DEVICE_FLAG_RDWR);
8282
if (result != RT_EOK)
8383
{
8484
LOG_E("Failed to register clock_time device: %s", name);
8585
return result;
8686
}
87-
87+
8888
/* Set as default if none exists */
8989
if (_default_device == RT_NULL)
9090
{
9191
_default_device = dev;
9292
LOG_D("Set %s as default clock_time device", name);
9393
}
94-
94+
9595
LOG_I("Registered clock_time device: %s (caps: 0x%02x)", name, caps);
96-
96+
9797
return RT_EOK;
9898
}
9999

@@ -111,9 +111,9 @@ rt_clock_time_t rt_clock_time_default(void)
111111
rt_err_t rt_clock_time_set_default(rt_clock_time_t dev)
112112
{
113113
RT_ASSERT(dev != RT_NULL);
114-
114+
115115
_default_device = dev;
116116
LOG_D("Changed default clock_time device to: %s", dev->parent.parent.name);
117-
117+
118118
return RT_EOK;
119119
}

components/drivers/clock_time/src/hrtimer.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ static unsigned long _cnt_convert(unsigned long cnt)
8181
{
8282
unsigned long rtn = 0;
8383
unsigned long current_cnt = rt_clock_cputimer_getcnt();
84-
85-
/*
84+
85+
/*
8686
* Check if target count is in the past.
8787
* For unsigned counters, if cnt <= current_cnt, it means the target
8888
* has already passed (or is exactly now).
@@ -91,10 +91,10 @@ static unsigned long _cnt_convert(unsigned long cnt)
9191
{
9292
return 0;
9393
}
94-
94+
9595
unsigned long count = cnt - current_cnt;
96-
97-
/*
96+
97+
/*
9898
* Sanity check for wrap-around detection.
9999
* If the difference exceeds half the maximum counter value, it's likely
100100
* a wrap-around or invalid value. This handles both:
@@ -108,7 +108,7 @@ static unsigned long _cnt_convert(unsigned long cnt)
108108
rt_uint64_t count_64 = (rt_uint64_t)count;
109109
rt_uint64_t res_cpu = rt_clock_cputimer_getres();
110110
rt_uint64_t res_hr = rt_clock_hrtimer_getres();
111-
111+
112112
rtn = (unsigned long)((count_64 * res_cpu) / res_hr);
113113
return rtn == 0 ? 1 : rtn; /* at least 1 */
114114
}

components/drivers/cputime/Kconfig

Lines changed: 0 additions & 38 deletions
This file was deleted.

components/drivers/cputime/SConscript

Lines changed: 0 additions & 18 deletions
This file was deleted.

components/drivers/cputime/cputime.c

Lines changed: 0 additions & 116 deletions
This file was deleted.

0 commit comments

Comments
 (0)