rtos: style corrections for uCOS-III

This patch corrects a number of style infractions in RTOS support for
uC/OS-III. These were missed during initial review last year prior to
the 0.10.0 release.

Change-Id: Ia2139f6ca381d4087fd8ee989f7a03ac474d7440
Signed-off-by: Steven Stallion <stallion@squareup.com>
Reviewed-on: http://openocd.zylin.com/4120
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
This commit is contained in:
Steven Stallion 2017-05-03 12:17:45 -05:00 committed by Freddie Chopin
parent 6767c1c1a3
commit e6fe4dddb9
3 changed files with 95 additions and 97 deletions

View File

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2016 by Square, Inc. * * Copyright (C) 2017 by Square, Inc. *
* Steven Stallion <stallion@squareup.com> * * Steven Stallion <stallion@squareup.com> *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -20,11 +20,12 @@
#include "config.h" #include "config.h"
#endif #endif
#include "rtos.h" #include <helper/types.h>
#include "rtos_standard_stackings.h" #include <rtos/rtos.h>
#include "target/armv7m.h" #include <rtos/rtos_standard_stackings.h>
#include <target/armv7m.h>
static const struct stack_register_offset rtos_uCOS_III_Cortex_M_stack_offsets[ARMV7M_NUM_CORE_REGS] = { static const struct stack_register_offset rtos_uCOS_III_Cortex_M_stack_offsets[] = {
{ 0x20, 32 }, /* r0 */ { 0x20, 32 }, /* r0 */
{ 0x24, 32 }, /* r1 */ { 0x24, 32 }, /* r1 */
{ 0x28, 32 }, /* r2 */ { 0x28, 32 }, /* r2 */
@ -47,7 +48,7 @@ static const struct stack_register_offset rtos_uCOS_III_Cortex_M_stack_offsets[A
const struct rtos_register_stacking rtos_uCOS_III_Cortex_M_stacking = { const struct rtos_register_stacking rtos_uCOS_III_Cortex_M_stacking = {
0x40, /* stack_registers_size */ 0x40, /* stack_registers_size */
-1, /* stack_growth_direction */ -1, /* stack_growth_direction */
ARMV7M_NUM_CORE_REGS, /* num_output_registers */ ARRAY_SIZE(rtos_uCOS_III_Cortex_M_stack_offsets), /* num_output_registers */
rtos_generic_stack_align8, /* stack_alignment */ rtos_generic_stack_align8, /* stack_alignment */
rtos_uCOS_III_Cortex_M_stack_offsets /* register_offsets */ rtos_uCOS_III_Cortex_M_stack_offsets /* register_offsets */
}; };

View File

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2016 by Square, Inc. * * Copyright (C) 2017 by Square, Inc. *
* Steven Stallion <stallion@squareup.com> * * Steven Stallion <stallion@squareup.com> *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -23,7 +23,7 @@
#include "config.h" #include "config.h"
#endif #endif
#include "rtos.h" #include <rtos/rtos.h>
extern const struct rtos_register_stacking rtos_uCOS_III_Cortex_M_stacking; extern const struct rtos_register_stacking rtos_uCOS_III_Cortex_M_stacking;

View File

@ -1,5 +1,5 @@
/*************************************************************************** /***************************************************************************
* Copyright (C) 2016 by Square, Inc. * * Copyright (C) 2017 by Square, Inc. *
* Steven Stallion <stallion@squareup.com> * * Steven Stallion <stallion@squareup.com> *
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
@ -20,14 +20,14 @@
#include "config.h" #include "config.h"
#endif #endif
#include <helper/log.h>
#include <helper/time_support.h> #include <helper/time_support.h>
#include <jtag/jtag.h> #include <helper/types.h>
#include "target/target.h" #include <rtos/rtos.h>
#include "target/target_type.h" #include <target/target.h>
#include "rtos.h" #include <target/target_type.h>
#include "helper/log.h"
#include "helper/types.h" #include "rtos_ucos_iii_stackings.h"
#include "rtos/rtos_ucos_iii_stackings.h"
#ifndef UCOS_III_MAX_STRLEN #ifndef UCOS_III_MAX_STRLEN
#define UCOS_III_MAX_STRLEN 64 #define UCOS_III_MAX_STRLEN 64
@ -263,8 +263,7 @@ static int uCOS_III_create(struct target *target)
for (size_t i = 0; i < ARRAY_SIZE(uCOS_III_params_list); i++) for (size_t i = 0; i < ARRAY_SIZE(uCOS_III_params_list); i++)
if (strcmp(uCOS_III_params_list[i].target_name, target->type->name) == 0) { if (strcmp(uCOS_III_params_list[i].target_name, target->type->name) == 0) {
params = malloc(sizeof(*params) + params = malloc(sizeof(*params) + (UCOS_III_MAX_THREADS * sizeof(*params->threads)));
UCOS_III_MAX_THREADS * sizeof(*params->threads));
if (params == NULL) { if (params == NULL) {
LOG_ERROR("uCOS-III: out of memory"); LOG_ERROR("uCOS-III: out of memory");
return ERROR_FAIL; return ERROR_FAIL;
@ -368,9 +367,7 @@ static int uCOS_III_update_threads(struct rtos *rtos)
char thread_str_buffer[UCOS_III_MAX_STRLEN + 1]; char thread_str_buffer[UCOS_III_MAX_STRLEN + 1];
/* find or create new threadid */ /* find or create new threadid */
retval = uCOS_III_find_or_create_thread(rtos, retval = uCOS_III_find_or_create_thread(rtos, thread_address, &thread_detail->threadid);
thread_address,
&thread_detail->threadid);
if (retval != ERROR_OK) { if (retval != ERROR_OK) {
LOG_ERROR("uCOS-III: failed to find or create thread"); LOG_ERROR("uCOS-III: failed to find or create thread");
return retval; return retval;