summaryrefslogtreecommitdiff
path: root/src/include/console/system76_ec.h
blob: 6e9311a4b828c3fd5c195b60e1635342266aeeca (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
/* SPDX-License-Identifier: GPL-2.0-only */

#ifndef CONSOLE_SYSTEM76_EC_H
#define CONSOLE_SYSTEM76_EC_H 1

#include <stddef.h>
#include <stdint.h>

void system76_ec_init(void);
void system76_ec_flush(void);
void system76_ec_print(uint8_t byte);

#define __CONSOLE_SYSTEM76_EC_ENABLE__	(CONFIG(CONSOLE_SYSTEM76_EC) && \
	(ENV_BOOTBLOCK || ENV_SEPARATE_ROMSTAGE || ENV_RAMSTAGE \
	 || ENV_SEPARATE_VERSTAGE || ENV_POSTCAR \
	 || (ENV_SMM && CONFIG(DEBUG_SMI))))

#if __CONSOLE_SYSTEM76_EC_ENABLE__
static inline void __system76_ec_init(void)
{
	system76_ec_init();
}
static inline void __system76_ec_tx_flush(void)
{
	system76_ec_flush();
}
static inline void __system76_ec_tx_byte(unsigned char byte)
{
	system76_ec_print(byte);
}
#else
static inline void __system76_ec_init(void) {}
static inline void __system76_ec_tx_flush(void) {}
static inline void __system76_ec_tx_byte(unsigned char byte) {}
#endif

#endif