2020-04-02 23:48:27 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2015-09-28 23:27:24 +02:00
|
|
|
|
|
|
|
#ifndef CONSOLE_SPI_H
|
|
|
|
#define CONSOLE_SPI_H 1
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
void spiconsole_init(void);
|
|
|
|
void spiconsole_tx_byte(unsigned char c);
|
|
|
|
|
2020-10-03 12:22:04 +02:00
|
|
|
#define __CONSOLE_SPI_ENABLE__ (CONFIG(EM100PRO_SPI_CONSOLE) && \
|
2019-03-06 01:53:33 +01:00
|
|
|
(ENV_RAMSTAGE || (ENV_SMM && CONFIG(DEBUG_SMI))))
|
2015-09-28 23:27:24 +02:00
|
|
|
|
|
|
|
#if __CONSOLE_SPI_ENABLE__
|
|
|
|
static inline void __spiconsole_init(void) { spiconsole_init(); }
|
2017-03-08 02:45:12 +01:00
|
|
|
static inline void __spiconsole_tx_byte(u8 data)
|
|
|
|
{
|
|
|
|
spiconsole_tx_byte(data);
|
|
|
|
}
|
2015-09-28 23:27:24 +02:00
|
|
|
#else
|
|
|
|
static inline void __spiconsole_init(void) {}
|
|
|
|
static inline void __spiconsole_tx_byte(u8 data) {}
|
|
|
|
#endif /* __CONSOLE_SPI_ENABLE__ */
|
|
|
|
|
|
|
|
#define MAX_MSG_LENGTH 128
|
|
|
|
|
|
|
|
#define EM100_DEDICATED_CMD 0x11
|
|
|
|
#define EM100_UFIFO_CMD 0xC0
|
|
|
|
#define EM100_MSG_SIGNATURE 0x47364440
|
|
|
|
|
|
|
|
enum em100_message_types {
|
|
|
|
EM100_MSG_CHECKPOINT_1B = 0x01,
|
|
|
|
EM100_MSG_CHECKPOINT_2B,
|
|
|
|
EM100_MSG_CHECKPOINT_4B,
|
|
|
|
EM100_MSG_HEX,
|
|
|
|
EM100_MSG_ASCII,
|
|
|
|
EM100_MSG_TIMESTAMP,
|
|
|
|
EM100_MSG_LOOKUP
|
|
|
|
};
|
|
|
|
|
|
|
|
struct em100_msg_header {
|
|
|
|
uint8_t spi_command;
|
|
|
|
uint8_t reserved;
|
|
|
|
uint8_t em100_command;
|
|
|
|
uint32_t msg_signature;
|
|
|
|
uint8_t msg_type;
|
|
|
|
uint8_t msg_length;
|
2017-07-13 02:20:27 +02:00
|
|
|
} __packed;
|
2015-09-28 23:27:24 +02:00
|
|
|
|
|
|
|
struct em100_msg {
|
|
|
|
struct em100_msg_header header;
|
|
|
|
char data[MAX_MSG_LENGTH];
|
2017-07-13 02:20:27 +02:00
|
|
|
} __packed;
|
2015-09-28 23:27:24 +02:00
|
|
|
|
|
|
|
#endif /* CONSOLE_SPI_H */
|