source: ssp_qb_r5f100le_cs/trunk/target/qb_r5f100le_cs/target_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.2 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 * Copyright (C) 2011-2014 by Naoki Saito
9 * Nagoya Municipal Industrial Research Institute, JAPAN
10 *
11 * ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì(1)`(4)‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
12 * ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
13 * •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
14 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
15 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
16 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
17 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
18 * —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
19ƒƒ“ƒgi—˜—p
20 * ŽÒƒ}ƒjƒ…
21ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
22 * ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
23 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
24 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
25 * ‚ƁD
26 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
27ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
28ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
29 * ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
30 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
31 * •ñ‚·‚邱‚ƁD
32 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
33 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
34 * ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
35 * —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
36 * –Ɛӂ·‚邱‚ƁD
37 *
38 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
39 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
40 * ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
41 * ƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»
42 * ‚̐ӔC‚𕉂í‚È‚¢D
43 *
44 * @(#) $Id: prc_timer.c 1304 2008-08-27 07:28:36Z ertl-honda $
45 */
46
47/*
48 * ƒJ[ƒlƒ‹‚̃^ƒCƒ€ƒeƒBƒbƒN—pƒ^ƒCƒ}ƒhƒ‰ƒCƒo
49 * ƒ^[ƒQƒbƒg–ˆ‚ÉŽg—p‚·‚éƒ^ƒCƒ}ƒfƒoƒCƒX‚ªˆÙ‚Ȃ蓾‚邱‚Æ‚©‚ç
50 * ‚±‚̃tƒ@ƒCƒ‹‚ðƒ^[ƒQƒbƒgˆË‘¶•”‚É”z’u‚·‚éD
51 * ‚±‚±‚ł́Cƒ^ƒCƒ}ƒ†ƒjƒbƒg0ƒ`ƒƒƒlƒ‹0 ‚ðƒJ[ƒlƒ‹‚̃^ƒCƒ€ƒeƒBƒbƒN‹Ÿ‹‹—pƒ^ƒCƒ}‚Æ‚µ‚ÄŽg—p‚·‚éD
52 */
53#pragma sfr
54
55#include "kernel_impl.h"
56#include "target_timer.h"
57#include "time_event.h"
58
59/*
60 * ƒ^ƒCƒ}‚Ì‹N“®ˆ—
61 */
62void
63target_timer_initialize(intptr_t exinf)
64{
65 /* ƒNƒƒbƒN‹Ÿ‹‹‹–‰Â */
66 PER0 |= TBIT_PER0_TAU0EN;
67
68 // fclk/4 = 5MHz ‚𓮍ìƒNƒƒbƒN‚Æ‚·‚éD
69 TPS0 &= ~UINT16_C(0x000f); /* ƒNƒƒbƒN‘I‘ð */
70 TPS0 |= UINT16_C(0x0002);
71
72 // ƒ‚[ƒhÝ’è(ƒCƒ“ƒ^[ƒo[ƒ‹ƒ^ƒCƒ}CŠ„ž‚Ý”­¶C—§‰º‚èƒGƒbƒW
73 // ƒ\ƒtƒgƒEƒFƒAEƒgƒŠƒK‚̂݁CƒNƒƒbƒNCK00)
74 TMR00 = UINT16_C(0x0001);
75
76 // ŽüŠú‚̐ݒè
77 TDR00 = TIMER_CLOCK;
78
79 // ƒ^ƒCƒ}ƒJƒEƒ“ƒgŠJŽn
80 TS0L |= TBIT_TSmL_TSm0;
81}
82
83/*
84 * ƒ^ƒCƒ}‚Ì’âŽ~ˆ—
85 */
86void
87target_timer_terminate(intptr_t exinf)
88{
89 // ƒ^ƒCƒ}ƒJƒEƒ“ƒg’âŽ~
90 TT0L |= TBIT_TTmL_TTm0;
91}
92
93/*
94 * ƒ^ƒCƒ}Š„ž‚݃nƒ“ƒhƒ‰
95 */
96void
97target_timer_handler(void)
98{
99 signal_time(); /* ƒ^ƒCƒ€ƒeƒBƒbƒN‚Ì‹Ÿ‹‹ */
100}
Note: See TracBrowser for help on using the repository browser.