Skip to content

Commit

Permalink
[kernel]补充endif后缀注释
Browse files Browse the repository at this point in the history
  • Loading branch information
mysterywolf committed Jun 9, 2021
1 parent 5c8625c commit 24b4b6c
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 40 deletions.
6 changes: 3 additions & 3 deletions src/clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define rt_tick rt_cpu_index(0)->tick
#else
static volatile rt_tick_t rt_tick = 0;
#endif
#endif /* RT_USING_SMP */

/**
* @addtogroup Clock
Expand Down Expand Up @@ -72,7 +72,7 @@ void rt_tick_increase(void)
rt_cpu_self()->tick ++;
#else
++ rt_tick;
#endif
#endif /* RT_USING_SMP */

/* check time slice */
thread = rt_thread_self();
Expand Down Expand Up @@ -138,7 +138,7 @@ RT_WEAK rt_tick_t rt_tick_get_millisecond(void)
#warning "rt-thread cannot provide a correct 1ms-based tick any longer,\
please redefine this function in another file by using a high-precision hard-timer."
return 0;
#endif
#endif /* 1000 % RT_TICK_PER_SECOND == 0u */
}

/**@}*/
Expand Down
26 changes: 13 additions & 13 deletions src/components.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
#ifdef RT_USING_USER_MAIN
#ifndef RT_MAIN_THREAD_STACK_SIZE
#define RT_MAIN_THREAD_STACK_SIZE 2048
#endif
#endif /* RT_MAIN_THREAD_STACK_SIZE */
#ifndef RT_MAIN_THREAD_PRIORITY
#define RT_MAIN_THREAD_PRIORITY (RT_THREAD_PRIORITY_MAX / 3)
#endif
#endif
#endif /* RT_MAIN_THREAD_PRIORITY */
#endif /* RT_USING_USER_MAIN */

#ifdef RT_USING_COMPONENTS_INIT
/*
Expand Down Expand Up @@ -98,7 +98,7 @@ void rt_components_board_init(void)
{
(*fn_ptr)();
}
#endif
#endif /* RT_DEBUG_INIT */
}

/**
Expand All @@ -124,9 +124,9 @@ void rt_components_init(void)
{
(*fn_ptr)();
}
#endif
#endif /* RT_DEBUG_INIT */
}
#endif /* RT_USING_COMPONENTS_INIT */
#endif /* RT_USING_COMPONENTS_INIT */

#ifdef RT_USING_USER_MAIN

Expand Down Expand Up @@ -167,7 +167,7 @@ int entry(void)
ALIGN(8)
static rt_uint8_t main_stack[RT_MAIN_THREAD_STACK_SIZE];
struct rt_thread main_thread;
#endif
#endif /* RT_USING_HEAP */

/* the system main thread */
void main_thread_entry(void *parameter)
Expand All @@ -177,11 +177,11 @@ void main_thread_entry(void *parameter)
#ifdef RT_USING_COMPONENTS_INIT
/* RT-Thread components initialization */
rt_components_init();
#endif
#endif /* RT_USING_COMPONENTS_INIT */

#ifdef RT_USING_SMP
rt_hw_secondary_cpu_up();
#endif
#endif /* RT_USING_SMP */
/* invoke system main function */
#if defined(__CC_ARM) || defined(__CLANG_ARM)
{
Expand Down Expand Up @@ -211,7 +211,7 @@ void rt_application_init(void)

/* if not define RT_USING_HEAP, using to eliminate the warning */
(void)result;
#endif
#endif /* RT_USING_HEAP */

rt_thread_startup(tid);
}
Expand All @@ -237,7 +237,7 @@ int rtthread_startup(void)
#ifdef RT_USING_SIGNALS
/* signal system initialization */
rt_system_signal_init();
#endif
#endif /* RT_USING_SIGNALS */

/* create init_thread */
rt_application_init();
Expand All @@ -250,12 +250,12 @@ int rtthread_startup(void)

#ifdef RT_USING_SMP
rt_hw_spin_lock(&_cpus_lock);
#endif /*RT_USING_SMP*/
#endif /* RT_USING_SMP */

/* start scheduler */
rt_system_scheduler_start();

/* never reach here */
return 0;
}
#endif
#endif /* RT_USING_USER_MAIN */
2 changes: 1 addition & 1 deletion src/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ void rt_cpus_lock_status_restore(struct rt_thread *thread)
}
RTM_EXPORT(rt_cpus_lock_status_restore);

#endif
#endif /* RT_USING_SMP */
14 changes: 7 additions & 7 deletions src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/

#include <rtthread.h>
#if defined(RT_USING_POSIX)
#ifdef RT_USING_POSIX
#include <rtdevice.h> /* for wqueue_init */
#endif
#endif /* RT_USING_POSIX */

#ifdef RT_USING_DEVICE

Expand All @@ -36,7 +36,7 @@
#define device_read (dev->read)
#define device_write (dev->write)
#define device_control (dev->control)
#endif
#endif /* RT_USING_DEVICE_OPS */

/**
* This function registers a device driver with specified name.
Expand All @@ -62,10 +62,10 @@ rt_err_t rt_device_register(rt_device_t dev,
dev->ref_count = 0;
dev->open_flag = 0;

#if defined(RT_USING_POSIX)
#ifdef RT_USING_POSIX
dev->fops = RT_NULL;
rt_wqueue_init(&(dev->wait_queue));
#endif
#endif /* RT_USING_POSIX */

return RT_EOK;
}
Expand Down Expand Up @@ -150,7 +150,7 @@ void rt_device_destroy(rt_device_t dev)
rt_free(dev);
}
RTM_EXPORT(rt_device_destroy);
#endif
#endif /* RT_USING_HEAP */

/**
* This function will initialize the specified device
Expand Down Expand Up @@ -434,4 +434,4 @@ rt_device_set_tx_complete(rt_device_t dev,
}
RTM_EXPORT(rt_device_set_tx_complete);

#endif
#endif /* RT_USING_DEVICE */
32 changes: 16 additions & 16 deletions src/idle.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@

#ifdef RT_USING_MODULE
#include <dlmodule.h>
#endif
#endif /* RT_USING_MODULE */

#if defined (RT_USING_HOOK)
#ifdef RT_USING_HOOK
#ifndef RT_USING_IDLE_HOOK
#define RT_USING_IDLE_HOOK
#endif
#endif
#endif /* RT_USING_IDLE_HOOK */
#endif /* RT_USING_HOOK */

#ifndef IDLE_THREAD_STACK_SIZE
#if defined (RT_USING_IDLE_HOOK) || defined(RT_USING_HEAP)
#define IDLE_THREAD_STACK_SIZE 256
#else
#define IDLE_THREAD_STACK_SIZE 128
#endif
#endif
#endif /* (RT_USING_IDLE_HOOK) || defined(RT_USING_HEAP) */
#endif /* IDLE_THREAD_STACK_SIZE */

#ifdef RT_USING_SMP
#define _CPUS_NR RT_CPUS_NR
#else
#define _CPUS_NR 1
#endif
#endif /* RT_USING_SMP */

extern rt_list_t rt_thread_defunct;

Expand All @@ -53,7 +53,7 @@ static rt_uint8_t rt_thread_stack[_CPUS_NR][IDLE_THREAD_STACK_SIZE];
#ifdef RT_USING_IDLE_HOOK
#ifndef RT_IDLE_HOOK_LIST_SIZE
#define RT_IDLE_HOOK_LIST_SIZE 4
#endif
#endif /* RT_IDLE_HOOK_LIST_SIZE */

static void (*idle_hook_list[RT_IDLE_HOOK_LIST_SIZE])(void);

Expand Down Expand Up @@ -125,7 +125,7 @@ rt_err_t rt_thread_idle_delhook(void (*hook)(void))
return ret;
}

#endif
#endif /* RT_USING_IDLE_HOOK */

#ifdef RT_USING_HEAP
/* Return whether there is defunctional thread to be deleted. */
Expand All @@ -141,7 +141,7 @@ rt_inline int _has_defunct_thread(void)

return l->next != l;
}
#endif
#endif /* RT_USING_HEAP */

/**
* @ingroup Thread
Expand Down Expand Up @@ -182,7 +182,7 @@ void rt_thread_idle_excute(void)
rt_object_delete((rt_object_t)thread);
rt_hw_interrupt_enable(lock);
}
#endif
#endif /* RT_USING_HEAP */
}

extern void rt_system_power_manager(void);
Expand All @@ -196,7 +196,7 @@ static void rt_thread_idle_entry(void *parameter)
rt_hw_secondary_cpu_idle_exec();
}
}
#endif
#endif /* RT_USING_SMP */

while (1)
{
Expand All @@ -212,12 +212,12 @@ static void rt_thread_idle_entry(void *parameter)
idle_hook();
}
}
#endif
#endif /* RT_USING_IDLE_HOOK */

rt_thread_idle_excute();
#ifdef RT_USING_PM
rt_system_power_manager();
#endif
#endif /* RT_USING_PM */
}
}

Expand Down Expand Up @@ -246,7 +246,7 @@ void rt_thread_idle_init(void)
32);
#ifdef RT_USING_SMP
rt_thread_control(&idle[i], RT_THREAD_CTRL_BIND_CPU, (void*)i);
#endif
#endif /* RT_USING_SMP */
/* startup */
rt_thread_startup(&idle[i]);
}
Expand All @@ -264,7 +264,7 @@ rt_thread_t rt_thread_idle_gethandler(void)
register int id = rt_hw_cpu_id();
#else
register int id = 0;
#endif
#endif /* RT_USING_SMP */

return (rt_thread_t)(&idle[id]);
}

0 comments on commit 24b4b6c

Please sign in to comment.