diff options
| author | thread-liu <[email protected]> | 2020-12-11 18:08:56 +0800 |
|---|---|---|
| committer | thread-liu <[email protected]> | 2020-12-11 18:08:56 +0800 |
| commit | 3ab2d4fb1ff4779a59f2fa3e2f8168582e617626 (patch) | |
| tree | 7e97747d70dd1691135b22135be97f423064e0a2 /components | |
| parent | a06f1fa627564ce9f1059047e4c484141354e252 (diff) | |
| parent | 42088b010a3eccd099fe96956196ed62ffd5fbf5 (diff) | |
Merge branch 'master' of https://github.com/RT-Thread/rt-thread into step4-ev1
Diffstat (limited to 'components')
| -rwxr-xr-x | components/drivers/Kconfig | 2 | ||||
| -rw-r--r-- | components/drivers/audio/audio_pipe.c | 1 | ||||
| -rw-r--r-- | components/drivers/i2c/i2c-bit-ops.c | 14 | ||||
| -rw-r--r-- | components/drivers/include/drivers/i2c.h | 12 | ||||
| -rw-r--r-- | components/net/netdev/src/netdev.c | 2 |
5 files changed, 25 insertions, 6 deletions
diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig index db4455160e..198f1bbbf8 100755 --- a/components/drivers/Kconfig +++ b/components/drivers/Kconfig @@ -97,7 +97,7 @@ if RT_USING_I2C default y if RT_USING_I2C_BITOPS - config RT_I2C_BITOPS_DEBUG + config RT_I2C_BITOPS_DEBUG bool "Use simulate I2C debug message" default n endif diff --git a/components/drivers/audio/audio_pipe.c b/components/drivers/audio/audio_pipe.c index 0a6f090a83..e9de1ffb74 100644 --- a/components/drivers/audio/audio_pipe.c +++ b/components/drivers/audio/audio_pipe.c @@ -9,6 +9,7 @@ */ #include <rthw.h> +#include <rtdevice.h> #include "audio_pipe.h" static void _rt_pipe_resume_writer(struct rt_audio_pipe *pipe) diff --git a/components/drivers/i2c/i2c-bit-ops.c b/components/drivers/i2c/i2c-bit-ops.c index 99338eef54..96af567a1e 100644 --- a/components/drivers/i2c/i2c-bit-ops.c +++ b/components/drivers/i2c/i2c-bit-ops.c @@ -375,8 +375,6 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, rt_int32_t i, ret; rt_uint16_t ignore_nack; - LOG_D("send start condition"); - i2c_start(ops); for (i = 0; i < num; i++) { msg = &msgs[i]; @@ -387,6 +385,11 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, { i2c_restart(ops); } + else + { + LOG_D("send start condition"); + i2c_start(ops); + } ret = i2c_bit_send_address(bus, msg); if ((ret != RT_EOK) && !ignore_nack) { @@ -423,8 +426,11 @@ static rt_size_t i2c_bit_xfer(struct rt_i2c_bus_device *bus, ret = i; out: - LOG_D("send stop condition"); - i2c_stop(ops); + if (!(msg->flags & RT_I2C_NO_STOP)) + { + LOG_D("send stop condition"); + i2c_stop(ops); + } return ret; } diff --git a/components/drivers/include/drivers/i2c.h b/components/drivers/include/drivers/i2c.h index 17d57288cd..d93e82fc2b 100644 --- a/components/drivers/include/drivers/i2c.h +++ b/components/drivers/include/drivers/i2c.h @@ -23,6 +23,7 @@ extern "C" { #define RT_I2C_NO_START (1u << 4) #define RT_I2C_IGNORE_NACK (1u << 5) #define RT_I2C_NO_READ_ACK (1u << 6) /* when I2C reading, we do not ACK */ +#define RT_I2C_NO_STOP (1u << 7) struct rt_i2c_msg { @@ -83,6 +84,17 @@ rt_size_t rt_i2c_master_recv(struct rt_i2c_bus_device *bus, rt_uint16_t flags, rt_uint8_t *buf, rt_uint32_t count); + +rt_inline rt_err_t rt_i2c_bus_lock(struct rt_i2c_bus_device *bus, rt_tick_t timeout) +{ + return rt_mutex_take(&bus->lock, timeout); +} + +rt_inline rt_err_t rt_i2c_bus_unlock(struct rt_i2c_bus_device *bus) +{ + return rt_mutex_release(&bus->lock); +} + int rt_i2c_core_init(void); #ifdef __cplusplus diff --git a/components/net/netdev/src/netdev.c b/components/net/netdev/src/netdev.c index 646d2dfdd1..04bf6e8ad7 100644 --- a/components/net/netdev/src/netdev.c +++ b/components/net/netdev/src/netdev.c @@ -887,7 +887,7 @@ static void netdev_list_if(void) rt_kprintf("%02x ", netdev->hwaddr[index]); } } - else if (netdev->hwaddr_len == NETDEV_IFCONFIG_IEMI_MAX_LEN) + else if (netdev->hwaddr_len == NETDEV_IFCONFIG_IMEI_MAX_LEN) { rt_kprintf("IMEI: "); for (index = 0; index < netdev->hwaddr_len; index++) |
