From 441f57c8377d8fe3f62e1eaa8b1258f3169d3729 Mon Sep 17 00:00:00 2001 From: daishengdong Date: Thu, 12 Mar 2020 11:04:17 +0800 Subject: [PATCH] fix "redefinition of typedef 'k_task_t'" 1. remove re-typedef of k_task_st to k_task_t in tos_task.h 2. add "typedef struct k_task_st k_task_t" to tos_ktypes.h --- components/fs/vfs/include/tos_vfs_device.h | 2 +- kernel/core/include/tos_ktypes.h | 36 ++++++++++++---------- kernel/core/include/tos_pend.h | 2 -- kernel/core/include/tos_task.h | 4 +-- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/components/fs/vfs/include/tos_vfs_device.h b/components/fs/vfs/include/tos_vfs_device.h index e7866d11..87b9d563 100644 --- a/components/fs/vfs/include/tos_vfs_device.h +++ b/components/fs/vfs/include/tos_vfs_device.h @@ -17,7 +17,7 @@ typedef struct vfs_char_device_operations_st { int (*resume) (void); } vfs_chrdev_ops_t; -typedef struct vfs_block_device_geometry_t { +typedef struct vfs_block_device_geometry_st { int is_available; uint32_t sector_size; uint32_t nsectors; diff --git a/kernel/core/include/tos_ktypes.h b/kernel/core/include/tos_ktypes.h index dead3aec..774d936f 100644 --- a/kernel/core/include/tos_ktypes.h +++ b/kernel/core/include/tos_ktypes.h @@ -21,34 +21,36 @@ #include #include -typedef uint8_t k_prio_t; -typedef uint8_t k_stack_t; -typedef uint8_t k_task_state_t; +typedef uint8_t k_prio_t; +typedef uint8_t k_stack_t; +typedef uint8_t k_task_state_t; +typedef struct k_task_st k_task_t; -typedef uint8_t k_nesting_t; +typedef uint8_t k_nesting_t; -typedef uint16_t k_opt_t; -typedef uint16_t k_sem_cnt_t; -typedef uint32_t k_event_flag_t; -typedef uint16_t k_barrier_cnt_t; -typedef uint16_t k_countdownlatch_cnt_t; +typedef uint16_t k_opt_t; -typedef uint32_t k_time_t; -typedef uint32_t k_timeslice_t; +typedef uint16_t k_sem_cnt_t; +typedef uint32_t k_event_flag_t; +typedef uint16_t k_barrier_cnt_t; +typedef uint16_t k_countdownlatch_cnt_t; -typedef uint32_t k_cycle_t; +typedef uint32_t k_time_t; +typedef uint32_t k_timeslice_t; + +typedef uint32_t k_cycle_t; #if TOS_CFG_CPU_DATA_SIZE == CPU_WORD_SIZE_08 -typedef uint32_t k_tick_t; +typedef uint32_t k_tick_t; #else -typedef uint64_t k_tick_t; +typedef uint64_t k_tick_t; #endif -#define K_TRUE (1u) -#define K_FALSE (0u) +#define K_TRUE (1u) +#define K_FALSE (0u) #ifndef K_NULL -#define K_NULL 0 +#define K_NULL 0 #endif #endif /* _TOS_KTYPES_H_ */ diff --git a/kernel/core/include/tos_pend.h b/kernel/core/include/tos_pend.h index 5f03e811..1b36f53f 100644 --- a/kernel/core/include/tos_pend.h +++ b/kernel/core/include/tos_pend.h @@ -20,8 +20,6 @@ __CDECLS_BEGIN -typedef struct k_task_st k_task_t; - /** * The reason why we wakeup from a pend. * when we wakeup, we need to know why. diff --git a/kernel/core/include/tos_task.h b/kernel/core/include/tos_task.h index a83099a9..8ceace44 100644 --- a/kernel/core/include/tos_task.h +++ b/kernel/core/include/tos_task.h @@ -71,7 +71,7 @@ typedef void (*k_task_walker_t)(k_task_t *task); /** * task control block */ -typedef struct k_task_st { +struct k_task_st { k_stack_t *sp; /**< task stack pointer. This lady always comes first, we count on her in port_s.S for context switch. */ knl_obj_t knl_obj; /**< just for verification, test whether current object is really a task. */ @@ -130,7 +130,7 @@ typedef struct k_task_st { k_event_flag_t *flag_match; /**< if we pend an event successfully, flag_match will be set by the event poster, and will be returned by tos_event_pend to the caller */ #endif -} k_task_t; +}; /** * @brief Create a task.