rtos: Use 'bool' as return type for detect_rtos()

Change-Id: I91ad0431d44ed94f48d20c4690f8642d66f52a9b
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/4274
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
fence_i_fix_for_release
Marc Schink 2017-10-29 11:39:51 +01:00 committed by Spencer Oliver
parent 7e64451097
commit dba9293a89
9 changed files with 29 additions and 29 deletions

View File

@ -103,7 +103,7 @@ static struct ChibiOS_params ChibiOS_params_list[] = {
}; };
#define CHIBIOS_NUM_PARAMS ((int)(sizeof(ChibiOS_params_list)/sizeof(struct ChibiOS_params))) #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_create(struct target *target);
static int ChibiOS_update_threads(struct rtos *rtos); 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); 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; return 0;
} }
static int ChibiOS_detect_rtos(struct target *target) static bool ChibiOS_detect_rtos(struct target *target)
{ {
if ((target->rtos->symbols != NULL) && if ((target->rtos->symbols != NULL) &&
((target->rtos->symbols[ChibiOS_VAL_rlist].address != 0) || ((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) { if (target->rtos->symbols[ChibiOS_VAL_ch_debug].address == 0) {
LOG_INFO("It looks like the target may be running ChibiOS " LOG_INFO("It looks like the target may be running ChibiOS "
"without ch_debug."); "without ch_debug.");
return 0; return false;
} }
/* looks like ChibiOS with memory map enabled.*/ /* looks like ChibiOS with memory map enabled.*/
return 1; return true;
} }
return 0; return false;
} }
static int ChibiOS_create(struct target *target) static int ChibiOS_create(struct target *target)

View File

@ -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))) #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_create(struct target *target);
static int FreeRTOS_update_threads(struct rtos *rtos); 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); 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 #endif
static int FreeRTOS_detect_rtos(struct target *target) static bool FreeRTOS_detect_rtos(struct target *target)
{ {
if ((target->rtos->symbols != NULL) && if ((target->rtos->symbols != NULL) &&
(target->rtos->symbols[FreeRTOS_VAL_pxReadyTasksLists].address != 0)) { (target->rtos->symbols[FreeRTOS_VAL_pxReadyTasksLists].address != 0)) {
/* looks like FreeRTOS */ /* looks like FreeRTOS */
return 1; return true;
} }
return 0; return false;
} }
static int FreeRTOS_create(struct target *target) static int FreeRTOS_create(struct target *target)

View File

@ -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(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 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_create(struct target *target);
static int ThreadX_update_threads(struct rtos *rtos); 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); 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; return 0;
} }
static int ThreadX_detect_rtos(struct target *target) static bool ThreadX_detect_rtos(struct target *target)
{ {
if ((target->rtos->symbols != NULL) && if ((target->rtos->symbols != NULL) &&
(target->rtos->symbols[ThreadX_VAL_tx_thread_created_ptr].address != 0)) { (target->rtos->symbols[ThreadX_VAL_tx_thread_created_ptr].address != 0)) {
/* looks like ThreadX */ /* looks like ThreadX */
return 1; return true;
} }
return 0; return false;
} }
#if 0 #if 0

View File

@ -27,7 +27,7 @@
#include "helper/types.h" #include "helper/types.h"
#include "rtos_ecos_stackings.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_create(struct target *target);
static int eCos_update_threads(struct rtos *rtos); 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); 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; return 0;
} }
static int eCos_detect_rtos(struct target *target) static bool eCos_detect_rtos(struct target *target)
{ {
if ((target->rtos->symbols != NULL) && if ((target->rtos->symbols != NULL) &&
(target->rtos->symbols[eCos_VAL_thread_list].address != 0)) { (target->rtos->symbols[eCos_VAL_thread_list].address != 0)) {
/* looks like eCos */ /* looks like eCos */
return 1; return true;
} }
return 0; return false;
} }
static int eCos_create(struct target *target) static int eCos_create(struct target *target)

View File

@ -31,7 +31,7 @@
#define EMBKERNEL_MAX_THREAD_NAME_STR_SIZE (64) #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_create(struct target *target);
static int embKernel_update_threads(struct rtos *rtos); 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); 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 != NULL) {
if (target->rtos->symbols[SYMBOL_ID_sCurrentTask].address != 0) if (target->rtos->symbols[SYMBOL_ID_sCurrentTask].address != 0)
return 1; return true;
} }
return 0; return false;
} }
static int embKernel_create(struct target *target) static int embKernel_create(struct target *target)

View File

@ -309,10 +309,10 @@ static int linux_os_thread_reg_list(struct rtos *rtos,
return ERROR_OK; 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"); LOG_INFO("should no be called");
return 0; return false;
} }
static int linux_os_smp_init(struct target *target); static int linux_os_smp_init(struct target *target);

View File

@ -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 struct target *target
) )
{ {
@ -254,9 +254,9 @@ static int mqx_detect_rtos(
(target->rtos->symbols != NULL) && (target->rtos->symbols != NULL) &&
(target->rtos->symbols[mqx_VAL_mqx_kernel_data].address != 0) (target->rtos->symbols[mqx_VAL_mqx_kernel_data].address != 0)
) { ) {
return 1; return true;
} }
return 0; return false;
} }
/* /*

View File

@ -59,7 +59,7 @@ struct rtos {
struct rtos_type { struct rtos_type {
const char *name; const char *name;
int (*detect_rtos)(struct target *target); bool (*detect_rtos)(struct target *target);
int (*create)(struct target *target); int (*create)(struct target *target);
int (*smp_init)(struct target *target); int (*smp_init)(struct target *target);
int (*update_threads)(struct rtos *rtos); int (*update_threads)(struct rtos *rtos);

View File

@ -241,7 +241,7 @@ static int uCOS_III_update_thread_offsets(struct rtos *rtos)
return ERROR_OK; 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 && return target->rtos->symbols != NULL &&
target->rtos->symbols[uCOS_III_VAL_OSRunning].address != 0; target->rtos->symbols[uCOS_III_VAL_OSRunning].address != 0;