{ 16, "Exited" }
};
-#define ECOS_NUM_STATES (sizeof(eCos_thread_states)/sizeof(struct eCos_thread_state))
+#define ECOS_NUM_STATES ARRAY_SIZE(eCos_thread_states)
struct eCos_params {
const char *target_name;
}
};
-#define ECOS_NUM_PARAMS ((int)(sizeof(eCos_params_list)/sizeof(struct eCos_params)))
-
enum eCos_symbol_values {
eCos_VAL_thread_list = 0,
eCos_VAL_current_thread_ptr = 1
static int eCos_create(struct target *target)
{
- int i = 0;
- while ((i < ECOS_NUM_PARAMS) &&
- (0 != strcmp(eCos_params_list[i].target_name, target->type->name))) {
- i++;
- }
- if (i >= ECOS_NUM_PARAMS) {
- LOG_ERROR("Could not find target in eCos compatibility list");
- return -1;
- }
+ for (unsigned int i = 0; i < ARRAY_SIZE(eCos_params_list); i++)
+ if (strcmp(eCos_params_list[i].target_name, target->type->name) == 0) {
+ target->rtos->rtos_specific_params = (void *)&eCos_params_list[i];
+ target->rtos->current_thread = 0;
+ target->rtos->thread_details = NULL;
+ return 0;
+ }
- target->rtos->rtos_specific_params = (void *) &eCos_params_list[i];
- target->rtos->current_thread = 0;
- target->rtos->thread_details = NULL;
- return 0;
+ LOG_ERROR("Could not find target in eCos compatibility list");
+ return -1;
}