Port to C027 (using AppShield and Ethernet)

Dependencies:   C12832 EthernetInterface LM75B MMA7660 MQTT mbed-rtos mbed

Fork of IBMIoTClientEthernetExample by IBM Watson IoT

Committer:
samdanbury
Date:
Wed Aug 20 12:45:14 2014 +0000
Revision:
6:37b6d0d56190
Code completely changed to improve the structure, flow and memory usage of the application

Who changed what in which revision?

UserRevisionLine numberNew contents of line
samdanbury 6:37b6d0d56190 1 /*----------------------------------------------------------------------------
samdanbury 6:37b6d0d56190 2 * RL-ARM - RTX
samdanbury 6:37b6d0d56190 3 *----------------------------------------------------------------------------
samdanbury 6:37b6d0d56190 4 * Name: RT_LIST.C
samdanbury 6:37b6d0d56190 5 * Purpose: Functions for the management of different lists
samdanbury 6:37b6d0d56190 6 * Rev.: V4.60
samdanbury 6:37b6d0d56190 7 *----------------------------------------------------------------------------
samdanbury 6:37b6d0d56190 8 *
samdanbury 6:37b6d0d56190 9 * Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH
samdanbury 6:37b6d0d56190 10 * All rights reserved.
samdanbury 6:37b6d0d56190 11 * Redistribution and use in source and binary forms, with or without
samdanbury 6:37b6d0d56190 12 * modification, are permitted provided that the following conditions are met:
samdanbury 6:37b6d0d56190 13 * - Redistributions of source code must retain the above copyright
samdanbury 6:37b6d0d56190 14 * notice, this list of conditions and the following disclaimer.
samdanbury 6:37b6d0d56190 15 * - Redistributions in binary form must reproduce the above copyright
samdanbury 6:37b6d0d56190 16 * notice, this list of conditions and the following disclaimer in the
samdanbury 6:37b6d0d56190 17 * documentation and/or other materials provided with the distribution.
samdanbury 6:37b6d0d56190 18 * - Neither the name of ARM nor the names of its contributors may be used
samdanbury 6:37b6d0d56190 19 * to endorse or promote products derived from this software without
samdanbury 6:37b6d0d56190 20 * specific prior written permission.
samdanbury 6:37b6d0d56190 21 *
samdanbury 6:37b6d0d56190 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
samdanbury 6:37b6d0d56190 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
samdanbury 6:37b6d0d56190 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
samdanbury 6:37b6d0d56190 25 * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
samdanbury 6:37b6d0d56190 26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
samdanbury 6:37b6d0d56190 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
samdanbury 6:37b6d0d56190 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
samdanbury 6:37b6d0d56190 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
samdanbury 6:37b6d0d56190 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
samdanbury 6:37b6d0d56190 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
samdanbury 6:37b6d0d56190 32 * POSSIBILITY OF SUCH DAMAGE.
samdanbury 6:37b6d0d56190 33 *---------------------------------------------------------------------------*/
samdanbury 6:37b6d0d56190 34
samdanbury 6:37b6d0d56190 35 #include "rt_TypeDef.h"
samdanbury 6:37b6d0d56190 36 #include "RTX_Conf.h"
samdanbury 6:37b6d0d56190 37 #include "rt_System.h"
samdanbury 6:37b6d0d56190 38 #include "rt_List.h"
samdanbury 6:37b6d0d56190 39 #include "rt_Task.h"
samdanbury 6:37b6d0d56190 40 #include "rt_Time.h"
samdanbury 6:37b6d0d56190 41 #include "rt_HAL_CM.h"
samdanbury 6:37b6d0d56190 42
samdanbury 6:37b6d0d56190 43 /*----------------------------------------------------------------------------
samdanbury 6:37b6d0d56190 44 * Global Variables
samdanbury 6:37b6d0d56190 45 *---------------------------------------------------------------------------*/
samdanbury 6:37b6d0d56190 46
samdanbury 6:37b6d0d56190 47 /* List head of chained ready tasks */
samdanbury 6:37b6d0d56190 48 struct OS_XCB os_rdy;
samdanbury 6:37b6d0d56190 49 /* List head of chained delay tasks */
samdanbury 6:37b6d0d56190 50 struct OS_XCB os_dly;
samdanbury 6:37b6d0d56190 51
samdanbury 6:37b6d0d56190 52
samdanbury 6:37b6d0d56190 53 /*----------------------------------------------------------------------------
samdanbury 6:37b6d0d56190 54 * Functions
samdanbury 6:37b6d0d56190 55 *---------------------------------------------------------------------------*/
samdanbury 6:37b6d0d56190 56
samdanbury 6:37b6d0d56190 57
samdanbury 6:37b6d0d56190 58 /*--------------------------- rt_put_prio -----------------------------------*/
samdanbury 6:37b6d0d56190 59
samdanbury 6:37b6d0d56190 60 void rt_put_prio (P_XCB p_CB, P_TCB p_task) {
samdanbury 6:37b6d0d56190 61 /* Put task identified with "p_task" into list ordered by priority. */
samdanbury 6:37b6d0d56190 62 /* "p_CB" points to head of list; list has always an element at end with */
samdanbury 6:37b6d0d56190 63 /* a priority less than "p_task->prio". */
samdanbury 6:37b6d0d56190 64 P_TCB p_CB2;
samdanbury 6:37b6d0d56190 65 U32 prio;
samdanbury 6:37b6d0d56190 66 BOOL sem_mbx = __FALSE;
samdanbury 6:37b6d0d56190 67
samdanbury 6:37b6d0d56190 68 if (p_CB->cb_type == SCB || p_CB->cb_type == MCB || p_CB->cb_type == MUCB) {
samdanbury 6:37b6d0d56190 69 sem_mbx = __TRUE;
samdanbury 6:37b6d0d56190 70 }
samdanbury 6:37b6d0d56190 71 prio = p_task->prio;
samdanbury 6:37b6d0d56190 72 p_CB2 = p_CB->p_lnk;
samdanbury 6:37b6d0d56190 73 /* Search for an entry in the list */
samdanbury 6:37b6d0d56190 74 while (p_CB2 != NULL && prio <= p_CB2->prio) {
samdanbury 6:37b6d0d56190 75 p_CB = (P_XCB)p_CB2;
samdanbury 6:37b6d0d56190 76 p_CB2 = p_CB2->p_lnk;
samdanbury 6:37b6d0d56190 77 }
samdanbury 6:37b6d0d56190 78 /* Entry found, insert the task into the list */
samdanbury 6:37b6d0d56190 79 p_task->p_lnk = p_CB2;
samdanbury 6:37b6d0d56190 80 p_CB->p_lnk = p_task;
samdanbury 6:37b6d0d56190 81 if (sem_mbx) {
samdanbury 6:37b6d0d56190 82 if (p_CB2 != NULL) {
samdanbury 6:37b6d0d56190 83 p_CB2->p_rlnk = p_task;
samdanbury 6:37b6d0d56190 84 }
samdanbury 6:37b6d0d56190 85 p_task->p_rlnk = (P_TCB)p_CB;
samdanbury 6:37b6d0d56190 86 }
samdanbury 6:37b6d0d56190 87 else {
samdanbury 6:37b6d0d56190 88 p_task->p_rlnk = NULL;
samdanbury 6:37b6d0d56190 89 }
samdanbury 6:37b6d0d56190 90 }
samdanbury 6:37b6d0d56190 91
samdanbury 6:37b6d0d56190 92
samdanbury 6:37b6d0d56190 93 /*--------------------------- rt_get_first ----------------------------------*/
samdanbury 6:37b6d0d56190 94
samdanbury 6:37b6d0d56190 95 P_TCB rt_get_first (P_XCB p_CB) {
samdanbury 6:37b6d0d56190 96 /* Get task at head of list: it is the task with highest priority. */
samdanbury 6:37b6d0d56190 97 /* "p_CB" points to head of list. */
samdanbury 6:37b6d0d56190 98 P_TCB p_first;
samdanbury 6:37b6d0d56190 99
samdanbury 6:37b6d0d56190 100 p_first = p_CB->p_lnk;
samdanbury 6:37b6d0d56190 101 p_CB->p_lnk = p_first->p_lnk;
samdanbury 6:37b6d0d56190 102 if (p_CB->cb_type == SCB || p_CB->cb_type == MCB || p_CB->cb_type == MUCB) {
samdanbury 6:37b6d0d56190 103 if (p_first->p_lnk != NULL) {
samdanbury 6:37b6d0d56190 104 p_first->p_lnk->p_rlnk = (P_TCB)p_CB;
samdanbury 6:37b6d0d56190 105 p_first->p_lnk = NULL;
samdanbury 6:37b6d0d56190 106 }
samdanbury 6:37b6d0d56190 107 p_first->p_rlnk = NULL;
samdanbury 6:37b6d0d56190 108 }
samdanbury 6:37b6d0d56190 109 else {
samdanbury 6:37b6d0d56190 110 p_first->p_lnk = NULL;
samdanbury 6:37b6d0d56190 111 }
samdanbury 6:37b6d0d56190 112 return (p_first);
samdanbury 6:37b6d0d56190 113 }
samdanbury 6:37b6d0d56190 114
samdanbury 6:37b6d0d56190 115
samdanbury 6:37b6d0d56190 116 /*--------------------------- rt_put_rdy_first ------------------------------*/
samdanbury 6:37b6d0d56190 117
samdanbury 6:37b6d0d56190 118 void rt_put_rdy_first (P_TCB p_task) {
samdanbury 6:37b6d0d56190 119 /* Put task identified with "p_task" at the head of the ready list. The */
samdanbury 6:37b6d0d56190 120 /* task must have at least a priority equal to highest priority in list. */
samdanbury 6:37b6d0d56190 121 p_task->p_lnk = os_rdy.p_lnk;
samdanbury 6:37b6d0d56190 122 p_task->p_rlnk = NULL;
samdanbury 6:37b6d0d56190 123 os_rdy.p_lnk = p_task;
samdanbury 6:37b6d0d56190 124 }
samdanbury 6:37b6d0d56190 125
samdanbury 6:37b6d0d56190 126
samdanbury 6:37b6d0d56190 127 /*--------------------------- rt_get_same_rdy_prio --------------------------*/
samdanbury 6:37b6d0d56190 128
samdanbury 6:37b6d0d56190 129 P_TCB rt_get_same_rdy_prio (void) {
samdanbury 6:37b6d0d56190 130 /* Remove a task of same priority from ready list if any exists. Other- */
samdanbury 6:37b6d0d56190 131 /* wise return NULL. */
samdanbury 6:37b6d0d56190 132 P_TCB p_first;
samdanbury 6:37b6d0d56190 133
samdanbury 6:37b6d0d56190 134 p_first = os_rdy.p_lnk;
samdanbury 6:37b6d0d56190 135 if (p_first->prio == os_tsk.run->prio) {
samdanbury 6:37b6d0d56190 136 os_rdy.p_lnk = os_rdy.p_lnk->p_lnk;
samdanbury 6:37b6d0d56190 137 return (p_first);
samdanbury 6:37b6d0d56190 138 }
samdanbury 6:37b6d0d56190 139 return (NULL);
samdanbury 6:37b6d0d56190 140 }
samdanbury 6:37b6d0d56190 141
samdanbury 6:37b6d0d56190 142
samdanbury 6:37b6d0d56190 143 /*--------------------------- rt_resort_prio --------------------------------*/
samdanbury 6:37b6d0d56190 144
samdanbury 6:37b6d0d56190 145 void rt_resort_prio (P_TCB p_task) {
samdanbury 6:37b6d0d56190 146 /* Re-sort ordered lists after the priority of 'p_task' has changed. */
samdanbury 6:37b6d0d56190 147 P_TCB p_CB;
samdanbury 6:37b6d0d56190 148
samdanbury 6:37b6d0d56190 149 if (p_task->p_rlnk == NULL) {
samdanbury 6:37b6d0d56190 150 if (p_task->state == READY) {
samdanbury 6:37b6d0d56190 151 /* Task is chained into READY list. */
samdanbury 6:37b6d0d56190 152 p_CB = (P_TCB)&os_rdy;
samdanbury 6:37b6d0d56190 153 goto res;
samdanbury 6:37b6d0d56190 154 }
samdanbury 6:37b6d0d56190 155 }
samdanbury 6:37b6d0d56190 156 else {
samdanbury 6:37b6d0d56190 157 p_CB = p_task->p_rlnk;
samdanbury 6:37b6d0d56190 158 while (p_CB->cb_type == TCB) {
samdanbury 6:37b6d0d56190 159 /* Find a header of this task chain list. */
samdanbury 6:37b6d0d56190 160 p_CB = p_CB->p_rlnk;
samdanbury 6:37b6d0d56190 161 }
samdanbury 6:37b6d0d56190 162 res:rt_rmv_list (p_task);
samdanbury 6:37b6d0d56190 163 rt_put_prio ((P_XCB)p_CB, p_task);
samdanbury 6:37b6d0d56190 164 }
samdanbury 6:37b6d0d56190 165 }
samdanbury 6:37b6d0d56190 166
samdanbury 6:37b6d0d56190 167
samdanbury 6:37b6d0d56190 168 /*--------------------------- rt_put_dly ------------------------------------*/
samdanbury 6:37b6d0d56190 169
samdanbury 6:37b6d0d56190 170 void rt_put_dly (P_TCB p_task, U16 delay) {
samdanbury 6:37b6d0d56190 171 /* Put a task identified with "p_task" into chained delay wait list using */
samdanbury 6:37b6d0d56190 172 /* a delay value of "delay". */
samdanbury 6:37b6d0d56190 173 P_TCB p;
samdanbury 6:37b6d0d56190 174 U32 delta,idelay = delay;
samdanbury 6:37b6d0d56190 175
samdanbury 6:37b6d0d56190 176 p = (P_TCB)&os_dly;
samdanbury 6:37b6d0d56190 177 if (p->p_dlnk == NULL) {
samdanbury 6:37b6d0d56190 178 /* Delay list empty */
samdanbury 6:37b6d0d56190 179 delta = 0;
samdanbury 6:37b6d0d56190 180 goto last;
samdanbury 6:37b6d0d56190 181 }
samdanbury 6:37b6d0d56190 182 delta = os_dly.delta_time;
samdanbury 6:37b6d0d56190 183 while (delta < idelay) {
samdanbury 6:37b6d0d56190 184 if (p->p_dlnk == NULL) {
samdanbury 6:37b6d0d56190 185 /* End of list found */
samdanbury 6:37b6d0d56190 186 last: p_task->p_dlnk = NULL;
samdanbury 6:37b6d0d56190 187 p->p_dlnk = p_task;
samdanbury 6:37b6d0d56190 188 p_task->p_blnk = p;
samdanbury 6:37b6d0d56190 189 p->delta_time = (U16)(idelay - delta);
samdanbury 6:37b6d0d56190 190 p_task->delta_time = 0;
samdanbury 6:37b6d0d56190 191 return;
samdanbury 6:37b6d0d56190 192 }
samdanbury 6:37b6d0d56190 193 p = p->p_dlnk;
samdanbury 6:37b6d0d56190 194 delta += p->delta_time;
samdanbury 6:37b6d0d56190 195 }
samdanbury 6:37b6d0d56190 196 /* Right place found */
samdanbury 6:37b6d0d56190 197 p_task->p_dlnk = p->p_dlnk;
samdanbury 6:37b6d0d56190 198 p->p_dlnk = p_task;
samdanbury 6:37b6d0d56190 199 p_task->p_blnk = p;
samdanbury 6:37b6d0d56190 200 if (p_task->p_dlnk != NULL) {
samdanbury 6:37b6d0d56190 201 p_task->p_dlnk->p_blnk = p_task;
samdanbury 6:37b6d0d56190 202 }
samdanbury 6:37b6d0d56190 203 p_task->delta_time = (U16)(delta - idelay);
samdanbury 6:37b6d0d56190 204 p->delta_time -= p_task->delta_time;
samdanbury 6:37b6d0d56190 205 }
samdanbury 6:37b6d0d56190 206
samdanbury 6:37b6d0d56190 207
samdanbury 6:37b6d0d56190 208 /*--------------------------- rt_dec_dly ------------------------------------*/
samdanbury 6:37b6d0d56190 209
samdanbury 6:37b6d0d56190 210 void rt_dec_dly (void) {
samdanbury 6:37b6d0d56190 211 /* Decrement delta time of list head: remove tasks having a value of zero.*/
samdanbury 6:37b6d0d56190 212 P_TCB p_rdy;
samdanbury 6:37b6d0d56190 213
samdanbury 6:37b6d0d56190 214 if (os_dly.p_dlnk == NULL) {
samdanbury 6:37b6d0d56190 215 return;
samdanbury 6:37b6d0d56190 216 }
samdanbury 6:37b6d0d56190 217 os_dly.delta_time--;
samdanbury 6:37b6d0d56190 218 while ((os_dly.delta_time == 0) && (os_dly.p_dlnk != NULL)) {
samdanbury 6:37b6d0d56190 219 p_rdy = os_dly.p_dlnk;
samdanbury 6:37b6d0d56190 220 if (p_rdy->p_rlnk != NULL) {
samdanbury 6:37b6d0d56190 221 /* Task is really enqueued, remove task from semaphore/mailbox */
samdanbury 6:37b6d0d56190 222 /* timeout waiting list. */
samdanbury 6:37b6d0d56190 223 p_rdy->p_rlnk->p_lnk = p_rdy->p_lnk;
samdanbury 6:37b6d0d56190 224 if (p_rdy->p_lnk != NULL) {
samdanbury 6:37b6d0d56190 225 p_rdy->p_lnk->p_rlnk = p_rdy->p_rlnk;
samdanbury 6:37b6d0d56190 226 p_rdy->p_lnk = NULL;
samdanbury 6:37b6d0d56190 227 }
samdanbury 6:37b6d0d56190 228 p_rdy->p_rlnk = NULL;
samdanbury 6:37b6d0d56190 229 }
samdanbury 6:37b6d0d56190 230 rt_put_prio (&os_rdy, p_rdy);
samdanbury 6:37b6d0d56190 231 os_dly.delta_time = p_rdy->delta_time;
samdanbury 6:37b6d0d56190 232 if (p_rdy->state == WAIT_ITV) {
samdanbury 6:37b6d0d56190 233 /* Calculate the next time for interval wait. */
samdanbury 6:37b6d0d56190 234 p_rdy->delta_time = p_rdy->interval_time + (U16)os_time;
samdanbury 6:37b6d0d56190 235 }
samdanbury 6:37b6d0d56190 236 p_rdy->state = READY;
samdanbury 6:37b6d0d56190 237 os_dly.p_dlnk = p_rdy->p_dlnk;
samdanbury 6:37b6d0d56190 238 if (p_rdy->p_dlnk != NULL) {
samdanbury 6:37b6d0d56190 239 p_rdy->p_dlnk->p_blnk = (P_TCB)&os_dly;
samdanbury 6:37b6d0d56190 240 p_rdy->p_dlnk = NULL;
samdanbury 6:37b6d0d56190 241 }
samdanbury 6:37b6d0d56190 242 p_rdy->p_blnk = NULL;
samdanbury 6:37b6d0d56190 243 }
samdanbury 6:37b6d0d56190 244 }
samdanbury 6:37b6d0d56190 245
samdanbury 6:37b6d0d56190 246
samdanbury 6:37b6d0d56190 247 /*--------------------------- rt_rmv_list -----------------------------------*/
samdanbury 6:37b6d0d56190 248
samdanbury 6:37b6d0d56190 249 void rt_rmv_list (P_TCB p_task) {
samdanbury 6:37b6d0d56190 250 /* Remove task identified with "p_task" from ready, semaphore or mailbox */
samdanbury 6:37b6d0d56190 251 /* waiting list if enqueued. */
samdanbury 6:37b6d0d56190 252 P_TCB p_b;
samdanbury 6:37b6d0d56190 253
samdanbury 6:37b6d0d56190 254 if (p_task->p_rlnk != NULL) {
samdanbury 6:37b6d0d56190 255 /* A task is enqueued in semaphore / mailbox waiting list. */
samdanbury 6:37b6d0d56190 256 p_task->p_rlnk->p_lnk = p_task->p_lnk;
samdanbury 6:37b6d0d56190 257 if (p_task->p_lnk != NULL) {
samdanbury 6:37b6d0d56190 258 p_task->p_lnk->p_rlnk = p_task->p_rlnk;
samdanbury 6:37b6d0d56190 259 }
samdanbury 6:37b6d0d56190 260 return;
samdanbury 6:37b6d0d56190 261 }
samdanbury 6:37b6d0d56190 262
samdanbury 6:37b6d0d56190 263 p_b = (P_TCB)&os_rdy;
samdanbury 6:37b6d0d56190 264 while (p_b != NULL) {
samdanbury 6:37b6d0d56190 265 /* Search the ready list for task "p_task" */
samdanbury 6:37b6d0d56190 266 if (p_b->p_lnk == p_task) {
samdanbury 6:37b6d0d56190 267 p_b->p_lnk = p_task->p_lnk;
samdanbury 6:37b6d0d56190 268 return;
samdanbury 6:37b6d0d56190 269 }
samdanbury 6:37b6d0d56190 270 p_b = p_b->p_lnk;
samdanbury 6:37b6d0d56190 271 }
samdanbury 6:37b6d0d56190 272 }
samdanbury 6:37b6d0d56190 273
samdanbury 6:37b6d0d56190 274
samdanbury 6:37b6d0d56190 275 /*--------------------------- rt_rmv_dly ------------------------------------*/
samdanbury 6:37b6d0d56190 276
samdanbury 6:37b6d0d56190 277 void rt_rmv_dly (P_TCB p_task) {
samdanbury 6:37b6d0d56190 278 /* Remove task identified with "p_task" from delay list if enqueued. */
samdanbury 6:37b6d0d56190 279 P_TCB p_b;
samdanbury 6:37b6d0d56190 280
samdanbury 6:37b6d0d56190 281 p_b = p_task->p_blnk;
samdanbury 6:37b6d0d56190 282 if (p_b != NULL) {
samdanbury 6:37b6d0d56190 283 /* Task is really enqueued */
samdanbury 6:37b6d0d56190 284 p_b->p_dlnk = p_task->p_dlnk;
samdanbury 6:37b6d0d56190 285 if (p_task->p_dlnk != NULL) {
samdanbury 6:37b6d0d56190 286 /* 'p_task' is in the middle of list */
samdanbury 6:37b6d0d56190 287 p_b->delta_time += p_task->delta_time;
samdanbury 6:37b6d0d56190 288 p_task->p_dlnk->p_blnk = p_b;
samdanbury 6:37b6d0d56190 289 p_task->p_dlnk = NULL;
samdanbury 6:37b6d0d56190 290 }
samdanbury 6:37b6d0d56190 291 else {
samdanbury 6:37b6d0d56190 292 /* 'p_task' is at the end of list */
samdanbury 6:37b6d0d56190 293 p_b->delta_time = 0;
samdanbury 6:37b6d0d56190 294 }
samdanbury 6:37b6d0d56190 295 p_task->p_blnk = NULL;
samdanbury 6:37b6d0d56190 296 }
samdanbury 6:37b6d0d56190 297 }
samdanbury 6:37b6d0d56190 298
samdanbury 6:37b6d0d56190 299
samdanbury 6:37b6d0d56190 300 /*--------------------------- rt_psq_enq ------------------------------------*/
samdanbury 6:37b6d0d56190 301
samdanbury 6:37b6d0d56190 302 void rt_psq_enq (OS_ID entry, U32 arg) {
samdanbury 6:37b6d0d56190 303 /* Insert post service request "entry" into ps-queue. */
samdanbury 6:37b6d0d56190 304 U32 idx;
samdanbury 6:37b6d0d56190 305
samdanbury 6:37b6d0d56190 306 idx = rt_inc_qi (os_psq->size, &os_psq->count, &os_psq->first);
samdanbury 6:37b6d0d56190 307 if (idx < os_psq->size) {
samdanbury 6:37b6d0d56190 308 os_psq->q[idx].id = entry;
samdanbury 6:37b6d0d56190 309 os_psq->q[idx].arg = arg;
samdanbury 6:37b6d0d56190 310 }
samdanbury 6:37b6d0d56190 311 else {
samdanbury 6:37b6d0d56190 312 os_error (OS_ERR_FIFO_OVF);
samdanbury 6:37b6d0d56190 313 }
samdanbury 6:37b6d0d56190 314 }
samdanbury 6:37b6d0d56190 315
samdanbury 6:37b6d0d56190 316
samdanbury 6:37b6d0d56190 317 /*----------------------------------------------------------------------------
samdanbury 6:37b6d0d56190 318 * end of file
samdanbury 6:37b6d0d56190 319 *---------------------------------------------------------------------------*/
samdanbury 6:37b6d0d56190 320