From b40c887b3ceec53463193d0dbe85306644769cf9 Mon Sep 17 00:00:00 2001 From: BernardXiong Date: Tue, 1 Feb 2022 16:46:05 +0800 Subject: [PATCH 1/2] Add smart extension setting file --- bsp/imx6ull-artpi-smart/.vscode/smart.json | 57 ++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 bsp/imx6ull-artpi-smart/.vscode/smart.json diff --git a/bsp/imx6ull-artpi-smart/.vscode/smart.json b/bsp/imx6ull-artpi-smart/.vscode/smart.json new file mode 100644 index 0000000000..eaacde0854 --- /dev/null +++ b/bsp/imx6ull-artpi-smart/.vscode/smart.json @@ -0,0 +1,57 @@ +{ + "env": { + "windows": { + "VENV_MODE": true, + "RTT_CC": "gcc", + "RTT_CC_PREFIX": "arm-linux-musleabi-", + "RTT_EXEC_PATH": "${SDK_ROOT}/tools/gnu_gcc/arm-linux-musleabi_for_i686-w64-mingw32/bin", + "PATH": "%RTT_EXEC_PATH%;%ENV_ROOT%/tools/gnu_gcc/arm_gcc/mingw/bin;%PATH%" + }, + "linux": { + "RTT_CC": "gcc", + "RTT_CC_PREFIX": "arm-linux-musleabi-", + "RTT_EXEC_PATH": "${SDK_ROOT}/tools/gnu_gcc/arm-linux-musleabi_for_x86_64-pc-linux-gnu/bin", + "PATH": "$PATH:$RTT_EXEC_PATH" + } + }, + "statusBarItem": { + "build": { + "icon": "$(zap)", + "enable": true, + "commands": [ + "scons -j 8" + ], + "label": "编译", + "tooltip": "编译 RT-Thread Smart 工程" + }, + "clean": { + "icon": "$(clear-all)", + "enable": true, + "commands": [ + "scons -c" + ], + "label": "清理", + "tooltip": "清理 RT-Thread Smart 工程" + }, + "download": { + "icon": "$(cloud-download)", + "enable": true, + "commands": [ + "udb tcp ${SERVER_IP} 5555", + "udb devices", + "udb push ${EXECUTABLE_PROGRAM} ${TARGET_PATH}" + ], + "label": "下载", + "tooltip": "下载 RT-Thread Smart 工程" + }, + "refresh": { + "icon": "$(sync)", + "enable": true, + "commands": [ + "scons --target=vsc -s" + ], + "label": "刷新 ", + "tooltip": "刷新工程" + } + } +} \ No newline at end of file -- Gitee From fc1faa123d4e0869de2cb8c551cc31da09d16bfd Mon Sep 17 00:00:00 2001 From: BernardXiong Date: Tue, 15 Mar 2022 15:00:28 +0800 Subject: [PATCH 2/2] [DeviceDrivers] change RT_DEVICE_CTRL_RTC_* to rtc.h --- components/drivers/Kconfig | 4 ++ components/drivers/include/drivers/lcd.h | 70 ++++++++++++++++++++++++ components/drivers/include/drivers/rtc.h | 10 +++- components/drivers/include/rtdevice.h | 4 ++ components/drivers/rtc/rtc.c | 7 ++- components/libc/compilers/musl/time.c | 2 +- components/libc/time/clock_time.c | 2 +- include/rtdef.h | 34 ++++++------ 8 files changed, 110 insertions(+), 23 deletions(-) create mode 100644 components/drivers/include/drivers/lcd.h diff --git a/components/drivers/Kconfig b/components/drivers/Kconfig index 8e6a17eef5..7f29aa251f 100755 --- a/components/drivers/Kconfig +++ b/components/drivers/Kconfig @@ -318,6 +318,10 @@ config RT_USING_TOUCH bool "Using Touch device drivers" default n +config RT_USING_LCD + bool "Using LCD graphic drivers" + default n + menuconfig RT_USING_HWCRYPTO bool "Using Hardware Crypto drivers" default n diff --git a/components/drivers/include/drivers/lcd.h b/components/drivers/include/drivers/lcd.h new file mode 100644 index 0000000000..d05105f101 --- /dev/null +++ b/components/drivers/include/drivers/lcd.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2006-2022, RT-Thread Development Team + * + * SPDX-License-Identifier: Apache-2.0 + * + * Change Logs: + * Date Author Notes + * 2022-03-05 bernard first version. + */ + +#ifndef RT_LCD_H__ +#define RT_LCD_H__ + +/* ioctls + 0x46 is 'F' */ + +#define FBIOGET_VSCREENINFO 0x4600 +#define FBIOPUT_VSCREENINFO 0x4601 +#define FBIOGET_FSCREENINFO 0x4602 +#define FBIOGETCMAP 0x4604 +#define FBIOPUTCMAP 0x4605 +#define FBIOPAN_DISPLAY 0x4606 +#define FBIO_CURSOR 0x4608 +/* #define FBIOGET_MONITORSPEC 0x460C */ +/* #define FBIOPUT_MONITORSPEC 0x460D */ +/* #define FBIOSWITCH_MONIBIT 0x460E */ + +#define FBIOGET_CON2FBMAP 0x460F +#define FBIOPUT_CON2FBMAP 0x4610 +#define FBIOBLANK 0x4611 /* arg: 0 or vesa level + 1 */ +#define FBIOGET_VBLANK 0x4612 +#define FBIO_ALLOC 0x4613 +#define FBIO_FREE 0x4614 +#define FBIOGET_GLYPH 0x4615 +#define FBIOGET_HWCINFO 0x4616 +#define FBIOPUT_MODEINFO 0x4617 +#define FBIOGET_DISPINFO 0x4618 +#define FBIO_WAITFORVSYNC 0x4620 + +struct fb_bitfield +{ + uint32_t offset; /* beginning of bitfield */ + uint32_t length; /* length of bitfield */ + uint32_t msb_right; /* != 0 : Most significant bit is */ + /* right */ +}; + +struct fb_var_screeninfo +{ + uint32_t xres; + uint32_t yres; + + uint32_t bits_per_pixel; + + struct fb_bitfield red; /* bitfield in fb mem if true color, */ + struct fb_bitfield green; /* else only length is significant */ + struct fb_bitfield blue; + struct fb_bitfield transp; /* transparency */ +}; + +struct fb_fix_screeninfo +{ + char id[16]; + unsigned long smem_start; + uint32_t smem_len; + + uint32_t line_length; +}; + +#endif diff --git a/components/drivers/include/drivers/rtc.h b/components/drivers/include/drivers/rtc.h index 1cd88a7be3..d3ac279273 100644 --- a/components/drivers/include/drivers/rtc.h +++ b/components/drivers/include/drivers/rtc.h @@ -8,8 +8,14 @@ * 2012-10-10 aozima first version. */ -#ifndef __RTC_H__ -#define __RTC_H__ +#ifndef RTC_H__ +#define RTC_H__ + +/* RTC device */ +#define RT_DEVICE_CTRL_RTC_GET_TIME 0x40 /**< get time */ +#define RT_DEVICE_CTRL_RTC_SET_TIME 0x41 /**< set time */ +#define RT_DEVICE_CTRL_RTC_GET_ALARM 0x42 /**< get alarm */ +#define RT_DEVICE_CTRL_RTC_SET_ALARM 0x43 /**< set alarm */ rt_err_t set_date(rt_uint32_t year, rt_uint32_t month, rt_uint32_t day); rt_err_t set_time(rt_uint32_t hour, rt_uint32_t minute, rt_uint32_t second); diff --git a/components/drivers/include/rtdevice.h b/components/drivers/include/rtdevice.h index f0fa2f5b4a..57c55fa038 100644 --- a/components/drivers/include/rtdevice.h +++ b/components/drivers/include/rtdevice.h @@ -143,6 +143,10 @@ extern "C" { #include "drivers/rt_inputcapture.h" #endif +#ifdef RT_USING_LCD +#include "drivers/lcd.h" +#endif + #ifdef __cplusplus } #endif diff --git a/components/drivers/rtc/rtc.c b/components/drivers/rtc/rtc.c index 361488f991..f8e8a43690 100644 --- a/components/drivers/rtc/rtc.c +++ b/components/drivers/rtc/rtc.c @@ -11,12 +11,13 @@ * 2018-02-16 armink add auto sync time by NTP */ -#include -#include -#include +#include #ifdef RT_USING_RTC +#include +#include + /* Using NTP auto sync RTC time */ #ifdef RTC_SYNC_USING_NTP /* NTP first sync delay time for network connect, unit: second */ diff --git a/components/libc/compilers/musl/time.c b/components/libc/compilers/musl/time.c index 5a4e89f50f..55a8fc4c42 100644 --- a/components/libc/compilers/musl/time.c +++ b/components/libc/compilers/musl/time.c @@ -7,7 +7,7 @@ * Date Author Notes */ #include -#include +#include #ifdef RT_USING_DEVICE int gettimeofday(struct timeval *tp, void *ignore) diff --git a/components/libc/time/clock_time.c b/components/libc/time/clock_time.c index 4a9e06ddea..6cfb8a2eb9 100644 --- a/components/libc/time/clock_time.c +++ b/components/libc/time/clock_time.c @@ -9,7 +9,7 @@ * which found by Rob */ -#include +#include #include "clock_time.h" static struct timeval _timevalue; diff --git a/include/rtdef.h b/include/rtdef.h index 89638b4618..8d0e954c34 100644 --- a/include/rtdef.h +++ b/include/rtdef.h @@ -1029,32 +1029,34 @@ enum rt_device_class_type /** * general device commands + * 0x01 - 0x1F general device control commands + * 0x20 - 0x3F udevice control commands + * 0x40 - special device control commands */ #define RT_DEVICE_CTRL_RESUME 0x01 /**< resume device */ #define RT_DEVICE_CTRL_SUSPEND 0x02 /**< suspend device */ #define RT_DEVICE_CTRL_CONFIG 0x03 /**< configure device */ #define RT_DEVICE_CTRL_CLOSE 0x04 /**< close device */ #define RT_DEVICE_CTRL_NOTIFY_SET 0x05 /**< set notify func */ -#define RT_DEVICE_CTRL_CONSOLE_OFLAG 0x06 /**< get console open flag */ - -#define RT_DEVICE_CTRL_SET_INT 0x10 /**< set interrupt */ -#define RT_DEVICE_CTRL_CLR_INT 0x11 /**< clear interrupt */ -#define RT_DEVICE_CTRL_GET_INT 0x12 /**< get interrupt status */ +#define RT_DEVICE_CTRL_SET_INT 0x06 /**< set interrupt */ +#define RT_DEVICE_CTRL_CLR_INT 0x07 /**< clear interrupt */ +#define RT_DEVICE_CTRL_GET_INT 0x08 /**< get interrupt status */ +#define RT_DEVICE_CTRL_MASK 0x1f /**< mask for contrl commands */ /** * special device commands */ -#define RT_DEVICE_CTRL_CHAR_STREAM 0x10 /**< stream mode on char device */ -#define RT_DEVICE_CTRL_BLK_GETGEOME 0x10 /**< get geometry information */ -#define RT_DEVICE_CTRL_BLK_SYNC 0x11 /**< flush data to block device */ -#define RT_DEVICE_CTRL_BLK_ERASE 0x12 /**< erase block on block device */ -#define RT_DEVICE_CTRL_BLK_AUTOREFRESH 0x13 /**< block device : enter/exit auto refresh mode */ -#define RT_DEVICE_CTRL_NETIF_GETMAC 0x10 /**< get mac address */ -#define RT_DEVICE_CTRL_MTD_FORMAT 0x10 /**< format a MTD device */ -#define RT_DEVICE_CTRL_RTC_GET_TIME 0x10 /**< get time */ -#define RT_DEVICE_CTRL_RTC_SET_TIME 0x11 /**< set time */ -#define RT_DEVICE_CTRL_RTC_GET_ALARM 0x12 /**< get alarm */ -#define RT_DEVICE_CTRL_RTC_SET_ALARM 0x13 /**< set alarm */ +/* console device */ +#define RT_DEVICE_CTRL_CONSOLE_OFLAG 0x40 /**< get console open flag */ +/* character device */ +#define RT_DEVICE_CTRL_CHAR_STREAM 0x40 /**< stream mode on char device */ +/* block device */ +#define RT_DEVICE_CTRL_BLK_GETGEOME 0x40 /**< get geometry information */ +#define RT_DEVICE_CTRL_BLK_SYNC 0x41 /**< flush data to block device */ +#define RT_DEVICE_CTRL_BLK_ERASE 0x42 /**< erase block on block device */ +#define RT_DEVICE_CTRL_BLK_AUTOREFRESH 0x43 /**< block device : enter/exit auto refresh mode */ +/* net interface device*/ +#define RT_DEVICE_CTRL_NETIF_GETMAC 0x40 /**< get mac address */ typedef struct rt_device *rt_device_t; -- Gitee