source: UsbWattMeter/trunk/asp_dcre/include/test_lib.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: 3.8 KB
Line 
1/*
2 * TOPPERS Software
3 * Toyohashi Open Platform for Embedded Real-Time Systems
4 *
5 * Copyright (C) 2005-2013 by Embedded and Real-Time Systems Laboratory
6 * Graduate School of Information Science, Nagoya Univ., JAPAN
7 *
8 * ã‹L’˜ìŒ ŽÒ‚́CˆÈ‰º‚Ì(1)`(4)‚ÌðŒ‚ð–ž‚½‚·ê‡‚ÉŒÀ‚èC–{ƒ\ƒtƒgƒEƒF
9 * ƒAi–{ƒ\ƒtƒgƒEƒFƒA‚ð‰ü•Ï‚µ‚½‚à‚Ì‚ðŠÜ‚ށDˆÈ‰º“¯‚¶j‚ðŽg—pE•¡»E‰ü
10 * •ÏEÄ”z•ziˆÈ‰ºC—˜—p‚ƌĂԁj‚·‚邱‚Ƃ𖳏ž‚Å‹–‘ø‚·‚éD
11 * (1) –{ƒ\ƒtƒgƒEƒFƒA‚ðƒ\[ƒXƒR[ƒh‚ÌŒ`‚Å—˜—p‚·‚éê‡‚ɂ́Cã‹L‚Ì’˜ì
12 * Œ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’肪C‚»‚Ì‚Ü‚Ü‚ÌŒ`‚Ń\[
13 * ƒXƒR[ƒh’†‚ÉŠÜ‚Ü‚ê‚Ä‚¢‚邱‚ƁD
14 * (2) –{ƒ\ƒtƒgƒEƒFƒA‚ðCƒ‰ƒCƒuƒ‰ƒŠŒ`Ž®‚ȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
15 * —p‚Å‚«‚éŒ`‚ōĔz•z‚·‚éê‡‚ɂ́CÄ”z•z‚É”º‚¤ƒhƒLƒ…
16ƒƒ“ƒgi—˜—p
17 * ŽÒƒ}ƒjƒ…
18ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L
19 * ‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
20 * (3) –{ƒ\ƒtƒgƒEƒFƒA‚ðC‹@Ší‚É‘g‚ݍž‚ނȂǁC‘¼‚̃\ƒtƒgƒEƒFƒAŠJ”­‚ÉŽg
21 * —p‚Å‚«‚È‚¢Œ`‚ōĔz•z‚·‚éê‡‚ɂ́CŽŸ‚Ì‚¢‚¸‚ê‚©‚ÌðŒ‚ð–ž‚½‚·‚±
22 * ‚ƁD
23 * (a) Ä”z•z‚É”º‚¤ƒhƒLƒ…
24ƒƒ“ƒgi—˜—pŽÒƒ}ƒjƒ…
25ƒAƒ‹‚Ȃǁj‚ɁCã‹L‚Ì’˜
26 * ìŒ •\Ž¦C‚±‚Ì—˜—pðŒ‚¨‚æ‚щº‹L‚Ì–³•ÛØ‹K’è‚ðŒfÚ‚·‚邱‚ƁD
27 * (b) Ä”z•z‚ÌŒ`‘Ô‚ðC•Ê‚É’è‚ß‚é•û–@‚É‚æ‚Á‚āCTOPPERSƒvƒƒWƒFƒNƒg‚É
28 * •ñ‚·‚邱‚ƁD
29 * (4) –{ƒ\ƒtƒgƒEƒFƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚é‚¢‚©‚Ȃ鑹
30 * ŠQ‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð–Ɛӂ·‚邱‚ƁD
31 * ‚Ü‚½C–{ƒ\ƒtƒgƒEƒFƒA‚̃†[ƒU‚Ü‚½‚̓Gƒ“ƒhƒ†[ƒU‚©‚ç‚Ì‚¢‚©‚Ȃ闝
32 * —R‚ÉŠî‚­¿‹‚©‚ç‚àCã‹L’˜ìŒ ŽÒ‚¨‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚ð
33 * –Ɛӂ·‚邱‚ƁD
34 *
35 * –{ƒ\ƒtƒgƒEƒFƒA‚́C–³•ÛØ‚Å’ñ‹Ÿ‚³‚ê‚Ä‚¢‚é‚à‚Ì‚Å‚ ‚éDã‹L’˜ìŒ ŽÒ‚¨
36 * ‚æ‚ÑTOPPERSƒvƒƒWƒFƒNƒg‚́C–{ƒ\ƒtƒgƒEƒFƒA‚ÉŠÖ‚µ‚āC“Á’è‚ÌŽg—p–Ú“I
37 * ‚ɑ΂·‚é“K‡«‚àŠÜ‚߂āC‚¢‚©‚È‚é•ÛØ‚às‚í‚È‚¢D‚Ü‚½C–{ƒ\ƒtƒgƒEƒF
38 * ƒA‚Ì—˜—p‚É‚æ‚è’¼Ú“I‚Ü‚½‚͊ԐړI‚ɐ¶‚¶‚½‚¢‚©‚Ȃ鑹ŠQ‚ÉŠÖ‚µ‚Ä‚àC‚»
39 * ‚̐ӔC‚𕉂í‚È‚¢D
40 *
41 * @(#) $Id: test_lib.h 164 2016-03-07 11:33:50Z coas-nagasima $
42 */
43
44/*
45 * ƒeƒXƒgƒvƒƒOƒ‰ƒ€—pƒ‰ƒCƒuƒ‰ƒŠ
46 */
47
48#ifndef TOPPERS_TEST_LIB_H
49#define TOPPERS_TEST_LIB_H
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
55#include <t_stddef.h>
56
57/*
58 * ƒ^[ƒQƒbƒgˆË‘¶‚Ì’è‹`
59 */
60#include "target_test.h"
61
62/*
63 * Ž©ŒÈf’fŠÖ”‚ÌŒ^
64 */
65typedef ER (*BIT_FUNC)(void);
66
67/*
68 * Ž©ŒÈf’fŠÖ”‚̐ݒè
69 */
70extern void set_bit_func(BIT_FUNC bit_func);
71
72/*
73 * ƒeƒXƒgƒvƒƒOƒ‰ƒ€‚ÌŠJŽn
74 */
75extern void test_start(char *progname);
76
77/*
78 * ƒVƒXƒeƒ€ƒƒO‚̏o—͏ˆ—
79 */
80extern void syslog_flush(void);
81
82/*
83 * ƒeƒXƒgƒvƒƒOƒ‰ƒ€‚̏I—¹
84 */
85extern void test_finish(void);
86
87/*
88 * ƒ`ƒFƒbƒNƒ|ƒCƒ“ƒg
89 */
90extern void check_point(uint_t count);
91
92/*
93 * Š®—¹ƒ`ƒFƒbƒNƒ|ƒCƒ“ƒg
94 */
95extern void check_finish(uint_t count);
96
97/*
98 * ðŒƒ`ƒFƒbƒN
99 */
100extern void _check_assert(const char *expr, const char *file, int_t line);
101#define check_assert(exp) \
102 ((void)(!(exp) ? (_check_assert(#exp, __FILE__, __LINE__), 0) : 0))
103
104/*
105 * ƒGƒ‰[ƒR[ƒhƒ`ƒFƒbƒN
106 */
107extern void _check_ercd(ER ercd, const char *file, int_t line);
108#define check_ercd(ercd, expected_ercd) \
109 ((void)((ercd) != (expected_ercd) ? \
110 (_check_ercd(ercd, __FILE__, __LINE__), 0) : 0))
111
112/*
113 * ƒVƒXƒeƒ€ó‘Ԃ̃`ƒFƒbƒN
114 */
115Inline void
116check_state(bool_t ctx, bool_t loc, PRI ipm, bool_t dsp,
117 bool_t dpn, bool_t tex)
118{
119 PRI intpri;
120 ER ercd;
121
122 check_assert(sns_ctx() == ctx);
123 check_assert(sns_loc() == loc);
124 if (!loc) {
125 /*
126 * IPM‚̃`ƒFƒbƒN‚́CCPUƒƒbƒN‰ðœó‘Ԃ̏ꍇ‚ɂ̂ݍs‚¤D
127 */
128 ercd = get_ipm(&intpri);
129 check_ercd(ercd, E_OK);
130 check_assert(intpri == ipm);
131 }
132 check_assert(sns_dsp() == dsp);
133 check_assert(sns_dpn() == dpn);
134 check_assert(sns_tex() == tex);
135}
136
137/*
138 * ƒVƒXƒeƒ€ó‘Ԃ̃`ƒFƒbƒNi”ñƒ^ƒXƒNƒRƒ“ƒeƒLƒXƒg—pj
139 */
140Inline void
141check_state_i(bool_t ctx, bool_t loc, bool_t dsp, bool_t dpn, bool_t tex)
142{
143 check_assert(sns_ctx() == ctx);
144 check_assert(sns_loc() == loc);
145 check_assert(sns_dsp() == dsp);
146 check_assert(sns_dpn() == dpn);
147 check_assert(sns_tex() == tex);
148}
149
150#ifdef __cplusplus
151}
152#endif
153
154#endif /* TOPPERS_TEST_LIB_H */
Note: See TracBrowser for help on using the repository browser.