[rtdef] re-implement RT_UNUSED

This commit is contained in:
Meco Man 2021-12-21 12:25:30 -05:00 committed by Bernard Xiong
parent d16ca48f90
commit 923fb0c146
6 changed files with 23 additions and 19 deletions

View File

@ -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,
rt_uint32_t mode, void (*hdr)(void *args), void *args)
{
RT_UNUSED GPIO_Type *gpio_port;
GPIO_Type *gpio_port;
uint16_t gpio_pin;
rt_base_t level;
rt_int32_t irqindex = -1;
RT_UNUSED(gpio_port);
if (PIN_PORT(pin) < PIN_ATPORT_MAX)
{
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,
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;
rt_base_t level;
rt_int32_t irqindex = -1;
RT_UNUSED(gpio_port);
if (PIN_PORT(pin) < PIN_ATPORT_MAX)
{
gpio_port = PIN_ATPORT(pin);

View File

@ -62,10 +62,12 @@ void rt_hw_serial_init(void);
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_UNUSED(iir);
if (UART_LSR(lpc_serial->hw_base) & 0x01)
{
rt_base_t level;

View File

@ -62,11 +62,13 @@ void rt_hw_serial_init(void);
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;
RT_ASSERT(lpc_serial != RT_NULL)
RT_UNUSED(iir);
if (UART_LSR(lpc_serial->hw_base) & 0x01)
{
rt_base_t level;

View File

@ -51,7 +51,9 @@ void rt_serial_handler(int vector, void *param)
{
//rt_kprintf("in rt_serial_handler\n");
rt_int32_t stat = *(RP)UART0_IIR ;
RT_UNUSED char c;
char c;
RT_UNUSED(c);
/*Received data*/
if (((stat & 0x0E) >> 1) == 0x02)

View File

@ -263,11 +263,13 @@ static rt_err_t sd_readblock(rt_uint32_t address, rt_uint8_t *buf)
U32 complete, i;
rt_uint8_t temp;
rt_err_t err;
RT_UNUSED rt_uint32_t discard;
rt_uint32_t discard;
#ifdef USE_TIMEOUT
rt_uint32_t to = 10;
#endif
RT_UNUSED(discard);
//rt_kprintf("in readblock:%x\n",address);
//Clear all the errors & interrups
*(RP)DMAC_INTINTERRCLR |= 0x1;

View File

@ -37,6 +37,7 @@
* 2021-03-19 Meco Man add security devices
* 2021-05-10 armink change version number to v4.0.4
* 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__
@ -118,14 +119,14 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define __CLANG_ARM
#endif
#define RT_UNUSED(x) ((void)x)
/* Compiler Related Definitions */
#if defined(__CC_ARM) || defined(__CLANG_ARM) /* ARM Compiler */
#include <stdarg.h>
#define RT_SECTION(x) __attribute__((section(x)))
#define RT_UNUSED __attribute__((unused))
#define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define RT_WEAK __attribute__((weak))
#define rt_inline static __inline
/* module compiling */
@ -133,19 +134,16 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#define RTT_API __declspec(dllimport)
#else
#define RTT_API __declspec(dllexport)
#endif
#endif /* RT_USING_MODULE */
#elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */
#include <stdarg.h>
#define RT_SECTION(x) @ x
#define RT_UNUSED
#define RT_USED __root
#define PRAGMA(x) _Pragma(#x)
#define ALIGN(n) PRAGMA(data_alignment=n)
#define RT_WEAK __weak
#define rt_inline static inline
#define RTT_API
#elif defined (__GNUC__) /* GNU GCC Compiler */
#ifdef RT_USING_NEWLIB
#include <stdarg.h>
@ -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_end(v) __builtin_va_end(v)
#define va_arg(v,l) __builtin_va_arg(v,l)
#endif
#endif /* RT_USING_NEWLIB */
#define RT_SECTION(x) __attribute__((section(x)))
#define RT_UNUSED __attribute__((unused))
#define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define RT_WEAK __attribute__((weak))
@ -168,7 +164,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#elif defined (__ADSPBLACKFIN__) /* for VisualDSP++ Compiler */
#include <stdarg.h>
#define RT_SECTION(x) __attribute__((section(x)))
#define RT_UNUSED __attribute__((unused))
#define RT_USED __attribute__((used))
#define ALIGN(n) __attribute__((aligned(n)))
#define RT_WEAK __attribute__((weak))
@ -177,7 +172,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#elif defined (_MSC_VER)
#include <stdarg.h>
#define RT_SECTION(x)
#define RT_UNUSED
#define RT_USED
#define ALIGN(n) __declspec(align(n))
#define RT_WEAK
@ -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
* details. */
#define RT_SECTION(x)
#define RT_UNUSED
#define RT_USED
#define PRAGMA(x) _Pragma(#x)
#define ALIGN(n)
@ -199,7 +192,6 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
#elif defined (__TASKING__)
#include <stdarg.h>
#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) __attribute__((__align(n)))