summaryrefslogtreecommitdiff
path: root/zephyr/drivers/cros_system/cros_system_native_posix.c
blob: fab9c4d03394dbea16c1ef5db6e131d5bf0eccf3 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/* Copyright 2022 The ChromiumOS Authors
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

/* LCOV_EXCL_START */
/* This is test code, so it should be excluded from coverage */

#include <zephyr/logging/log.h>
#include <zephyr/sys/util.h>

#include "common.h"
#include "drivers/cros_system.h"

LOG_MODULE_REGISTER(cros_system, LOG_LEVEL_ERR);

/* Driver config stub */
struct cros_system_native_posix_config {};

/* Driver data stub */
struct cros_system_native_posix_data {};

test_mockable_static int cros_system_native_posix_init(const struct device *dev)
{
	ARG_UNUSED(dev);

	return 0;
}

/* Stubbed cros_system API */

test_mockable_static int
cros_system_native_posix_get_reset_cause(const struct device *dev)
{
	ARG_UNUSED(dev);

	return 0;
}

test_mockable_static int
cros_system_native_posix_soc_reset(const struct device *dev)
{
	ARG_UNUSED(dev);

	return 0;
}

test_mockable_static int
cros_system_native_posix_hibernate(const struct device *dev, uint32_t seconds,
				   uint32_t microseconds)
{
	ARG_UNUSED(dev);
	ARG_UNUSED(seconds);
	ARG_UNUSED(microseconds);

	return 0;
}

test_mockable_static const char *
cros_system_native_posix_get_chip_vendor(const struct device *dev)
{
	ARG_UNUSED(dev);

	return "NATIVE_POSIX_VENDOR";
}

test_mockable_static const char *
cros_system_native_posix_get_chip_name(const struct device *dev)
{
	ARG_UNUSED(dev);

	return "NATIVE_POSIX_CHIP";
}

test_mockable_static const char *
cros_system_native_posix_get_chip_revision(const struct device *dev)
{
	ARG_UNUSED(dev);

	return "NATIVE_POSIX_REVISION";
}

__maybe_unused test_mockable_static uint64_t
cros_system_native_posix_deep_sleep_ticks(const struct device *dev)
{
	ARG_UNUSED(dev);

	return 0;
}

static struct cros_system_native_posix_data cros_system_native_posix_dev_data;

static const struct cros_system_native_posix_config cros_system_dev_cfg = {};

/* clang-format off */
/* clang-format extends past 80 lines here */
static const struct
cros_system_driver_api cros_system_driver_native_posix_api = {
	.get_reset_cause = cros_system_native_posix_get_reset_cause,
	.soc_reset = cros_system_native_posix_soc_reset,
	.hibernate = cros_system_native_posix_hibernate,
	.chip_vendor = cros_system_native_posix_get_chip_vendor,
	.chip_name = cros_system_native_posix_get_chip_name,
	.chip_revision = cros_system_native_posix_get_chip_revision,
#ifdef CONFIG_PM
	.deep_sleep_ticks = cros_system_native_posix_deep_sleep_ticks,
#endif
};
/* clang-format on */

DEVICE_DEFINE(cros_system_native_posix_0, "CROS_SYSTEM",
	      cros_system_native_posix_init, NULL,
	      &cros_system_native_posix_dev_data, &cros_system_dev_cfg,
	      PRE_KERNEL_1, CONFIG_CROS_SYSTEM_NATIVE_POSIX_INIT_PRIORITY,
	      &cros_system_driver_native_posix_api);

/* LCOV_EXCL_STOP */