the changes on the rtos to adapt the wifi

Fork of mbed-rtos by mbed official

Committer:
mbed_official
Date:
Tue Jun 03 11:30:14 2014 +0100
Revision:
31:015df9e602b6
Parent:
11:db1fc233faa9
Synchronized with git revision bcacbb9fbf3432829227430830cca4315b57c1b9

Full URL: https://github.com/mbedmicro/mbed/commit/bcacbb9fbf3432829227430830cca4315b57c1b9/

Who changed what in which revision?

UserRevisionLine numberNew contents of line
emilmont 6:350b53afb889 1 /*----------------------------------------------------------------------------
emilmont 6:350b53afb889 2 * RL-ARM - RTX
emilmont 6:350b53afb889 3 *----------------------------------------------------------------------------
emilmont 6:350b53afb889 4 * Name: RT_TIME.C
emilmont 6:350b53afb889 5 * Purpose: Delay and interval wait functions
emilmont 6:350b53afb889 6 * Rev.: V4.60
emilmont 6:350b53afb889 7 *----------------------------------------------------------------------------
emilmont 6:350b53afb889 8 *
emilmont 6:350b53afb889 9 * Copyright (c) 1999-2009 KEIL, 2009-2012 ARM Germany GmbH
emilmont 6:350b53afb889 10 * All rights reserved.
emilmont 6:350b53afb889 11 * Redistribution and use in source and binary forms, with or without
emilmont 6:350b53afb889 12 * modification, are permitted provided that the following conditions are met:
emilmont 6:350b53afb889 13 * - Redistributions of source code must retain the above copyright
emilmont 6:350b53afb889 14 * notice, this list of conditions and the following disclaimer.
emilmont 6:350b53afb889 15 * - Redistributions in binary form must reproduce the above copyright
emilmont 6:350b53afb889 16 * notice, this list of conditions and the following disclaimer in the
emilmont 6:350b53afb889 17 * documentation and/or other materials provided with the distribution.
mbed_official 31:015df9e602b6 18 * - Neither the name of ARM nor the names of its contributors may be used
mbed_official 31:015df9e602b6 19 * to endorse or promote products derived from this software without
emilmont 6:350b53afb889 20 * specific prior written permission.
emilmont 6:350b53afb889 21 *
mbed_official 31:015df9e602b6 22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mbed_official 31:015df9e602b6 23 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
emilmont 6:350b53afb889 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
emilmont 6:350b53afb889 25 * ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
emilmont 6:350b53afb889 26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
mbed_official 31:015df9e602b6 27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
mbed_official 31:015df9e602b6 28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
mbed_official 31:015df9e602b6 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
mbed_official 31:015df9e602b6 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
emilmont 6:350b53afb889 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
emilmont 6:350b53afb889 32 * POSSIBILITY OF SUCH DAMAGE.
emilmont 6:350b53afb889 33 *---------------------------------------------------------------------------*/
emilmont 6:350b53afb889 34
emilmont 6:350b53afb889 35 #include "rt_TypeDef.h"
emilmont 11:db1fc233faa9 36 #include "RTX_Conf.h"
emilmont 6:350b53afb889 37 #include "rt_Task.h"
emilmont 6:350b53afb889 38 #include "rt_Time.h"
emilmont 6:350b53afb889 39
emilmont 6:350b53afb889 40 /*----------------------------------------------------------------------------
emilmont 6:350b53afb889 41 * Global Variables
emilmont 6:350b53afb889 42 *---------------------------------------------------------------------------*/
emilmont 6:350b53afb889 43
emilmont 6:350b53afb889 44 /* Free running system tick counter */
emilmont 6:350b53afb889 45 U32 os_time;
emilmont 6:350b53afb889 46
emilmont 6:350b53afb889 47
emilmont 6:350b53afb889 48 /*----------------------------------------------------------------------------
emilmont 6:350b53afb889 49 * Functions
emilmont 6:350b53afb889 50 *---------------------------------------------------------------------------*/
emilmont 6:350b53afb889 51
emilmont 6:350b53afb889 52
emilmont 6:350b53afb889 53 /*--------------------------- rt_time_get -----------------------------------*/
emilmont 6:350b53afb889 54
emilmont 6:350b53afb889 55 U32 rt_time_get (void) {
emilmont 6:350b53afb889 56 /* Get system time tick */
emilmont 6:350b53afb889 57 return (os_time);
emilmont 6:350b53afb889 58 }
emilmont 6:350b53afb889 59
emilmont 6:350b53afb889 60
emilmont 6:350b53afb889 61 /*--------------------------- rt_dly_wait -----------------------------------*/
emilmont 6:350b53afb889 62
emilmont 6:350b53afb889 63 void rt_dly_wait (U16 delay_time) {
emilmont 6:350b53afb889 64 /* Delay task by "delay_time" */
emilmont 6:350b53afb889 65 rt_block (delay_time, WAIT_DLY);
emilmont 6:350b53afb889 66 }
emilmont 6:350b53afb889 67
emilmont 6:350b53afb889 68
emilmont 6:350b53afb889 69 /*--------------------------- rt_itv_set ------------------------------------*/
emilmont 6:350b53afb889 70
emilmont 6:350b53afb889 71 void rt_itv_set (U16 interval_time) {
emilmont 6:350b53afb889 72 /* Set interval length and define start of first interval */
emilmont 6:350b53afb889 73 os_tsk.run->interval_time = interval_time;
emilmont 6:350b53afb889 74 os_tsk.run->delta_time = interval_time + (U16)os_time;
emilmont 6:350b53afb889 75 }
emilmont 6:350b53afb889 76
emilmont 6:350b53afb889 77
emilmont 6:350b53afb889 78 /*--------------------------- rt_itv_wait -----------------------------------*/
emilmont 6:350b53afb889 79
emilmont 6:350b53afb889 80 void rt_itv_wait (void) {
emilmont 6:350b53afb889 81 /* Wait for interval end and define start of next one */
emilmont 6:350b53afb889 82 U16 delta;
emilmont 6:350b53afb889 83
emilmont 6:350b53afb889 84 delta = os_tsk.run->delta_time - (U16)os_time;
emilmont 6:350b53afb889 85 os_tsk.run->delta_time += os_tsk.run->interval_time;
emilmont 6:350b53afb889 86 if ((delta & 0x8000) == 0) {
emilmont 6:350b53afb889 87 rt_block (delta, WAIT_ITV);
emilmont 6:350b53afb889 88 }
emilmont 6:350b53afb889 89 }
emilmont 6:350b53afb889 90
emilmont 6:350b53afb889 91 /*----------------------------------------------------------------------------
emilmont 6:350b53afb889 92 * end of file
emilmont 6:350b53afb889 93 *---------------------------------------------------------------------------*/
emilmont 6:350b53afb889 94