summaryrefslogtreecommitdiff
path: root/include/rtdef.h
diff options
context:
space:
mode:
authorguo <[email protected]>2021-09-28 10:36:54 +0800
committerGitHub <[email protected]>2021-09-28 10:36:54 +0800
commit55a302cd092758a44b589d65470a69d9e8ae4ced (patch)
treee60fc53994c426007e9eb4877e5bd123f124ef39 /include/rtdef.h
parent00727d6b6db92dc1cf98f028f26fd6168594b905 (diff)
parent00d42ef73cff61ecda7ff006b077a73e1a4ff669 (diff)
Merge branch 'master' into usbh_construct
Diffstat (limited to 'include/rtdef.h')
-rw-r--r--include/rtdef.h78
1 files changed, 55 insertions, 23 deletions
diff --git a/include/rtdef.h b/include/rtdef.h
index 0256601949..3f5f4c5ef9 100644
--- a/include/rtdef.h
+++ b/include/rtdef.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006-2018, RT-Thread Development Team
+ * Copyright (c) 2006-2021, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
@@ -34,6 +34,8 @@
* 2019-12-20 Bernard change version number to v4.0.3
* 2020-08-10 Meco Man add macro for struct rt_device_ops
* 2020-10-23 Meco Man define maximum value of ipc type
+ * 2021-03-19 Meco Man add security devices
+ * 2021-05-10 armink change version number to v4.0.4
*/
#ifndef __RT_DEF_H__
@@ -55,7 +57,7 @@ extern "C" {
/* RT-Thread version information */
#define RT_VERSION 4L /**< major version number */
#define RT_SUBVERSION 0L /**< minor version number */
-#define RT_REVISION 3L /**< revise version number */
+#define RT_REVISION 4L /**< revise version number */
/* RT-Thread version */
#define RTTHREAD_VERSION ((RT_VERSION * 10000) + \
@@ -193,17 +195,15 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define rt_inline static inline
#define RTT_API
#elif defined (__TASKING__)
-
#include <stdarg.h>
- #define RT_SECTION(x)
- #define RT_UNUSED
- #define RT_USED
+ #define RT_SECTION(x) __attribute__((section(x)))
+ #define RT_UNUSED __attribute__((unused))
+ #define RT_USED __attribute__((used, protect))
#define PRAGMA(x) _Pragma(#x)
- #define ALIGN(n)
- #define RT_WEAK
+ #define ALIGN(n) __attribute__((__align(n)))
+ #define RT_WEAK __attribute__((weak))
#define rt_inline static inline
#define RTT_API
-
#else
#error not supported tool chain
#endif
@@ -212,7 +212,32 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#ifdef RT_USING_COMPONENTS_INIT
typedef int (*init_fn_t)(void);
#ifdef _MSC_VER /* we do not support MS VC++ compiler */
- #define INIT_EXPORT(fn, level)
+#pragma section("rti_fn$f",read)
+ #if RT_DEBUG_INIT
+ struct rt_init_desc
+ {
+ const char* level;
+ const init_fn_t fn;
+ const char* fn_name;
+ };
+ #define INIT_EXPORT(fn, level) \
+ const char __rti_level_##fn[] = level"__rt_init_"#fn; \
+ const char __rti_##fn##_name[] = #fn; \
+ __declspec(allocate("rti_fn$f")) \
+ RT_USED const struct rt_init_desc __rt_init_msc_##fn = \
+ {__rti_level_##fn, fn, __rti_##fn##_name};
+ #else
+ struct rt_init_desc
+ {
+ const char* level;
+ const init_fn_t fn;
+ };
+ #define INIT_EXPORT(fn, level) \
+ const char __rti_level_##fn[] = level"__rt_init_"#fn; \
+ __declspec(allocate("rti_fn$f")) \
+ RT_USED const struct rt_init_desc __rt_init_msc_##fn = \
+ {__rti_level_##fn, fn };
+ #endif
#else
#if RT_DEBUG_INIT
struct rt_init_desc
@@ -252,7 +277,6 @@ typedef int (*init_fn_t)(void);
/* define these to empty, even if not include finsh.h file */
#define FINSH_FUNCTION_EXPORT(name, desc)
#define FINSH_FUNCTION_EXPORT_ALIAS(name, alias, desc)
-#define FINSH_VAR_EXPORT(name, type, desc)
#define MSH_CMD_EXPORT(command, desc)
#define MSH_CMD_EXPORT_ALIAS(command, alias, desc)
@@ -486,7 +510,7 @@ typedef struct rt_timer *rt_timer_t;
* @addtogroup Signal
*/
#ifdef RT_USING_SIGNALS
-#include <libc/libc_signal.h>
+#include <sys/signal.h>
typedef unsigned long rt_sigset_t;
typedef void (*rt_sighandler_t)(int signo);
typedef siginfo_t rt_siginfo_t;
@@ -543,6 +567,10 @@ typedef siginfo_t rt_siginfo_t;
#define RT_SCHEDULE_IPI 0
#endif
+#ifndef RT_STOP_IPI
+#define RT_STOP_IPI 1
+#endif
+
/**
* CPUs definitions
*
@@ -635,6 +663,10 @@ struct rt_thread
rt_ubase_t init_tick; /**< thread's initialized tick */
rt_ubase_t remaining_tick; /**< remaining tick */
+#ifdef RT_USING_CPU_USAGE
+ rt_uint64_t duration_tick; /**< cpu usage tick */
+#endif
+
struct rt_timer thread_timer; /**< built-in thread timer */
void (*cleanup)(struct rt_thread *tid); /**< cleanup function when thread exit */
@@ -802,6 +834,9 @@ struct rt_memheap_item
struct rt_memheap_item *next_free; /**< next free memheap item */
struct rt_memheap_item *prev_free; /**< prev free memheap item */
+#ifdef RT_USING_MEMTRACE
+ rt_uint8_t owner_thread_name[4]; /**< owner thread name */
+#endif
};
/**
@@ -873,6 +908,7 @@ enum rt_device_class_type
RT_Device_Class_I2CBUS, /**< I2C bus device */
RT_Device_Class_USBDevice, /**< USB slave device */
RT_Device_Class_USBHost, /**< USB host bus */
+ RT_Device_Class_USBOTG, /**< USB OTG bus */
RT_Device_Class_SPIBUS, /**< SPI bus device */
RT_Device_Class_SPIDevice, /**< SPI device */
RT_Device_Class_SDIO, /**< SDIO bus device */
@@ -884,6 +920,7 @@ enum rt_device_class_type
RT_Device_Class_Sensor, /**< Sensor device */
RT_Device_Class_Touch, /**< Touch device */
RT_Device_Class_PHY, /**< PHY device */
+ RT_Device_Class_Security, /**< Security device */
RT_Device_Class_Unknown /**< unknown device */
};
@@ -936,10 +973,6 @@ enum rt_device_class_type
#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 */
typedef struct rt_device *rt_device_t;
@@ -1041,6 +1074,10 @@ struct rt_device_blk_sectors
#define RTGRAPHIC_CTRL_GET_INFO 3
#define RTGRAPHIC_CTRL_SET_MODE 4
#define RTGRAPHIC_CTRL_GET_EXT 5
+#define RTGRAPHIC_CTRL_SET_BRIGHTNESS 6
+#define RTGRAPHIC_CTRL_GET_BRIGHTNESS 7
+#define RTGRAPHIC_CTRL_GET_MODE 8
+#define RTGRAPHIC_CTRL_GET_STATUS 9
/* graphic deice */
enum
@@ -1057,9 +1094,7 @@ enum
RTGRAPHIC_PIXEL_FORMAT_RGB888,
RTGRAPHIC_PIXEL_FORMAT_ARGB888,
RTGRAPHIC_PIXEL_FORMAT_ABGR888,
- RTGRAPHIC_PIXEL_FORMAT_ARGB565,
- RTGRAPHIC_PIXEL_FORMAT_ALPHA,
- RTGRAPHIC_PIXEL_FORMAT_COLOR,
+ RTGRAPHIC_PIXEL_FORMAT_RESERVED,
};
/**
@@ -1074,7 +1109,7 @@ struct rt_device_graphic_info
{
rt_uint8_t pixel_format; /**< graphic format */
rt_uint8_t bits_per_pixel; /**< bits per pixel */
- rt_uint16_t reserved; /**< reserved field */
+ rt_uint16_t pitch; /**< bytes per line */
rt_uint16_t width; /**< width of graphic device */
rt_uint16_t height; /**< height of graphic device */
@@ -1111,9 +1146,6 @@ struct rt_device_graphic_ops
/**@}*/
#endif
-/* definitions for libc */
-#include "rtlibc.h"
-
#ifdef __cplusplus
}
#endif