Clubcos  0.0.0
Clubcos - Clubc Operating System
 모두 데이타 구조 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 매크로 페이지들
timer.h
이 파일의 문서화 페이지로 가기
1 // Copyright (c) 2014, 임경현 (dlarudgus20)
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are met:
6 //
7 // * Redistributions of source code must retain the above copyright notice, this
8 // list of conditions and the following disclaimer.
9 //
10 // * Redistributions in binary form must reproduce the above copyright notice,
11 // this list of conditions and the following disclaimer in the documentation
12 // and/or other materials provided with the distribution.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 // DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18 // FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 // DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 // CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 
32 #ifndef TIMER_H_
33 #define TIMER_H_
34 
35 #include <stddef.h>
36 #include <stdint.h>
37 #include <stdbool.h>
38 #include "linkedlist.h"
39 
40 enum
41 {
42  PIT_FREQUENCY = 1193180,
44 
47 
51  PIT_CONTROL_MODE0 = 0x00, // Interrupt during counting
52  PIT_CONTROL_MODE2 = 0x04, // Clock rate generator
55 
60 };
61 
63 typedef struct tagTimeOut
64 {
65  union
66  {
69  };
70 
71  uint32_t timeout;
72  uint32_t code;
73 
79 } TimeOut;
80 
82 typedef struct tagTimerStruct
83 {
84  volatile uint32_t TickCountLow;
85  volatile uint32_t TickCountHigh;
86 
88 } TimerStruct;
89 
92 
94 void ckTimerInitialize(void);
99 bool ckTimerSet(TimeOut *pTimeOut);
100 
101 //TimeOut *ckTimerAllocTimeOut(uint32_t timeout, uint32_t code, LinkedList *NoticeQueue);
102 
104 void ckTimerIntHandler(void);
105 
110 void ckTimerBusyDirectWait_ms(uint32_t milli);
111 
112 #endif /* TIMER_H_ */
타이머 관리 구조체입니다.
Definition: timer.h:82
Definition: timer.h:58
uint32_t timeout
타임아웃이 발생할 tick count입니다.
Definition: timer.h:71
Definition: timer.h:42
struct tagTimeOut * pNextTimeOut
Timer 내부에서 사용하는 순방향 연결 리스트의 노드입니다.
Definition: timer.h:67
이중 환형 연결 리스트의 한 노드를 나타내는 구조체입니다.
Definition: linkedlist.h:42
LinkedListNode NoticeNode
NoticeQueue 에 push하는 데 사용되는 노드입니다.
Definition: timer.h:68
volatile uint32_t TickCountLow
틱 카운트의 하위 32비트입니다.
Definition: timer.h:84
Definition: timer.h:51
TimeOut * pTimeOutHead
TimeOut 구조체 리스트의 head입니다.
Definition: timer.h:87
TimerStruct g_TimerStruct
TimerStruct 입니다.
Definition: timer.c:44
struct tagTimerStruct TimerStruct
타이머 관리 구조체입니다.
void ckTimerIntHandler(void)
타이머 인터럽트 ISR입니다.
Definition: timer.h:43
Definition: timer.h:49
Definition: timer.h:54
LinkedList * NoticeQueue
타임아웃이 발생한 후에 이 구조체가 push될 연결 리스트입니다.
Definition: timer.h:78
void ckTimerBusyDirectWait_ms(uint32_t milli)
인터럽트를 금지한 후 PIT 카운터를 읽어 지정된 시간동안 바쁜 대기를 수행합니다.
Definition: timer.c:157
bool ckTimerSet(TimeOut *pTimeOut)
타임아웃을 설정합니다.
Definition: timer.c:80
Definition: timer.h:56
타임아웃을 나타내는 구조체입니다.
Definition: timer.h:63
volatile uint32_t TickCountHigh
틱 카운트의 상위 32비트입니다.
Definition: timer.h:85
이중 환형 연결 리스트 구조체입니다.
Definition: linkedlist.h:51
Definition: timer.h:48
uint32_t code
사용자가 마음대로 사용할 수 있는 추가 정보입니다.
Definition: timer.h:72
Definition: timer.h:45
Definition: timer.h:53
Definition: timer.h:50
Definition: timer.h:46
Definition: timer.h:52
void ckTimerInitialize(void)
타이머를 초기화합니다.
Definition: timer.c:58
struct tagTimeOut TimeOut
타임아웃을 나타내는 구조체입니다.