Nummer 0.1 Werkt nog niet volledig
Fork of mbed-rtos by
rtx/TARGET_CORTEX_A/rt_Mutex.c@109:f37e70028583, 2016-05-13 (annotated)
- Committer:
- Reynier
- Date:
- Fri May 13 21:42:20 2016 +0000
- Revision:
- 109:f37e70028583
- Parent:
- 92:bc9729798a19
Alles zonder werkende NRF
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 48:e9a2c7cb57a4 | 1 | /*---------------------------------------------------------------------------- |
mbed_official | 48:e9a2c7cb57a4 | 2 | * RL-ARM - RTX |
mbed_official | 48:e9a2c7cb57a4 | 3 | *---------------------------------------------------------------------------- |
mbed_official | 48:e9a2c7cb57a4 | 4 | * Name: RT_MUTEX.C |
mbed_official | 48:e9a2c7cb57a4 | 5 | * Purpose: Implements mutex synchronization objects |
mbed_official | 92:bc9729798a19 | 6 | * Rev.: V4.73 |
mbed_official | 48:e9a2c7cb57a4 | 7 | *---------------------------------------------------------------------------- |
mbed_official | 48:e9a2c7cb57a4 | 8 | * |
mbed_official | 92:bc9729798a19 | 9 | * Copyright (c) 1999-2009 KEIL, 2009-2013 ARM Germany GmbH |
mbed_official | 48:e9a2c7cb57a4 | 10 | * All rights reserved. |
mbed_official | 48:e9a2c7cb57a4 | 11 | * Redistribution and use in source and binary forms, with or without |
mbed_official | 48:e9a2c7cb57a4 | 12 | * modification, are permitted provided that the following conditions are met: |
mbed_official | 48:e9a2c7cb57a4 | 13 | * - Redistributions of source code must retain the above copyright |
mbed_official | 48:e9a2c7cb57a4 | 14 | * notice, this list of conditions and the following disclaimer. |
mbed_official | 48:e9a2c7cb57a4 | 15 | * - Redistributions in binary form must reproduce the above copyright |
mbed_official | 48:e9a2c7cb57a4 | 16 | * notice, this list of conditions and the following disclaimer in the |
mbed_official | 48:e9a2c7cb57a4 | 17 | * documentation and/or other materials provided with the distribution. |
mbed_official | 68:d3d0e710b443 | 18 | * - Neither the name of ARM nor the names of its contributors may be used |
mbed_official | 68:d3d0e710b443 | 19 | * to endorse or promote products derived from this software without |
mbed_official | 48:e9a2c7cb57a4 | 20 | * specific prior written permission. |
mbed_official | 48:e9a2c7cb57a4 | 21 | * |
mbed_official | 68:d3d0e710b443 | 22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 68:d3d0e710b443 | 23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 48:e9a2c7cb57a4 | 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
mbed_official | 48:e9a2c7cb57a4 | 25 | * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE |
mbed_official | 48:e9a2c7cb57a4 | 26 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
mbed_official | 68:d3d0e710b443 | 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
mbed_official | 68:d3d0e710b443 | 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
mbed_official | 68:d3d0e710b443 | 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
mbed_official | 68:d3d0e710b443 | 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
mbed_official | 48:e9a2c7cb57a4 | 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
mbed_official | 48:e9a2c7cb57a4 | 32 | * POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 48:e9a2c7cb57a4 | 33 | *---------------------------------------------------------------------------*/ |
mbed_official | 48:e9a2c7cb57a4 | 34 | |
mbed_official | 48:e9a2c7cb57a4 | 35 | #include "rt_TypeDef.h" |
mbed_official | 48:e9a2c7cb57a4 | 36 | #include "RTX_Config.h" |
mbed_official | 48:e9a2c7cb57a4 | 37 | #include "rt_List.h" |
mbed_official | 48:e9a2c7cb57a4 | 38 | #include "rt_Task.h" |
mbed_official | 48:e9a2c7cb57a4 | 39 | #include "rt_Mutex.h" |
mbed_official | 48:e9a2c7cb57a4 | 40 | #ifdef __CORTEX_A9 |
mbed_official | 48:e9a2c7cb57a4 | 41 | #include "rt_HAL_CA.h" |
mbed_official | 48:e9a2c7cb57a4 | 42 | #else |
mbed_official | 48:e9a2c7cb57a4 | 43 | #include "rt_HAL_CM.h" |
mbed_official | 48:e9a2c7cb57a4 | 44 | #endif |
mbed_official | 48:e9a2c7cb57a4 | 45 | |
mbed_official | 48:e9a2c7cb57a4 | 46 | |
mbed_official | 48:e9a2c7cb57a4 | 47 | /*---------------------------------------------------------------------------- |
mbed_official | 48:e9a2c7cb57a4 | 48 | * Functions |
mbed_official | 48:e9a2c7cb57a4 | 49 | *---------------------------------------------------------------------------*/ |
mbed_official | 48:e9a2c7cb57a4 | 50 | |
mbed_official | 48:e9a2c7cb57a4 | 51 | |
mbed_official | 48:e9a2c7cb57a4 | 52 | /*--------------------------- rt_mut_init -----------------------------------*/ |
mbed_official | 48:e9a2c7cb57a4 | 53 | |
mbed_official | 48:e9a2c7cb57a4 | 54 | void rt_mut_init (OS_ID mutex) { |
mbed_official | 48:e9a2c7cb57a4 | 55 | /* Initialize a mutex object */ |
mbed_official | 48:e9a2c7cb57a4 | 56 | P_MUCB p_MCB = mutex; |
mbed_official | 48:e9a2c7cb57a4 | 57 | |
mbed_official | 48:e9a2c7cb57a4 | 58 | p_MCB->cb_type = MUCB; |
mbed_official | 48:e9a2c7cb57a4 | 59 | p_MCB->level = 0; |
mbed_official | 48:e9a2c7cb57a4 | 60 | p_MCB->p_lnk = NULL; |
mbed_official | 48:e9a2c7cb57a4 | 61 | p_MCB->owner = NULL; |
mbed_official | 92:bc9729798a19 | 62 | p_MCB->p_mlnk = NULL; |
mbed_official | 48:e9a2c7cb57a4 | 63 | } |
mbed_official | 48:e9a2c7cb57a4 | 64 | |
mbed_official | 48:e9a2c7cb57a4 | 65 | |
mbed_official | 48:e9a2c7cb57a4 | 66 | /*--------------------------- rt_mut_delete ---------------------------------*/ |
mbed_official | 48:e9a2c7cb57a4 | 67 | |
mbed_official | 48:e9a2c7cb57a4 | 68 | #ifdef __CMSIS_RTOS |
mbed_official | 48:e9a2c7cb57a4 | 69 | OS_RESULT rt_mut_delete (OS_ID mutex) { |
mbed_official | 48:e9a2c7cb57a4 | 70 | /* Delete a mutex object */ |
mbed_official | 48:e9a2c7cb57a4 | 71 | P_MUCB p_MCB = mutex; |
mbed_official | 48:e9a2c7cb57a4 | 72 | P_TCB p_TCB; |
mbed_official | 92:bc9729798a19 | 73 | P_MUCB p_mlnk; |
mbed_official | 92:bc9729798a19 | 74 | U8 prio; |
mbed_official | 48:e9a2c7cb57a4 | 75 | |
mbed_official | 48:e9a2c7cb57a4 | 76 | __DMB(); |
mbed_official | 48:e9a2c7cb57a4 | 77 | /* Restore owner task's priority. */ |
mbed_official | 48:e9a2c7cb57a4 | 78 | if (p_MCB->level != 0) { |
mbed_official | 92:bc9729798a19 | 79 | |
mbed_official | 92:bc9729798a19 | 80 | p_TCB = p_MCB->owner; |
mbed_official | 92:bc9729798a19 | 81 | |
mbed_official | 92:bc9729798a19 | 82 | /* Remove mutex from task mutex owner list. */ |
mbed_official | 92:bc9729798a19 | 83 | p_mlnk = p_TCB->p_mlnk; |
mbed_official | 92:bc9729798a19 | 84 | if (p_mlnk == p_MCB) { |
mbed_official | 92:bc9729798a19 | 85 | p_TCB->p_mlnk = p_MCB->p_mlnk; |
mbed_official | 92:bc9729798a19 | 86 | } |
mbed_official | 92:bc9729798a19 | 87 | else { |
mbed_official | 92:bc9729798a19 | 88 | while (p_mlnk) { |
mbed_official | 92:bc9729798a19 | 89 | if (p_mlnk->p_mlnk == p_MCB) { |
mbed_official | 92:bc9729798a19 | 90 | p_mlnk->p_mlnk = p_MCB->p_mlnk; |
mbed_official | 92:bc9729798a19 | 91 | break; |
mbed_official | 92:bc9729798a19 | 92 | } |
mbed_official | 92:bc9729798a19 | 93 | p_mlnk = p_mlnk->p_mlnk; |
mbed_official | 92:bc9729798a19 | 94 | } |
mbed_official | 48:e9a2c7cb57a4 | 95 | } |
mbed_official | 92:bc9729798a19 | 96 | |
mbed_official | 92:bc9729798a19 | 97 | /* Restore owner task's priority. */ |
mbed_official | 92:bc9729798a19 | 98 | prio = p_TCB->prio_base; |
mbed_official | 92:bc9729798a19 | 99 | p_mlnk = p_TCB->p_mlnk; |
mbed_official | 92:bc9729798a19 | 100 | while (p_mlnk) { |
mbed_official | 92:bc9729798a19 | 101 | if (p_mlnk->p_lnk && (p_mlnk->p_lnk->prio > prio)) { |
mbed_official | 92:bc9729798a19 | 102 | /* A task with higher priority is waiting for mutex. */ |
mbed_official | 92:bc9729798a19 | 103 | prio = p_mlnk->p_lnk->prio; |
mbed_official | 92:bc9729798a19 | 104 | } |
mbed_official | 92:bc9729798a19 | 105 | p_mlnk = p_mlnk->p_mlnk; |
mbed_official | 92:bc9729798a19 | 106 | } |
mbed_official | 92:bc9729798a19 | 107 | if (p_TCB->prio != prio) { |
mbed_official | 92:bc9729798a19 | 108 | p_TCB->prio = prio; |
mbed_official | 92:bc9729798a19 | 109 | if (p_TCB != os_tsk.run) { |
mbed_official | 92:bc9729798a19 | 110 | rt_resort_prio (p_TCB); |
mbed_official | 92:bc9729798a19 | 111 | } |
mbed_official | 92:bc9729798a19 | 112 | } |
mbed_official | 92:bc9729798a19 | 113 | |
mbed_official | 48:e9a2c7cb57a4 | 114 | } |
mbed_official | 48:e9a2c7cb57a4 | 115 | |
mbed_official | 48:e9a2c7cb57a4 | 116 | while (p_MCB->p_lnk != NULL) { |
mbed_official | 48:e9a2c7cb57a4 | 117 | /* A task is waiting for mutex. */ |
mbed_official | 48:e9a2c7cb57a4 | 118 | p_TCB = rt_get_first ((P_XCB)p_MCB); |
mbed_official | 48:e9a2c7cb57a4 | 119 | rt_ret_val(p_TCB, 0/*osOK*/); |
mbed_official | 48:e9a2c7cb57a4 | 120 | rt_rmv_dly(p_TCB); |
mbed_official | 48:e9a2c7cb57a4 | 121 | p_TCB->state = READY; |
mbed_official | 48:e9a2c7cb57a4 | 122 | rt_put_prio (&os_rdy, p_TCB); |
mbed_official | 48:e9a2c7cb57a4 | 123 | } |
mbed_official | 48:e9a2c7cb57a4 | 124 | |
mbed_official | 48:e9a2c7cb57a4 | 125 | if (os_rdy.p_lnk && (os_rdy.p_lnk->prio > os_tsk.run->prio)) { |
mbed_official | 48:e9a2c7cb57a4 | 126 | /* preempt running task */ |
mbed_official | 48:e9a2c7cb57a4 | 127 | rt_put_prio (&os_rdy, os_tsk.run); |
mbed_official | 48:e9a2c7cb57a4 | 128 | os_tsk.run->state = READY; |
mbed_official | 48:e9a2c7cb57a4 | 129 | rt_dispatch (NULL); |
mbed_official | 48:e9a2c7cb57a4 | 130 | } |
mbed_official | 48:e9a2c7cb57a4 | 131 | |
mbed_official | 48:e9a2c7cb57a4 | 132 | p_MCB->cb_type = 0; |
mbed_official | 48:e9a2c7cb57a4 | 133 | |
mbed_official | 48:e9a2c7cb57a4 | 134 | return (OS_R_OK); |
mbed_official | 48:e9a2c7cb57a4 | 135 | } |
mbed_official | 48:e9a2c7cb57a4 | 136 | #endif |
mbed_official | 48:e9a2c7cb57a4 | 137 | |
mbed_official | 48:e9a2c7cb57a4 | 138 | |
mbed_official | 48:e9a2c7cb57a4 | 139 | /*--------------------------- rt_mut_release --------------------------------*/ |
mbed_official | 48:e9a2c7cb57a4 | 140 | |
mbed_official | 48:e9a2c7cb57a4 | 141 | OS_RESULT rt_mut_release (OS_ID mutex) { |
mbed_official | 48:e9a2c7cb57a4 | 142 | /* Release a mutex object */ |
mbed_official | 48:e9a2c7cb57a4 | 143 | P_MUCB p_MCB = mutex; |
mbed_official | 48:e9a2c7cb57a4 | 144 | P_TCB p_TCB; |
mbed_official | 92:bc9729798a19 | 145 | P_MUCB p_mlnk; |
mbed_official | 92:bc9729798a19 | 146 | U8 prio; |
mbed_official | 48:e9a2c7cb57a4 | 147 | |
mbed_official | 48:e9a2c7cb57a4 | 148 | if (p_MCB->level == 0 || p_MCB->owner != os_tsk.run) { |
mbed_official | 48:e9a2c7cb57a4 | 149 | /* Unbalanced mutex release or task is not the owner */ |
mbed_official | 48:e9a2c7cb57a4 | 150 | return (OS_R_NOK); |
mbed_official | 48:e9a2c7cb57a4 | 151 | } |
mbed_official | 48:e9a2c7cb57a4 | 152 | __DMB(); |
mbed_official | 48:e9a2c7cb57a4 | 153 | if (--p_MCB->level != 0) { |
mbed_official | 48:e9a2c7cb57a4 | 154 | return (OS_R_OK); |
mbed_official | 48:e9a2c7cb57a4 | 155 | } |
mbed_official | 92:bc9729798a19 | 156 | |
mbed_official | 92:bc9729798a19 | 157 | /* Remove mutex from task mutex owner list. */ |
mbed_official | 92:bc9729798a19 | 158 | p_mlnk = os_tsk.run->p_mlnk; |
mbed_official | 92:bc9729798a19 | 159 | if (p_mlnk == p_MCB) { |
mbed_official | 92:bc9729798a19 | 160 | os_tsk.run->p_mlnk = p_MCB->p_mlnk; |
mbed_official | 92:bc9729798a19 | 161 | } |
mbed_official | 92:bc9729798a19 | 162 | else { |
mbed_official | 92:bc9729798a19 | 163 | while (p_mlnk) { |
mbed_official | 92:bc9729798a19 | 164 | if (p_mlnk->p_mlnk == p_MCB) { |
mbed_official | 92:bc9729798a19 | 165 | p_mlnk->p_mlnk = p_MCB->p_mlnk; |
mbed_official | 92:bc9729798a19 | 166 | break; |
mbed_official | 92:bc9729798a19 | 167 | } |
mbed_official | 92:bc9729798a19 | 168 | p_mlnk = p_mlnk->p_mlnk; |
mbed_official | 92:bc9729798a19 | 169 | } |
mbed_official | 92:bc9729798a19 | 170 | } |
mbed_official | 92:bc9729798a19 | 171 | |
mbed_official | 48:e9a2c7cb57a4 | 172 | /* Restore owner task's priority. */ |
mbed_official | 92:bc9729798a19 | 173 | prio = os_tsk.run->prio_base; |
mbed_official | 92:bc9729798a19 | 174 | p_mlnk = os_tsk.run->p_mlnk; |
mbed_official | 92:bc9729798a19 | 175 | while (p_mlnk) { |
mbed_official | 92:bc9729798a19 | 176 | if (p_mlnk->p_lnk && (p_mlnk->p_lnk->prio > prio)) { |
mbed_official | 92:bc9729798a19 | 177 | /* A task with higher priority is waiting for mutex. */ |
mbed_official | 92:bc9729798a19 | 178 | prio = p_mlnk->p_lnk->prio; |
mbed_official | 92:bc9729798a19 | 179 | } |
mbed_official | 92:bc9729798a19 | 180 | p_mlnk = p_mlnk->p_mlnk; |
mbed_official | 92:bc9729798a19 | 181 | } |
mbed_official | 92:bc9729798a19 | 182 | os_tsk.run->prio = prio; |
mbed_official | 92:bc9729798a19 | 183 | |
mbed_official | 48:e9a2c7cb57a4 | 184 | if (p_MCB->p_lnk != NULL) { |
mbed_official | 48:e9a2c7cb57a4 | 185 | /* A task is waiting for mutex. */ |
mbed_official | 48:e9a2c7cb57a4 | 186 | p_TCB = rt_get_first ((P_XCB)p_MCB); |
mbed_official | 48:e9a2c7cb57a4 | 187 | #ifdef __CMSIS_RTOS |
mbed_official | 48:e9a2c7cb57a4 | 188 | rt_ret_val(p_TCB, 0/*osOK*/); |
mbed_official | 48:e9a2c7cb57a4 | 189 | #else |
mbed_official | 68:d3d0e710b443 | 190 | rt_ret_val(p_TCB, OS_R_MUT); |
mbed_official | 48:e9a2c7cb57a4 | 191 | #endif |
mbed_official | 48:e9a2c7cb57a4 | 192 | rt_rmv_dly (p_TCB); |
mbed_official | 48:e9a2c7cb57a4 | 193 | /* A waiting task becomes the owner of this mutex. */ |
mbed_official | 48:e9a2c7cb57a4 | 194 | p_MCB->level = 1; |
mbed_official | 48:e9a2c7cb57a4 | 195 | p_MCB->owner = p_TCB; |
mbed_official | 92:bc9729798a19 | 196 | p_MCB->p_mlnk = p_TCB->p_mlnk; |
mbed_official | 92:bc9729798a19 | 197 | p_TCB->p_mlnk = p_MCB; |
mbed_official | 48:e9a2c7cb57a4 | 198 | /* Priority inversion, check which task continues. */ |
mbed_official | 48:e9a2c7cb57a4 | 199 | if (os_tsk.run->prio >= rt_rdy_prio()) { |
mbed_official | 48:e9a2c7cb57a4 | 200 | rt_dispatch (p_TCB); |
mbed_official | 48:e9a2c7cb57a4 | 201 | } |
mbed_official | 48:e9a2c7cb57a4 | 202 | else { |
mbed_official | 48:e9a2c7cb57a4 | 203 | /* Ready task has higher priority than running task. */ |
mbed_official | 48:e9a2c7cb57a4 | 204 | rt_put_prio (&os_rdy, os_tsk.run); |
mbed_official | 48:e9a2c7cb57a4 | 205 | rt_put_prio (&os_rdy, p_TCB); |
mbed_official | 48:e9a2c7cb57a4 | 206 | os_tsk.run->state = READY; |
mbed_official | 48:e9a2c7cb57a4 | 207 | p_TCB->state = READY; |
mbed_official | 48:e9a2c7cb57a4 | 208 | rt_dispatch (NULL); |
mbed_official | 48:e9a2c7cb57a4 | 209 | } |
mbed_official | 48:e9a2c7cb57a4 | 210 | } |
mbed_official | 48:e9a2c7cb57a4 | 211 | else { |
mbed_official | 92:bc9729798a19 | 212 | /* Check if own priority lowered by priority inversion. */ |
mbed_official | 48:e9a2c7cb57a4 | 213 | if (rt_rdy_prio() > os_tsk.run->prio) { |
mbed_official | 48:e9a2c7cb57a4 | 214 | rt_put_prio (&os_rdy, os_tsk.run); |
mbed_official | 48:e9a2c7cb57a4 | 215 | os_tsk.run->state = READY; |
mbed_official | 48:e9a2c7cb57a4 | 216 | rt_dispatch (NULL); |
mbed_official | 48:e9a2c7cb57a4 | 217 | } |
mbed_official | 48:e9a2c7cb57a4 | 218 | } |
mbed_official | 48:e9a2c7cb57a4 | 219 | return (OS_R_OK); |
mbed_official | 48:e9a2c7cb57a4 | 220 | } |
mbed_official | 48:e9a2c7cb57a4 | 221 | |
mbed_official | 48:e9a2c7cb57a4 | 222 | |
mbed_official | 48:e9a2c7cb57a4 | 223 | /*--------------------------- rt_mut_wait -----------------------------------*/ |
mbed_official | 48:e9a2c7cb57a4 | 224 | |
mbed_official | 48:e9a2c7cb57a4 | 225 | OS_RESULT rt_mut_wait (OS_ID mutex, U16 timeout) { |
mbed_official | 48:e9a2c7cb57a4 | 226 | /* Wait for a mutex, continue when mutex is free. */ |
mbed_official | 48:e9a2c7cb57a4 | 227 | P_MUCB p_MCB = mutex; |
mbed_official | 48:e9a2c7cb57a4 | 228 | |
mbed_official | 48:e9a2c7cb57a4 | 229 | if (p_MCB->level == 0) { |
mbed_official | 48:e9a2c7cb57a4 | 230 | p_MCB->owner = os_tsk.run; |
mbed_official | 92:bc9729798a19 | 231 | p_MCB->p_mlnk = os_tsk.run->p_mlnk; |
mbed_official | 92:bc9729798a19 | 232 | os_tsk.run->p_mlnk = p_MCB; |
mbed_official | 48:e9a2c7cb57a4 | 233 | goto inc; |
mbed_official | 48:e9a2c7cb57a4 | 234 | } |
mbed_official | 48:e9a2c7cb57a4 | 235 | if (p_MCB->owner == os_tsk.run) { |
mbed_official | 48:e9a2c7cb57a4 | 236 | /* OK, running task is the owner of this mutex. */ |
mbed_official | 48:e9a2c7cb57a4 | 237 | inc:p_MCB->level++; |
mbed_official | 48:e9a2c7cb57a4 | 238 | __DMB(); |
mbed_official | 48:e9a2c7cb57a4 | 239 | return (OS_R_OK); |
mbed_official | 48:e9a2c7cb57a4 | 240 | } |
mbed_official | 48:e9a2c7cb57a4 | 241 | /* Mutex owned by another task, wait until released. */ |
mbed_official | 48:e9a2c7cb57a4 | 242 | if (timeout == 0) { |
mbed_official | 48:e9a2c7cb57a4 | 243 | return (OS_R_TMO); |
mbed_official | 48:e9a2c7cb57a4 | 244 | } |
mbed_official | 48:e9a2c7cb57a4 | 245 | /* Raise the owner task priority if lower than current priority. */ |
mbed_official | 48:e9a2c7cb57a4 | 246 | /* This priority inversion is called priority inheritance. */ |
mbed_official | 92:bc9729798a19 | 247 | if (p_MCB->owner->prio < os_tsk.run->prio) { |
mbed_official | 48:e9a2c7cb57a4 | 248 | p_MCB->owner->prio = os_tsk.run->prio; |
mbed_official | 48:e9a2c7cb57a4 | 249 | rt_resort_prio (p_MCB->owner); |
mbed_official | 48:e9a2c7cb57a4 | 250 | } |
mbed_official | 48:e9a2c7cb57a4 | 251 | if (p_MCB->p_lnk != NULL) { |
mbed_official | 48:e9a2c7cb57a4 | 252 | rt_put_prio ((P_XCB)p_MCB, os_tsk.run); |
mbed_official | 48:e9a2c7cb57a4 | 253 | } |
mbed_official | 48:e9a2c7cb57a4 | 254 | else { |
mbed_official | 48:e9a2c7cb57a4 | 255 | p_MCB->p_lnk = os_tsk.run; |
mbed_official | 48:e9a2c7cb57a4 | 256 | os_tsk.run->p_lnk = NULL; |
mbed_official | 48:e9a2c7cb57a4 | 257 | os_tsk.run->p_rlnk = (P_TCB)p_MCB; |
mbed_official | 48:e9a2c7cb57a4 | 258 | } |
mbed_official | 48:e9a2c7cb57a4 | 259 | rt_block(timeout, WAIT_MUT); |
mbed_official | 48:e9a2c7cb57a4 | 260 | return (OS_R_TMO); |
mbed_official | 48:e9a2c7cb57a4 | 261 | } |
mbed_official | 48:e9a2c7cb57a4 | 262 | |
mbed_official | 48:e9a2c7cb57a4 | 263 | |
mbed_official | 48:e9a2c7cb57a4 | 264 | /*---------------------------------------------------------------------------- |
mbed_official | 48:e9a2c7cb57a4 | 265 | * end of file |
mbed_official | 48:e9a2c7cb57a4 | 266 | *---------------------------------------------------------------------------*/ |
mbed_official | 48:e9a2c7cb57a4 | 267 |