summaryrefslogtreecommitdiff
path: root/cts/common/cts_common.h
blob: 13a435e6552716e8474b59b357987bb8a89ec2b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* Copyright 2016 The Chromium OS Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef __CTS_COMMON_H
#define __CTS_COMMON_H

#include "console.h"

/* Console output macros */
#define CPUTS(outstr) cputs(CC_SYSTEM, outstr)
#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
#define CPRINTL(format, args...) CPRINTS("%s:%d: "format, \
					 __func__, __LINE__, ## args)

#define READ_WAIT_TIME_MS		100
#define CTS_INTERRUPT_TRIGGER_DELAY_US	(250 * MSEC)

enum cts_rc {
	#include "cts.rc"
};

struct cts_test {
	enum cts_rc (*run)(void);
	char *name;
};

extern const int cts_test_count;

/**
 * Main loop where each test in a suite is executed
 *
 * A test suite can implement its custom loop as needed.
 *
 * Args:
 * @test: List of tests to run
 * @name: Name of the test to be printed on EC console
 */
void cts_main_loop(const struct cts_test* tests, const char *name);

/**
 * Callback function called at the beginning of the main loop
 */
void clean_state(void);

/**
 * Synchronize DUT and TH
 *
 * @return CTS_RC_SUCCESS if sync is successful
 */
enum cts_rc sync(void);

#endif