diff --git a/components/drivers/hwtimer/hwtimer.c b/components/drivers/hwtimer/hwtimer.c index 1b2792558d19e064a1a5d31e3ead0ff069ee2ca4..156ec246770b2f981f15c68ae5ad984f08c32a2e 100644 --- a/components/drivers/hwtimer/hwtimer.c +++ b/components/drivers/hwtimer/hwtimer.c @@ -318,6 +318,14 @@ static rt_err_t rt_hwtimer_control(struct rt_device *dev, int cmd, void *args) rt_hw_interrupt_enable(level); } break; + case HWTIMER_CTRL_COUNT_GET: + { + if (timer->ops->count_get != RT_NULL) { + rt_int32_t cnt = timer->ops->count_get(timer); + *(rt_uint32_t *)args = cnt; + } + } + break; default: { if (timer->ops->control != RT_NULL) diff --git a/components/drivers/include/drivers/hwtimer.h b/components/drivers/include/drivers/hwtimer.h index 6f11ff2c5456b43a580036f0e4279e05a47461d0..d4623b401e355e96b30349a4f8f4aa926c909af5 100644 --- a/components/drivers/include/drivers/hwtimer.h +++ b/components/drivers/include/drivers/hwtimer.h @@ -21,7 +21,8 @@ typedef enum HWTIMER_CTRL_FREQ_SET = RT_DEVICE_CTRL_BASE(Timer) + 0x01, /* set the count frequency */ HWTIMER_CTRL_STOP = RT_DEVICE_CTRL_BASE(Timer) + 0x02, /* stop timer */ HWTIMER_CTRL_INFO_GET = RT_DEVICE_CTRL_BASE(Timer) + 0x03, /* get a timer feature information */ - HWTIMER_CTRL_MODE_SET = RT_DEVICE_CTRL_BASE(Timer) + 0x04 /* Setting the timing mode(oneshot/period) */ + HWTIMER_CTRL_MODE_SET = RT_DEVICE_CTRL_BASE(Timer) + 0x04, /* Setting the timing mode(oneshot/period) */ + HWTIMER_CTRL_COUNT_GET = RT_DEVICE_CTRL_BASE(Timer) + 0x05 /* get hwtimer count */ } rt_hwtimer_ctrl_t; /* Timing Mode */ diff --git a/src/object.c b/src/object.c index f924f37bc9c333e9f4645ef6fa3d2243e83d5443..2b8158e40f3e7107138a8a676100dca40b285fa8 100644 --- a/src/object.c +++ b/src/object.c @@ -723,7 +723,7 @@ rt_object_t rt_object_find(const char *name, rt_uint8_t type) }; /* parameter check */ - if (name == RT_NULL || rt_object_get_information(type) == RT_NULL) + if (name == RT_NULL || rt_object_get_information((enum rt_object_class_type)type) == RT_NULL) return RT_NULL; /* which is invoke in interrupt status */