source: ssp_qb_r5f100le_cs/trunk/arch/arm_m_gcc/prc_timer.c@ 93

Last change on this file since 93 was 93, checked in by nmir-saito, 8 years ago

add Combined package of SSP kernel for QB-R5F100LE-TB(RL78 processor)

File size: 3.4 KB
Line 
1/*
2 * TOPPERS/SSP Kernel
3 * Smallest Set Profile Kernel
4 *
5 * Copyright (C) 2007 by Embedded and Real-Time Systems Laboratory
6 * Graduate School of Information Science, Nagoya Univ., JAPAN
7 * Copyright (C) 2010 by Meika Sugimoto
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 * @(#) $Id: prc_timer.c 1304 2008-08-27 07:28:36Z ertl-honda $
43 */
44
45/*
46 * ƒ^ƒCƒ}ƒhƒ‰ƒCƒoiSYSTIC—pj
47 */
48#include <sil.h>
49#include "kernel_impl.h"
50#include "target_timer.h"
51#include "time_event.h"
52
53/*
54 * ƒ^ƒCƒ}‚Ì‹N“®ˆ—
55 */
56void
57target_timer_initialize(intptr_t exinf)
58{
59 CLOCK cyc;
60 uint32_t tmp;
61
62#ifdef SYSTIC_USE_CALIBRATION
63 /* CALIBRATIONƒŒƒWƒXƒ^‚Ì’l‚ðŽg—p */
64 cyc = (sil_rew_mem((void *)SYSTIC_CALIBRATION) & SYSTIC_TENMS) / 10;
65#else
66 cyc = TO_CLOCK(TIC_NUME, TIC_DENO) - 1;
67#endif /* SYSTIC_USE_CALIBRATION */
68
69 /* ’âŽ~ */
70 tmp = sil_rew_mem((void *)SYSTIC_CONTROL_STATUS);
71 tmp &= ~SYSTIC_ENABLE;
72 sil_wrw_mem((void *)SYSTIC_CONTROL_STATUS, tmp);
73
74 sil_wrw_mem((void *)SYSTIC_RELOAD_VALUE, cyc);
75 sil_wrw_mem((void *)SYSTIC_CURRENT_VALUE, cyc);
76
77 tmp = sil_rew_mem((void *)SYSTIC_CONTROL_STATUS);
78
79#ifdef SYSTIC_USE_STCLK
80 /* ŠO•”ƒNƒƒbƒN‚ÌŽg—p */
81 tmp |= SYSTIC_ENABLE;
82#else
83 /* ƒvƒƒZƒbƒTƒNƒƒbƒN‚ÌŽg—p */
84 tmp |= SYSTIC_ENABLE|SYSTIC_CLKSOURCE;
85#endif /* SYSTIC_USE_STCLK */
86
87 sil_wrw_mem((void *)SYSTIC_CONTROL_STATUS, tmp);
88}
89
90/*
91 * ƒ^ƒCƒ}‚Ì’âŽ~ˆ—
92 */
93void
94target_timer_terminate(intptr_t exinf)
95{
96 /* ƒ^ƒCƒ}‚ð’âŽ~ */
97 sil_wrw_mem((void*)SYSTIC_CONTROL_STATUS, 0x00);
98}
99
100/*
101 * ƒ^ƒCƒ}Š„ž‚݃nƒ“ƒhƒ‰
102 */
103void
104target_timer_handler(void)
105{
106 /* probe_int ‚Ì‚½‚߁CCOUNTFLAG‚ðƒNƒŠƒA */
107 (void)sil_rew_mem((void *)SYSTIC_CONTROL_STATUS);
108
109 i_begin_int(INTNO_TIMER);
110 signal_time(); /* ƒ^ƒCƒ€ƒeƒBƒbƒN‚Ì‹Ÿ‹‹ */
111 i_end_int(INTNO_TIMER);
112}
Note: See TracBrowser for help on using the repository browser.