summaryrefslogtreecommitdiff
path: root/chip/host/registers.c
blob: fad062ea1564c01d05bd3907f08d2c48484874b2 (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
/* Copyright 2020 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.
 *
 * Registers for test
 */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "common.h"
#include "registers.h"
#include "util.h"

static struct faux_register_array {
	const char * const name;
	unsigned int var;
} mock_registers_[] = {
	{
		.name = GNAME(PMU, PWRDN_SCRATCH20),
	},

	/* Define registers as needed. */
};

void *get_reg_addr(const char * const reg_name)
{
	int i;

	for (i = 0; i < ARRAY_SIZE(mock_registers_); i++)
		if (!strcmp(mock_registers_[i].name, reg_name))
			return &mock_registers_[i].var;

	fprintf(stderr, "Unknown register is accessed: %s\n", reg_name);
	exit(1);
}