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.
rt_Time.c
00001 /** 00002 * @file rt_Time.c 00003 * @brief 00004 * 00005 * DAPLink Interface Firmware 00006 * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved 00007 * SPDX-License-Identifier: Apache-2.0 00008 * 00009 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00010 * not use this file except in compliance with the License. 00011 * You may obtain a copy of the License at 00012 * 00013 * http://www.apache.org/licenses/LICENSE-2.0 00014 * 00015 * Unless required by applicable law or agreed to in writing, software 00016 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00017 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00018 * See the License for the specific language governing permissions and 00019 * limitations under the License. 00020 */ 00021 00022 #include "rt_TypeDef.h" 00023 #include "RTX_Config.h" 00024 #include "rt_Task.h" 00025 #include "rt_Time.h" 00026 00027 /*---------------------------------------------------------------------------- 00028 * Global Variables 00029 *---------------------------------------------------------------------------*/ 00030 00031 /* Free running system tick counter */ 00032 U32 os_time; 00033 00034 00035 /*---------------------------------------------------------------------------- 00036 * Functions 00037 *---------------------------------------------------------------------------*/ 00038 00039 00040 /*--------------------------- rt_time_get -----------------------------------*/ 00041 00042 U32 rt_time_get (void) { 00043 /* Get system time tick */ 00044 return (os_time); 00045 } 00046 00047 00048 /*--------------------------- rt_dly_wait -----------------------------------*/ 00049 00050 void rt_dly_wait (U16 delay_time) { 00051 /* Delay task by "delay_time" */ 00052 rt_block (delay_time, WAIT_DLY); 00053 } 00054 00055 00056 /*--------------------------- rt_itv_set ------------------------------------*/ 00057 00058 void rt_itv_set (U16 interval_time) { 00059 /* Set interval length and define start of first interval */ 00060 os_tsk.run->interval_time = interval_time; 00061 os_tsk.run->delta_time = interval_time + (U16)os_time; 00062 } 00063 00064 00065 /*--------------------------- rt_itv_wait -----------------------------------*/ 00066 00067 void rt_itv_wait (void) { 00068 /* Wait for interval end and define start of next one */ 00069 U16 delta; 00070 00071 delta = os_tsk.run->delta_time - (U16)os_time; 00072 os_tsk.run->delta_time += os_tsk.run->interval_time; 00073 if ((delta & 0x8000) == 0) { 00074 rt_block (delta, WAIT_ITV); 00075 } 00076 } 00077 00078 /*---------------------------------------------------------------------------- 00079 * end of file 00080 *---------------------------------------------------------------------------*/ 00081
Generated on Tue Jul 12 2022 15:37:22 by
1.7.2