2014-04-29 12:26:51 +00:00
|
|
|
/*
|
2019-06-17 18:27:55 +00:00
|
|
|
* This file is part of the Trezor project, https://trezor.io/
|
2014-04-29 12:26:51 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2014 Pavol Rusnak <stick@satoshilabs.com>
|
|
|
|
*
|
|
|
|
* This library is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* along with this library. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __MESSAGES_H__
|
|
|
|
#define __MESSAGES_H__
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2019-03-29 16:10:31 +00:00
|
|
|
#include <stdint.h>
|
2014-04-29 12:26:51 +00:00
|
|
|
#include "trezor.h"
|
|
|
|
|
2019-02-04 12:53:05 +00:00
|
|
|
#define MSG_IN_SIZE (15 * 1024)
|
2014-04-29 12:26:51 +00:00
|
|
|
|
2019-02-04 12:53:05 +00:00
|
|
|
#define MSG_OUT_SIZE (3 * 1024)
|
2014-04-29 12:26:51 +00:00
|
|
|
|
|
|
|
#define msg_read(buf, len) msg_read_common('n', (buf), (len))
|
|
|
|
#define msg_write(id, ptr) msg_write_common('n', (id), (ptr))
|
2016-08-29 20:36:18 +00:00
|
|
|
const uint8_t *msg_out_data(void);
|
2014-04-29 12:26:51 +00:00
|
|
|
|
|
|
|
#if DEBUG_LINK
|
|
|
|
|
2019-02-04 12:53:05 +00:00
|
|
|
#define MSG_DEBUG_OUT_SIZE (2 * 1024)
|
2014-04-29 12:26:51 +00:00
|
|
|
|
|
|
|
#define msg_debug_read(buf, len) msg_read_common('d', (buf), (len))
|
|
|
|
#define msg_debug_write(id, ptr) msg_write_common('d', (id), (ptr))
|
2016-08-29 20:36:18 +00:00
|
|
|
const uint8_t *msg_debug_out_data(void);
|
2014-04-29 12:26:51 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2018-06-18 20:01:54 +00:00
|
|
|
void msg_read_common(char type, const uint8_t *buf, uint32_t len);
|
2014-04-29 12:26:51 +00:00
|
|
|
bool msg_write_common(char type, uint16_t msg_id, const void *msg_ptr);
|
|
|
|
|
2016-08-29 20:36:18 +00:00
|
|
|
void msg_read_tiny(const uint8_t *buf, int len);
|
2018-03-20 13:48:40 +00:00
|
|
|
extern uint8_t msg_tiny[128];
|
2014-04-29 12:26:51 +00:00
|
|
|
extern uint16_t msg_tiny_id;
|
|
|
|
|
|
|
|
#endif
|