source: UsbWattMeter/trunk/asp_dcre/kernel/semaphore.h@ 164

Last change on this file since 164 was 164, checked in by coas-nagasima, 6 years ago

TOPPERS/ECNLサンプルアプリ「USB充電器電力計」を追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 4.0 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) 2000 by Embedded and Real-Time Systems Laboratory
7 * Toyohashi Univ. of Technology, JAPAN
8 * Copyright (C) 2005-2012 by Embedded and Real-Time Systems Laboratory
9 * Graduate School of Information Science, Nagoya Univ., 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: semaphore.h 164 2016-03-07 11:33:50Z coas-nagasima $
45 */
46
47/*
48 * ƒZƒ}ƒtƒH‹@”\
49 */
50
51#ifndef TOPPERS_SEMAPHORE_H
52#define TOPPERS_SEMAPHORE_H
53
54#include "wait.h"
55
56/*
57 * ƒZƒ}ƒtƒH‰Šú‰»ƒuƒƒbƒN
58 *
59 * ‚±‚̍\‘¢‘̂́C“¯ŠúE’ʐMƒIƒuƒWƒFƒNƒg‚̏‰Šú‰»ƒuƒƒbƒN‚Ì‹¤’Ê•”•ª
60 * iWOBJINIBj‚ðŠg’£iƒIƒuƒWƒFƒNƒgŽwŒüŒ¾Œê‚ÌŒp³‚É‘Š“–j‚µ‚½‚à‚̂ŁC
61 * Å‰‚̃tƒB[ƒ‹ƒh‚ª‹¤’Ê‚É‚È‚Á‚Ä‚¢‚éD
62 */
63typedef struct semaphore_initialization_block {
64 ATR sematr; /* ƒZƒ}ƒtƒH‘®« */
65 uint_t isemcnt; /* ƒZƒ}ƒtƒH‚ÌŽ‘Œ¹”‚̏‰Šú’l */
66 uint_t maxsem; /* ƒZƒ}ƒtƒH‚̍ő厑Œ¹” */
67} SEMINIB;
68
69/*
70 * ƒZƒ}ƒtƒHŠÇ—ƒuƒƒbƒN
71 *
72 * ‚±‚̍\‘¢‘̂́C“¯ŠúE’ʐMƒIƒuƒWƒFƒNƒg‚ÌŠÇ—ƒuƒƒbƒN‚Ì‹¤’Ê•”•ªiWOBJCBj
73 * ‚ðŠg’£iƒIƒuƒWƒFƒNƒgŽwŒüŒ¾Œê‚ÌŒp³‚É‘Š“–j‚µ‚½‚à‚̂ŁCÅ‰‚Ì2‚‚Ì
74 * ƒtƒB[ƒ‹ƒh‚ª‹¤’Ê‚É‚È‚Á‚Ä‚¢‚éD
75 */
76typedef struct semaphore_control_block {
77 QUEUE wait_queue; /* ƒZƒ}ƒtƒH‘Ò‚¿ƒLƒ…
78[ */
79 const SEMINIB *p_seminib; /* ‰Šú‰»ƒuƒƒbƒN‚ւ̃|ƒCƒ“ƒ^ */
80 uint_t semcnt; /* ƒZƒ}ƒtƒHŒ»ÝƒJƒEƒ“ƒg’l */
81} SEMCB;
82
83/*
84 * ƒZƒ}ƒtƒH‘Ò‚¿î•ñƒuƒƒbƒN‚Ì’è‹`
85 *
86 * ‚±‚̍\‘¢‘̂́C“¯ŠúE’ʐMƒIƒuƒWƒFƒNƒg‚Ì‘Ò‚¿î•ñƒuƒƒbƒN‚Ì‹¤’Ê•”•ª
87 * iWINFO_WOBJj‚ðŠg’£iƒIƒuƒWƒFƒNƒgŽwŒüŒ¾Œê‚ÌŒp³‚É‘Š“–j‚µ‚½‚à‚̂ŁC
88 * ‚·‚ׂẴtƒB[ƒ‹ƒh‚ª‹¤’Ê‚É‚È‚Á‚Ä‚¢‚éD
89 */
90typedef struct semaphore_waiting_information {
91 WINFO winfo; /* •W€‚Ì‘Ò‚¿î•ñƒuƒƒbƒN */
92 SEMCB *p_semcb; /* ‘Ò‚Á‚Ä‚¢‚éƒZƒ}ƒtƒH‚ÌŠÇ—ƒuƒƒbƒN */
93} WINFO_SEM;
94
95/*
96 * Žg—p‚µ‚Ä‚¢‚È‚¢ƒZƒ}ƒtƒHŠÇ—ƒuƒƒbƒN‚̃ŠƒXƒg
97 */
98extern QUEUE free_semcb;
99
100/*
101 * ƒZƒ}ƒtƒHID‚̍őå’likernel_cfg.cj
102 */
103extern const ID tmax_semid;
104extern const ID tmax_ssemid;
105
106/*
107 * ƒZƒ}ƒtƒH‰Šú‰»ƒuƒƒbƒN‚̃GƒŠƒAikernel_cfg.cj
108 */
109extern const SEMINIB seminib_table[];
110extern SEMINIB aseminib_table[];
111
112/*
113 * ƒZƒ}ƒtƒHŠÇ—ƒuƒƒbƒN‚̃GƒŠƒAikernel_cfg.cj
114 */
115extern SEMCB semcb_table[];
116
117/*
118 * ƒZƒ}ƒtƒHŠÇ—ƒuƒƒbƒN‚©‚çƒZƒ}ƒtƒHID‚ðŽæ‚èo‚·‚½‚߂̃}ƒNƒ
119 */
120#define SEMID(p_semcb) ((ID)(((p_semcb) - semcb_table) + TMIN_SEMID))
121
122/*
123 * ƒZƒ}ƒtƒH‹@”\‚̏‰Šú‰»
124 */
125extern void initialize_semaphore(void);
126
127#endif /* TOPPERS_SEMAPHORE_H */
Note: See TracBrowser for help on using the repository browser.