Counter

Dependencies:   EthernetInterface NTPClient SDFileSystem TextLCD WebSocketClient mbed-rtos mbed Socket lwip-eth lwip-sys lwip FATFileSystem

Committer:
Tuxitheone
Date:
Mon Feb 29 18:59:15 2016 +0000
Revision:
0:ecaf3e593122
TankCounter

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Tuxitheone 0:ecaf3e593122 1 /*----------------------------------------------------------------------------
Tuxitheone 0:ecaf3e593122 2 * RL-ARM - RTX
Tuxitheone 0:ecaf3e593122 3 *----------------------------------------------------------------------------
Tuxitheone 0:ecaf3e593122 4 * Name: RT_MAILBOX.C
Tuxitheone 0:ecaf3e593122 5 * Purpose: Implements waits and wake-ups for mailbox messages
Tuxitheone 0:ecaf3e593122 6 * Rev.: V4.60
Tuxitheone 0:ecaf3e593122 7 *----------------------------------------------------------------------------
Tuxitheone 0:ecaf3e593122 8 *
Tuxitheone 0:ecaf3e593122 9 * Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH
Tuxitheone 0:ecaf3e593122 10 * All rights reserved.
Tuxitheone 0:ecaf3e593122 11 * Redistribution and use in source and binary forms, with or without
Tuxitheone 0:ecaf3e593122 12 * modification, are permitted provided that the following conditions are met:
Tuxitheone 0:ecaf3e593122 13 * - Redistributions of source code must retain the above copyright
Tuxitheone 0:ecaf3e593122 14 * notice, this list of conditions and the following disclaimer.
Tuxitheone 0:ecaf3e593122 15 * - Redistributions in binary form must reproduce the above copyright
Tuxitheone 0:ecaf3e593122 16 * notice, this list of conditions and the following disclaimer in the
Tuxitheone 0:ecaf3e593122 17 * documentation and/or other materials provided with the distribution.
Tuxitheone 0:ecaf3e593122 18 * - Neither the name of ARM nor the names of its contributors may be used
Tuxitheone 0:ecaf3e593122 19 * to endorse or promote products derived from this software without
Tuxitheone 0:ecaf3e593122 20 * specific prior written permission.
Tuxitheone 0:ecaf3e593122 21 *
Tuxitheone 0:ecaf3e593122 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Tuxitheone 0:ecaf3e593122 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Tuxitheone 0:ecaf3e593122 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Tuxitheone 0:ecaf3e593122 25 * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
Tuxitheone 0:ecaf3e593122 26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
Tuxitheone 0:ecaf3e593122 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
Tuxitheone 0:ecaf3e593122 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
Tuxitheone 0:ecaf3e593122 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
Tuxitheone 0:ecaf3e593122 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
Tuxitheone 0:ecaf3e593122 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
Tuxitheone 0:ecaf3e593122 32 * POSSIBILITY OF SUCH DAMAGE.
Tuxitheone 0:ecaf3e593122 33 *---------------------------------------------------------------------------*/
Tuxitheone 0:ecaf3e593122 34
Tuxitheone 0:ecaf3e593122 35 #include "rt_TypeDef.h"
Tuxitheone 0:ecaf3e593122 36 #include "RTX_Conf.h"
Tuxitheone 0:ecaf3e593122 37 #include "rt_System.h"
Tuxitheone 0:ecaf3e593122 38 #include "rt_List.h"
Tuxitheone 0:ecaf3e593122 39 #include "rt_Mailbox.h"
Tuxitheone 0:ecaf3e593122 40 #include "rt_MemBox.h"
Tuxitheone 0:ecaf3e593122 41 #include "rt_Task.h"
Tuxitheone 0:ecaf3e593122 42 #include "rt_HAL_CM.h"
Tuxitheone 0:ecaf3e593122 43
Tuxitheone 0:ecaf3e593122 44
Tuxitheone 0:ecaf3e593122 45 /*----------------------------------------------------------------------------
Tuxitheone 0:ecaf3e593122 46 * Functions
Tuxitheone 0:ecaf3e593122 47 *---------------------------------------------------------------------------*/
Tuxitheone 0:ecaf3e593122 48
Tuxitheone 0:ecaf3e593122 49
Tuxitheone 0:ecaf3e593122 50 /*--------------------------- rt_mbx_init -----------------------------------*/
Tuxitheone 0:ecaf3e593122 51
Tuxitheone 0:ecaf3e593122 52 void rt_mbx_init (OS_ID mailbox, U16 mbx_size) {
Tuxitheone 0:ecaf3e593122 53 /* Initialize a mailbox */
Tuxitheone 0:ecaf3e593122 54 P_MCB p_MCB = mailbox;
Tuxitheone 0:ecaf3e593122 55
Tuxitheone 0:ecaf3e593122 56 p_MCB->cb_type = MCB;
Tuxitheone 0:ecaf3e593122 57 p_MCB->state = 0;
Tuxitheone 0:ecaf3e593122 58 p_MCB->isr_st = 0;
Tuxitheone 0:ecaf3e593122 59 p_MCB->p_lnk = NULL;
Tuxitheone 0:ecaf3e593122 60 p_MCB->first = 0;
Tuxitheone 0:ecaf3e593122 61 p_MCB->last = 0;
Tuxitheone 0:ecaf3e593122 62 p_MCB->count = 0;
Tuxitheone 0:ecaf3e593122 63 p_MCB->size = (mbx_size + sizeof(void *) - sizeof(struct OS_MCB)) /
Tuxitheone 0:ecaf3e593122 64 (U32)sizeof (void *);
Tuxitheone 0:ecaf3e593122 65 }
Tuxitheone 0:ecaf3e593122 66
Tuxitheone 0:ecaf3e593122 67
Tuxitheone 0:ecaf3e593122 68 /*--------------------------- rt_mbx_send -----------------------------------*/
Tuxitheone 0:ecaf3e593122 69
Tuxitheone 0:ecaf3e593122 70 OS_RESULT rt_mbx_send (OS_ID mailbox, void *p_msg, U16 timeout) {
Tuxitheone 0:ecaf3e593122 71 /* Send message to a mailbox */
Tuxitheone 0:ecaf3e593122 72 P_MCB p_MCB = mailbox;
Tuxitheone 0:ecaf3e593122 73 P_TCB p_TCB;
Tuxitheone 0:ecaf3e593122 74
Tuxitheone 0:ecaf3e593122 75 if ((p_MCB->p_lnk != NULL) && (p_MCB->state == 1)) {
Tuxitheone 0:ecaf3e593122 76 /* A task is waiting for message */
Tuxitheone 0:ecaf3e593122 77 p_TCB = rt_get_first ((P_XCB)p_MCB);
Tuxitheone 0:ecaf3e593122 78 #ifdef __CMSIS_RTOS
Tuxitheone 0:ecaf3e593122 79 rt_ret_val2(p_TCB, 0x10/*osEventMessage*/, (U32)p_msg);
Tuxitheone 0:ecaf3e593122 80 #else
Tuxitheone 0:ecaf3e593122 81 *p_TCB->msg = p_msg;
Tuxitheone 0:ecaf3e593122 82 rt_ret_val (p_TCB, OS_R_MBX);
Tuxitheone 0:ecaf3e593122 83 #endif
Tuxitheone 0:ecaf3e593122 84 rt_rmv_dly (p_TCB);
Tuxitheone 0:ecaf3e593122 85 rt_dispatch (p_TCB);
Tuxitheone 0:ecaf3e593122 86 }
Tuxitheone 0:ecaf3e593122 87 else {
Tuxitheone 0:ecaf3e593122 88 /* Store message in mailbox queue */
Tuxitheone 0:ecaf3e593122 89 if (p_MCB->count == p_MCB->size) {
Tuxitheone 0:ecaf3e593122 90 /* No free message entry, wait for one. If message queue is full, */
Tuxitheone 0:ecaf3e593122 91 /* then no task is waiting for message. The 'p_MCB->p_lnk' list */
Tuxitheone 0:ecaf3e593122 92 /* pointer can now be reused for send message waits task list. */
Tuxitheone 0:ecaf3e593122 93 if (timeout == 0) {
Tuxitheone 0:ecaf3e593122 94 return (OS_R_TMO);
Tuxitheone 0:ecaf3e593122 95 }
Tuxitheone 0:ecaf3e593122 96 if (p_MCB->p_lnk != NULL) {
Tuxitheone 0:ecaf3e593122 97 rt_put_prio ((P_XCB)p_MCB, os_tsk.run);
Tuxitheone 0:ecaf3e593122 98 }
Tuxitheone 0:ecaf3e593122 99 else {
Tuxitheone 0:ecaf3e593122 100 p_MCB->p_lnk = os_tsk.run;
Tuxitheone 0:ecaf3e593122 101 os_tsk.run->p_lnk = NULL;
Tuxitheone 0:ecaf3e593122 102 os_tsk.run->p_rlnk = (P_TCB)p_MCB;
Tuxitheone 0:ecaf3e593122 103 /* Task is waiting to send a message */
Tuxitheone 0:ecaf3e593122 104 p_MCB->state = 2;
Tuxitheone 0:ecaf3e593122 105 }
Tuxitheone 0:ecaf3e593122 106 os_tsk.run->msg = p_msg;
Tuxitheone 0:ecaf3e593122 107 rt_block (timeout, WAIT_MBX);
Tuxitheone 0:ecaf3e593122 108 return (OS_R_TMO);
Tuxitheone 0:ecaf3e593122 109 }
Tuxitheone 0:ecaf3e593122 110 /* Yes, there is a free entry in a mailbox. */
Tuxitheone 0:ecaf3e593122 111 p_MCB->msg[p_MCB->first] = p_msg;
Tuxitheone 0:ecaf3e593122 112 rt_inc (&p_MCB->count);
Tuxitheone 0:ecaf3e593122 113 if (++p_MCB->first == p_MCB->size) {
Tuxitheone 0:ecaf3e593122 114 p_MCB->first = 0;
Tuxitheone 0:ecaf3e593122 115 }
Tuxitheone 0:ecaf3e593122 116 }
Tuxitheone 0:ecaf3e593122 117 return (OS_R_OK);
Tuxitheone 0:ecaf3e593122 118 }
Tuxitheone 0:ecaf3e593122 119
Tuxitheone 0:ecaf3e593122 120
Tuxitheone 0:ecaf3e593122 121 /*--------------------------- rt_mbx_wait -----------------------------------*/
Tuxitheone 0:ecaf3e593122 122
Tuxitheone 0:ecaf3e593122 123 OS_RESULT rt_mbx_wait (OS_ID mailbox, void **message, U16 timeout) {
Tuxitheone 0:ecaf3e593122 124 /* Receive a message; possibly wait for it */
Tuxitheone 0:ecaf3e593122 125 P_MCB p_MCB = mailbox;
Tuxitheone 0:ecaf3e593122 126 P_TCB p_TCB;
Tuxitheone 0:ecaf3e593122 127
Tuxitheone 0:ecaf3e593122 128 /* If a message is available in the fifo buffer */
Tuxitheone 0:ecaf3e593122 129 /* remove it from the fifo buffer and return. */
Tuxitheone 0:ecaf3e593122 130 if (p_MCB->count) {
Tuxitheone 0:ecaf3e593122 131 *message = p_MCB->msg[p_MCB->last];
Tuxitheone 0:ecaf3e593122 132 if (++p_MCB->last == p_MCB->size) {
Tuxitheone 0:ecaf3e593122 133 p_MCB->last = 0;
Tuxitheone 0:ecaf3e593122 134 }
Tuxitheone 0:ecaf3e593122 135 if ((p_MCB->p_lnk != NULL) && (p_MCB->state == 2)) {
Tuxitheone 0:ecaf3e593122 136 /* A task is waiting to send message */
Tuxitheone 0:ecaf3e593122 137 p_TCB = rt_get_first ((P_XCB)p_MCB);
Tuxitheone 0:ecaf3e593122 138 #ifdef __CMSIS_RTOS
Tuxitheone 0:ecaf3e593122 139 rt_ret_val(p_TCB, 0/*osOK*/);
Tuxitheone 0:ecaf3e593122 140 #else
Tuxitheone 0:ecaf3e593122 141 rt_ret_val(p_TCB, OS_R_OK);
Tuxitheone 0:ecaf3e593122 142 #endif
Tuxitheone 0:ecaf3e593122 143 p_MCB->msg[p_MCB->first] = p_TCB->msg;
Tuxitheone 0:ecaf3e593122 144 if (++p_MCB->first == p_MCB->size) {
Tuxitheone 0:ecaf3e593122 145 p_MCB->first = 0;
Tuxitheone 0:ecaf3e593122 146 }
Tuxitheone 0:ecaf3e593122 147 rt_rmv_dly (p_TCB);
Tuxitheone 0:ecaf3e593122 148 rt_dispatch (p_TCB);
Tuxitheone 0:ecaf3e593122 149 }
Tuxitheone 0:ecaf3e593122 150 else {
Tuxitheone 0:ecaf3e593122 151 rt_dec (&p_MCB->count);
Tuxitheone 0:ecaf3e593122 152 }
Tuxitheone 0:ecaf3e593122 153 return (OS_R_OK);
Tuxitheone 0:ecaf3e593122 154 }
Tuxitheone 0:ecaf3e593122 155 /* No message available: wait for one */
Tuxitheone 0:ecaf3e593122 156 if (timeout == 0) {
Tuxitheone 0:ecaf3e593122 157 return (OS_R_TMO);
Tuxitheone 0:ecaf3e593122 158 }
Tuxitheone 0:ecaf3e593122 159 if (p_MCB->p_lnk != NULL) {
Tuxitheone 0:ecaf3e593122 160 rt_put_prio ((P_XCB)p_MCB, os_tsk.run);
Tuxitheone 0:ecaf3e593122 161 }
Tuxitheone 0:ecaf3e593122 162 else {
Tuxitheone 0:ecaf3e593122 163 p_MCB->p_lnk = os_tsk.run;
Tuxitheone 0:ecaf3e593122 164 os_tsk.run->p_lnk = NULL;
Tuxitheone 0:ecaf3e593122 165 os_tsk.run->p_rlnk = (P_TCB)p_MCB;
Tuxitheone 0:ecaf3e593122 166 /* Task is waiting to receive a message */
Tuxitheone 0:ecaf3e593122 167 p_MCB->state = 1;
Tuxitheone 0:ecaf3e593122 168 }
Tuxitheone 0:ecaf3e593122 169 rt_block(timeout, WAIT_MBX);
Tuxitheone 0:ecaf3e593122 170 #ifndef __CMSIS_RTOS
Tuxitheone 0:ecaf3e593122 171 os_tsk.run->msg = message;
Tuxitheone 0:ecaf3e593122 172 #endif
Tuxitheone 0:ecaf3e593122 173 return (OS_R_TMO);
Tuxitheone 0:ecaf3e593122 174 }
Tuxitheone 0:ecaf3e593122 175
Tuxitheone 0:ecaf3e593122 176
Tuxitheone 0:ecaf3e593122 177 /*--------------------------- rt_mbx_check ----------------------------------*/
Tuxitheone 0:ecaf3e593122 178
Tuxitheone 0:ecaf3e593122 179 OS_RESULT rt_mbx_check (OS_ID mailbox) {
Tuxitheone 0:ecaf3e593122 180 /* Check for free space in a mailbox. Returns the number of messages */
Tuxitheone 0:ecaf3e593122 181 /* that can be stored to a mailbox. It returns 0 when mailbox is full. */
Tuxitheone 0:ecaf3e593122 182 P_MCB p_MCB = mailbox;
Tuxitheone 0:ecaf3e593122 183
Tuxitheone 0:ecaf3e593122 184 return (p_MCB->size - p_MCB->count);
Tuxitheone 0:ecaf3e593122 185 }
Tuxitheone 0:ecaf3e593122 186
Tuxitheone 0:ecaf3e593122 187
Tuxitheone 0:ecaf3e593122 188 /*--------------------------- isr_mbx_send ----------------------------------*/
Tuxitheone 0:ecaf3e593122 189
Tuxitheone 0:ecaf3e593122 190 void isr_mbx_send (OS_ID mailbox, void *p_msg) {
Tuxitheone 0:ecaf3e593122 191 /* Same function as "os_mbx_send", but to be called by ISRs. */
Tuxitheone 0:ecaf3e593122 192 P_MCB p_MCB = mailbox;
Tuxitheone 0:ecaf3e593122 193
Tuxitheone 0:ecaf3e593122 194 rt_psq_enq (p_MCB, (U32)p_msg);
Tuxitheone 0:ecaf3e593122 195 rt_psh_req ();
Tuxitheone 0:ecaf3e593122 196 }
Tuxitheone 0:ecaf3e593122 197
Tuxitheone 0:ecaf3e593122 198
Tuxitheone 0:ecaf3e593122 199 /*--------------------------- isr_mbx_receive -------------------------------*/
Tuxitheone 0:ecaf3e593122 200
Tuxitheone 0:ecaf3e593122 201 OS_RESULT isr_mbx_receive (OS_ID mailbox, void **message) {
Tuxitheone 0:ecaf3e593122 202 /* Receive a message in the interrupt function. The interrupt function */
Tuxitheone 0:ecaf3e593122 203 /* should not wait for a message since this would block the rtx os. */
Tuxitheone 0:ecaf3e593122 204 P_MCB p_MCB = mailbox;
Tuxitheone 0:ecaf3e593122 205
Tuxitheone 0:ecaf3e593122 206 if (p_MCB->count) {
Tuxitheone 0:ecaf3e593122 207 /* A message is available in the fifo buffer. */
Tuxitheone 0:ecaf3e593122 208 *message = p_MCB->msg[p_MCB->last];
Tuxitheone 0:ecaf3e593122 209 if (p_MCB->state == 2) {
Tuxitheone 0:ecaf3e593122 210 /* A task is locked waiting to send message */
Tuxitheone 0:ecaf3e593122 211 rt_psq_enq (p_MCB, 0);
Tuxitheone 0:ecaf3e593122 212 rt_psh_req ();
Tuxitheone 0:ecaf3e593122 213 }
Tuxitheone 0:ecaf3e593122 214 rt_dec (&p_MCB->count);
Tuxitheone 0:ecaf3e593122 215 if (++p_MCB->last == p_MCB->size) {
Tuxitheone 0:ecaf3e593122 216 p_MCB->last = 0;
Tuxitheone 0:ecaf3e593122 217 }
Tuxitheone 0:ecaf3e593122 218 return (OS_R_MBX);
Tuxitheone 0:ecaf3e593122 219 }
Tuxitheone 0:ecaf3e593122 220 return (OS_R_OK);
Tuxitheone 0:ecaf3e593122 221 }
Tuxitheone 0:ecaf3e593122 222
Tuxitheone 0:ecaf3e593122 223
Tuxitheone 0:ecaf3e593122 224 /*--------------------------- rt_mbx_psh ------------------------------------*/
Tuxitheone 0:ecaf3e593122 225
Tuxitheone 0:ecaf3e593122 226 void rt_mbx_psh (P_MCB p_CB, void *p_msg) {
Tuxitheone 0:ecaf3e593122 227 /* Store the message to the mailbox queue or pass it to task directly. */
Tuxitheone 0:ecaf3e593122 228 P_TCB p_TCB;
Tuxitheone 0:ecaf3e593122 229 void *mem;
Tuxitheone 0:ecaf3e593122 230
Tuxitheone 0:ecaf3e593122 231 if (p_CB->p_lnk != NULL) switch (p_CB->state) {
Tuxitheone 0:ecaf3e593122 232 #ifdef __CMSIS_RTOS
Tuxitheone 0:ecaf3e593122 233 case 3:
Tuxitheone 0:ecaf3e593122 234 /* Task is waiting to allocate memory, remove it from the waiting list */
Tuxitheone 0:ecaf3e593122 235 mem = rt_alloc_box(p_msg);
Tuxitheone 0:ecaf3e593122 236 if (mem == NULL) break;
Tuxitheone 0:ecaf3e593122 237 p_TCB = rt_get_first ((P_XCB)p_CB);
Tuxitheone 0:ecaf3e593122 238 rt_ret_val(p_TCB, (U32)mem);
Tuxitheone 0:ecaf3e593122 239 p_TCB->state = READY;
Tuxitheone 0:ecaf3e593122 240 rt_rmv_dly (p_TCB);
Tuxitheone 0:ecaf3e593122 241 rt_put_prio (&os_rdy, p_TCB);
Tuxitheone 0:ecaf3e593122 242 break;
Tuxitheone 0:ecaf3e593122 243 #endif
Tuxitheone 0:ecaf3e593122 244 case 2:
Tuxitheone 0:ecaf3e593122 245 /* Task is waiting to send a message, remove it from the waiting list */
Tuxitheone 0:ecaf3e593122 246 p_TCB = rt_get_first ((P_XCB)p_CB);
Tuxitheone 0:ecaf3e593122 247 #ifdef __CMSIS_RTOS
Tuxitheone 0:ecaf3e593122 248 rt_ret_val(p_TCB, 0/*osOK*/);
Tuxitheone 0:ecaf3e593122 249 #else
Tuxitheone 0:ecaf3e593122 250 rt_ret_val(p_TCB, OS_R_OK);
Tuxitheone 0:ecaf3e593122 251 #endif
Tuxitheone 0:ecaf3e593122 252 p_CB->msg[p_CB->first] = p_TCB->msg;
Tuxitheone 0:ecaf3e593122 253 rt_inc (&p_CB->count);
Tuxitheone 0:ecaf3e593122 254 if (++p_CB->first == p_CB->size) {
Tuxitheone 0:ecaf3e593122 255 p_CB->first = 0;
Tuxitheone 0:ecaf3e593122 256 }
Tuxitheone 0:ecaf3e593122 257 p_TCB->state = READY;
Tuxitheone 0:ecaf3e593122 258 rt_rmv_dly (p_TCB);
Tuxitheone 0:ecaf3e593122 259 rt_put_prio (&os_rdy, p_TCB);
Tuxitheone 0:ecaf3e593122 260 break;
Tuxitheone 0:ecaf3e593122 261 case 1:
Tuxitheone 0:ecaf3e593122 262 /* Task is waiting for a message, pass the message to the task directly */
Tuxitheone 0:ecaf3e593122 263 p_TCB = rt_get_first ((P_XCB)p_CB);
Tuxitheone 0:ecaf3e593122 264 #ifdef __CMSIS_RTOS
Tuxitheone 0:ecaf3e593122 265 rt_ret_val2(p_TCB, 0x10/*osEventMessage*/, (U32)p_msg);
Tuxitheone 0:ecaf3e593122 266 #else
Tuxitheone 0:ecaf3e593122 267 *p_TCB->msg = p_msg;
Tuxitheone 0:ecaf3e593122 268 rt_ret_val (p_TCB, OS_R_MBX);
Tuxitheone 0:ecaf3e593122 269 #endif
Tuxitheone 0:ecaf3e593122 270 p_TCB->state = READY;
Tuxitheone 0:ecaf3e593122 271 rt_rmv_dly (p_TCB);
Tuxitheone 0:ecaf3e593122 272 rt_put_prio (&os_rdy, p_TCB);
Tuxitheone 0:ecaf3e593122 273 break;
Tuxitheone 0:ecaf3e593122 274 } else {
Tuxitheone 0:ecaf3e593122 275 /* No task is waiting for a message, store it to the mailbox queue */
Tuxitheone 0:ecaf3e593122 276 if (p_CB->count < p_CB->size) {
Tuxitheone 0:ecaf3e593122 277 p_CB->msg[p_CB->first] = p_msg;
Tuxitheone 0:ecaf3e593122 278 rt_inc (&p_CB->count);
Tuxitheone 0:ecaf3e593122 279 if (++p_CB->first == p_CB->size) {
Tuxitheone 0:ecaf3e593122 280 p_CB->first = 0;
Tuxitheone 0:ecaf3e593122 281 }
Tuxitheone 0:ecaf3e593122 282 }
Tuxitheone 0:ecaf3e593122 283 else {
Tuxitheone 0:ecaf3e593122 284 os_error (OS_ERR_MBX_OVF);
Tuxitheone 0:ecaf3e593122 285 }
Tuxitheone 0:ecaf3e593122 286 }
Tuxitheone 0:ecaf3e593122 287 }
Tuxitheone 0:ecaf3e593122 288
Tuxitheone 0:ecaf3e593122 289 /*----------------------------------------------------------------------------
Tuxitheone 0:ecaf3e593122 290 * end of file
Tuxitheone 0:ecaf3e593122 291 *---------------------------------------------------------------------------*/
Tuxitheone 0:ecaf3e593122 292