clean up rtthread.h (#7843)

This commit is contained in:
Man, Jianting (Meco) 2023-07-22 18:19:34 -04:00 committed by GitHub
parent 244b903e5d
commit aee1bd532e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 50 additions and 65 deletions

View File

@ -32,6 +32,9 @@
#ifdef RT_USING_LEGACY #ifdef RT_USING_LEGACY
#include <rtlegacy.h> #include <rtlegacy.h>
#endif #endif
#ifdef RT_USING_FINSH
#include <finsh.h>
#endif /* RT_USING_FINSH */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -55,28 +58,24 @@ void rt_object_init(struct rt_object *object,
const char *name); const char *name);
void rt_object_detach(rt_object_t object); void rt_object_detach(rt_object_t object);
#ifdef RT_USING_HEAP #ifdef RT_USING_HEAP
rt_object_t rt_object_allocate(enum rt_object_class_type type, rt_object_t rt_object_allocate(enum rt_object_class_type type, const char *name);
const char *name);
void rt_object_delete(rt_object_t object); void rt_object_delete(rt_object_t object);
#endif /* custom object */
rt_object_t rt_custom_object_create(const char *name, void *data, rt_err_t (*data_destroy)(void *));
rt_err_t rt_custom_object_destroy(rt_object_t obj);
#endif /* RT_USING_HEAP */
rt_bool_t rt_object_is_systemobject(rt_object_t object); rt_bool_t rt_object_is_systemobject(rt_object_t object);
rt_uint8_t rt_object_get_type(rt_object_t object); rt_uint8_t rt_object_get_type(rt_object_t object);
rt_object_t rt_object_find(const char *name, rt_uint8_t type); rt_object_t rt_object_find(const char *name, rt_uint8_t type);
rt_err_t rt_object_get_name(rt_object_t object, char *name, rt_uint8_t name_size); rt_err_t rt_object_get_name(rt_object_t object, char *name, rt_uint8_t name_size);
#ifdef RT_USING_HEAP
/* custom object */
rt_object_t rt_custom_object_create(const char *name, void *data, rt_err_t (*data_destroy)(void *));
rt_err_t rt_custom_object_destroy(rt_object_t obj);
#endif
#ifdef RT_USING_HOOK #ifdef RT_USING_HOOK
void rt_object_attach_sethook(void (*hook)(struct rt_object *object)); void rt_object_attach_sethook(void (*hook)(struct rt_object *object));
void rt_object_detach_sethook(void (*hook)(struct rt_object *object)); void rt_object_detach_sethook(void (*hook)(struct rt_object *object));
void rt_object_trytake_sethook(void (*hook)(struct rt_object *object)); void rt_object_trytake_sethook(void (*hook)(struct rt_object *object));
void rt_object_take_sethook(void (*hook)(struct rt_object *object)); void rt_object_take_sethook(void (*hook)(struct rt_object *object));
void rt_object_put_sethook(void (*hook)(struct rt_object *object)); void rt_object_put_sethook(void (*hook)(struct rt_object *object));
#endif #endif /* RT_USING_HOOK */
/**@}*/ /**@}*/
@ -95,7 +94,7 @@ rt_tick_t rt_tick_from_millisecond(rt_int32_t ms);
rt_tick_t rt_tick_get_millisecond(void); rt_tick_t rt_tick_get_millisecond(void);
#ifdef RT_USING_HOOK #ifdef RT_USING_HOOK
void rt_tick_sethook(void (*hook)(void)); void rt_tick_sethook(void (*hook)(void));
#endif #endif /* RT_USING_HOOK */
void rt_system_timer_init(void); void rt_system_timer_init(void);
void rt_system_timer_thread_init(void); void rt_system_timer_thread_init(void);
@ -114,18 +113,16 @@ rt_timer_t rt_timer_create(const char *name,
rt_tick_t time, rt_tick_t time,
rt_uint8_t flag); rt_uint8_t flag);
rt_err_t rt_timer_delete(rt_timer_t timer); rt_err_t rt_timer_delete(rt_timer_t timer);
#endif #endif /* RT_USING_HEAP */
rt_err_t rt_timer_start(rt_timer_t timer); rt_err_t rt_timer_start(rt_timer_t timer);
rt_err_t rt_timer_stop(rt_timer_t timer); rt_err_t rt_timer_stop(rt_timer_t timer);
rt_err_t rt_timer_control(rt_timer_t timer, int cmd, void *arg); rt_err_t rt_timer_control(rt_timer_t timer, int cmd, void *arg);
rt_tick_t rt_timer_next_timeout_tick(void); rt_tick_t rt_timer_next_timeout_tick(void);
void rt_timer_check(void); void rt_timer_check(void);
#ifdef RT_USING_HOOK #ifdef RT_USING_HOOK
void rt_timer_enter_sethook(void (*hook)(struct rt_timer *timer)); void rt_timer_enter_sethook(void (*hook)(struct rt_timer *timer));
void rt_timer_exit_sethook(void (*hook)(struct rt_timer *timer)); void rt_timer_exit_sethook(void (*hook)(struct rt_timer *timer));
#endif #endif /* RT_USING_HOOK */
/**@}*/ /**@}*/
@ -154,7 +151,7 @@ rt_thread_t rt_thread_create(const char *name,
rt_uint8_t priority, rt_uint8_t priority,
rt_uint32_t tick); rt_uint32_t tick);
rt_err_t rt_thread_delete(rt_thread_t thread); rt_err_t rt_thread_delete(rt_thread_t thread);
#endif #endif /* RT_USING_HEAP */
rt_thread_t rt_thread_self(void); rt_thread_t rt_thread_self(void);
rt_thread_t rt_thread_find(char *name); rt_thread_t rt_thread_find(char *name);
rt_err_t rt_thread_startup(rt_thread_t thread); rt_err_t rt_thread_startup(rt_thread_t thread);
@ -169,22 +166,19 @@ rt_err_t rt_thread_resume(rt_thread_t thread);
#ifdef RT_USING_SMART #ifdef RT_USING_SMART
rt_err_t rt_thread_wakeup(rt_thread_t thread); rt_err_t rt_thread_wakeup(rt_thread_t thread);
void rt_thread_wakeup_set(struct rt_thread *thread, rt_wakeup_func_t func, void* user_data); void rt_thread_wakeup_set(struct rt_thread *thread, rt_wakeup_func_t func, void* user_data);
#endif #endif /* RT_USING_SMART */
void rt_thread_timeout(void *parameter); void rt_thread_timeout(void *parameter);
rt_err_t rt_thread_get_name(rt_thread_t thread, char *name, rt_uint8_t name_size); rt_err_t rt_thread_get_name(rt_thread_t thread, char *name, rt_uint8_t name_size);
#ifdef RT_USING_SIGNALS #ifdef RT_USING_SIGNALS
void rt_thread_alloc_sig(rt_thread_t tid); void rt_thread_alloc_sig(rt_thread_t tid);
void rt_thread_free_sig(rt_thread_t tid); void rt_thread_free_sig(rt_thread_t tid);
int rt_thread_kill(rt_thread_t tid, int sig); int rt_thread_kill(rt_thread_t tid, int sig);
#endif #endif /* RT_USING_SIGNALS */
#ifdef RT_USING_HOOK #ifdef RT_USING_HOOK
void rt_thread_suspend_sethook(void (*hook)(rt_thread_t thread)); void rt_thread_suspend_sethook(void (*hook)(rt_thread_t thread));
void rt_thread_resume_sethook (void (*hook)(rt_thread_t thread)); void rt_thread_resume_sethook (void (*hook)(rt_thread_t thread));
void rt_thread_inited_sethook (void (*hook)(rt_thread_t thread)); void rt_thread_inited_sethook (void (*hook)(rt_thread_t thread));
#endif #endif /* RT_USING_HOOK */
/* /*
* idle thread interface * idle thread interface
@ -193,7 +187,7 @@ void rt_thread_idle_init(void);
#if defined(RT_USING_HOOK) || defined(RT_USING_IDLE_HOOK) #if defined(RT_USING_HOOK) || defined(RT_USING_IDLE_HOOK)
rt_err_t rt_thread_idle_sethook(void (*hook)(void)); rt_err_t rt_thread_idle_sethook(void (*hook)(void));
rt_err_t rt_thread_idle_delhook(void (*hook)(void)); rt_err_t rt_thread_idle_delhook(void (*hook)(void));
#endif #endif /* defined(RT_USING_HOOK) || defined(RT_USING_IDLE_HOOK) */
rt_thread_t rt_thread_idle_gethandler(void); rt_thread_t rt_thread_idle_gethandler(void);
/* /*
@ -213,12 +207,12 @@ rt_uint16_t rt_critical_level(void);
#ifdef RT_USING_HOOK #ifdef RT_USING_HOOK
void rt_scheduler_sethook(void (*hook)(rt_thread_t from, rt_thread_t to)); void rt_scheduler_sethook(void (*hook)(rt_thread_t from, rt_thread_t to));
void rt_scheduler_switch_sethook(void (*hook)(struct rt_thread *tid)); void rt_scheduler_switch_sethook(void (*hook)(struct rt_thread *tid));
#endif #endif /* RT_USING_HOOK */
#ifdef RT_USING_SMP #ifdef RT_USING_SMP
void rt_secondary_cpu_entry(void); void rt_secondary_cpu_entry(void);
void rt_scheduler_ipi_handler(int vector, void *param); void rt_scheduler_ipi_handler(int vector, void *param);
#endif #endif /* RT_USING_SMP */
/**@}*/ /**@}*/
@ -231,9 +225,8 @@ void rt_signal_mask(int signo);
void rt_signal_unmask(int signo); void rt_signal_unmask(int signo);
rt_sighandler_t rt_signal_install(int signo, rt_sighandler_t handler); rt_sighandler_t rt_signal_install(int signo, rt_sighandler_t handler);
int rt_signal_wait(const rt_sigset_t *set, rt_siginfo_t *si, rt_int32_t timeout); int rt_signal_wait(const rt_sigset_t *set, rt_siginfo_t *si, rt_int32_t timeout);
int rt_system_signal_init(void); int rt_system_signal_init(void);
#endif #endif /* RT_USING_SIGNALS */
/**@}*/ /**@}*/
/** /**
@ -259,17 +252,15 @@ rt_mp_t rt_mp_create(const char *name,
rt_size_t block_count, rt_size_t block_count,
rt_size_t block_size); rt_size_t block_size);
rt_err_t rt_mp_delete(rt_mp_t mp); rt_err_t rt_mp_delete(rt_mp_t mp);
#endif #endif /* RT_USING_HEAP */
void *rt_mp_alloc(rt_mp_t mp, rt_int32_t time); void *rt_mp_alloc(rt_mp_t mp, rt_int32_t time);
void rt_mp_free(void *block); void rt_mp_free(void *block);
#ifdef RT_USING_HOOK #ifdef RT_USING_HOOK
void rt_mp_alloc_sethook(void (*hook)(struct rt_mempool *mp, void *block)); void rt_mp_alloc_sethook(void (*hook)(struct rt_mempool *mp, void *block));
void rt_mp_free_sethook(void (*hook)(struct rt_mempool *mp, void *block)); void rt_mp_free_sethook(void (*hook)(struct rt_mempool *mp, void *block));
#endif #endif /* RT_USING_HOOK */
#endif #endif /* RT_USING_MEMPOOL */
#ifdef RT_USING_HEAP #ifdef RT_USING_HEAP
/* /*
@ -291,14 +282,14 @@ void rt_memory_info(rt_size_t *total,
#if defined(RT_USING_SLAB) && defined(RT_USING_SLAB_AS_HEAP) #if defined(RT_USING_SLAB) && defined(RT_USING_SLAB_AS_HEAP)
void *rt_page_alloc(rt_size_t npages); void *rt_page_alloc(rt_size_t npages);
void rt_page_free(void *addr, rt_size_t npages); void rt_page_free(void *addr, rt_size_t npages);
#endif #endif /* defined(RT_USING_SLAB) && defined(RT_USING_SLAB_AS_HEAP) */
#ifdef RT_USING_HOOK #ifdef RT_USING_HOOK
void rt_malloc_sethook(void (*hook)(void *ptr, rt_size_t size)); void rt_malloc_sethook(void (*hook)(void *ptr, rt_size_t size));
void rt_free_sethook(void (*hook)(void *ptr)); void rt_free_sethook(void (*hook)(void *ptr));
#endif #endif /* RT_USING_HOOK */
#endif #endif /* RT_USING_HEAP */
#ifdef RT_USING_SMALL_MEM #ifdef RT_USING_SMALL_MEM
/** /**
@ -311,7 +302,7 @@ rt_err_t rt_smem_detach(rt_smem_t m);
void *rt_smem_alloc(rt_smem_t m, rt_size_t size); void *rt_smem_alloc(rt_smem_t m, rt_size_t size);
void *rt_smem_realloc(rt_smem_t m, void *rmem, rt_size_t newsize); void *rt_smem_realloc(rt_smem_t m, void *rmem, rt_size_t newsize);
void rt_smem_free(void *rmem); void rt_smem_free(void *rmem);
#endif #endif /* RT_USING_SMALL_MEM */
#ifdef RT_USING_MEMHEAP #ifdef RT_USING_MEMHEAP
/** /**
@ -329,7 +320,7 @@ void rt_memheap_info(struct rt_memheap *heap,
rt_size_t *total, rt_size_t *total,
rt_size_t *used, rt_size_t *used,
rt_size_t *max_used); rt_size_t *max_used);
#endif #endif /* RT_USING_MEMHEAP */
#ifdef RT_USING_SLAB #ifdef RT_USING_SLAB
/** /**
@ -342,7 +333,7 @@ void rt_slab_page_free(rt_slab_t m, void *addr, rt_size_t npages);
void *rt_slab_alloc(rt_slab_t m, rt_size_t size); void *rt_slab_alloc(rt_slab_t m, rt_size_t size);
void *rt_slab_realloc(rt_slab_t m, void *ptr, rt_size_t size); void *rt_slab_realloc(rt_slab_t m, void *ptr, rt_size_t size);
void rt_slab_free(rt_slab_t m, void *ptr); void rt_slab_free(rt_slab_t m, void *ptr);
#endif #endif /* RT_USING_SLAB */
/**@}*/ /**@}*/
@ -363,7 +354,7 @@ rt_err_t rt_sem_detach(rt_sem_t sem);
#ifdef RT_USING_HEAP #ifdef RT_USING_HEAP
rt_sem_t rt_sem_create(const char *name, rt_uint32_t value, rt_uint8_t flag); rt_sem_t rt_sem_create(const char *name, rt_uint32_t value, rt_uint8_t flag);
rt_err_t rt_sem_delete(rt_sem_t sem); rt_err_t rt_sem_delete(rt_sem_t sem);
#endif #endif /* RT_USING_HEAP */
rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t timeout); rt_err_t rt_sem_take(rt_sem_t sem, rt_int32_t timeout);
rt_err_t rt_sem_take_interruptible(rt_sem_t sem, rt_int32_t timeout); rt_err_t rt_sem_take_interruptible(rt_sem_t sem, rt_int32_t timeout);
@ -371,7 +362,7 @@ rt_err_t rt_sem_take_killable(rt_sem_t sem, rt_int32_t timeout);
rt_err_t rt_sem_trytake(rt_sem_t sem); rt_err_t rt_sem_trytake(rt_sem_t sem);
rt_err_t rt_sem_release(rt_sem_t sem); rt_err_t rt_sem_release(rt_sem_t sem);
rt_err_t rt_sem_control(rt_sem_t sem, int cmd, void *arg); rt_err_t rt_sem_control(rt_sem_t sem, int cmd, void *arg);
#endif #endif /* RT_USING_SEMAPHORE */
#ifdef RT_USING_MUTEX #ifdef RT_USING_MUTEX
/* /*
@ -382,7 +373,7 @@ rt_err_t rt_mutex_detach(rt_mutex_t mutex);
#ifdef RT_USING_HEAP #ifdef RT_USING_HEAP
rt_mutex_t rt_mutex_create(const char *name, rt_uint8_t flag); rt_mutex_t rt_mutex_create(const char *name, rt_uint8_t flag);
rt_err_t rt_mutex_delete(rt_mutex_t mutex); rt_err_t rt_mutex_delete(rt_mutex_t mutex);
#endif #endif /* RT_USING_HEAP */
void rt_mutex_drop_thread(rt_mutex_t mutex, rt_thread_t thread); void rt_mutex_drop_thread(rt_mutex_t mutex, rt_thread_t thread);
rt_uint8_t rt_mutex_setprioceiling(rt_mutex_t mutex, rt_uint8_t priority); rt_uint8_t rt_mutex_setprioceiling(rt_mutex_t mutex, rt_uint8_t priority);
rt_uint8_t rt_mutex_getprioceiling(rt_mutex_t mutex); rt_uint8_t rt_mutex_getprioceiling(rt_mutex_t mutex);
@ -393,7 +384,7 @@ rt_err_t rt_mutex_take_interruptible(rt_mutex_t mutex, rt_int32_t time);
rt_err_t rt_mutex_take_killable(rt_mutex_t mutex, rt_int32_t time); rt_err_t rt_mutex_take_killable(rt_mutex_t mutex, rt_int32_t time);
rt_err_t rt_mutex_release(rt_mutex_t mutex); rt_err_t rt_mutex_release(rt_mutex_t mutex);
rt_err_t rt_mutex_control(rt_mutex_t mutex, int cmd, void *arg); rt_err_t rt_mutex_control(rt_mutex_t mutex, int cmd, void *arg);
#endif #endif /* RT_USING_MUTEX */
#ifdef RT_USING_EVENT #ifdef RT_USING_EVENT
/* /*
@ -404,7 +395,7 @@ rt_err_t rt_event_detach(rt_event_t event);
#ifdef RT_USING_HEAP #ifdef RT_USING_HEAP
rt_event_t rt_event_create(const char *name, rt_uint8_t flag); rt_event_t rt_event_create(const char *name, rt_uint8_t flag);
rt_err_t rt_event_delete(rt_event_t event); rt_err_t rt_event_delete(rt_event_t event);
#endif #endif /* RT_USING_HEAP */
rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set); rt_err_t rt_event_send(rt_event_t event, rt_uint32_t set);
rt_err_t rt_event_recv(rt_event_t event, rt_err_t rt_event_recv(rt_event_t event,
@ -423,7 +414,7 @@ rt_err_t rt_event_recv_killable(rt_event_t event,
rt_int32_t timeout, rt_int32_t timeout,
rt_uint32_t *recved); rt_uint32_t *recved);
rt_err_t rt_event_control(rt_event_t event, int cmd, void *arg); rt_err_t rt_event_control(rt_event_t event, int cmd, void *arg);
#endif #endif /* RT_USING_EVENT */
#ifdef RT_USING_MAILBOX #ifdef RT_USING_MAILBOX
/* /*
@ -438,7 +429,7 @@ rt_err_t rt_mb_detach(rt_mailbox_t mb);
#ifdef RT_USING_HEAP #ifdef RT_USING_HEAP
rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag); rt_mailbox_t rt_mb_create(const char *name, rt_size_t size, rt_uint8_t flag);
rt_err_t rt_mb_delete(rt_mailbox_t mb); rt_err_t rt_mb_delete(rt_mailbox_t mb);
#endif #endif /* RT_USING_HEAP */
rt_err_t rt_mb_send(rt_mailbox_t mb, rt_ubase_t value); rt_err_t rt_mb_send(rt_mailbox_t mb, rt_ubase_t value);
rt_err_t rt_mb_send_wait(rt_mailbox_t mb, rt_err_t rt_mb_send_wait(rt_mailbox_t mb,
@ -455,7 +446,7 @@ rt_err_t rt_mb_recv(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout);
rt_err_t rt_mb_recv_interruptibale(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout); rt_err_t rt_mb_recv_interruptibale(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout);
rt_err_t rt_mb_recv_killable(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout); rt_err_t rt_mb_recv_killable(rt_mailbox_t mb, rt_ubase_t *value, rt_int32_t timeout);
rt_err_t rt_mb_control(rt_mailbox_t mb, int cmd, void *arg); rt_err_t rt_mb_control(rt_mailbox_t mb, int cmd, void *arg);
#endif #endif /* RT_USING_MAILBOX */
#ifdef RT_USING_MESSAGEQUEUE #ifdef RT_USING_MESSAGEQUEUE
@ -465,7 +456,7 @@ struct rt_mq_message
rt_ssize_t length; rt_ssize_t length;
#ifdef RT_USING_MESSAGEQUEUE_PRIORITY #ifdef RT_USING_MESSAGEQUEUE_PRIORITY
rt_int32_t prio; rt_int32_t prio;
#endif #endif /* RT_USING_MESSAGEQUEUE_PRIORITY */
}; };
#define RT_MQ_BUF_SIZE(msg_size, max_msgs) \ #define RT_MQ_BUF_SIZE(msg_size, max_msgs) \
@ -487,7 +478,7 @@ rt_mq_t rt_mq_create(const char *name,
rt_size_t max_msgs, rt_size_t max_msgs,
rt_uint8_t flag); rt_uint8_t flag);
rt_err_t rt_mq_delete(rt_mq_t mq); rt_err_t rt_mq_delete(rt_mq_t mq);
#endif #endif /* RT_USING_HEAP */
rt_err_t rt_mq_send(rt_mq_t mq, const void *buffer, rt_size_t size); rt_err_t rt_mq_send(rt_mq_t mq, const void *buffer, rt_size_t size);
rt_err_t rt_mq_send_interrupt(rt_mq_t mq, const void *buffer, rt_size_t size); rt_err_t rt_mq_send_interrupt(rt_mq_t mq, const void *buffer, rt_size_t size);
@ -532,8 +523,8 @@ rt_err_t rt_mq_recv_prio(rt_mq_t mq,
rt_int32_t *prio, rt_int32_t *prio,
rt_int32_t timeout, rt_int32_t timeout,
int suspend_flag); int suspend_flag);
#endif #endif /* RT_USING_MESSAGEQUEUE_PRIORITY */
#endif #endif /* RT_USING_MESSAGEQUEUE */
/* defunct */ /* defunct */
void rt_thread_defunct_enqueue(rt_thread_t thread); void rt_thread_defunct_enqueue(rt_thread_t thread);
@ -550,15 +541,13 @@ void rt_spin_lock(struct rt_spinlock *lock);
void rt_spin_unlock(struct rt_spinlock *lock); void rt_spin_unlock(struct rt_spinlock *lock);
rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock); rt_base_t rt_spin_lock_irqsave(struct rt_spinlock *lock);
void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level); void rt_spin_unlock_irqrestore(struct rt_spinlock *lock, rt_base_t level);
#else #else
#define rt_spin_lock_init(lock) /* nothing */ #define rt_spin_lock_init(lock) /* nothing */
#define rt_spin_lock(lock) rt_enter_critical() #define rt_spin_lock(lock) rt_enter_critical()
#define rt_spin_unlock(lock) rt_exit_critical() #define rt_spin_unlock(lock) rt_exit_critical()
#define rt_spin_lock_irqsave(lock) rt_hw_interrupt_disable() #define rt_spin_lock_irqsave(lock) rt_hw_interrupt_disable()
#define rt_spin_unlock_irqrestore(lock, level) rt_hw_interrupt_enable(level) #define rt_spin_unlock_irqrestore(lock, level) rt_hw_interrupt_enable(level)
#endif /* RT_USING_SMP */
#endif
/**@}*/ /**@}*/
@ -581,7 +570,7 @@ rt_err_t rt_device_unregister(rt_device_t dev);
#ifdef RT_USING_HEAP #ifdef RT_USING_HEAP
rt_device_t rt_device_create(int type, int attach_size); rt_device_t rt_device_create(int type, int attach_size);
void rt_device_destroy(rt_device_t device); void rt_device_destroy(rt_device_t device);
#endif #endif /* RT_USING_HEAP */
rt_err_t rt_err_t
rt_device_set_rx_indicate(rt_device_t dev, rt_device_set_rx_indicate(rt_device_t dev,
@ -604,7 +593,7 @@ rt_ssize_t rt_device_write(rt_device_t dev,
rt_err_t rt_device_control(rt_device_t dev, int cmd, void *arg); rt_err_t rt_device_control(rt_device_t dev, int cmd, void *arg);
/**@}*/ /**@}*/
#endif #endif /* RT_USING_DEVICE */
/* /*
* interrupt service * interrupt service
@ -628,7 +617,7 @@ void rt_cpus_unlock(rt_base_t level);
struct rt_cpu *rt_cpu_self(void); struct rt_cpu *rt_cpu_self(void);
struct rt_cpu *rt_cpu_index(int index); struct rt_cpu *rt_cpu_index(int index);
#endif #endif /* RT_USING_SMP */
/* /*
* the number of nested interrupts. * the number of nested interrupts.
@ -638,12 +627,12 @@ rt_uint8_t rt_interrupt_get_nest(void);
#ifdef RT_USING_HOOK #ifdef RT_USING_HOOK
void rt_interrupt_enter_sethook(void (*hook)(void)); void rt_interrupt_enter_sethook(void (*hook)(void));
void rt_interrupt_leave_sethook(void (*hook)(void)); void rt_interrupt_leave_sethook(void (*hook)(void));
#endif #endif /* RT_USING_HOOK */
#ifdef RT_USING_COMPONENTS_INIT #ifdef RT_USING_COMPONENTS_INIT
void rt_components_init(void); void rt_components_init(void);
void rt_components_board_init(void); void rt_components_board_init(void);
#endif #endif /* RT_USING_COMPONENTS_INIT */
/** /**
* @addtogroup KernelService * @addtogroup KernelService
@ -659,7 +648,7 @@ void rt_components_board_init(void);
#else #else
int rt_kprintf(const char *fmt, ...); int rt_kprintf(const char *fmt, ...);
void rt_kputs(const char *str); void rt_kputs(const char *str);
#endif #endif /* RT_USING_CONSOLE */
int rt_vsprintf(char *dest, const char *format, va_list arg_ptr); int rt_vsprintf(char *dest, const char *format, va_list arg_ptr);
int rt_vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list args); int rt_vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list args);
@ -669,7 +658,7 @@ int rt_snprintf(char *buf, rt_size_t size, const char *format, ...);
#if defined(RT_USING_DEVICE) && defined(RT_USING_CONSOLE) #if defined(RT_USING_DEVICE) && defined(RT_USING_CONSOLE)
rt_device_t rt_console_set_device(const char *name); rt_device_t rt_console_set_device(const char *name);
rt_device_t rt_console_get_device(void); rt_device_t rt_console_get_device(void);
#endif #endif /* defined(RT_USING_DEVICE) && defined(RT_USING_CONSOLE) */
rt_err_t rt_get_errno(void); rt_err_t rt_get_errno(void);
void rt_set_errno(rt_err_t no); void rt_set_errno(rt_err_t no);
@ -679,7 +668,7 @@ const char *rt_strerror(rt_err_t error);
#ifndef errno #ifndef errno
#define errno *_rt_errno() #define errno *_rt_errno()
#endif #endif
#endif #endif /* !defined(RT_USING_NEWLIBC) && !defined(_WIN32) */
int __rt_ffs(int value); int __rt_ffs(int value);
@ -806,10 +795,6 @@ while (0)
#define RT_ASSERT(EX) #define RT_ASSERT(EX)
#endif /* RT_USING_DEBUG */ #endif /* RT_USING_DEBUG */
#ifdef RT_USING_FINSH
#include <finsh.h>
#endif /* RT_USING_FINSH */
/**@}*/ /**@}*/
#ifdef __cplusplus #ifdef __cplusplus