summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorWayne Lin <[email protected]>2020-12-29 19:36:00 +0800
committerWayne Lin <[email protected]>2020-12-29 19:36:00 +0800
commitc9892a82bec1f77146fbf7bed6294384dcad62d5 (patch)
tree4a119920fa6e9040508383486a6cd432e8ae7e9a /components
parent1c4328e5a9f6e1cbb737f975e689fc21ea8f6cca (diff)
parent94ba15a80b4856b9654aefa0510465b084a7e459 (diff)
Merge branch 'master' of https://github.com/RT-Thread/rt-thread into nuvoton
Diffstat (limited to 'components')
-rwxr-xr-xcomponents/drivers/Kconfig5
-rw-r--r--components/drivers/hwtimer/hwtimer.c9
-rw-r--r--components/drivers/sensors/SConscript2
-rw-r--r--components/drivers/touch/SConscript2
-rw-r--r--components/drivers/touch/touch.c26
-rw-r--r--components/drivers/touch/touch.h5
-rw-r--r--components/libc/aio/SConscript2
-rw-r--r--components/libc/compilers/dlib/SConscript2
-rw-r--r--components/libc/compilers/newlib/SConscript2
-rw-r--r--components/libc/pthreads/SConscript2
-rw-r--r--components/libc/time/SConscript2
-rw-r--r--components/net/lwip-1.4.1/SConscript2
-rw-r--r--components/net/lwip_nat/SConscript2
-rw-r--r--components/net/netdev/SConscript2
-rw-r--r--components/utilities/utest/SConscript2
15 files changed, 47 insertions, 20 deletions
diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig
index 198f1bbbf8..006497519f 100755
--- a/components/drivers/Kconfig
+++ b/components/drivers/Kconfig
@@ -291,6 +291,11 @@ endif
config RT_USING_TOUCH
bool "Using Touch device drivers"
default n
+ if RT_USING_TOUCH
+ config RT_TOUCH_PIN_IRQ
+ bool "touch irq use pin irq"
+ default n
+ endif
menuconfig RT_USING_HWCRYPTO
bool "Using Hardware Crypto drivers"
diff --git a/components/drivers/hwtimer/hwtimer.c b/components/drivers/hwtimer/hwtimer.c
index 3953919fae..976d8bbf32 100644
--- a/components/drivers/hwtimer/hwtimer.c
+++ b/components/drivers/hwtimer/hwtimer.c
@@ -10,6 +10,7 @@
#include <rtthread.h>
#include <rtdevice.h>
+#include <rthw.h>
rt_inline rt_uint32_t timeout_calc(rt_hwtimer_t *timer, rt_hwtimerval_t *tv)
{
@@ -144,19 +145,25 @@ static rt_size_t rt_hwtimer_read(struct rt_device *dev, rt_off_t pos, void *buff
rt_hwtimer_t *timer;
rt_hwtimerval_t tv;
rt_uint32_t cnt;
+ rt_base_t level;
+ rt_int32_t overflow;
float t;
timer = (rt_hwtimer_t *)dev;
if (timer->ops->count_get == RT_NULL)
return 0;
+ level = rt_hw_interrupt_disable();
cnt = timer->ops->count_get(timer);
+ overflow = timer->overflow;
+ rt_hw_interrupt_enable(level);
+
if (timer->info->cntmode == HWTIMER_CNTMODE_DW)
{
cnt = (timer->freq * timer->period_sec) - cnt;
}
- t = timer->overflow * timer->period_sec + cnt/(float)timer->freq;
+ t = overflow * timer->period_sec + cnt/(float)timer->freq;
tv.sec = t;
tv.usec = (t - tv.sec) * 1000000;
size = size > sizeof(tv)? sizeof(tv) : size;
diff --git a/components/drivers/sensors/SConscript b/components/drivers/sensors/SConscript
index 51c4b50eef..b56ae5ce6e 100644
--- a/components/drivers/sensors/SConscript
+++ b/components/drivers/sensors/SConscript
@@ -7,7 +7,7 @@ src = ['sensor.c']
CPPPATH = [cwd, cwd + '/../include']
if GetDepend('RT_USING_SENSOR_CMD'):
- src += ['sensor_cmd.c'];
+ src += ['sensor_cmd.c']
group = DefineGroup('Sensors', src, depend = ['RT_USING_SENSOR', 'RT_USING_DEVICE'], CPPPATH = CPPPATH)
diff --git a/components/drivers/touch/SConscript b/components/drivers/touch/SConscript
index f370b2aba6..6c2a126c9c 100644
--- a/components/drivers/touch/SConscript
+++ b/components/drivers/touch/SConscript
@@ -6,6 +6,6 @@ cwd = GetCurrentDir()
src = ['touch.c']
CPPPATH = [cwd, cwd + '/../include']
-group = DefineGroup('Touch', src, depend = ['RT_USING_TOUCH', 'RT_USING_DEVICE'], CPPPATH = CPPPATH)
+group = DefineGroup('DeviceDrivers', src, depend = ['RT_USING_TOUCH', 'RT_USING_DEVICE'], CPPPATH = CPPPATH)
Return('group')
diff --git a/components/drivers/touch/touch.c b/components/drivers/touch/touch.c
index 80ba6378bb..e9595e9f8f 100644
--- a/components/drivers/touch/touch.c
+++ b/components/drivers/touch/touch.c
@@ -16,12 +16,9 @@
#include <rtdbg.h>
/* ISR for touch interrupt */
-static void irq_callback(void *args)
+void rt_hw_touch_isr(rt_touch_t touch)
{
- rt_touch_t touch;
-
- touch = (rt_touch_t)args;
-
+ RT_ASSERT(touch);
if (touch->parent.rx_indicate == RT_NULL)
{
return;
@@ -35,9 +32,17 @@ static void irq_callback(void *args)
touch->parent.rx_indicate(&touch->parent, 1);
}
+#ifdef RT_TOUCH_PIN_IRQ
+static void touch_irq_callback(void *param)
+{
+ rt_hw_touch_isr((rt_touch_t)param);
+}
+#endif
+
/* touch interrupt initialization function */
static rt_err_t rt_touch_irq_init(rt_touch_t touch)
{
+#ifdef RT_TOUCH_PIN_IRQ
if (touch->config.irq_pin.pin == RT_PIN_NONE)
{
return -RT_EINVAL;
@@ -47,18 +52,19 @@ static rt_err_t rt_touch_irq_init(rt_touch_t touch)
if (touch->config.irq_pin.mode == PIN_MODE_INPUT_PULLDOWN)
{
- rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_RISING, irq_callback, (void *)touch);
+ rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_RISING, touch_irq_callback, (void *)touch);
}
else if (touch->config.irq_pin.mode == PIN_MODE_INPUT_PULLUP)
{
- rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_FALLING, irq_callback, (void *)touch);
+ rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_FALLING, touch_irq_callback, (void *)touch);
}
else if (touch->config.irq_pin.mode == PIN_MODE_INPUT)
{
- rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_RISING_FALLING, irq_callback, (void *)touch);
+ rt_pin_attach_irq(touch->config.irq_pin.pin, PIN_IRQ_MODE_RISING_FALLING, touch_irq_callback, (void *)touch);
}
rt_pin_irq_enable(touch->config.irq_pin.pin, PIN_IRQ_ENABLE);
+#endif
return RT_EOK;
}
@@ -66,19 +72,23 @@ static rt_err_t rt_touch_irq_init(rt_touch_t touch)
/* touch interrupt enable */
static void rt_touch_irq_enable(rt_touch_t touch)
{
+#ifdef RT_TOUCH_PIN_IRQ
if (touch->config.irq_pin.pin != RT_PIN_NONE)
{
rt_pin_irq_enable(touch->config.irq_pin.pin, RT_TRUE);
}
+#endif
}
/* touch interrupt disable */
static void rt_touch_irq_disable(rt_touch_t touch)
{
+#ifdef RT_TOUCH_PIN_IRQ
if (touch->config.irq_pin.pin != RT_PIN_NONE)
{
rt_pin_irq_enable(touch->config.irq_pin.pin, RT_FALSE);
}
+#endif
}
static rt_err_t rt_touch_open(rt_device_t dev, rt_uint16_t oflag)
diff --git a/components/drivers/touch/touch.h b/components/drivers/touch/touch.h
index c33fe17520..be12c24206 100644
--- a/components/drivers/touch/touch.h
+++ b/components/drivers/touch/touch.h
@@ -66,7 +66,9 @@ struct rt_touch_info
struct rt_touch_config
{
+#ifdef RT_TOUCH_PIN_IRQ
struct rt_device_pin_mode irq_pin; /* Interrupt pin, The purpose of this pin is to notification read data */
+#endif
char *dev_name; /* The name of the communication device */
void *user_data;
};
@@ -103,6 +105,9 @@ int rt_hw_touch_register(rt_touch_t touch,
rt_uint32_t flag,
void *data);
+/* if you doesn't use pin device. you must call this function in your touch irq callback */
+void rt_hw_touch_isr(rt_touch_t touch);
+
#ifdef __cplusplus
}
#endif
diff --git a/components/libc/aio/SConscript b/components/libc/aio/SConscript
index 175767100a..f10462e9c4 100644
--- a/components/libc/aio/SConscript
+++ b/components/libc/aio/SConscript
@@ -6,6 +6,6 @@ cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp')
CPPPATH = [cwd]
-group = DefineGroup('aio', src, depend = ['RT_USING_POSIX', 'RT_USING_POSIX_AIO'], CPPPATH = CPPPATH)
+group = DefineGroup('libc', src, depend = ['RT_USING_POSIX', 'RT_USING_POSIX_AIO'], CPPPATH = CPPPATH)
Return('group')
diff --git a/components/libc/compilers/dlib/SConscript b/components/libc/compilers/dlib/SConscript
index 456b762496..75a5812fab 100644
--- a/components/libc/compilers/dlib/SConscript
+++ b/components/libc/compilers/dlib/SConscript
@@ -20,7 +20,7 @@ if rtconfig.PLATFORM == 'iar':
if LooseVersion(IARVersion()) < LooseVersion("8.20.1"):
CPPDEFINES = CPPDEFINES + ['_DLIB_THREAD_SUPPORT']
- group = DefineGroup('dlib', src, depend = ['RT_USING_LIBC'],
+ group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'],
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
Return('group')
diff --git a/components/libc/compilers/newlib/SConscript b/components/libc/compilers/newlib/SConscript
index 06e5faad09..d0868bbdea 100644
--- a/components/libc/compilers/newlib/SConscript
+++ b/components/libc/compilers/newlib/SConscript
@@ -15,7 +15,7 @@ CPPDEFINES = ['RT_USING_NEWLIB']
LIBS = ['c', 'm']
if rtconfig.PLATFORM == 'gcc':
- group = DefineGroup('newlib', src, depend = ['RT_USING_LIBC'],
+ group = DefineGroup('libc', src, depend = ['RT_USING_LIBC'],
CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES, LIBS = LIBS)
Return('group')
diff --git a/components/libc/pthreads/SConscript b/components/libc/pthreads/SConscript
index e154ee0aa9..767b406d4c 100644
--- a/components/libc/pthreads/SConscript
+++ b/components/libc/pthreads/SConscript
@@ -16,7 +16,7 @@ try:
except :
pass
-group = DefineGroup('pthreads', src,
+group = DefineGroup('libc', src,
depend = ['RT_USING_PTHREADS', 'RT_USING_LIBC'], CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
Return('group')
diff --git a/components/libc/time/SConscript b/components/libc/time/SConscript
index 4ecd5d24bc..f7e6f7e8e9 100644
--- a/components/libc/time/SConscript
+++ b/components/libc/time/SConscript
@@ -6,7 +6,7 @@ cwd = GetCurrentDir()
src = Glob('*.c') + Glob('*.cpp')
CPPPATH = [cwd]
-group = DefineGroup('pthreads', src,
+group = DefineGroup('libc', src,
depend = ['RT_USING_PTHREADS'], CPPPATH = CPPPATH)
Return('group')
diff --git a/components/net/lwip-1.4.1/SConscript b/components/net/lwip-1.4.1/SConscript
index 8e3a4cb9d4..848e2d8255 100644
--- a/components/net/lwip-1.4.1/SConscript
+++ b/components/net/lwip-1.4.1/SConscript
@@ -82,6 +82,6 @@ if GetDepend(['RT_LWIP_PPP']):
if GetDepend(['RT_LWIP_USING_PING']):
src += Glob('src/apps/ping/ping.c')
-group = DefineGroup('LwIP', src, depend = ['RT_USING_LWIP', 'RT_USING_LWIP141'], CPPPATH = path)
+group = DefineGroup('lwIP', src, depend = ['RT_USING_LWIP', 'RT_USING_LWIP141'], CPPPATH = path)
Return('group')
diff --git a/components/net/lwip_nat/SConscript b/components/net/lwip_nat/SConscript
index ce684f677a..d8b95b1ce3 100644
--- a/components/net/lwip_nat/SConscript
+++ b/components/net/lwip_nat/SConscript
@@ -5,6 +5,6 @@ src = Glob('*.c')
CPPPATH = [cwd]
-group = DefineGroup('LwIP', src, depend = ['RT_USING_LWIP', 'LWIP_USING_NAT'], CPPPATH = CPPPATH)
+group = DefineGroup('lwIP', src, depend = ['RT_USING_LWIP', 'LWIP_USING_NAT'], CPPPATH = CPPPATH)
Return('group')
diff --git a/components/net/netdev/SConscript b/components/net/netdev/SConscript
index fca31a268b..ec1d2b2905 100644
--- a/components/net/netdev/SConscript
+++ b/components/net/netdev/SConscript
@@ -8,6 +8,6 @@ src = Glob('src/*.c')
CPPPATH = [cwd + '/include']
-group = DefineGroup('netdev', src, depend = ['RT_USING_NETDEV'], CPPPATH = CPPPATH)
+group = DefineGroup('SAL', src, depend = ['RT_USING_NETDEV'], CPPPATH = CPPPATH)
Return('group')
diff --git a/components/utilities/utest/SConscript b/components/utilities/utest/SConscript
index dc77bc2591..5d408ccbd0 100644
--- a/components/utilities/utest/SConscript
+++ b/components/utilities/utest/SConscript
@@ -3,6 +3,6 @@ from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]
-group = DefineGroup('utest', src, depend = ['RT_USING_UTEST'], CPPPATH = CPPPATH)
+group = DefineGroup('UTest', src, depend = ['RT_USING_UTEST'], CPPPATH = CPPPATH)
Return('group')