source: asp_ewarm/asp-1.7.0/arch/arm_m_iccarm/prc_timer.c@ 61

Last change on this file since 61 was 61, checked in by ertl-honda, 11 years ago

ASP for EWARM のコミット.

File size: 3.4 KB
Line 
1/*
2 * TOPPERS/ASP Kernel
3 * Toyohashi Open Platform for Embedded Real-Time Systems/
4 * Advanced Standard Profile Kernel
5 *
6 * Copyright (C) 2007 by Embedded and Real-Time Systems Laboratory
7 * Graduate School of Information Science, Nagoya Univ., JAPAN
8 *
9 * ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì(1)`(4)‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
10 * ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
11 * •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
12 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
13 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
14 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
15 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
16 * —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
17ƒƒ“ƒgi—˜—p
18 * ŽÒƒ}ƒjƒ…
19ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
20 * ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
21 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
22 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
23 * ‚ƁD
24 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
25ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
26ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
27 * ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
28 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
29 * •ñ‚·‚邱‚ƁD
30 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
31 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
32 * ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
33 * —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
34 * –Ɛӂ·‚邱‚ƁD
35 *
36 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
37 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
38 * ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
39 * ƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»
40 * ‚̐ӔC‚𕉂í‚È‚¢D
41 *
42 */
43
44/*
45 * ƒ^ƒCƒ}ƒhƒ‰ƒCƒoiSYSTIC—pj
46 */
47#include <sil.h>
48#include "kernel_impl.h"
49#include "time_event.h"
50#include "target_timer.h"
51
52/*
53 * ƒ^ƒCƒ}‚Ì‹N“®ˆ—
54 */
55void
56target_timer_initialize(intptr_t exinf)
57{
58 CLOCK cyc;
59 uint32_t tmp;
60
61#ifdef SYSTIC_USE_CALIBRATION
62 /* CALIBRATIONƒŒƒWƒXƒ^‚Ì’l‚ðŽg—p */
63 cyc = (sil_rew_mem((void *)SYSTIC_CALIBRATION) & SYSTIC_TENMS) / 10;
64#else
65 cyc = TO_CLOCK(TIC_NUME, TIC_DENO) - 1;
66#endif /* SYSTIC_USE_CALIBRATION */
67
68 /* ’âŽ~ */
69 tmp = sil_rew_mem((void *)SYSTIC_CONTROL_STATUS);
70 tmp &= ~SYSTIC_ENABLE;
71 sil_wrw_mem((void *)SYSTIC_CONTROL_STATUS, tmp);
72
73 sil_wrw_mem((void *)SYSTIC_RELOAD_VALUE, cyc);
74 sil_wrw_mem((void *)SYSTIC_CURRENT_VALUE, cyc);
75
76 tmp = sil_rew_mem((void *)SYSTIC_CONTROL_STATUS);
77
78#ifdef SYSTIC_USE_STCLK
79 /* ŠO•”ƒNƒƒbƒN‚ÌŽg—p */
80 tmp |= SYSTIC_ENABLE;
81#else
82 /* ƒvƒƒZƒbƒTƒNƒƒbƒN‚ÌŽg—p */
83 tmp |= SYSTIC_ENABLE|SYSTIC_CLKSOURCE;
84#endif /* SYSTIC_USE_STCLK */
85
86 sil_wrw_mem((void *)SYSTIC_CONTROL_STATUS, tmp);
87}
88
89/*
90 * ƒ^ƒCƒ}‚Ì’âŽ~ˆ—
91 */
92void
93target_timer_terminate(intptr_t exinf)
94{
95 /* ƒ^ƒCƒ}‚ð’âŽ~ */
96 sil_wrw_mem((void*)SYSTIC_CONTROL_STATUS, 0x00);
97}
98
99/*
100 * ƒ^ƒCƒ}Š„ž‚݃nƒ“ƒhƒ‰
101 */
102void
103target_timer_handler(void)
104{
105 uint32_t tmp;
106
107 /* probe_int ‚Ì‚½‚߁CCOUNTFLAG‚ðƒNƒŠƒA */
108 tmp = sil_rew_mem((void *)SYSTIC_CURRENT_VALUE);
109
110 i_begin_int(INTNO_TIMER);
111 signal_time(); /* ƒ^ƒCƒ€ƒeƒBƒbƒN‚Ì‹Ÿ‹‹ */
112 i_end_int(INTNO_TIMER);
113}
Note: See TracBrowser for help on using the repository browser.