fixes entering bootload messages to be less scary
[RRG-proxmark3.git] / armsrc / BigBuf.h
blobf73af3818d8500278ffdb8cbf26b946698f0f180
1 //-----------------------------------------------------------------------------
2 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // See LICENSE.txt for the text of the license.
15 //-----------------------------------------------------------------------------
16 // BigBuf and functions to allocate/free parts of it.
17 //-----------------------------------------------------------------------------
19 #ifndef __BIGBUF_H
20 #define __BIGBUF_H
22 #include "common.h"
24 #define MAX_FRAME_SIZE 256 // maximum allowed ISO14443 frame
25 #define MAX_PARITY_SIZE ((MAX_FRAME_SIZE + 7) / 8)
26 #define MAX_MIFARE_FRAME_SIZE 18 // biggest Mifare frame is answer to a read (one block = 16 Bytes) + 2 Bytes CRC
27 #define MAX_MIFARE_PARITY_SIZE 3 // need 18 parity bits for the 18 Byte above. 3 Bytes are enough to store these
28 #define CARD_MEMORY_SIZE 4096
29 //#define DMA_BUFFER_SIZE (512 + 256)
30 #define DMA_BUFFER_SIZE 512
32 // 8 data bits and 1 parity bit per payload byte, 1 correction bit, 1 SOC bit, 2 EOC bits
33 #define TOSEND_BUFFER_SIZE (9 * MAX_FRAME_SIZE + 1 + 1 + 2)
35 uint8_t *BigBuf_get_addr(void);
36 uint32_t BigBuf_get_size(void);
37 uint8_t *BigBuf_get_EM_addr(void);
38 uint16_t BigBuf_max_traceLen(void);
39 uint32_t BigBuf_get_hi(void);
41 void BigBuf_initialize(void);
42 void BigBuf_Clear(void);
43 void BigBuf_Clear_ext(bool verbose);
44 void BigBuf_Clear_keep_EM(void);
45 void BigBuf_Clear_EM(void);
46 uint8_t *BigBuf_malloc(uint16_t);
47 uint8_t *BigBuf_calloc(uint16_t);
48 void BigBuf_free(void);
49 void BigBuf_free_keep_EM(void);
50 void BigBuf_print_status(void);
51 uint32_t BigBuf_get_traceLen(void);
52 void clear_trace(void);
53 void set_tracing(bool enable);
54 void set_tracelen(uint32_t value);
55 bool get_tracing(void);
57 bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_start, uint32_t timestamp_end, const uint8_t *parity, bool reader2tag);
58 bool RAMFUNC LogTraceBits(const uint8_t *btBytes, uint16_t bitLen, uint32_t timestamp_start, uint32_t timestamp_end, bool reader2tag);
59 bool LogTrace_ISO15693(const uint8_t *bytes, uint16_t len, uint32_t ts_start, uint32_t ts_end, const uint8_t *parity, bool reader2tag);
61 int emlSet(const uint8_t *data, uint32_t offset, uint32_t length);
62 int emlGet(uint8_t *out, uint32_t offset, uint32_t length);
64 typedef struct {
65 int max;
66 int bit;
67 uint8_t *buf;
68 } tosend_t;
70 tosend_t *get_tosend(void);
71 void tosend_reset(void);
72 void tosend_stuffbit(int b);
74 typedef struct {
75 uint16_t size;
76 uint8_t *buf;
77 } dmabuf8_t;
79 typedef struct {
80 uint16_t size;
81 uint16_t *buf;
82 } dmabuf16_t;
84 dmabuf8_t *get_dma8(void);
85 dmabuf16_t *get_dma16(void);
86 #endif /* __BIGBUF_H */