提交 923fb0c1 编写于 作者: mysterywolf's avatar mysterywolf 提交者: Bernard Xiong

[rtdef] re-implement RT_UNUSED

上级 d16ca48f
...@@ -205,11 +205,13 @@ rt_inline const struct pin_irq_map *get_pin_irq_map(uint32_t pinbit) ...@@ -205,11 +205,13 @@ rt_inline const struct pin_irq_map *get_pin_irq_map(uint32_t pinbit)
static rt_err_t at32_pin_attach_irq(struct rt_device *device, rt_int32_t pin, static rt_err_t at32_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
rt_uint32_t mode, void (*hdr)(void *args), void *args) rt_uint32_t mode, void (*hdr)(void *args), void *args)
{ {
RT_UNUSED GPIO_Type *gpio_port; GPIO_Type *gpio_port;
uint16_t gpio_pin; uint16_t gpio_pin;
rt_base_t level; rt_base_t level;
rt_int32_t irqindex = -1; rt_int32_t irqindex = -1;
RT_UNUSED(gpio_port);
if (PIN_PORT(pin) < PIN_ATPORT_MAX) if (PIN_PORT(pin) < PIN_ATPORT_MAX)
{ {
gpio_port = PIN_ATPORT(pin); gpio_port = PIN_ATPORT(pin);
...@@ -251,11 +253,13 @@ static rt_err_t at32_pin_attach_irq(struct rt_device *device, rt_int32_t pin, ...@@ -251,11 +253,13 @@ static rt_err_t at32_pin_attach_irq(struct rt_device *device, rt_int32_t pin,
static rt_err_t at32_pin_dettach_irq(struct rt_device *device, rt_int32_t pin) static rt_err_t at32_pin_dettach_irq(struct rt_device *device, rt_int32_t pin)
{ {
RT_UNUSED GPIO_Type *gpio_port; GPIO_Type *gpio_port;
uint16_t gpio_pin; uint16_t gpio_pin;
rt_base_t level; rt_base_t level;
rt_int32_t irqindex = -1; rt_int32_t irqindex = -1;
RT_UNUSED(gpio_port);
if (PIN_PORT(pin) < PIN_ATPORT_MAX) if (PIN_PORT(pin) < PIN_ATPORT_MAX)
{ {
gpio_port = PIN_ATPORT(pin); gpio_port = PIN_ATPORT(pin);
......
...@@ -62,10 +62,12 @@ void rt_hw_serial_init(void); ...@@ -62,10 +62,12 @@ void rt_hw_serial_init(void);
void rt_hw_uart_isr(struct rt_lpcserial* lpc_serial) void rt_hw_uart_isr(struct rt_lpcserial* lpc_serial)
{ {
RT_UNUSED rt_uint32_t iir; rt_uint32_t iir;
RT_ASSERT(lpc_serial != RT_NULL) RT_ASSERT(lpc_serial != RT_NULL)
RT_UNUSED(iir);
if (UART_LSR(lpc_serial->hw_base) & 0x01) if (UART_LSR(lpc_serial->hw_base) & 0x01)
{ {
rt_base_t level; rt_base_t level;
......
...@@ -62,11 +62,13 @@ void rt_hw_serial_init(void); ...@@ -62,11 +62,13 @@ void rt_hw_serial_init(void);
void rt_hw_uart_isr(int irqno, void *param) void rt_hw_uart_isr(int irqno, void *param)
{ {
RT_UNUSED rt_uint32_t iir; rt_uint32_t iir;
struct rt_lpcserial* lpc_serial = (struct rt_lpcserial*)param; struct rt_lpcserial* lpc_serial = (struct rt_lpcserial*)param;
RT_ASSERT(lpc_serial != RT_NULL) RT_ASSERT(lpc_serial != RT_NULL)
RT_UNUSED(iir);
if (UART_LSR(lpc_serial->hw_base) & 0x01) if (UART_LSR(lpc_serial->hw_base) & 0x01)
{ {
rt_base_t level; rt_base_t level;
......
...@@ -51,7 +51,9 @@ void rt_serial_handler(int vector, void *param) ...@@ -51,7 +51,9 @@ void rt_serial_handler(int vector, void *param)
{ {
//rt_kprintf("in rt_serial_handler\n"); //rt_kprintf("in rt_serial_handler\n");
rt_int32_t stat = *(RP)UART0_IIR ; rt_int32_t stat = *(RP)UART0_IIR ;
RT_UNUSED char c; char c;
RT_UNUSED(c);
/*Received data*/ /*Received data*/
if (((stat & 0x0E) >> 1) == 0x02) if (((stat & 0x0E) >> 1) == 0x02)
......
...@@ -263,11 +263,13 @@ static rt_err_t sd_readblock(rt_uint32_t address, rt_uint8_t *buf) ...@@ -263,11 +263,13 @@ static rt_err_t sd_readblock(rt_uint32_t address, rt_uint8_t *buf)
U32 complete, i; U32 complete, i;
rt_uint8_t temp; rt_uint8_t temp;
rt_err_t err; rt_err_t err;
RT_UNUSED rt_uint32_t discard; rt_uint32_t discard;
#ifdef USE_TIMEOUT #ifdef USE_TIMEOUT
rt_uint32_t to = 10; rt_uint32_t to = 10;
#endif #endif
RT_UNUSED(discard);
//rt_kprintf("in readblock:%x\n",address); //rt_kprintf("in readblock:%x\n",address);
//Clear all the errors & interrups //Clear all the errors & interrups
*(RP)DMAC_INTINTERRCLR |= 0x1; *(RP)DMAC_INTINTERRCLR |= 0x1;
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
* 2021-03-19 Meco Man add security devices * 2021-03-19 Meco Man add security devices
* 2021-05-10 armink change version number to v4.0.4 * 2021-05-10 armink change version number to v4.0.4
* 2021-11-19 Meco Man change version number to v4.1.0 * 2021-11-19 Meco Man change version number to v4.1.0
* 2021-12-21 Meco Man re-implement RT_UNUSED
*/ */
#ifndef __RT_DEF_H__ #ifndef __RT_DEF_H__
...@@ -118,14 +119,14 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -118,14 +119,14 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define __CLANG_ARM #define __CLANG_ARM
#endif #endif
#define RT_UNUSED(x) ((void)x)
/* Compiler Related Definitions */ /* Compiler Related Definitions */
#if defined(__CC_ARM) || defined(__CLANG_ARM) /* ARM Compiler */ #if defined(__CC_ARM) || defined(__CLANG_ARM) /* ARM Compiler */
#include <stdarg.h> #include <stdarg.h>
#define RT_SECTION(x) __attribute__((section(x))) #define RT_SECTION(x) __attribute__((section(x)))
#define RT_UNUSED __attribute__((unused))
#define RT_USED __attribute__((used)) #define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n))) #define ALIGN(n) __attribute__((aligned(n)))
#define RT_WEAK __attribute__((weak)) #define RT_WEAK __attribute__((weak))
#define rt_inline static __inline #define rt_inline static __inline
/* module compiling */ /* module compiling */
...@@ -133,19 +134,16 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -133,19 +134,16 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define RTT_API __declspec(dllimport) #define RTT_API __declspec(dllimport)
#else #else
#define RTT_API __declspec(dllexport) #define RTT_API __declspec(dllexport)
#endif #endif /* RT_USING_MODULE */
#elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */ #elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */
#include <stdarg.h> #include <stdarg.h>
#define RT_SECTION(x) @ x #define RT_SECTION(x) @ x
#define RT_UNUSED
#define RT_USED __root #define RT_USED __root
#define PRAGMA(x) _Pragma(#x) #define PRAGMA(x) _Pragma(#x)
#define ALIGN(n) PRAGMA(data_alignment=n) #define ALIGN(n) PRAGMA(data_alignment=n)
#define RT_WEAK __weak #define RT_WEAK __weak
#define rt_inline static inline #define rt_inline static inline
#define RTT_API #define RTT_API
#elif defined (__GNUC__) /* GNU GCC Compiler */ #elif defined (__GNUC__) /* GNU GCC Compiler */
#ifdef RT_USING_NEWLIB #ifdef RT_USING_NEWLIB
#include <stdarg.h> #include <stdarg.h>
...@@ -156,10 +154,8 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -156,10 +154,8 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define va_start(v,l) __builtin_va_start(v,l) #define va_start(v,l) __builtin_va_start(v,l)
#define va_end(v) __builtin_va_end(v) #define va_end(v) __builtin_va_end(v)
#define va_arg(v,l) __builtin_va_arg(v,l) #define va_arg(v,l) __builtin_va_arg(v,l)
#endif #endif /* RT_USING_NEWLIB */
#define RT_SECTION(x) __attribute__((section(x))) #define RT_SECTION(x) __attribute__((section(x)))
#define RT_UNUSED __attribute__((unused))
#define RT_USED __attribute__((used)) #define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n))) #define ALIGN(n) __attribute__((aligned(n)))
#define RT_WEAK __attribute__((weak)) #define RT_WEAK __attribute__((weak))
...@@ -168,7 +164,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -168,7 +164,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#elif defined (__ADSPBLACKFIN__) /* for VisualDSP++ Compiler */ #elif defined (__ADSPBLACKFIN__) /* for VisualDSP++ Compiler */
#include <stdarg.h> #include <stdarg.h>
#define RT_SECTION(x) __attribute__((section(x))) #define RT_SECTION(x) __attribute__((section(x)))
#define RT_UNUSED __attribute__((unused))
#define RT_USED __attribute__((used)) #define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n))) #define ALIGN(n) __attribute__((aligned(n)))
#define RT_WEAK __attribute__((weak)) #define RT_WEAK __attribute__((weak))
...@@ -177,7 +172,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -177,7 +172,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#elif defined (_MSC_VER) #elif defined (_MSC_VER)
#include <stdarg.h> #include <stdarg.h>
#define RT_SECTION(x) #define RT_SECTION(x)
#define RT_UNUSED
#define RT_USED #define RT_USED
#define ALIGN(n) __declspec(align(n)) #define ALIGN(n) __declspec(align(n))
#define RT_WEAK #define RT_WEAK
...@@ -189,7 +183,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -189,7 +183,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
* GCC and MDK) compilers. See ARM Optimizing C/C++ Compiler 5.9.3 for more * GCC and MDK) compilers. See ARM Optimizing C/C++ Compiler 5.9.3 for more
* details. */ * details. */
#define RT_SECTION(x) #define RT_SECTION(x)
#define RT_UNUSED
#define RT_USED #define RT_USED
#define PRAGMA(x) _Pragma(#x) #define PRAGMA(x) _Pragma(#x)
#define ALIGN(n) #define ALIGN(n)
...@@ -199,7 +192,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */ ...@@ -199,7 +192,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#elif defined (__TASKING__) #elif defined (__TASKING__)
#include <stdarg.h> #include <stdarg.h>
#define RT_SECTION(x) __attribute__((section(x))) #define RT_SECTION(x) __attribute__((section(x)))
#define RT_UNUSED __attribute__((unused))
#define RT_USED __attribute__((used, protect)) #define RT_USED __attribute__((used, protect))
#define PRAGMA(x) _Pragma(#x) #define PRAGMA(x) _Pragma(#x)
#define ALIGN(n) __attribute__((__align(n))) #define ALIGN(n) __attribute__((__align(n)))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册