summaryrefslogtreecommitdiff
path: root/zephyr/shim/chip/npcx/espi.c
blob: 163db6007fe13d4ee6f4d57625434f58307e227e (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
/* Copyright 2021 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.
 */

#include <device.h>
#include <sys/util.h>

#include "soc_espi.h"
#include "zephyr_espi_shim.h"

bool is_acpi_command(uint32_t data)
{
	return (data >> NPCX_ACPI_TYPE_POS) & 0x01;
}

uint32_t get_acpi_value(uint32_t data)
{
	return (data >> NPCX_ACPI_DATA_POS) & 0xff;
}

bool is_8042_ibf(uint32_t data)
{
	return (data >> NPCX_8042_EVT_POS) & NPCX_8042_EVT_IBF;
}

bool is_8042_obe(uint32_t data)
{
	return (data >> NPCX_8042_EVT_POS) & NPCX_8042_EVT_OBE;
}

uint32_t get_8042_type(uint32_t data)
{
	return (data >> NPCX_8042_TYPE_POS) & 0xFF;
}

uint32_t get_8042_data(uint32_t data)
{
	return (data >> NPCX_8042_DATA_POS) & 0xFF;
}