Files
OpenCellular/chip/g/rbox.h
Mary Ruthven 61e0653261 cr50: add basic rbox support
This change modifies the behavior of RBOX by blocking the key0 and key1
output, when the power button is pressed. It also adds support for
printing debug statements when various RBOX interrupts are triggered.

BUG=none
BRANCH=none
TEST=On cr50 test board verify key0 and key1 out are not asserted unless
the power button is pressed.

Change-Id: I67a3c1b8009279015bdc87bcf0995cffa9ab6f03
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/341470
Tested-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2016-04-29 16:07:13 -07:00

36 lines
1012 B
C

/* 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 */