![]() |
|
|||
File indexing completed on 2025-05-11 08:22:48
0001 /* ---------------------------------------------------------------------------- */ 0002 /* Atmel Microcontroller Software Support */ 0003 /* SAM Software Package License */ 0004 /* ---------------------------------------------------------------------------- */ 0005 /* Copyright (c) 2015, Atmel Corporation */ 0006 /* */ 0007 /* All rights reserved. */ 0008 /* */ 0009 /* Redistribution and use in source and binary forms, with or without */ 0010 /* modification, are permitted provided that the following condition is met: */ 0011 /* */ 0012 /* - Redistributions of source code must retain the above copyright notice, */ 0013 /* this list of conditions and the disclaimer below. */ 0014 /* */ 0015 /* Atmel's name may not be used to endorse or promote products derived from */ 0016 /* this software without specific prior written permission. */ 0017 /* */ 0018 /* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */ 0019 /* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */ 0020 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */ 0021 /* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */ 0022 /* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ 0023 /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ 0024 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */ 0025 /* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ 0026 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */ 0027 /* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ 0028 /* ---------------------------------------------------------------------------- */ 0029 0030 /** 0031 * \file 0032 * 0033 * \par Purpose 0034 * 0035 * Methods and definitions for Global time tick and wait functions. 0036 * 0037 * Defines a common and simplest use of Time Tick, to increase tickCount 0038 * every 1ms, the application can get this value through GetTickCount(). 0039 * 0040 * \par Usage 0041 * 0042 * -# Configure the System Tick with TimeTick_Configure() when MCK changed 0043 * \note 0044 * Must be done before any invoke of GetTickCount(), Wait() or Sleep(). 0045 * -# Uses GetTickCount to get current tick value. 0046 * -# Uses Wait to wait several ms. 0047 * -# Uses Sleep to enter wait for interrupt mode to wait several ms. 0048 * 0049 */ 0050 0051 #ifndef _TIMETICK_ 0052 #define _TIMETICK_ 0053 0054 /*---------------------------------------------------------------------------- 0055 * Headers 0056 *----------------------------------------------------------------------------*/ 0057 0058 #include <stdint.h> 0059 0060 /*---------------------------------------------------------------------------- 0061 * Definitions 0062 *----------------------------------------------------------------------------*/ 0063 0064 typedef struct { 0065 volatile uint32_t *pTimer1; 0066 volatile uint32_t *pTimer2; 0067 volatile uint32_t *pTimer3; 0068 volatile uint32_t *pTimer4; 0069 } SyTickDelayCounter_t; 0070 0071 /*---------------------------------------------------------------------------- 0072 * Definitions 0073 *----------------------------------------------------------------------------*/ 0074 typedef struct _TimeEvent { 0075 uint32_t event; 0076 uint32_t time_tick; 0077 uint32_t time_start; 0078 uint32_t occur; 0079 struct _TimeEvent *pPreEvent; 0080 struct _TimeEvent *pNextEvent; 0081 } TimeEvent; 0082 0083 /*---------------------------------------------------------------------------- 0084 * Global functions 0085 *----------------------------------------------------------------------------*/ 0086 0087 uint32_t TimeTick_Configure(void); 0088 0089 void TimeTick_Increment(uint32_t dwInc); 0090 0091 uint32_t GetDelayInTicks(uint32_t startTick, uint32_t endTick); 0092 0093 uint32_t GetTicks(void); 0094 0095 void Wait(volatile uint32_t dwMs); 0096 0097 void Sleep(volatile uint32_t dwMs); 0098 0099 extern void SetTimeEvent(TimeEvent *pEvent); 0100 0101 #endif /* _TIMETICK_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |