summaryrefstree
path: root/kernel/drivers/vision/npu/ring_log_buf.idiot
blob: 3753527cbfbaffe7dcbc0b0fb364a60da761f614 (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
56
/*
 * Samsung Exynos SoC series NPU driver
 *
 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
 *              http://www.samsung.com/
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */

#ifdef IDIOT_DECL_SECTION

/* Populate the buffer with character with ascii code between 65~127 */
#define		MAKE_DATA_ST	65
#define		MAKE_DATE_ED	127
int makeData(char* buf, size_t len, const char first) {
	size_t i;
	char ch = first;
	if(MAKE_DATA_ST > first || MAKE_DATA_ED < first) {
		return -1;
	}
	
	for(i = 0; i < len; i++) {
		buf[i] = ch;
		ch++;
		if(ch > MAKE_DATE_ED) ch = MAKE_DATA_ST;
	}
	
	return i;
}

#define INPUT_BUF_LEN	4096
#define OUTPUT_BUF_LEN	4096
char TEST_INPUT_BUF[INPUT_BUF_LEN];
char TEST_OUTPUT_BUF[OUTPUT_BUF_LEN];
#define FIRST_CHAR	'a'

static struct npu_ring_log_buffer fw_log_keeper = {
	.magic = NPU_RING_LOG_BUFFER_MAGIC,
	.name = "NPU FW log",
};
#endif	/* IDIOT_DECL_SECTION */

#undef SETUP_CODE
#undef TEARDOWN_CODE
#define SETUP_CODE	struct npu_ring_log_buffer sut; \
			npu_ring_log_buffer_start(&sut, 2 << 4);
#define TEARDOWN_CODE	npu_ring_log_buffer_stop(&sut);

TESTDEF(ring_log_buf_01_single_chars,
	IDIOT_ASSERT_EQ(makeData(TEST_BUF, 1, FIRST_CHAR));
	
	
)