mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-05 14:31:31 +00:00
This will be used to support ITE IT8380 chip which contains an Andes N801 core. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:23574 TEST=make BOARD=it8380dev Change-Id: I91f9380c51c7712aa6a6418223a11551ab0091ce Reviewed-on: https://chromium-review.googlesource.com/175480 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
58 lines
1.3 KiB
C
58 lines
1.3 KiB
C
/* Copyright (c) 2013 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 map and defintions for Andes cores
|
|
*/
|
|
|
|
#ifndef __CPU_H
|
|
#define __CPU_H
|
|
|
|
#include <stdint.h>
|
|
|
|
/* Process Status Word bits */
|
|
#define PSW_GIE (1 << 0) /* Global Interrupt Enable */
|
|
#define PSW_INTL_SHIFT 1 /* Interrupt Stack Level */
|
|
#define PSW_INTL_MASK (0x3 << PSW_INTL_SHIFT)
|
|
|
|
/* write Process Status Word privileged register */
|
|
static inline void set_psw(uint32_t val)
|
|
{
|
|
asm volatile ("mtsr %0, $PSW" : : "r"(val));
|
|
}
|
|
|
|
/* read Process Status Word privileged register */
|
|
static inline uint32_t get_psw(void)
|
|
{
|
|
uint32_t ret;
|
|
asm volatile ("mfsr %0, $PSW" : "=r"(ret));
|
|
return ret;
|
|
}
|
|
|
|
/* write Interruption Program Counter privileged register */
|
|
static inline void set_ipc(uint32_t val)
|
|
{
|
|
asm volatile ("mtsr %0, $IPC" : : "r"(val));
|
|
}
|
|
|
|
/* read Interruption Program Counter privileged register */
|
|
static inline uint32_t get_ipc(void)
|
|
{
|
|
uint32_t ret;
|
|
asm volatile ("mfsr %0, $IPC" : "=r"(ret));
|
|
return ret;
|
|
}
|
|
|
|
/* read Interruption Type privileged register */
|
|
static inline uint32_t get_itype(void)
|
|
{
|
|
uint32_t ret;
|
|
asm volatile ("mfsr %0, $ITYPE" : "=r"(ret));
|
|
return ret;
|
|
}
|
|
|
|
/* Generic CPU core initialization */
|
|
void cpu_init(void);
|
|
|
|
#endif /* __CPU_H */
|