summaryrefslogtreecommitdiff
path: root/chip/g/rbox.h
blob: c2a09c84328da311931ce8765b9588c85816e9f2 (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
/* 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 __CROS_RBOX_H
#define __CROS_RBOX_H

#include "console.h"
#include "registers.h"

/* Console output macros */
#define CPUTS(outstr) cputs(CC_RBOX, outstr)
#define CPRINTS(format, args...) cprints(CC_RBOX, format, ## args)

#ifdef CONFIG_RBOX_DEBUG
#define INTR(field) CONCAT2(INTR_, field)

#define ENABLE_INT(field) GWRITE_FIELD(RBOX, INT_ENABLE, INTR(field), 1)
#define ENABLE_INT_RF(field) (ENABLE_INT(CONCAT2(field, _RED)) &&	\
	ENABLE_INT(CONCAT2(field, _FED)))

#define RBOX_INT(NAME, NAME_STR)					\
									\
	DECLARE_IRQ(CONCAT3(GC_IRQNUM_RBOX0_INTR_, NAME, _INT),		\
		CONCAT2(NAME, _int_), 1);				\
	void CONCAT2(NAME, _int_)(void)					\
	{								\
		CPRINTS("%s", NAME_STR);				\
		/* Clear interrupt */					\
		GWRITE_FIELD(RBOX, INT_STATE, INTR(NAME), 1);		\
	}

#endif  /* DEBUG_RBOX */
#endif  /* __CROS_RDD_H */