From dba9293a8907516bfec826464ac2896ffaba6da6 Mon Sep 17 00:00:00 2001 From: Marc Schink Date: Sun, 29 Oct 2017 11:39:51 +0100 Subject: [PATCH] rtos: Use 'bool' as return type for detect_rtos() Change-Id: I91ad0431d44ed94f48d20c4690f8642d66f52a9b Signed-off-by: Marc Schink Reviewed-on: http://openocd.zylin.com/4274 Tested-by: jenkins Reviewed-by: Andreas Fritiofson --- src/rtos/ChibiOS.c | 10 +++++----- src/rtos/FreeRTOS.c | 8 ++++---- src/rtos/ThreadX.c | 8 ++++---- src/rtos/eCos.c | 8 ++++---- src/rtos/embKernel.c | 8 ++++---- src/rtos/linux.c | 4 ++-- src/rtos/mqx.c | 8 ++++---- src/rtos/rtos.h | 2 +- src/rtos/uCOS-III.c | 2 +- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/rtos/ChibiOS.c b/src/rtos/ChibiOS.c index 1bc1af8fc..ef0bb16cf 100644 --- a/src/rtos/ChibiOS.c +++ b/src/rtos/ChibiOS.c @@ -103,7 +103,7 @@ static struct ChibiOS_params ChibiOS_params_list[] = { }; #define CHIBIOS_NUM_PARAMS ((int)(sizeof(ChibiOS_params_list)/sizeof(struct ChibiOS_params))) -static int ChibiOS_detect_rtos(struct target *target); +static bool ChibiOS_detect_rtos(struct target *target); static int ChibiOS_create(struct target *target); static int ChibiOS_update_threads(struct rtos *rtos); static int ChibiOS_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char **hex_reg_list); @@ -510,7 +510,7 @@ static int ChibiOS_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]) return 0; } -static int ChibiOS_detect_rtos(struct target *target) +static bool ChibiOS_detect_rtos(struct target *target) { if ((target->rtos->symbols != NULL) && ((target->rtos->symbols[ChibiOS_VAL_rlist].address != 0) || @@ -519,14 +519,14 @@ static int ChibiOS_detect_rtos(struct target *target) if (target->rtos->symbols[ChibiOS_VAL_ch_debug].address == 0) { LOG_INFO("It looks like the target may be running ChibiOS " "without ch_debug."); - return 0; + return false; } /* looks like ChibiOS with memory map enabled.*/ - return 1; + return true; } - return 0; + return false; } static int ChibiOS_create(struct target *target) diff --git a/src/rtos/FreeRTOS.c b/src/rtos/FreeRTOS.c index 83961eb95..6027d6739 100644 --- a/src/rtos/FreeRTOS.c +++ b/src/rtos/FreeRTOS.c @@ -99,7 +99,7 @@ static const struct FreeRTOS_params FreeRTOS_params_list[] = { #define FREERTOS_NUM_PARAMS ((int)(sizeof(FreeRTOS_params_list)/sizeof(struct FreeRTOS_params))) -static int FreeRTOS_detect_rtos(struct target *target); +static bool FreeRTOS_detect_rtos(struct target *target); static int FreeRTOS_create(struct target *target); static int FreeRTOS_update_threads(struct rtos *rtos); static int FreeRTOS_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char **hex_reg_list); @@ -528,14 +528,14 @@ static int FreeRTOS_get_thread_ascii_info(struct rtos *rtos, threadid_t thread_i #endif -static int FreeRTOS_detect_rtos(struct target *target) +static bool FreeRTOS_detect_rtos(struct target *target) { if ((target->rtos->symbols != NULL) && (target->rtos->symbols[FreeRTOS_VAL_pxReadyTasksLists].address != 0)) { /* looks like FreeRTOS */ - return 1; + return true; } - return 0; + return false; } static int FreeRTOS_create(struct target *target) diff --git a/src/rtos/ThreadX.c b/src/rtos/ThreadX.c index ab8a66e93..b7dbe6d11 100644 --- a/src/rtos/ThreadX.c +++ b/src/rtos/ThreadX.c @@ -35,7 +35,7 @@ static const struct rtos_register_stacking *get_stacking_info_arm926ejs(const st static int is_thread_id_valid(const struct rtos *rtos, int64_t thread_id); static int is_thread_id_valid_arm926ejs(const struct rtos *rtos, int64_t thread_id); -static int ThreadX_detect_rtos(struct target *target); +static bool ThreadX_detect_rtos(struct target *target); static int ThreadX_create(struct target *target); static int ThreadX_update_threads(struct rtos *rtos); static int ThreadX_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char **hex_reg_list); @@ -492,14 +492,14 @@ static int ThreadX_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]) return 0; } -static int ThreadX_detect_rtos(struct target *target) +static bool ThreadX_detect_rtos(struct target *target) { if ((target->rtos->symbols != NULL) && (target->rtos->symbols[ThreadX_VAL_tx_thread_created_ptr].address != 0)) { /* looks like ThreadX */ - return 1; + return true; } - return 0; + return false; } #if 0 diff --git a/src/rtos/eCos.c b/src/rtos/eCos.c index edc3d8b51..9e41030ee 100644 --- a/src/rtos/eCos.c +++ b/src/rtos/eCos.c @@ -27,7 +27,7 @@ #include "helper/types.h" #include "rtos_ecos_stackings.h" -static int eCos_detect_rtos(struct target *target); +static bool eCos_detect_rtos(struct target *target); static int eCos_create(struct target *target); static int eCos_update_threads(struct rtos *rtos); static int eCos_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char **hex_reg_list); @@ -363,14 +363,14 @@ static int eCos_get_symbol_list_to_lookup(symbol_table_elem_t *symbol_list[]) return 0; } -static int eCos_detect_rtos(struct target *target) +static bool eCos_detect_rtos(struct target *target) { if ((target->rtos->symbols != NULL) && (target->rtos->symbols[eCos_VAL_thread_list].address != 0)) { /* looks like eCos */ - return 1; + return true; } - return 0; + return false; } static int eCos_create(struct target *target) diff --git a/src/rtos/embKernel.c b/src/rtos/embKernel.c index e515383ac..a40c86c3f 100644 --- a/src/rtos/embKernel.c +++ b/src/rtos/embKernel.c @@ -31,7 +31,7 @@ #define EMBKERNEL_MAX_THREAD_NAME_STR_SIZE (64) -static int embKernel_detect_rtos(struct target *target); +static bool embKernel_detect_rtos(struct target *target); static int embKernel_create(struct target *target); static int embKernel_update_threads(struct rtos *rtos); static int embKernel_get_thread_reg_list(struct rtos *rtos, int64_t thread_id, char **hex_reg_list); @@ -107,13 +107,13 @@ static const struct embKernel_params embKernel_params_list[] = { } }; -static int embKernel_detect_rtos(struct target *target) +static bool embKernel_detect_rtos(struct target *target) { if (target->rtos->symbols != NULL) { if (target->rtos->symbols[SYMBOL_ID_sCurrentTask].address != 0) - return 1; + return true; } - return 0; + return false; } static int embKernel_create(struct target *target) diff --git a/src/rtos/linux.c b/src/rtos/linux.c index 3efaab133..3b2a2b0c3 100644 --- a/src/rtos/linux.c +++ b/src/rtos/linux.c @@ -309,10 +309,10 @@ static int linux_os_thread_reg_list(struct rtos *rtos, return ERROR_OK; } -static int linux_os_detect(struct target *target) +static bool linux_os_detect(struct target *target) { LOG_INFO("should no be called"); - return 0; + return false; } static int linux_os_smp_init(struct target *target); diff --git a/src/rtos/mqx.c b/src/rtos/mqx.c index 63a48c54b..531b03b57 100644 --- a/src/rtos/mqx.c +++ b/src/rtos/mqx.c @@ -244,9 +244,9 @@ static int mqx_is_scheduler_running( } /* - * API function, return 1 if MQX is present + * API function, return true if MQX is present */ -static int mqx_detect_rtos( +static bool mqx_detect_rtos( struct target *target ) { @@ -254,9 +254,9 @@ static int mqx_detect_rtos( (target->rtos->symbols != NULL) && (target->rtos->symbols[mqx_VAL_mqx_kernel_data].address != 0) ) { - return 1; + return true; } - return 0; + return false; } /* diff --git a/src/rtos/rtos.h b/src/rtos/rtos.h index 70c1193e5..87aa5027d 100644 --- a/src/rtos/rtos.h +++ b/src/rtos/rtos.h @@ -59,7 +59,7 @@ struct rtos { struct rtos_type { const char *name; - int (*detect_rtos)(struct target *target); + bool (*detect_rtos)(struct target *target); int (*create)(struct target *target); int (*smp_init)(struct target *target); int (*update_threads)(struct rtos *rtos); diff --git a/src/rtos/uCOS-III.c b/src/rtos/uCOS-III.c index 0a0fb3e9e..8e63ea4e6 100644 --- a/src/rtos/uCOS-III.c +++ b/src/rtos/uCOS-III.c @@ -241,7 +241,7 @@ static int uCOS_III_update_thread_offsets(struct rtos *rtos) return ERROR_OK; } -static int uCOS_III_detect_rtos(struct target *target) +static bool uCOS_III_detect_rtos(struct target *target) { return target->rtos->symbols != NULL && target->rtos->symbols[uCOS_III_VAL_OSRunning].address != 0;