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

Last change on this file since 164 was 164, checked in by coas-nagasima, 7 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: 5.1 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-2003 by Embedded and Real-Time Systems Laboratory
7 * Toyohashi Univ. of Technology, JAPAN
8 * Copyright (C) 2005-2013 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: dataqueue.h 164 2016-03-07 11:33:50Z coas-nagasima $
45 */
46
47/*
48 * ƒf[ƒ^ƒLƒ…
49[‹@”\
50 */
51
52#ifndef TOPPERS_DATAQUEUE_H
53#define TOPPERS_DATAQUEUE_H
54
55#include "wait.h"
56
57/*
58 * ƒf[ƒ^ŠÇ—ƒuƒƒbƒN
59 */
60typedef struct data_management_block {
61 intptr_t data; /* ƒf[ƒ^–{‘Ì */
62} DTQMB;
63
64/*
65 * ƒf[ƒ^ƒLƒ…
66[‰Šú‰»ƒuƒƒbƒN
67 *
68 * ‚±‚̍\‘¢‘̂́C“¯ŠúE’ʐMƒIƒuƒWƒFƒNƒg‚̏‰Šú‰»ƒuƒƒbƒN‚Ì‹¤’Ê•”•ª
69 * iWOBJINIBj‚ðŠg’£iƒIƒuƒWƒFƒNƒgŽwŒüŒ¾Œê‚ÌŒp³‚É‘Š“–j‚µ‚½‚à‚̂ŁC
70 * Å‰‚̃tƒB[ƒ‹ƒh‚ª‹¤’Ê‚É‚È‚Á‚Ä‚¢‚éD
71 */
72typedef struct dataqueue_initialization_block {
73 ATR dtqatr; /* ƒf[ƒ^ƒLƒ…
74[‘®« */
75 uint_t dtqcnt; /* ƒf[ƒ^ƒLƒ…
76[‚Ì—e—Ê */
77 DTQMB *p_dtqmb; /* ƒf[ƒ^ƒLƒ…
78[ŠÇ——̈æ‚̐擪”Ô’n */
79} DTQINIB;
80
81/*
82 * ƒf[ƒ^ƒLƒ…
83[ŠÇ—ƒuƒƒbƒN
84 *
85 * ‚±‚̍\‘¢‘̂́C“¯ŠúE’ʐMƒIƒuƒWƒFƒNƒg‚ÌŠÇ—ƒuƒƒbƒN‚Ì‹¤’Ê•”•ªiWOBJCBj
86 * ‚ðŠg’£iƒIƒuƒWƒFƒNƒgŽwŒüŒ¾Œê‚ÌŒp³‚É‘Š“–j‚µ‚½‚à‚̂ŁCÅ‰‚Ì2‚‚Ì
87 * ƒtƒB[ƒ‹ƒh‚ª‹¤’Ê‚É‚È‚Á‚Ä‚¢‚éD
88 */
89typedef struct dataqueue_control_block {
90 QUEUE swait_queue; /* ƒf[ƒ^ƒLƒ…
91[‘—M‘Ò‚¿ƒLƒ…
92[ */
93 const DTQINIB *p_dtqinib; /* ‰Šú‰»ƒuƒƒbƒN‚ւ̃|ƒCƒ“ƒ^ */
94 QUEUE rwait_queue; /* ƒf[ƒ^ƒLƒ…
95[ŽóM‘Ò‚¿ƒLƒ…
96[ */
97 uint_t count; /* ƒf[ƒ^ƒLƒ…
98[’†‚̃f[ƒ^‚̐” */
99 uint_t head; /* Å‰‚̃f[ƒ^‚ÌŠi”[êŠ */
100 uint_t tail; /* ÅŒã‚̃f[ƒ^‚ÌŠi”[êŠ‚ÌŽŸ */
101} DTQCB;
102
103/*
104 * ƒf[ƒ^ƒLƒ…
105[‘Ò‚¿î•ñƒuƒƒbƒN‚Ì’è‹`
106 *
107 * ‚±‚̍\‘¢‘̂́C“¯ŠúE’ʐMƒIƒuƒWƒFƒNƒg‚Ì‘Ò‚¿î•ñƒuƒƒbƒN‚Ì‹¤’Ê•”•ª
108 * iWINFO_WOBJj‚ðŠg’£iƒIƒuƒWƒFƒNƒgŽwŒüŒ¾Œê‚ÌŒp³‚É‘Š“–j‚µ‚½‚à‚̂ŁC
109 * Å‰‚Ì2‚‚̃tƒB[ƒ‹ƒh‚ª‹¤’Ê‚É‚È‚Á‚Ä‚¢‚éD
110 * ƒf[ƒ^ƒLƒ…
111[‚Ö‚Ì‘—M‘Ò‚¿‚ƃf[ƒ^ƒLƒ…
112[‚©‚ç‚ÌŽóM‘Ò‚¿‚ŁC“¯‚¶‘Ò‚¿î
113 * •ñƒuƒƒbƒN‚ðŽg‚¤D
114 */
115typedef struct dataqueue_waiting_information {
116 WINFO winfo; /* •W€‚Ì‘Ò‚¿î•ñƒuƒƒbƒN */
117 DTQCB *p_dtqcb; /* ‘Ò‚Á‚Ä‚¢‚éƒf[ƒ^ƒLƒ…
118[‚ÌŠÇ—ƒuƒƒbƒN */
119 intptr_t data; /* ‘—ŽóMƒf[ƒ^ */
120} WINFO_DTQ;
121
122/*
123 * Žg—p‚µ‚Ä‚¢‚È‚¢ƒf[ƒ^ƒLƒ…
124[ŠÇ—ƒuƒƒbƒN‚̃ŠƒXƒg
125 */
126extern QUEUE free_dtqcb;
127
128/*
129 * ƒf[ƒ^ƒLƒ…
130[ID‚̍őå’likernel_cfg.cj
131 */
132extern const ID tmax_dtqid;
133extern const ID tmax_sdtqid;
134
135/*
136 * ƒf[ƒ^ƒLƒ…
137[‰Šú‰»ƒuƒƒbƒN‚̃GƒŠƒAikernel_cfg.cj
138 */
139extern const DTQINIB dtqinib_table[];
140extern DTQINIB adtqinib_table[];
141
142/*
143 * ƒf[ƒ^ƒLƒ…
144[ŠÇ—ƒuƒƒbƒN‚̃GƒŠƒAikernel_cfg.cj
145 */
146extern DTQCB dtqcb_table[];
147
148/*
149 * ƒf[ƒ^ƒLƒ…
150[ŠÇ—ƒuƒƒbƒN‚©‚çƒf[ƒ^ƒLƒ…
151[ID‚ðŽæ‚èo‚·‚½‚߂̃}ƒNƒ
152 */
153#define DTQID(p_dtqcb) ((ID)(((p_dtqcb) - dtqcb_table) + TMIN_DTQID))
154
155/*
156 * ƒf[ƒ^ƒLƒ…
157[‹@”\‚̏‰Šú‰»
158 */
159extern void initialize_dataqueue(void);
160
161/*
162 * ƒf[ƒ^ƒLƒ…
163[ŠÇ——̈æ‚ւ̃f[ƒ^‚ÌŠi”[
164 */
165extern void enqueue_data(DTQCB *p_dtqcb, intptr_t data);
166
167/*
168 * ƒf[ƒ^ƒLƒ…
169[ŠÇ——̈æ‚ւ̃f[ƒ^‚Ì‹­§Ši”[
170 */
171extern void force_enqueue_data(DTQCB *p_dtqcb, intptr_t data);
172
173/*
174 * ƒf[ƒ^ƒLƒ…
175[ŠÇ——̈悩‚ç‚̃f[ƒ^‚ÌŽæo‚µ
176 */
177extern void dequeue_data(DTQCB *p_dtqcb, intptr_t *p_data);
178
179/*
180 * ƒf[ƒ^ƒLƒ…
181[‚ւ̃f[ƒ^‘—M
182 */
183extern bool_t send_data(DTQCB *p_dtqcb, intptr_t data, bool_t *p_dspreq);
184
185/*
186 * ƒf[ƒ^ƒLƒ…
187[‚ւ̃f[ƒ^‹­§‘—M
188 */
189extern bool_t force_send_data(DTQCB *p_dtqcb, intptr_t data);
190
191/*
192 * ƒf[ƒ^ƒLƒ…
193[‚©‚ç‚̃f[ƒ^ŽóM
194 */
195extern bool_t receive_data(DTQCB *p_dtqcb, intptr_t *p_data,
196 bool_t *p_dspreq);
197
198#endif /* TOPPERS_DATAQUEUE_H */
Note: See TracBrowser for help on using the repository browser.