mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-24 07:18:09 +00:00
core+legacy: update nanopb api to version 0.4
This commit is contained in:
parent
3eb7775659
commit
6dbed1424f
@ -107,7 +107,7 @@ static void _usb_write_flush(usb_write_state *state) {
|
||||
}
|
||||
|
||||
static secbool _send_msg(uint8_t iface_num, uint16_t msg_id,
|
||||
const pb_field_t fields[], const void *msg) {
|
||||
const pb_msgdesc_t *fields, const void *msg) {
|
||||
// determine message size by serializing it into a dummy stream
|
||||
pb_ostream_t sizestream = {.callback = NULL,
|
||||
.state = NULL,
|
||||
@ -225,7 +225,7 @@ static bool _usb_read(pb_istream_t *stream, uint8_t *buf, size_t count) {
|
||||
static void _usb_read_flush(usb_read_state *state) { (void)state; }
|
||||
|
||||
static secbool _recv_msg(uint8_t iface_num, uint32_t msg_size, uint8_t *buf,
|
||||
const pb_field_t fields[], void *msg) {
|
||||
const pb_msgdesc_t *fields, void *msg) {
|
||||
usb_read_state state = {.iface_num = iface_num,
|
||||
.packet_index = 0,
|
||||
.packet_pos = MSG_HEADER1_LEN,
|
||||
|
@ -35,7 +35,7 @@ struct MessagesMap_t {
|
||||
char type; // n = normal, d = debug
|
||||
char dir; // i = in, o = out
|
||||
uint16_t msg_id;
|
||||
const pb_field_t *fields;
|
||||
const pb_msgdesc_t *fields;
|
||||
void (*process_func)(const void *ptr);
|
||||
};
|
||||
|
||||
@ -46,7 +46,7 @@ static const struct MessagesMap_t MessagesMap[] = {
|
||||
|
||||
#include "messages_map_limits.h"
|
||||
|
||||
const pb_field_t *MessageFields(char type, char dir, uint16_t msg_id) {
|
||||
const pb_msgdesc_t *MessageFields(char type, char dir, uint16_t msg_id) {
|
||||
const struct MessagesMap_t *m = MessagesMap;
|
||||
while (m->type) {
|
||||
if (type == m->type && dir == m->dir && msg_id == m->msg_id) {
|
||||
@ -159,7 +159,7 @@ static bool pb_debug_callback_out(pb_ostream_t *stream, const uint8_t *buf,
|
||||
#endif
|
||||
|
||||
bool msg_write_common(char type, uint16_t msg_id, const void *msg_ptr) {
|
||||
const pb_field_t *fields = MessageFields(type, 'o', msg_id);
|
||||
const pb_msgdesc_t *fields = MessageFields(type, 'o', msg_id);
|
||||
if (!fields) { // unknown message
|
||||
return false;
|
||||
}
|
||||
@ -212,7 +212,7 @@ enum {
|
||||
READSTATE_READING,
|
||||
};
|
||||
|
||||
void msg_process(char type, uint16_t msg_id, const pb_field_t *fields,
|
||||
void msg_process(char type, uint16_t msg_id, const pb_msgdesc_t *fields,
|
||||
uint8_t *msg_raw, uint32_t msg_size) {
|
||||
static uint8_t msg_data[MSG_IN_SIZE];
|
||||
memzero(msg_data, sizeof(msg_data));
|
||||
@ -231,7 +231,7 @@ void msg_read_common(char type, const uint8_t *buf, uint32_t len) {
|
||||
static uint16_t msg_id = 0xFFFF;
|
||||
static uint32_t msg_size = 0;
|
||||
static uint32_t msg_pos = 0;
|
||||
static const pb_field_t *fields = 0;
|
||||
static const pb_msgdesc_t *fields = 0;
|
||||
|
||||
if (len != 64) return;
|
||||
|
||||
@ -325,7 +325,7 @@ void msg_read_tiny(const uint8_t *buf, int len) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pb_field_t *fields = 0;
|
||||
const pb_msgdesc_t *fields = 0;
|
||||
pb_istream_t stream = pb_istream_from_buffer(buf + 9, msg_size);
|
||||
|
||||
switch (msg_id) {
|
||||
|
Loading…
Reference in New Issue
Block a user