Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: NaturalTinyShell_ice libmDot-12Sept mbed-rtos mbed
Fork of ICE by
src/ConfigurationHandler/ConfigurationHandler.cpp@1:057d8fc6cb2f, 2016-09-01 (annotated)
- Committer:
- jmarkel44
- Date:
- Thu Sep 01 19:42:11 2016 +0000
- Revision:
- 1:057d8fc6cb2f
- Parent:
- 0:65cfa4873284
- Child:
- 2:da28f21b72a1
args working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jmarkel44 | 0:65cfa4873284 | 1 | /****************************************************************************** |
jmarkel44 | 0:65cfa4873284 | 2 | * |
jmarkel44 | 0:65cfa4873284 | 3 | * File: ConfigurationHandler.cpp |
jmarkel44 | 0:65cfa4873284 | 4 | * Desciption: source for the ICE Configuration Handler |
jmarkel44 | 0:65cfa4873284 | 5 | * |
jmarkel44 | 0:65cfa4873284 | 6 | *****************************************************************************/ |
jmarkel44 | 0:65cfa4873284 | 7 | #include <stdio.h> |
jmarkel44 | 0:65cfa4873284 | 8 | #include "global.h" |
jmarkel44 | 0:65cfa4873284 | 9 | #include "rtos.h" |
jmarkel44 | 0:65cfa4873284 | 10 | #include "ConfigurationHandler.h" |
jmarkel44 | 0:65cfa4873284 | 11 | #include <map> |
jmarkel44 | 0:65cfa4873284 | 12 | #include <string> |
jmarkel44 | 0:65cfa4873284 | 13 | |
jmarkel44 | 0:65cfa4873284 | 14 | using namespace std; |
jmarkel44 | 0:65cfa4873284 | 15 | |
jmarkel44 | 0:65cfa4873284 | 16 | extern osThreadId mainThreadId; |
jmarkel44 | 0:65cfa4873284 | 17 | |
jmarkel44 | 0:65cfa4873284 | 18 | // local functions |
jmarkel44 | 0:65cfa4873284 | 19 | static void loadPersistentControls( void ); |
jmarkel44 | 0:65cfa4873284 | 20 | static void createHandler ( const Message_t * ); |
jmarkel44 | 0:65cfa4873284 | 21 | static void modifyHandler ( const Message_t * ); |
jmarkel44 | 0:65cfa4873284 | 22 | static void destroyHandler( const Message_t * ); |
jmarkel44 | 0:65cfa4873284 | 23 | static void displayThreadTable( void ); |
jmarkel44 | 0:65cfa4873284 | 24 | |
jmarkel44 | 0:65cfa4873284 | 25 | // control spawners |
jmarkel44 | 0:65cfa4873284 | 26 | static Thread* spawnNewTimerControl( const char * ); |
jmarkel44 | 0:65cfa4873284 | 27 | static Thread* spawnNewPIDControl( const char * ); |
jmarkel44 | 0:65cfa4873284 | 28 | static Thread* spawnNewSetpointControl( const char * ); |
jmarkel44 | 0:65cfa4873284 | 29 | static Thread* spawnNewCompositeControl(const char *); |
jmarkel44 | 0:65cfa4873284 | 30 | static Thread* spawnNewManualControl(const char *); |
jmarkel44 | 0:65cfa4873284 | 31 | |
jmarkel44 | 0:65cfa4873284 | 32 | // control thread table |
jmarkel44 | 0:65cfa4873284 | 33 | typedef map<string, Thread *> StringThreadMap; |
jmarkel44 | 0:65cfa4873284 | 34 | static StringThreadMap threadTable; |
jmarkel44 | 0:65cfa4873284 | 35 | |
jmarkel44 | 0:65cfa4873284 | 36 | /***************************************************************************** |
jmarkel44 | 0:65cfa4873284 | 37 | * Function: ConfigurationHandler |
jmarkel44 | 0:65cfa4873284 | 38 | * Description: entry point for the configuration handler |
jmarkel44 | 0:65cfa4873284 | 39 | * |
jmarkel44 | 0:65cfa4873284 | 40 | * @param (IN) args (user-defined arguments) |
jmarkel44 | 0:65cfa4873284 | 41 | * @return none |
jmarkel44 | 0:65cfa4873284 | 42 | *****************************************************************************/ |
jmarkel44 | 0:65cfa4873284 | 43 | void ConfigurationHandler(void const *args) |
jmarkel44 | 0:65cfa4873284 | 44 | { |
jmarkel44 | 0:65cfa4873284 | 45 | int rc; |
jmarkel44 | 0:65cfa4873284 | 46 | printf("\r%s is started...\n", __func__); |
jmarkel44 | 0:65cfa4873284 | 47 | |
jmarkel44 | 0:65cfa4873284 | 48 | //loadPersistentControls(); |
jmarkel44 | 0:65cfa4873284 | 49 | |
jmarkel44 | 0:65cfa4873284 | 50 | osSignalSet(mainThreadId, sig_continue); |
jmarkel44 | 0:65cfa4873284 | 51 | |
jmarkel44 | 0:65cfa4873284 | 52 | while (true) { |
jmarkel44 | 0:65cfa4873284 | 53 | // wait for a message from a data handler |
jmarkel44 | 0:65cfa4873284 | 54 | osEvent evt = MailBox.get(); |
jmarkel44 | 0:65cfa4873284 | 55 | if (evt.status == osEventMail) { |
jmarkel44 | 0:65cfa4873284 | 56 | Message_t *msg = (Message_t*)evt.value.p; |
jmarkel44 | 0:65cfa4873284 | 57 | switch (msg->action) { |
jmarkel44 | 0:65cfa4873284 | 58 | case ACTION_CREATE: |
jmarkel44 | 0:65cfa4873284 | 59 | createHandler(msg); |
jmarkel44 | 0:65cfa4873284 | 60 | break; |
jmarkel44 | 0:65cfa4873284 | 61 | case ACTION_MODIFY: |
jmarkel44 | 0:65cfa4873284 | 62 | modifyHandler(msg); |
jmarkel44 | 0:65cfa4873284 | 63 | break; |
jmarkel44 | 0:65cfa4873284 | 64 | case ACTION_DESTROY: |
jmarkel44 | 0:65cfa4873284 | 65 | destroyHandler(msg); |
jmarkel44 | 0:65cfa4873284 | 66 | break; |
jmarkel44 | 0:65cfa4873284 | 67 | default: |
jmarkel44 | 0:65cfa4873284 | 68 | printf("\r\n%s: ERROR\n", __FUNCTION__); |
jmarkel44 | 0:65cfa4873284 | 69 | rc = -1; |
jmarkel44 | 0:65cfa4873284 | 70 | break; |
jmarkel44 | 0:65cfa4873284 | 71 | } |
jmarkel44 | 0:65cfa4873284 | 72 | |
jmarkel44 | 0:65cfa4873284 | 73 | if ( rc != 0 ) { |
jmarkel44 | 0:65cfa4873284 | 74 | // do something |
jmarkel44 | 0:65cfa4873284 | 75 | } |
jmarkel44 | 0:65cfa4873284 | 76 | |
jmarkel44 | 0:65cfa4873284 | 77 | // free the allocated memory for the message |
jmarkel44 | 0:65cfa4873284 | 78 | MailBox.free(msg); |
jmarkel44 | 0:65cfa4873284 | 79 | } |
jmarkel44 | 0:65cfa4873284 | 80 | } |
jmarkel44 | 0:65cfa4873284 | 81 | } |
jmarkel44 | 0:65cfa4873284 | 82 | |
jmarkel44 | 0:65cfa4873284 | 83 | /***************************************************************************** |
jmarkel44 | 0:65cfa4873284 | 84 | * Function: ConfigurationHandler_DisplayThreads |
jmarkel44 | 0:65cfa4873284 | 85 | * Description: Display list of active threads |
jmarkel44 | 0:65cfa4873284 | 86 | * |
jmarkel44 | 0:65cfa4873284 | 87 | * @param none |
jmarkel44 | 0:65cfa4873284 | 88 | * @return none |
jmarkel44 | 0:65cfa4873284 | 89 | *****************************************************************************/ |
jmarkel44 | 0:65cfa4873284 | 90 | void ConfigurationHandler_DisplayThreads(void) |
jmarkel44 | 0:65cfa4873284 | 91 | { |
jmarkel44 | 0:65cfa4873284 | 92 | displayThreadTable(); |
jmarkel44 | 0:65cfa4873284 | 93 | } |
jmarkel44 | 0:65cfa4873284 | 94 | /***************************************************************************** |
jmarkel44 | 0:65cfa4873284 | 95 | * Function: loadPersistentControls |
jmarkel44 | 0:65cfa4873284 | 96 | * Description: Create a new control thread |
jmarkel44 | 0:65cfa4873284 | 97 | * |
jmarkel44 | 0:65cfa4873284 | 98 | * @param (IN) msg (parsed message data from the cloud) |
jmarkel44 | 0:65cfa4873284 | 99 | * @return none |
jmarkel44 | 0:65cfa4873284 | 100 | *****************************************************************************/ |
jmarkel44 | 0:65cfa4873284 | 101 | static void loadPersistentControls(void) |
jmarkel44 | 0:65cfa4873284 | 102 | { |
jmarkel44 | 0:65cfa4873284 | 103 | printf("\r%s no-op\n", __func__); |
jmarkel44 | 0:65cfa4873284 | 104 | } |
jmarkel44 | 0:65cfa4873284 | 105 | |
jmarkel44 | 0:65cfa4873284 | 106 | /***************************************************************************** |
jmarkel44 | 0:65cfa4873284 | 107 | * Function: createHandler |
jmarkel44 | 0:65cfa4873284 | 108 | * Description: Create a new control thread |
jmarkel44 | 0:65cfa4873284 | 109 | * |
jmarkel44 | 0:65cfa4873284 | 110 | * @param (IN) msg (parsed message data from the cloud) |
jmarkel44 | 0:65cfa4873284 | 111 | * @return none |
jmarkel44 | 0:65cfa4873284 | 112 | *****************************************************************************/ |
jmarkel44 | 0:65cfa4873284 | 113 | static void createHandler(const Message_t *msg) |
jmarkel44 | 0:65cfa4873284 | 114 | { |
jmarkel44 | 0:65cfa4873284 | 115 | printf("\r\n%s: invoked with %s [%u]\n", |
jmarkel44 | 0:65cfa4873284 | 116 | __func__, msg->controlFile, msg->control); |
jmarkel44 | 1:057d8fc6cb2f | 117 | |
jmarkel44 | 0:65cfa4873284 | 118 | switch (msg->control) { |
jmarkel44 | 0:65cfa4873284 | 119 | case CONTROL_TIMER: { |
jmarkel44 | 0:65cfa4873284 | 120 | Thread *t = spawnNewTimerControl(msg->controlFile); |
jmarkel44 | 0:65cfa4873284 | 121 | threadTable[msg->controlFile] = t; |
jmarkel44 | 0:65cfa4873284 | 122 | break; |
jmarkel44 | 0:65cfa4873284 | 123 | } |
jmarkel44 | 0:65cfa4873284 | 124 | case CONTROL_PID: { |
jmarkel44 | 0:65cfa4873284 | 125 | Thread *t = spawnNewPIDControl(msg->controlFile); |
jmarkel44 | 0:65cfa4873284 | 126 | threadTable[msg->controlFile] = t; |
jmarkel44 | 0:65cfa4873284 | 127 | break; |
jmarkel44 | 0:65cfa4873284 | 128 | } |
jmarkel44 | 0:65cfa4873284 | 129 | case CONTROL_SETPOINT: { |
jmarkel44 | 0:65cfa4873284 | 130 | Thread *t = spawnNewSetpointControl(msg->controlFile); |
jmarkel44 | 0:65cfa4873284 | 131 | threadTable[msg->controlFile] = t; |
jmarkel44 | 0:65cfa4873284 | 132 | break; |
jmarkel44 | 0:65cfa4873284 | 133 | } |
jmarkel44 | 0:65cfa4873284 | 134 | case CONTROL_COMPOSITE: { |
jmarkel44 | 0:65cfa4873284 | 135 | Thread *t = spawnNewCompositeControl(msg->controlFile); |
jmarkel44 | 0:65cfa4873284 | 136 | threadTable[msg->controlFile] = t; |
jmarkel44 | 0:65cfa4873284 | 137 | break; |
jmarkel44 | 0:65cfa4873284 | 138 | } |
jmarkel44 | 0:65cfa4873284 | 139 | case CONTROL_MANUAL: { |
jmarkel44 | 0:65cfa4873284 | 140 | Thread *t = spawnNewManualControl(msg->controlFile); |
jmarkel44 | 0:65cfa4873284 | 141 | threadTable[msg->controlFile] = t; |
jmarkel44 | 0:65cfa4873284 | 142 | break; |
jmarkel44 | 0:65cfa4873284 | 143 | } |
jmarkel44 | 0:65cfa4873284 | 144 | default: |
jmarkel44 | 0:65cfa4873284 | 145 | printf("%s: unkown control type (%u)", __func__, msg->control); |
jmarkel44 | 0:65cfa4873284 | 146 | break; |
jmarkel44 | 0:65cfa4873284 | 147 | } |
jmarkel44 | 0:65cfa4873284 | 148 | } |
jmarkel44 | 0:65cfa4873284 | 149 | |
jmarkel44 | 0:65cfa4873284 | 150 | /***************************************************************************** |
jmarkel44 | 0:65cfa4873284 | 151 | * Function: modifyHandler |
jmarkel44 | 0:65cfa4873284 | 152 | * Description: modify an existing control thread |
jmarkel44 | 0:65cfa4873284 | 153 | * |
jmarkel44 | 0:65cfa4873284 | 154 | * @param (IN) args (user-defined arguments) |
jmarkel44 | 0:65cfa4873284 | 155 | * @return none |
jmarkel44 | 0:65cfa4873284 | 156 | *****************************************************************************/ |
jmarkel44 | 0:65cfa4873284 | 157 | static void modifyHandler(const Message_t *msg) |
jmarkel44 | 0:65cfa4873284 | 158 | { |
jmarkel44 | 0:65cfa4873284 | 159 | // STUBBED |
jmarkel44 | 0:65cfa4873284 | 160 | printf("\r\n%s: invoked with %s\n", __FUNCTION__, msg->controlFile); |
jmarkel44 | 0:65cfa4873284 | 161 | } |
jmarkel44 | 0:65cfa4873284 | 162 | |
jmarkel44 | 0:65cfa4873284 | 163 | /***************************************************************************** |
jmarkel44 | 0:65cfa4873284 | 164 | * Function: destroyHandler |
jmarkel44 | 0:65cfa4873284 | 165 | * Description: detroy an existing control thread |
jmarkel44 | 0:65cfa4873284 | 166 | * |
jmarkel44 | 0:65cfa4873284 | 167 | * @param (IN) args (user-defined arguments) |
jmarkel44 | 0:65cfa4873284 | 168 | * @return none |
jmarkel44 | 0:65cfa4873284 | 169 | *****************************************************************************/ |
jmarkel44 | 0:65cfa4873284 | 170 | static void destroyHandler(const Message_t *msg) |
jmarkel44 | 0:65cfa4873284 | 171 | { |
jmarkel44 | 0:65cfa4873284 | 172 | printf("\r\n%s: invoked with %s\n", __FUNCTION__, msg->controlFile); |
jmarkel44 | 0:65cfa4873284 | 173 | |
jmarkel44 | 0:65cfa4873284 | 174 | StringThreadMap::iterator pos; |
jmarkel44 | 0:65cfa4873284 | 175 | |
jmarkel44 | 0:65cfa4873284 | 176 | // find the control thread, terminate it, then delete the entry |
jmarkel44 | 0:65cfa4873284 | 177 | // from the thread table. |
jmarkel44 | 0:65cfa4873284 | 178 | pos = threadTable.find(msg->controlFile); |
jmarkel44 | 0:65cfa4873284 | 179 | if ( pos != threadTable.end() ) { |
jmarkel44 | 0:65cfa4873284 | 180 | Thread *t = pos->second; |
jmarkel44 | 0:65cfa4873284 | 181 | t->terminate(); |
jmarkel44 | 0:65cfa4873284 | 182 | // perform cleanup |
jmarkel44 | 0:65cfa4873284 | 183 | delete t; |
jmarkel44 | 0:65cfa4873284 | 184 | // remove the entry from the map |
jmarkel44 | 0:65cfa4873284 | 185 | threadTable.erase(pos); |
jmarkel44 | 0:65cfa4873284 | 186 | } |
jmarkel44 | 0:65cfa4873284 | 187 | } |
jmarkel44 | 0:65cfa4873284 | 188 | |
jmarkel44 | 1:057d8fc6cb2f | 189 | static Thread *spawnNewTimerControl( const char *controlFile) |
jmarkel44 | 0:65cfa4873284 | 190 | { |
jmarkel44 | 1:057d8fc6cb2f | 191 | // TODO: Be sure to free these args when the thread dies |
jmarkel44 | 1:057d8fc6cb2f | 192 | Args_t *args = (Args_t*)malloc(sizeof(Args_t)); |
jmarkel44 | 1:057d8fc6cb2f | 193 | |
jmarkel44 | 1:057d8fc6cb2f | 194 | strncpy(args->controlFile, controlFile, sizeof(args->controlFile)); |
jmarkel44 | 1:057d8fc6cb2f | 195 | args->reserved = 0; |
jmarkel44 | 1:057d8fc6cb2f | 196 | |
jmarkel44 | 1:057d8fc6cb2f | 197 | Thread *t = new Thread(TimerControl, (void *)args); |
jmarkel44 | 0:65cfa4873284 | 198 | return t; |
jmarkel44 | 0:65cfa4873284 | 199 | } |
jmarkel44 | 0:65cfa4873284 | 200 | static Thread* spawnNewPIDControl( const char *controlFile ) |
jmarkel44 | 0:65cfa4873284 | 201 | { |
jmarkel44 | 1:057d8fc6cb2f | 202 | Args_t *args = (Args_t *)malloc(sizeof(Args_t)); |
jmarkel44 | 1:057d8fc6cb2f | 203 | |
jmarkel44 | 1:057d8fc6cb2f | 204 | strncpy(args->controlFile, controlFile, sizeof(args->controlFile)); |
jmarkel44 | 1:057d8fc6cb2f | 205 | args->reserved = 0; |
jmarkel44 | 1:057d8fc6cb2f | 206 | |
jmarkel44 | 1:057d8fc6cb2f | 207 | Thread *t = new Thread(PIDControl, (void *)args); |
jmarkel44 | 0:65cfa4873284 | 208 | return t; |
jmarkel44 | 0:65cfa4873284 | 209 | } |
jmarkel44 | 0:65cfa4873284 | 210 | |
jmarkel44 | 0:65cfa4873284 | 211 | static Thread* spawnNewSetpointControl( const char *controlFile ) |
jmarkel44 | 0:65cfa4873284 | 212 | { |
jmarkel44 | 1:057d8fc6cb2f | 213 | Args_t *args = (Args_t *)malloc(sizeof(Args_t)); |
jmarkel44 | 1:057d8fc6cb2f | 214 | |
jmarkel44 | 1:057d8fc6cb2f | 215 | strncpy(args->controlFile, controlFile, sizeof(args->controlFile)); |
jmarkel44 | 1:057d8fc6cb2f | 216 | args->reserved = 0; |
jmarkel44 | 1:057d8fc6cb2f | 217 | |
jmarkel44 | 1:057d8fc6cb2f | 218 | Thread *t = new Thread(SetpointControl, (void *)args); |
jmarkel44 | 0:65cfa4873284 | 219 | return t; |
jmarkel44 | 0:65cfa4873284 | 220 | } |
jmarkel44 | 0:65cfa4873284 | 221 | |
jmarkel44 | 1:057d8fc6cb2f | 222 | static Thread* spawnNewCompositeControl(const char *controlFile) |
jmarkel44 | 0:65cfa4873284 | 223 | { |
jmarkel44 | 1:057d8fc6cb2f | 224 | Args_t *args = (Args_t *)malloc(sizeof(Args_t)); |
jmarkel44 | 1:057d8fc6cb2f | 225 | |
jmarkel44 | 1:057d8fc6cb2f | 226 | strncpy(args->controlFile, controlFile, sizeof(args->controlFile)); |
jmarkel44 | 1:057d8fc6cb2f | 227 | args->reserved = 0; |
jmarkel44 | 1:057d8fc6cb2f | 228 | |
jmarkel44 | 1:057d8fc6cb2f | 229 | Thread *t = new Thread(CompositeControl, (void *)args); |
jmarkel44 | 0:65cfa4873284 | 230 | return t; |
jmarkel44 | 0:65cfa4873284 | 231 | } |
jmarkel44 | 1:057d8fc6cb2f | 232 | |
jmarkel44 | 0:65cfa4873284 | 233 | static Thread* spawnNewManualControl(const char *controlFile) |
jmarkel44 | 0:65cfa4873284 | 234 | { |
jmarkel44 | 1:057d8fc6cb2f | 235 | Args_t *args = (Args_t *)malloc(sizeof(Args_t)); |
jmarkel44 | 1:057d8fc6cb2f | 236 | |
jmarkel44 | 1:057d8fc6cb2f | 237 | strncpy(args->controlFile, controlFile, sizeof(args->controlFile)); |
jmarkel44 | 1:057d8fc6cb2f | 238 | args->reserved = 0; |
jmarkel44 | 1:057d8fc6cb2f | 239 | |
jmarkel44 | 1:057d8fc6cb2f | 240 | Thread *t = new Thread(ManualControl, (void *)args); |
jmarkel44 | 0:65cfa4873284 | 241 | return t; |
jmarkel44 | 0:65cfa4873284 | 242 | } |
jmarkel44 | 0:65cfa4873284 | 243 | |
jmarkel44 | 0:65cfa4873284 | 244 | /***************************************************************************** |
jmarkel44 | 0:65cfa4873284 | 245 | * Function: displayThreadTable |
jmarkel44 | 0:65cfa4873284 | 246 | * Description: display the elements in the thread table |
jmarkel44 | 0:65cfa4873284 | 247 | * |
jmarkel44 | 0:65cfa4873284 | 248 | * @param (IN) controlFile: file which to control fome |
jmarkel44 | 0:65cfa4873284 | 249 | * @return osThreadId |
jmarkel44 | 0:65cfa4873284 | 250 | *****************************************************************************/ |
jmarkel44 | 0:65cfa4873284 | 251 | static void displayThreadTable(void) |
jmarkel44 | 0:65cfa4873284 | 252 | { |
jmarkel44 | 0:65cfa4873284 | 253 | StringThreadMap::iterator pos; |
jmarkel44 | 0:65cfa4873284 | 254 | |
jmarkel44 | 0:65cfa4873284 | 255 | // this must exactly match the OS thread states in Thread.h |
jmarkel44 | 0:65cfa4873284 | 256 | const char *stateMapper[] = { "Inactive", |
jmarkel44 | 0:65cfa4873284 | 257 | "Ready", |
jmarkel44 | 0:65cfa4873284 | 258 | "Running", |
jmarkel44 | 0:65cfa4873284 | 259 | "WaitingDelay", |
jmarkel44 | 0:65cfa4873284 | 260 | "WaitingInterval", |
jmarkel44 | 0:65cfa4873284 | 261 | "WaitingOr", |
jmarkel44 | 0:65cfa4873284 | 262 | "WaitingAnd", |
jmarkel44 | 0:65cfa4873284 | 263 | "WaitingSemaphore", |
jmarkel44 | 0:65cfa4873284 | 264 | "WaitingMailbox", |
jmarkel44 | 0:65cfa4873284 | 265 | "WaitingMutex", |
jmarkel44 | 0:65cfa4873284 | 266 | "Deleted" |
jmarkel44 | 0:65cfa4873284 | 267 | }; |
jmarkel44 | 0:65cfa4873284 | 268 | |
jmarkel44 | 0:65cfa4873284 | 269 | if ( threadTable.size() == 0 ) { |
jmarkel44 | 0:65cfa4873284 | 270 | printf("\r\nThere are currently no active control threads\r\n"); |
jmarkel44 | 0:65cfa4873284 | 271 | return; |
jmarkel44 | 0:65cfa4873284 | 272 | } |
jmarkel44 | 0:65cfa4873284 | 273 | |
jmarkel44 | 0:65cfa4873284 | 274 | printf("\rControl Thread Table\n"); |
jmarkel44 | 0:65cfa4873284 | 275 | for ( pos = threadTable.begin(); pos != threadTable.end(); ++pos ) { |
jmarkel44 | 0:65cfa4873284 | 276 | Thread *t = (Thread *)pos->second; |
jmarkel44 | 0:65cfa4873284 | 277 | printf("\r[%32s]->\tpri=%u\tstate=%s\tstack_size=%u\tfree=%u\tused=%u\tmax=%u\r\n", |
jmarkel44 | 0:65cfa4873284 | 278 | pos->first.c_str(), |
jmarkel44 | 0:65cfa4873284 | 279 | t->get_priority(), |
jmarkel44 | 0:65cfa4873284 | 280 | stateMapper[t->get_state()], |
jmarkel44 | 0:65cfa4873284 | 281 | t->stack_size(), |
jmarkel44 | 0:65cfa4873284 | 282 | t->free_stack(), |
jmarkel44 | 0:65cfa4873284 | 283 | t->used_stack(), |
jmarkel44 | 0:65cfa4873284 | 284 | t->max_stack()); |
jmarkel44 | 0:65cfa4873284 | 285 | } |
jmarkel44 | 0:65cfa4873284 | 286 | } |
jmarkel44 | 0:65cfa4873284 | 287 |